-
Notifications
You must be signed in to change notification settings - Fork 10
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
Limit pan in network visualization (#18) #28
Conversation
Fixing the JRaviLab#18 Problem: Users could pan graphs infinitely in any direction, sometimes losing the graph completely from view. We needed different handling for small graphs (that fit viewport) vs large graphs (that exceed viewport). Solution: 1. For small graphs that fit viewport: - Keep graph fully visible at all times - Snap back with animation if user tries to pan outside bounds - Center graph if no valid position is found 2. For large graphs that exceed viewport: - Calculate graph's center and dimensions relative to viewport - Allow panning up to 10px beyond graph edges in any direction - Use center-based math to ensure uniform panning limits on all sides - Add smooth animations when bringing graph back into valid position - Fallback to centering if graph somehow gets completely hidden The solution ensures users never lose track of their graphs while still maintaining fluid pan interactions. The uniform 10px edge padding gives just enough peek space without letting users pan too far.
✅ Deploy Preview for molevolvr ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
I found it a bit tricky since there wasn't a straightforward solution available online. Most of the related issues are either still open or not pointing in the right direction. I believe the solution I developed successfully places limits on the panning that users can do. I've tested it with various types of network, and it’s working well for me. Could you kindly test it and share your feedback? I would love to know your thoughts. Regards |
@vincerubinetti Thankyou so much for taking out your time and reviewing it. You're right. You have really made it quite minimal and optimal. Thanks for sharing it. :) Regards |
Thanks for your work here. You were on the right track, and as you said, it was not very straightforward. Really this should be something that is built into Cytoscape. |
Closes #18