@objectifthunes/whiteboard
LAYOUT

Draggable & DraggableSurface

Screen-space dragging for overlay chrome — grid snap on release, per-id persistence, double-click or resetDraggables() to reset. No WhiteboardShell required.


PREVIEW
Drag me

Snaps to the grid on release. Double-click to reset.

Me too — buttons inside still click:

SOURCE
import { DraggableSurface, resetDraggables } from '@objectifthunes/whiteboard'

// keep your CSS anchoring — the drag is a translate() on top of it
<DraggableSurface id="legend" padding="sm" className="absolute bottom-4 left-1/2 -translate-x-1/2">
  …
</DraggableSurface>

<Button onClick={resetDraggables}>Reset layout</Button>
// double-click an empty area of a panel to reset just that one
NOTES

For chrome floating over your own stage. Dragging starts from any non-interactive area — inputs, buttons and canvases inside keep their own pointer behaviour. The offset snaps to the whiteboard grid on release, honours the global whiteboard-snap-now event, and persists per id in localStorage. Draggable is the same behaviour without the Surface chrome (wrap a Toolbar with it).