Let clicks inside a box but outside its polygon hit nested annotations#1788
Open
mattdawkins wants to merge 2 commits into
Open
Let clicks inside a box but outside its polygon hit nested annotations#1788mattdawkins wants to merge 2 commits into
mattdawkins wants to merge 2 commits into
Conversation
Right-clicking a small annotation nested inside a larger one could edit the larger annotation instead: its rectangle covered the click point even when the click was outside its drawn polygon. While polygons are displayed, a detection that has one now owns only its polygon shape for click targeting - the rectangle is just the envelope - so clicks (left or right) inside the box but outside every polygon fall through to whatever is actually under the cursor. The hidden-box click-target mode now also keeps polygon visibility in sync so the same rule applies when box display is off. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A click inside a detection's box but outside its polygon now only yields when another detection under the cursor actually contains the point (by its own shape rule). With no better candidate the box click still selects/edits the detection, so a lone detection remains clickable anywhere within its box. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Problem
Right-clicking a small annotation that sits inside a larger annotation's bounding box sometimes edited the larger annotation instead. In particular, when the larger annotation has both a polygon and a rectangle and the click lands inside its rectangle but outside its polygon — directly on the smaller annotation — the larger one could still win the click (feature click ordering is closest-border, and the big box's edge can be nearer).
Fix
While polygons are displayed, a detection that has a polygon now owns only its polygon shape for click targeting; its rectangle is treated as just the envelope:
RectangleLayer's feature click handler, a click (left or right) that falls inside the detection's box but outside every one of its polygons is ignored by that feature, letting the click fall through to whatever is actually under the cursor — e.g. the nested smaller annotation.polyRings, native coords, transformed through the display transform for the containment test so the aligned/warped view works too).Detections without polygons, and all behavior while polygon display is off (
drawingOtherfalse), are unchanged.🤖 Generated with Claude Code