Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images not resizing to fit the screen in scrollview #64

Open
danielweck opened this issue Jul 25, 2014 · 6 comments
Open

Images not resizing to fit the screen in scrollview #64

danielweck opened this issue Jul 25, 2014 · 6 comments

Comments

@danielweck
Copy link
Member

Originally posted by @vanisuthamathi
readium/readium-js#57

Steps to Reproduce:

  1. Enable scroll view - readium.reader.updateSettings({
    scroll: "scroll-doc"
    }); in the Epub reader view
  2. Read any article containing big image sizes like 600x511, 600X300 and etc.,
    Observation:

    Images are not resizing to fit the screen as shown in the attached image.
    image_notresizing

Note: We have fixed in our application by adding css properties to the image tags after the content documents are loaded
$(imgTags).css('max-width', '98%');
$(imgTags).css('max-height', '98%');

Please fix in the readium library

@danielweck
Copy link
Member Author

See candidate fix in feature branch:
https://github.com/readium/readium-shared-js/tree/feature/scroll_img_resize

UPDATE: feature branch now deleted, but commit preserved as reference (proposal: scroll view acts like regular scrolling webpage => no arbitrary resize-to-fit imposed by reading system, just application of authored CSS styles).

Code diff:
30c0ecd

I do not think that this is a fully-satisfactory solution though, as many books I tried have image width/height either set via CSS or attributes, and the application of maximum values irrespective of aspect ratio sometimes produces unexpected / undesirable results. Furthermore, some images do not resize when opening the page for the first time, only when resizing the viewport.

In fairness though, the same problem already exists with the columnized paginated view:
https://github.com/readium/readium-shared-js/blob/develop/js/views/reflowable_view.js#L669

...so one could argue that the behaviour should be consistent across all types of reflowable views, and that we should apply the same image resizing algorithm to the scroll view?

@danielweck
Copy link
Member Author

See also: #45

@danielweck
Copy link
Member Author

See also:
#88

@danielweck
Copy link
Member Author

Shared utility function between scroll and column-paginated views:

a64dc4d

Feature branch:

https://github.com/readium/readium-shared-js/tree/feature/scroll_img_resize

UPDATE: feature branch now deleted, but commit preserved as reference (proposal: scroll view acts like regular scrolling webpage => no arbitrary resize-to-fit imposed by reading system, just application of authored CSS styles).

@rkwright
Copy link
Member

I created a test file and verified this bug in the current build of the Chrome Extension. The file is here:
https://readiumfoundation.box.com/s/c9rxcdaszp39dswiw7su

@rkwright rkwright modified the milestones: v1, v1+ Aug 26, 2014
@ryanackley
Copy link
Contributor

We'll need to add this for svg's as well in your feature branch. It's just a matter of adding 'svg' to the jquery selector we use.

@rkwright rkwright added func:Image and removed bug labels May 13, 2016
@rkwright rkwright removed this from the m1.1 milestone May 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants