Skip to content

Smart alignment guides, snap system, gap reader, and resize snap#1

Open
alizme wants to merge 2 commits intomasterfrom
smart-alignment-ruler
Open

Smart alignment guides, snap system, gap reader, and resize snap#1
alizme wants to merge 2 commits intomasterfrom
smart-alignment-ruler

Conversation

@alizme
Copy link
Copy Markdown

@alizme alizme commented Mar 29, 2026

Summary

  • Screen dragging — drag screens by name label or background, with undo/redo support via batched patches
  • Alignment snap guides — edge, center, and equal-size alignment detection with 5px snap threshold; shows dashed guide lines and live distance rulers during drag
  • Gap distance reader — hold Option/Alt with a frame selected, hover another frame to see edge-to-edge distances; hover the parent container to see 4-side inset distances
  • Resize snap guides — when resizing a frame inside a stack/auto-layout parent, the dragged edge snaps to sibling frame edges with dashed guide lines
  • Selection overlay fix — selection ring now tracks screen position during drag

New files

  • alignment-guides.ts — pure snap/alignment computation (edges, centers, equal-size multi-guides, distance indicators)
  • alignment-overlay.svelte — SVG overlay for guide lines and distance labels
  • gap-measurement.ts — gap and inset distance computation between two rects
  • gap-overlay.svelte — SVG overlay for gap measurement labels

Modified files

  • canvas.svelte — screen drag handling, Alt+hover gap measurement, data-id on screen divs
  • editor-state.svelte.ts — public findParent(), selectedNode in measurement effect
  • selection-overlay.svelte — resize snap logic with sibling edge detection and guide SVG rendering

Test plan

  • Drag a screen near another screen — verify snap guides appear at edges, centers, and matching-size edges
  • Verify distance labels update live while dragging along a guide
  • Verify guides and labels clear on drag end
  • Undo/redo restores screen to pre-drag position
  • Select a screen, hold Option/Alt, hover another screen — verify gap distance labels appear
  • Select a child frame, hold Option/Alt, hover parent screen — verify 4-side inset distances
  • Release Option — verify measurements clear immediately
  • Verify selection ring moves in sync with dragged screen (no lag)
  • Resize a child frame edge inside a stack — verify it snaps to sibling edges with guide lines
  • Resize corner handles — verify both axes snap simultaneously
  • Verify resize guides clear on resize end

🤖 Generated with Claude Code

alizme and others added 2 commits March 30, 2026 00:39
- Screen dragging with edge/center/equal-size snap alignment guides
- Live distance ruler measurements during drag along active guides
- Option/Alt + hover gap distance reader between selected and hovered frames
- Parent inset mode showing 4-side distances when hovering parent container
- Fix selection overlay lag during screen drag by tracking selectedNode in measurement effect

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When resizing a frame inside a stack/auto-layout parent, the dragged
edge snaps to sibling frame edges with guide lines. Tracks raw
(unsnapped) dimensions separately to prevent jitter, queries sibling
DOM rects each frame for accurate positions in reflowing layouts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@alizme alizme changed the title Smart alignment guides, snap system, and gap distance reader Smart alignment guides, snap system, gap reader, and resize snap Mar 30, 2026
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