Improve polygon vertex dragging responsiveness in edit mode#38
Merged
AhmedFatthy1040 merged 1 commit intoAhmedFatthy1040:mainfrom Jun 10, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds logic to prioritize polygon vertex dragging when in edit mode, ensuring that clicks on vertices initiate drag operations instead of triggering standard actions.
- Intercepts left-clicks in edit mode to check for and start vertex drags
- Bypasses normal click handling when a vertex drag begins
- Adjusts method closing braces and indentation around
handleMouseMove
Comments suppressed due to low confidence (3)
web/js/canvas.js:561
- These
console.logstatements appear to be leftover debug logs. Consider removing them or using a dedicated debug-level logger so production output remains clean.
console.log('Is editing polygon:', this.isEditingPolygon);
web/js/canvas.js:585
- The closing brace and
handleMouseMovedeclaration are merged together, impacting readability. Please split and indent properly so each block and method signature stands on its own line.
} } handleMouseMove(e) {
web/js/canvas.js:564
- The new vertex drag logic isn't covered by existing tests. Consider adding unit or integration tests for
getVertexAtPointandstartVertexDragin edit mode to prevent regressions.
// --- FIX: Always check for vertex under mouse in edit mode ---
| e.button === 0 && | ||
| this.editModeActive && | ||
| this.isEditingPolygon && | ||
| this.editingAnnotationId |
There was a problem hiding this comment.
Using a truthiness check on editingAnnotationId will skip IDs equal to 0. Use an explicit null/undefined check (e.g., this.editingAnnotationId != null) to handle all valid numeric IDs.
Suggested change
| this.editingAnnotationId | |
| this.editingAnnotationId != null |
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.
This pull request includes a fix in the
CanvasManagerclass withinweb/js/canvas.js. The change ensures that vertex dragging is properly handled in edit mode when interacting with polygons.Fix for edit mode behavior: