RPIC

canvas

rpic extension. canvas from <position> to <position> fixes the output page to the rectangle spanned by the two corners, independent of the drawn content.

Without it, the viewBox hugs the content’s bounding box — so moving the leftmost or topmost object shifts the whole drawing on screen. With a fixed canvas, the frame’s origin and size are stable: dragging one object moves only that object, which is exactly what a visual editor needs.

.PS
canvas from (0,0) to (4,2)
box "stays put" fit at (1,1)
circle rad 0.3 at (3,1.3)
.PE
stays put

Anchoring to geometry

The corners are ordinary pic positions, so the page can be pinned to an invisible frame:

.PS
F: box wid 3.5 ht 1.6 at (1.75,0.8) invis
canvas from F.sw to F.ne
box "framed" fit at (0.8,0.8)
.PE
framed

Rules

For editors

The per-object geometry export (compile()objects, with each shape’s bbox in viewBox units and its source span) uses the same frame. Together they close the loop for bidirectional editing: stable coordinates out, precise source positions back.