Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/editor/src/lib/editor/Editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5407,7 +5407,10 @@ export class Editor extends EventEmitter<TLEventMap> {
// If the shape is filled, then it's a hit. Remember, we're
// 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

return inMarginClosestToEdgeHit || shape
}
// Point is outside the filled shape but within margin — skip (no margin bleed)
} else {
// If the shape is bigger than the viewport, then skip it.
if (this.getShapePageBounds(shape)!.contains(viewportPageBounds)) continue
Expand Down
Loading