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

setScale causes unexpected scroll #4654

Closed
moniika opened this issue Feb 25, 2021 · 1 comment
Closed

setScale causes unexpected scroll #4654

moniika opened this issue Feb 25, 2021 · 1 comment
Labels
issue: bug Describes why the code or behaviour is wrong

Comments

@moniika
Copy link
Contributor

moniika commented Feb 25, 2021

Describe the bug

Calling setScale causes an unexpected scroll of the workspace.

To Reproduce

Steps to reproduce the behavior:

  1. Go to https://blockly-demo.appspot.com/static/tests/playground.html
  2. Pull out at least one block on the workspace
  3. Reset zoom with zoom reset button (if not at 1)
  4. In the console, execute Blockly.getMainWorkspace().setScale(1) multiple times
  5. Observe scroll of workspace.

Expected behavior

Expect workspace to not scroll on repeated setScale calls.

Additional context

The cause of this scroll appears to be the addition of absoluteTop and absoluteLeft to scrollX/scrollY inside of setScale
This math is needed for zoom logic, but not for every function that calls setScroll (zoomToFit and zoomReset_ don't need this translation and have a scrollToCenter call after calling setScale to compensate).

It causes odd behaviour with single-direction scrollbars when zoomReset is called.

@moniika moniika added issue: bug Describes why the code or behaviour is wrong issue: triage Issues awaiting triage by a Blockly team member labels Feb 25, 2021
@moniika moniika changed the title setScale causes unexpected scroll setScale causes unexpected scroll Feb 25, 2021
@moniika moniika added duplicate and removed issue: triage Issues awaiting triage by a Blockly team member labels Mar 2, 2021
@moniika
Copy link
Contributor Author

moniika commented Mar 2, 2021

Duplicate of #3800

@moniika moniika marked this as a duplicate of #3800 Mar 2, 2021
@moniika moniika closed this as completed Mar 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: bug Describes why the code or behaviour is wrong
Projects
None yet
Development

No branches or pull requests

1 participant