-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Limit pan in network visualization (#18)
Fixing the #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. Testing: Verified behavior with both small and large graphs at various zoom levels. Panning limits remain consistent in all directions.
- Loading branch information
Daud Ahmed
committed
Oct 6, 2024
1 parent
7af1f3c
commit 3f0df7b
Showing
1 changed file
with
149 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters