Add a zoom-to-mouse-position option to the 3D viewer#592
Open
markomarkovic wants to merge 1 commit into
Open
Conversation
When the "Zoom to mouse position" preference is enabled, the mouse wheel zooms toward the point under the cursor via the view's ZoomAtPoint instead of the centered SetZoom. The preference defaults to off, preserving the existing centered-zoom behavior.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a Zoom to mouse position viewer preference. When enabled, the mouse wheel zooms toward the point under the cursor instead of the view center.
wheelEventzooms via the view'sStartZoomAtPoint/ZoomAtPoint; when disabled it keeps the originalSetZoom.ZOOM_STEP, so a wheel notch moves the same amount in both modes.Changes
cq_editor/widgets/occt_widget.py—ZOOM_AT_POINT_STEPconstant,_zoom_to_cursorflag,set_zoom_to_cursor(), and thewheelEventbranch.cq_editor/widgets/viewer.py— the preference and its wiring inupdatePreferences.tests/test_app.py—test_viewer_zoom_to_mousecovering both wheel paths and the preference wiring.Testing
pytest tests/test_app.py— the new test and the existing viewer tests pass.Claude AI assisted with the implementation under my direction; design, testing, and review are mine.