-
Notifications
You must be signed in to change notification settings - Fork 230
Fix pinch zoom Y-axis and centering (fixes #876) #892
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
base: main
Are you sure you want to change the base?
Fix pinch zoom Y-axis and centering (fixes #876) #892
Conversation
Co-authored-by: Cursor <[email protected]>
✅ Deploy Preview for circuitverse ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
WalkthroughThe changes fix the pinch-to-zoom functionality in the simulator's event listener by correcting three calculation errors. The distance calculation for pinch detection is fixed from a comma-separated expression to a proper sum of squares formula. The Y-coordinate reference in center calculations is corrected from 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hi @Nihal4777 just a quick reminder, PR is ready pls review it |
|
Hi @Nakshatra480 , |
|
Also include valid proof for the changes before requesting a review |
|
@Radhikaa-chauhan now the the description is fine? |

Fixes #876
Describe the changes you have made in this PR -
This PR addresses issues with the pinch-to-zoom functionality in the simulator. The previous implementation had calculation errors that caused the view to jump or zoom incorrectly, particularly affecting the Y-axis and centering.
Key fixes included:
+).globalScope.oxwas being used for Y-axis calculations instead ofglobalScope.oy.Testing of the UI changes (If any) -
Screen.Recording.2026-02-10.at.2.00.43.PM.mov
Code Understanding and AI Usage
Did you use AI assistance (ChatGPT, Claude, Copilot, etc.) to write any part of this code?
If you used AI assistance:
Explain your implementation approach:
I focused on debugging the
listeners.jsfile where touch events are handled. After identifying that the math for the pinch distance was incorrect, I fixed the formula. I then realized the zooming wasn't centered around the user's fingers, which led me to find the incorrect usage ofoxinstead ofoy. Finally, I adjusted how the global origin is updated—instead of absolute assignment, I implemented a relative shift based on the difference between the new and old scale, which preserves the visual center of the zoom.Checklist before requesting a review