Files
excalidraw/dev-docs/docs/codebase/frames.mdx
David Luzar dd2f8fc32b fix(editor): don't clip arrows to their frames (#12516)
* fix(editor): don't clip arrows to their frames

Arrows (and their labels) are no longer clipped to the frame they belong
to, so they can connect elements across and out of frames. They stay
members of their frame, so they're still moved, copied, deleted and
exported with it.

- Not clipped on the canvas or in SVG, and hit (click, hover, box and
  lasso selection) outside their frame too.
- Exporting a frame includes other frames' arrows reaching into it, as it
  does other non-children overlapping it.
- Moving a frame (dragging it, with the arrow keys or from the stats
  panel) keeps its arrows bound to the elements that don't move with it,
  instead of unbinding them. Their free points move with the frame, elbow
  arrows are routed once per move and keep their fixed segments.
- mutateElement no longer ignores an elbow arrow's x/y update to 0.

Fixes #6749
Fixes #7827

Claude Opus 5.5 (xhigh reasoning)

* docs(changelog): arrows aren't clipped to frames

Claude Opus 5.5 (xhigh reasoning)

* 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)

* fix(editor): take arrows out of frames when nudged or moved from the stats panel

The arrow keys and the stats panel move arrows too, so check there as well
whether a moved arrow still has an end in its frame.

Claude Opus 5.5 (xhigh reasoning)
2026-11-03 09:20:50 +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`).