Skip to content
New issue

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

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

Already on GitHub? # to your account

[graph] zoom-in and zoom-out misaligned #2111

Closed
saulpw opened this issue Nov 14, 2023 Discussed in #2106 · 4 comments · Fixed by #2139
Closed

[graph] zoom-in and zoom-out misaligned #2111

saulpw opened this issue Nov 14, 2023 Discussed in #2106 · 4 comments · Fixed by #2139
Assignees

Comments

@saulpw
Copy link
Owner

saulpw commented Nov 14, 2023

Discussed in #2106

Zooming in and then back out of a graph should take you back to your original starting point. Now, it goes slightly off until eventually the plot disappears off the screen.

Expected Behavior

This is the expected behavior when you zoom-in and out on a graph with your mouse-wheel:

correct

And this is the develop behavior:

incorrect

@isosphere

This comment was marked as off-topic.

@saulpw
Copy link
Owner Author

saulpw commented Nov 21, 2023

@isosphere This was working fine before with geometric zoom. I tried linear zoom and it didn't 'feel' right. This isn't a precision issue; likely just an off-by-one error from a change we made to the canvas in ~august or so.

@midichef
Copy link
Contributor

@anjakefala
I am leaving a comment here so you can assign this to me, as you asked in the Discussion related to this.

I've figured out what's happening here. Graph andInvertedCanvas use a different coordinate system from Canvas. Their y-axis grows in the opposite direction and starts from a different origin point. zoomin/out-mouse incorrectly rely on Canvas.fixPoint(), which uses the y-coordinate system for Canvas. InvertedCanvas needs its own version of fixPoint(). I'm testing a fix now.

If there are more such bugs in graph.py discovered in the future, the fix would follow this general rule: look for functions being called in graph.py that are in Canvas that involve y-coordinate calculations. Override them in InvertedCanvas and modify them to use inverted y-coordinates.

@anjakefala
Copy link
Collaborator

If there are more such bugs in graph.py discovered in the future, the fix would follow this general rule: look for functions being called in graph.py that are in Canvas that involve y-coordinate calculations. Override them in InvertedCanvas and modify them to use inverted y-coordinates.

This was such a helpful write-up, thank you!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants