Skip to content

selecting assets now has no margin#9

Merged
kaznaan merged 4 commits intoluma/v4.4.xfrom
gray/asset-selection-noMargin
Feb 28, 2026
Merged

selecting assets now has no margin#9
kaznaan merged 4 commits intoluma/v4.4.xfrom
gray/asset-selection-noMargin

Conversation

@graycrawford
Copy link
Copy Markdown
Collaborator

Filled shapes (assets, frames, anything with isFilled: true) now only hit when the cursor is actually inside their bounds (distance <= 0), not within the invisible 8px/zoom margin outside.

Unfilled shapes (lines, arrows, hollow outlines) keep the margin so they're still easy to click.

@cursor
Copy link
Copy Markdown

cursor Bot commented Feb 27, 2026

PR Summary

Medium Risk
Changes core hit-testing behavior so filled/closed shapes no longer register clicks from within the configurable outer margin, which can affect selection/drag interactions and edge cases at various zoom levels.

Overview
Filled closed shapes (and filled groups) now only return as a hit when the pointer is effectively on/inside the shape (distance <= 1), preventing selection via the previous outer-margin “bleed” area.

Open/unfilled shapes keep using the existing margin-based hit testing, so thin strokes remain easier to click.

Written by Cursor Bugbot for commit a07286e. This will update automatically on new commits. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Threshold uses 1 instead of 0 for filled shapes
    • Changed distance <= 1 back to distance <= 0 to match the 'no margin bleed' comment and ensure filled shapes are only hittable when the cursor is actually inside their bounds.

Create PR

Or push these changes by commenting:

@cursor push 39c5e9b13a
Preview (39c5e9b13a)
diff --git a/packages/editor/src/lib/editor/Editor.ts b/packages/editor/src/lib/editor/Editor.ts
--- a/packages/editor/src/lib/editor/Editor.ts
+++ b/packages/editor/src/lib/editor/Editor.ts
@@ -5402,7 +5402,7 @@
 				// Are we close to the shape's edge?
 				if (distance <= outerMargin || (hitInside && distance <= 0 && distance > -innerMargin)) {
 					if (geometry.isFilled || (isGroup && geometry.children[0].isFilled)) {
-						if (distance <= 1) {
+						if (distance <= 0) {
 							return inMarginClosestToEdgeHit || shape
 						}
 						// Point is outside the filled shape but within margin — skip (no margin bleed)

// starting from the TOP-MOST shape in z-index order, so any
// other hits would be occluded by the shape.
return inMarginClosestToEdgeHit || shape
if (distance <= 1) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Threshold uses 1 instead of 0 for filled shapes

Medium Severity

The PR description states filled shapes hit only when distance <= 0 (cursor actually inside bounds), but the code checks distance <= 1. For closed geometries, positive distance means outside the shape, so distance <= 1 still allows hits up to 1 unit outside the shape boundary — contradicting the stated "no margin bleed" goal in the accompanying comment. The condition likely needs to be distance <= 0.

Fix in Cursor Fix in Web

@kaznaan kaznaan merged commit 6eb24f8 into luma/v4.4.x Feb 28, 2026
4 of 8 checks passed
@kaznaan kaznaan mentioned this pull request May 8, 2026
3 tasks
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.

2 participants