mirror of
https://github.com/excalidraw/excalidraw.git
synced 2026-11-26 23:50:01 +03:00
When placing skeleton arrows, each end bound beyond its element's binding
area is either extended onto the element (if it just falls short) or
unbound. 61255ad73 did this one end at a time: start first, then end. For
elbow arrows, extending the start goes through `movePoints`, which reroutes
the whole arrow from both its bindings. That moved the still-bound end onto
its element before it was checked, so it was kept bound. The result
depended on which end was the start.
Reproduction: rectangles A (0,0 100x20) and B (500,0 100x20), and an elbow
arrow (`elbowed: true`) [0,0]→[400,0]→[400,490] at (150,10), bound from A
to B. Its start falls 50px short of A, and its end is at (550,500), far
below B.
Failure case:
A→B: start extended onto A and bound, end rerouted to about (550,26)
just under B, and left bound to B
B→A (same arrow reversed): end extended onto A and bound, start left at
(550,500) and unbound
Expected: both directions as B→A: the A end extended and bound, the B end
left where given and unbound.
Fix: `extendBoundEndOntoElement` becomes `getBoundEndExtension`, which only
returns where the end would be extended to and moves nothing. The skeleton
conversion now checks both ends against the arrow as given. It unbinds the
unreachable ends first, so the reroute doesn't take them along, then
applies every extension in one `movePoints` call, then rebinds as before.
Only elbow arrows were affected: moving one end of a non-elbow arrow leaves
its other end in place. Mermaid's converter doesn't produce elbow arrows,
so this needs hand-written or LLM-generated skeletons.
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>