mirror of
https://github.com/excalidraw/excalidraw.git
synced 2026-11-28 16:19:32 +03:00
Review finding 6.
Reproduction / evidence: `LinearElementEditor.movePoints()` took
`moveMidPointsWithElement` in its `otherUpdates` argument (typed next to
`startBinding`/`endBinding`), which is the bag of element updates forwarded
to `_updatePoints()` and from there into `scene.mutateElement()`. Callers:
- `updateBoundElements()` (binding.ts) passed
`{ moveMidPointsWithElement: <same element at both ends> }` as
`otherUpdates` - the only caller setting a real value.
- `LinearElementEditor` point dragging (two call sites) forwarded
`updates?.moveMidPointsWithElement` from `PointMoveOtherUpdates`, but
`pointDraggingUpdates()` never sets that field, so it was always
undefined there.
Before 25902dc3b this put `moveMidPointsWithElement: false/true` on every
arrow updated through its bindings (and bumped its version). 25902dc3b
fixed it by copying only `startBinding`/`endBinding` out of `otherUpdates`
in the non-elbow branch of `_updatePoints()`.
Failure case: `otherUpdates` still mixed a behaviour flag with element
properties, so the filter in `_updatePoints()` had to know about every
non-property key. Any new option added to `otherUpdates` the same way
would be silently persisted on linear elements (and saved to scenes)
unless the filter was updated too.
Fix: move `moveMidPointsWithElement` into `movePoints()`'s existing
`options` parameter, next to `isBindingEnabled` /
`isMidpointSnappingEnabled`, and drop it from `otherUpdates` and from
`PointMoveOtherUpdates` (along with the dead forwarding at the two drag
call sites). `otherUpdates` now only holds element properties, so the
non-elbow branch of `_updatePoints()` spreads it directly again, as on
master; `mutateElement()` skips undefined values, so explicitly undefined
bindings remain no-ops. The elbow branch's binding filtering is untouched.
Behaviour is unchanged (no snapshot changes). Added a test that the option
still keeps midpoints moving with the element and isn't stored on it.