Files
excalidraw/dev-docs/docs/codebase/frames.mdx
T
dwelle 986c195625 fix(editor): take arrows out of frames once neither of their ends is in them
An arrow belongs to its frame only while one of its ends is in it: bound to
an element in the frame, or, unbound, inside it. Checked when an arrow is
finished (drawn, or an end dragged), when a drag ends (the dragged arrows and
those bound to the dragged elements), and when a frame's children are
recomputed (resize, grouping). An arrow bound only to elements outside its
frame thus no longer gets cut, duplicated or exported with it.

Claude Opus 5.5 (xhigh reasoning)
2026-11-02 09:50:12 +01:00

29 lines
1.3 KiB
Plaintext

# Frames
## Ordering
Frames should be ordered where frame children come first, followed by the frame element itself:
```
[
other_element,
frame1_child1,
frame1_child2,
frame1,
other_element,
frame2_child1,
frame2_child2,
frame2,
other_element,
...
]
```
If not ordered correctly, the editor will still function, but the elements may not be rendered and clipped correctly. Further, the renderer relies on this ordering for performance optimizations.
## Clipping
Frame children are clipped to their frame, and can't be hit (selected, hovered, box- or lasso-selected) outside of it.
Arrows (with their labels) are the exception: they're never clipped, so that they can connect elements across and out of frames. They still belong to the frame they're drawn from, so they're moved, copied and deleted with it, but only while one of their ends is in it: bound to an element in the frame, or, unbound, inside it (see `removeArrowsWithoutEndInFrame`). An arrow bound only to elements outside the frame thus leaves it. When exporting a frame, arrows of other frames reaching into it are exported too, as are any other non-children overlapping it. When moving a frame (dragging it, with the arrow keys, or from the stats panel), its arrows bound to elements that don't move with it stay bound to them (see `moveFrameArrows`).