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

Fix panning of zoomed images #1863

Merged
merged 1 commit into from
Aug 15, 2023
Merged

Fix panning of zoomed images #1863

merged 1 commit into from
Aug 15, 2023

Conversation

starypatyk
Copy link
Contributor

When an image is enlarged (zoomed using the scroll wheel), panning (dragging) behaves incorrectly:

  • It is not possible to see parts of the image close to the border.
  • The image does not "catch" with the dragging - it feels like the image resists dragging.

I see that there is an open PR #1063 that is broader in scope and apparently fixes this issue as well. However it did not progress for over a year now. 😞

In this PR, I propose a very small, alternative change that should fix just the two issues mentioned above.

If you think it is better to continue with #1063, I can try to pick it up instead.

Full image:
obraz

Before
Zoomed image dragged down as much as possible - row 0 is not visible
obraz

After
Zoomed image dragged down as much as possible - row 0 is visible
obraz

@starypatyk starypatyk added bug Something isn't working 3. to review Waiting for reviews labels Aug 14, 2023
@@ -240,7 +240,7 @@ export default {
const growY = this.zoomHeight - this.height

this.shiftX = Math.min(Math.max(moveX, -growX / 2), growX / 2)
this.shiftY = Math.min(Math.max(moveY, -growY / 2), growX / 2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow, that looks like a nice typo! Can't believe that hasn't been caught in all those years

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The key issue was incorrect calculation of top/left margins. I must admit that I am not fluent enough in CSS to fully understand why the shift must be multiplied by 2 to get the margins correct. But observations of the calculated box model in dev tools and testing confirmed this is the case. 😇

@skjnldsv
Copy link
Member

/backport to stable27

@skjnldsv
Copy link
Member

/backport to stable26

@backportbot-nextcloud backportbot-nextcloud bot added the backport-request Pending backport by the backport-bot label Aug 15, 2023
@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 15, 2023
Signed-off-by: Dariusz Olszewski <starypatyk@users.noreply.github.com>
@skjnldsv skjnldsv merged commit 8f0c125 into master Aug 15, 2023
22 of 25 checks passed
@skjnldsv skjnldsv deleted the fix/pan-zoomed-images branch August 15, 2023 09:56
@backportbot-nextcloud
Copy link

The backport to stable27 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable27
git pull origin stable27

# Create the new backport branch
git checkout -b fix/foo-stable27

# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts. Resolve them.
git cherry-pick abc123

# Push the cherry pick commit to the remote repository and open a pull request
git push origin fix/foo-stable27

More info at https://docs.nextcloud.com/server/latest/developer_manual/getting_started/development_process.html#manual-backport

@backportbot-nextcloud
Copy link

The backport to stable26 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable26
git pull origin stable26

# Create the new backport branch
git checkout -b fix/foo-stable26

# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts. Resolve them.
git cherry-pick abc123

# Push the cherry pick commit to the remote repository and open a pull request
git push origin fix/foo-stable26

More info at https://docs.nextcloud.com/server/latest/developer_manual/getting_started/development_process.html#manual-backport

@skjnldsv
Copy link
Member

/backport to stable27

@skjnldsv
Copy link
Member

/backport to stable26

@backportbot-nextcloud
Copy link

The backport to stable27 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable27
git pull origin stable27

# Create the new backport branch
git checkout -b fix/foo-stable27

# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts. Resolve them.
git cherry-pick abc123

# Push the cherry pick commit to the remote repository and open a pull request
git push origin fix/foo-stable27

More info at https://docs.nextcloud.com/server/latest/developer_manual/getting_started/development_process.html#manual-backport

@backportbot-nextcloud
Copy link

The backport to stable26 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable26
git pull origin stable26

# Create the new backport branch
git checkout -b fix/foo-stable26

# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts. Resolve them.
git cherry-pick abc123

# Push the cherry pick commit to the remote repository and open a pull request
git push origin fix/foo-stable26

More info at https://docs.nextcloud.com/server/latest/developer_manual/getting_started/development_process.html#manual-backport

@skjnldsv skjnldsv removed the backport-request Pending backport by the backport-bot label Aug 15, 2023
@github-actions
Copy link

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 bug Something isn't working feedback-requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants