ENH: Preserve PolygonSelector cursor position after clear - #32195
Open
lucaznch wants to merge 1 commit into
Open
ENH: Preserve PolygonSelector cursor position after clear#32195lucaznch wants to merge 1 commit into
lucaznch wants to merge 1 commit into
Conversation
When pressing the Escape key to clear a polygonal chain, the pending vertex representing the cursor is reset to (0, 0) and rendered. This commit enhances that behavior by resetting the pending vertex to the last known cursor position, falling back to the center of the axes if unknown.
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.
PR summary
Closes #28220
When pressing the Escape key to clear a polygonal chain, the pending vertex representing the cursor is reset to (0, 0) and rendered.
This PR enhances that behavior by reseting the pending vertex to the last known cursor position, falling back to the center of the axes if unknown.
Using the last known cursor position provides a more pleasant visualization interactively, and the center of the axes is preferable to (0, 0) since it is guaranteed to be visible.
Visual comparison
Current
current.mp4
Proposed
proposed.mp4
AI Disclosure
The implementation is my own but I asked chatgpt to review it, and it recommended guarding against NaN, which I added.
PR quality check