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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve image zooming (scroll wheel) #1887

Merged
merged 4 commits into from Aug 27, 2023
Merged

Improve image zooming (scroll wheel) #1887

merged 4 commits into from Aug 27, 2023

Conversation

starypatyk
Copy link
Contributor

@starypatyk starypatyk commented Aug 19, 2023

I propose a few small changes to the image zooming code that should improve UX in this area:

  1. f854d9d - this fixes calculation of the displayed image dimensions - currently the .modal-container element does not include the header, so the calculation should not compensate for this. After this change the same image location stays under the mouse cursor position when zooming in/out. Previously the position drifted away slightly.
  2. c6f34c8 - this enables zooming beyond natural image dimensions (up to 500% of the default view - apparently as originally intended). Changing maxHeight/maxWidth over 100% does not enlarge the image, so I had to switch to height/width. This in turn required switching animations off - it looked very ugly with the animations on. The animations did not work previously, so it seems a fair trade-off for me. 馃槈 I have also made a few cosmetic changes to simplify calculations.
  3. ee0c498 - I have changed the zoomRatio calculations to always increase/decrease it by 10% (rather than linearly). This feels more natural - esp. with larger zoom levels.

When zooming beyond 100% this still uses the preview image - so obviously there will be some blurriness. Requesting the original image in this case would certainly be a better solution, but it seems to be something for a separate PR.

PS. As a follow-up, I plan to work on pinch to zoom on mobile devices (#917)

Edit I see that all cypress tests failed. 馃槥 This seems to be unrelated to this PR.

@starypatyk starypatyk added enhancement New feature or request 3. to review Waiting for reviews labels Aug 19, 2023
@szaimen szaimen requested a review from skjnldsv August 21, 2023 10:10
@szaimen szaimen added this to the Nextcloud 28 milestone Aug 21, 2023
@skjnldsv
Copy link
Member

Works great! Thank you so much @starypatyk !!! 馃檱 馃檹

@skjnldsv skjnldsv added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Aug 24, 2023
Signed-off-by: Dariusz Olszewski <starypatyk@users.noreply.github.com>
Signed-off-by: Dariusz Olszewski <starypatyk@users.noreply.github.com>
Signed-off-by: Dariusz Olszewski <starypatyk@users.noreply.github.com>
Signed-off-by: Dariusz Olszewski <starypatyk@users.noreply.github.com>
@skjnldsv skjnldsv merged commit 2f3384f into master Aug 27, 2023
9 checks passed
@skjnldsv skjnldsv deleted the enh/image-zooming branch August 27, 2023 08:34
@github-actions
Copy link

github-actions bot commented Sep 3, 2023

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the reviewing process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR reviewing process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish enhancement New feature or request feedback-requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants