Feature Library

Smart guides, align and handles

0.20 CPU ms
A still of the Smart guides, align and handles demo
Still
The live demo starts when it’s in view.Drag shapes to snap · corners resize, just outside them turns · Alt drags freely

The pure geometry behind editing shapes on a board.

What it costs a frame

0.20 ms
GPU
not used
CPU, median
0.20 ms
CPU, 95th pct
0.28 ms
Draw calls
0
Weight
Light

Measured 3 November 2026 on 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 156, 1920×1080 at 1×. 600 frames × 3 rounds, median kept. What ran: Measured with a card dragged round the board by script, snapping every frame: each frame runs the edge, middle and equal-spacing snaps against the other eleven shapes and the board, then moves the card and redraws the guides, gap labels and handles. Phones: tiers are being measured next.

On every machine it was measured on
MachineGPU msCPU msCPU p95
unknown GPU · 13th Gen Intel(R) Core(TM) i9-13900Hreference · measuring toolnot timed0.200.28
apple · Apple A19 Proin a browser tab · 16 November 2026not timed0.260.36
Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 2026not timed0.300.52

Bars against one 16.7 ms frame. A browser-tab run is timed in a visible tab without the tool’s scripted input, so read it as close, not exact.

What it needs

Renders with
DOM and CSSPlain DOM and CSS: every current browser.
Your browser
Runs hereNo WebGPU needed
Depends on
NothingNo other packages

What it’s for

  1. Design tools and whiteboards
  2. Diagram and node editors
  3. Slide and page layout
  4. Dashboard builders
  5. Floor plans

Pitfalls, in brief

  1. The snap reach is in screen pixels: divide it by the zoom before passing it in, or snapping grabs from across the board when zoomed out and never when zoomed in.
  2. Build SnapTargets once when a drag starts, from everything but the moving items: the others do not move during it, and rebuilding it per frame sorts every edge again.
  3. Snap the raw offset from the drag’s start, never the last snapped position: snapping the snapped box sticks it to the first line it meets.
  4. Turned items snap by their axis-aligned bounds (boundsOfBox), and snapResize only makes sense for an unturned box resized freely: skip it with a kept aspect, from the centre or for a turned box.
  5. Resize from the box as it was when the drag started, not as it is now: resizeBox measures the pointer in that box’s own frame, so a turned box keeps its opposite corner still.
2 more in brief
  1. Hit-test handles before shapes, and the shapes topmost first; the rotate zone sits just outside each corner, so a corner handle has to win inside its reach.
  2. With a group selected, scale and turn the boxes as they were at the drag’s start (scaleBoxes, rotateBoxes), not step by step, or rounding drifts them apart.
7 pitfalls in full, the hook-up guide, the module source and its tests come with the part.

Where it comes from

From SpaciousPro. Fully custom code.

snappingsmart guidesequal spacingaligndistributeresize handlesrotationhit testingno dependencies

Near it in the frame