mirror of
https://github.com/excalidraw/excalidraw.git
synced 2026-11-26 23:50:01 +03:00
Rebinding an arrow end to another element left the old element still listing the arrow in its `boundElements`. For example, dragging an elbow arrow's end off rectangle A and dropping it on rectangle B without Alt bound the end to B, and B listed the arrow, but so did A. `applyBinding` wrote the new binding onto the arrow and added the arrow to the new element, but never removed it from the previous one. Plain arrows dragged in the editor were not affected, as their bindings are written while dragging through `_updatePoints`, which keeps `boundElements` in step. Elbow arrows only bind while dragging when Alt is held, so a plain drop went through `applyBinding` alone. Calling `bindBindingElement` or `bindBindingElementToFixedPoint` directly hit the same gap with any arrow. `applyBinding` now runs the new binding through `syncBoundElementsWithNextBindings` before writing it. The element the end leaves stops listing the arrow, unless the arrow's other end is still bound to it. The `move.test.tsx` snapshot changes in one `versionNonce` only. The bound elements are now updated before the arrow rather than after, so the random nonces are drawn in a different order.