Skip to content

feat(line): smart-align snap on thickness side-handle drag#72

Merged
u8array merged 1 commit into
mainfrom
fix/smart-align-on-resize
May 17, 2026
Merged

feat(line): smart-align snap on thickness side-handle drag#72
u8array merged 1 commit into
mainfrom
fix/smart-align-on-resize

Conversation

@u8array
Copy link
Copy Markdown
Owner

@u8array u8array commented May 17, 2026

No description provided.

The thickness handle previously bypassed the snap pipeline entirely, so
the band's outer edge could never align to other objects or label edges
even when grid-snap was off. Wire it into computeResizeSnap with a
single active edge (bottom for horizontal lines, right for vertical),
matching how the Transformer-based free resize already snaps. Shift
bypasses, diagonals and rotated views skip (band axis not stage-aligned
for either case). Reuses othersSnapshotRef and clearSnap with the
endpoint-drag pattern so the lifecycle and translation handling stay
consistent.
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces smart-align snapping for the thickness side-handle of line objects, allowing the line width to snap to other objects on the canvas. The implementation adds a snapThickness function that calculates a bounding box for the line's band and delegates to the existing resize snap logic. Feedback identifies three improvement opportunities: normalizing rotation calculations for better robustness, verifying the alignment of the localBand coordinates with the visual rendering to prevent sub-pixel offsets, and avoiding premature rounding of the thickness value before snapping to maintain precision.

Comment thread src/components/Canvas/LineObject.tsx
Comment thread src/components/Canvas/LineObject.tsx
Comment thread src/components/Canvas/LineObject.tsx
@u8array u8array merged commit eb77ac2 into main May 17, 2026
2 checks passed
@u8array u8array deleted the fix/smart-align-on-resize branch May 20, 2026 21:32
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