Skip to content

Let clicks inside a box but outside its polygon hit nested annotations#1788

Open
mattdawkins wants to merge 2 commits into
mainfrom
fix/nested-annotation-right-click
Open

Let clicks inside a box but outside its polygon hit nested annotations#1788
mattdawkins wants to merge 2 commits into
mainfrom
fix/nested-annotation-right-click

Conversation

@mattdawkins

Copy link
Copy Markdown
Member

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:

  • In 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.
  • The detection's polygon rings are carried on the layer data (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 (drawingOther false), are unchanged.

🤖 Generated with Claude Code

mattdawkins and others added 2 commits July 21, 2026 23:14
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant