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

Zoom in doesn't center selected block #65884

Open
2 tasks done
jeryj opened this issue Oct 4, 2024 · 3 comments
Open
2 tasks done

Zoom in doesn't center selected block #65884

jeryj opened this issue Oct 4, 2024 · 3 comments
Assignees
Labels
[Feature] Zoom Out [Type] Bug An existing feature does not function as intended

Comments

@jeryj
Copy link
Contributor

jeryj commented Oct 4, 2024

Description

When zooming in to the canvas via double click or enter keypress on a block, it doesn't zoom to the selected block location.

Step-by-step reproduction instructions

  1. Enter zoom out
  2. Select a section at the top of the canvas
  3. Scroll down
  4. Double click to zoom in on a block
  5. Selected block will not be in frame

Screenshots, screen recording, code snippet

Screen.Recording.2024-10-04.at.2.07.29.PM.mov

Environment info

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes
@jeryj jeryj added [Feature] Zoom Out [Type] Bug An existing feature does not function as intended labels Oct 4, 2024
@jeryj jeryj self-assigned this Oct 4, 2024
@jeryj
Copy link
Contributor Author

jeryj commented Oct 4, 2024

I think setting a transform-origin in the zoom out CSS transform and calculating a variable on the scaling animation that checks for the current scroll offset and calculating the central point could work well. It would need to work for both zoom-in and out.

@stokesman
Copy link
Contributor

It seems like this is what #61465 is meant to solve. It seems overkill to actually center the block because that’s adjusting the scroll position instead of maintaining it. Also, it can’t work for blocks that are near the end of the canvas unless spacing is added to the end of the canvas to make enough overflow/scrolling range to center the block. Not that it would have to work for such blocks.

I’ll mention as well that #63390 maintains scroll position for free (i.e. without code managing it).

@ndiego
Copy link
Member

ndiego commented Oct 7, 2024

I can confirm this is occurring in 6.7 Beta 1, so I am adding it to the project board. It would be great to come up with a solution before the release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Zoom Out [Type] Bug An existing feature does not function as intended
Projects
Status: 📥 Todo
Development

No branches or pull requests

3 participants