@excalidraw/element 0.18.0-1b287a8ba → 0.18.0-39ce38a0d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/dev/index.js +101 -78
  2. package/dist/dev/index.js.map +2 -2
  3. package/dist/prod/index.js +11 -11
  4. package/dist/types/common/src/constants.d.ts +1 -0
  5. package/dist/types/element/src/delta.d.ts +11 -1
  6. package/dist/types/element/src/linearElementEditor.d.ts +2 -1
  7. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +0 -3
  8. package/dist/types/excalidraw/actions/actionBoundText.d.ts +0 -2
  9. package/dist/types/excalidraw/actions/actionCanvas.d.ts +0 -13
  10. package/dist/types/excalidraw/actions/actionClipboard.d.ts +3 -8
  11. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +0 -1
  12. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +3 -6
  13. package/dist/types/excalidraw/actions/actionElementLink.d.ts +0 -1
  14. package/dist/types/excalidraw/actions/actionElementLock.d.ts +0 -2
  15. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +0 -1
  16. package/dist/types/excalidraw/actions/actionExport.d.ts +0 -9
  17. package/dist/types/excalidraw/actions/actionFinalize.d.ts +2 -3
  18. package/dist/types/excalidraw/actions/actionFrame.d.ts +0 -4
  19. package/dist/types/excalidraw/actions/actionGroup.d.ts +0 -2
  20. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +33 -3
  21. package/dist/types/excalidraw/actions/actionLink.d.ts +0 -1
  22. package/dist/types/excalidraw/actions/actionMenu.d.ts +0 -3
  23. package/dist/types/excalidraw/actions/actionNavigate.d.ts +0 -2
  24. package/dist/types/excalidraw/actions/actionProperties.d.ts +0 -15
  25. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +0 -1
  26. package/dist/types/excalidraw/actions/actionStyles.d.ts +0 -1
  27. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +0 -1
  28. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +0 -1
  29. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +0 -1
  30. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +0 -1
  31. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +0 -1
  32. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +0 -1
  33. package/dist/types/excalidraw/components/Actions.d.ts +0 -4
  34. package/dist/types/excalidraw/renderer/staticScene.d.ts +4 -1
  35. package/dist/types/excalidraw/types.d.ts +4 -4
  36. package/package.json +3 -3
package/dist/dev/index.js CHANGED
@@ -8127,7 +8127,8 @@ var LinearElementEditor = class _LinearElementEditor {
8127
8127
  segmentMidPointHoveredCoords;
8128
8128
  elbowed;
8129
8129
  customLineAngle;
8130
- constructor(element, elementsMap) {
8130
+ isEditing;
8131
+ constructor(element, elementsMap, isEditing = false) {
8131
8132
  this.elementId = element.id;
8132
8133
  if (!pointsEqual6(element.points[0], pointFrom8(0, 0))) {
8133
8134
  console.error("Linear element is not normalized", Error().stack);
@@ -8158,6 +8159,7 @@ var LinearElementEditor = class _LinearElementEditor {
8158
8159
  this.segmentMidPointHoveredCoords = null;
8159
8160
  this.elbowed = isElbowArrow(element) && element.elbowed;
8160
8161
  this.customLineAngle = null;
8162
+ this.isEditing = isEditing;
8161
8163
  }
8162
8164
  // ---------------------------------------------------------------------------
8163
8165
  // static methods
@@ -8175,11 +8177,11 @@ var LinearElementEditor = class _LinearElementEditor {
8175
8177
  return null;
8176
8178
  }
8177
8179
  static handleBoxSelection(event, appState, setState, elementsMap) {
8178
- if (!appState.editingLinearElement || !appState.selectionElement) {
8180
+ if (!appState.selectedLinearElement?.isEditing || !appState.selectionElement) {
8179
8181
  return false;
8180
8182
  }
8181
- const { editingLinearElement } = appState;
8182
- const { selectedPointsIndices, elementId } = editingLinearElement;
8183
+ const { selectedLinearElement } = appState;
8184
+ const { selectedPointsIndices, elementId } = selectedLinearElement;
8183
8185
  const element = _LinearElementEditor.getElement(elementId, elementsMap);
8184
8186
  if (!element) {
8185
8187
  return false;
@@ -8201,8 +8203,8 @@ var LinearElementEditor = class _LinearElementEditor {
8201
8203
  return true;
8202
8204
  });
8203
8205
  setState({
8204
- editingLinearElement: {
8205
- ...editingLinearElement,
8206
+ selectedLinearElement: {
8207
+ ...selectedLinearElement,
8206
8208
  selectedPointsIndices: nextSelectedPoints.length ? nextSelectedPoints : null
8207
8209
  }
8208
8210
  });
@@ -8356,7 +8358,6 @@ var LinearElementEditor = class _LinearElementEditor {
8356
8358
  };
8357
8359
  return {
8358
8360
  ...app.state,
8359
- editingLinearElement: app.state.editingLinearElement ? newLinearElementEditor : null,
8360
8361
  selectedLinearElement: newLinearElementEditor,
8361
8362
  suggestedBindings
8362
8363
  };
@@ -8440,7 +8441,7 @@ var LinearElementEditor = class _LinearElementEditor {
8440
8441
  }
8441
8442
  static getEditorMidPoints = (element, elementsMap, appState) => {
8442
8443
  const boundText = getBoundTextElement(element, elementsMap);
8443
- if (!isElbowArrow(element) && !appState.editingLinearElement && element.points.length > 2 && !boundText) {
8444
+ if (!isElbowArrow(element) && !appState.selectedLinearElement?.isEditing && element.points.length > 2 && !boundText) {
8444
8445
  return [];
8445
8446
  }
8446
8447
  const points = _LinearElementEditor.getPointsGlobalCoordinates(
@@ -8490,7 +8491,7 @@ var LinearElementEditor = class _LinearElementEditor {
8490
8491
  element,
8491
8492
  elementsMap
8492
8493
  );
8493
- if (points.length >= 3 && !appState.editingLinearElement && !isElbowArrow(element)) {
8494
+ if (points.length >= 3 && !appState.selectedLinearElement?.isEditing && !isElbowArrow(element)) {
8494
8495
  return null;
8495
8496
  }
8496
8497
  const threshold = (_LinearElementEditor.POINT_HANDLE_SIZE + 1) / appState.zoom.value;
@@ -8630,7 +8631,7 @@ var LinearElementEditor = class _LinearElementEditor {
8630
8631
  segmentMidpoint,
8631
8632
  elementsMap
8632
8633
  );
8633
- } else if (event.altKey && appState.editingLinearElement) {
8634
+ } else if (event.altKey && appState.selectedLinearElement?.isEditing) {
8634
8635
  if (linearElementEditor.lastUncommittedPoint == null) {
8635
8636
  scene.mutateElement(element, {
8636
8637
  points: [
@@ -8740,14 +8741,14 @@ var LinearElementEditor = class _LinearElementEditor {
8740
8741
  }
8741
8742
  static handlePointerMove(event, scenePointerX, scenePointerY, app) {
8742
8743
  const appState = app.state;
8743
- if (!appState.editingLinearElement) {
8744
+ if (!appState.selectedLinearElement?.isEditing) {
8744
8745
  return null;
8745
8746
  }
8746
- const { elementId, lastUncommittedPoint } = appState.editingLinearElement;
8747
+ const { elementId, lastUncommittedPoint } = appState.selectedLinearElement;
8747
8748
  const elementsMap = app.scene.getNonDeletedElementsMap();
8748
8749
  const element = _LinearElementEditor.getElement(elementId, elementsMap);
8749
8750
  if (!element) {
8750
- return appState.editingLinearElement;
8751
+ return appState.selectedLinearElement;
8751
8752
  }
8752
8753
  const { points } = element;
8753
8754
  const lastPoint = points[points.length - 1];
@@ -8755,10 +8756,10 @@ var LinearElementEditor = class _LinearElementEditor {
8755
8756
  if (lastPoint === lastUncommittedPoint) {
8756
8757
  _LinearElementEditor.deletePoints(element, app, [points.length - 1]);
8757
8758
  }
8758
- return {
8759
- ...appState.editingLinearElement,
8759
+ return appState.selectedLinearElement?.lastUncommittedPoint ? {
8760
+ ...appState.selectedLinearElement,
8760
8761
  lastUncommittedPoint: null
8761
- };
8762
+ } : appState.selectedLinearElement;
8762
8763
  }
8763
8764
  let newPoint;
8764
8765
  if (shouldRotateWithDiscreteAngle(event) && points.length >= 2) {
@@ -8778,8 +8779,8 @@ var LinearElementEditor = class _LinearElementEditor {
8778
8779
  newPoint = _LinearElementEditor.createPointAt(
8779
8780
  element,
8780
8781
  elementsMap,
8781
- scenePointerX - appState.editingLinearElement.pointerOffset.x,
8782
- scenePointerY - appState.editingLinearElement.pointerOffset.y,
8782
+ scenePointerX - appState.selectedLinearElement.pointerOffset.x,
8783
+ scenePointerY - appState.selectedLinearElement.pointerOffset.y,
8783
8784
  event[KEYS2.CTRL_OR_CMD] || isElbowArrow(element) ? null : app.getEffectiveGridSize()
8784
8785
  );
8785
8786
  }
@@ -8800,7 +8801,7 @@ var LinearElementEditor = class _LinearElementEditor {
8800
8801
  _LinearElementEditor.addPoints(element, app.scene, [newPoint]);
8801
8802
  }
8802
8803
  return {
8803
- ...appState.editingLinearElement,
8804
+ ...appState.selectedLinearElement,
8804
8805
  lastUncommittedPoint: element.points[element.points.length - 1]
8805
8806
  };
8806
8807
  }
@@ -8906,11 +8907,11 @@ var LinearElementEditor = class _LinearElementEditor {
8906
8907
  // ---------------------------------------------------------------------------
8907
8908
  static duplicateSelectedPoints(appState, scene) {
8908
8909
  invariant6(
8909
- appState.editingLinearElement,
8910
+ appState.selectedLinearElement?.isEditing,
8910
8911
  "Not currently editing a linear element"
8911
8912
  );
8912
8913
  const elementsMap = scene.getNonDeletedElementsMap();
8913
- const { selectedPointsIndices, elementId } = appState.editingLinearElement;
8914
+ const { selectedPointsIndices, elementId } = appState.selectedLinearElement;
8914
8915
  const element = _LinearElementEditor.getElement(elementId, elementsMap);
8915
8916
  invariant6(
8916
8917
  element,
@@ -8957,14 +8958,14 @@ var LinearElementEditor = class _LinearElementEditor {
8957
8958
  }
8958
8959
  return {
8959
8960
  ...appState,
8960
- editingLinearElement: {
8961
- ...appState.editingLinearElement,
8961
+ selectedLinearElement: {
8962
+ ...appState.selectedLinearElement,
8962
8963
  selectedPointsIndices: nextSelectedIndices
8963
8964
  }
8964
8965
  };
8965
8966
  }
8966
8967
  static deletePoints(element, app, pointIndices) {
8967
- const isUncommittedPoint = app.state.editingLinearElement?.lastUncommittedPoint === element.points[element.points.length - 1];
8968
+ const isUncommittedPoint = app.state.selectedLinearElement?.isEditing && app.state.selectedLinearElement?.lastUncommittedPoint === element.points[element.points.length - 1];
8968
8969
  const nextPoints = element.points.filter((_, idx) => {
8969
8970
  return !pointIndices.includes(idx);
8970
8971
  });
@@ -9073,7 +9074,7 @@ var LinearElementEditor = class _LinearElementEditor {
9073
9074
  pointFrom8(origin.x, origin.y),
9074
9075
  pointFrom8(pointerCoords.x, pointerCoords.y)
9075
9076
  );
9076
- if (!appState.editingLinearElement && dist < DRAGGING_THRESHOLD / appState.zoom.value) {
9077
+ if (!appState.selectedLinearElement?.isEditing && dist < DRAGGING_THRESHOLD / appState.zoom.value) {
9077
9078
  return false;
9078
9079
  }
9079
9080
  return true;
@@ -10562,6 +10563,11 @@ var getCanvasPadding = (element) => {
10562
10563
  return element.strokeWidth * 12;
10563
10564
  case "text":
10564
10565
  return element.fontSize / 2;
10566
+ case "arrow":
10567
+ if (element.endArrowhead || element.endArrowhead) {
10568
+ return 40;
10569
+ }
10570
+ return 20;
10565
10571
  default:
10566
10572
  return 20;
10567
10573
  }
@@ -13231,8 +13237,9 @@ var Store = class {
13231
13237
  constructor(app) {
13232
13238
  this.app = app;
13233
13239
  }
13234
- // internally used by history
13240
+ // for internal use by history
13235
13241
  onDurableIncrementEmitter = new Emitter();
13242
+ // for public use as part of onIncrement API
13236
13243
  onStoreIncrementEmitter = new Emitter();
13237
13244
  scheduledMacroActions = /* @__PURE__ */ new Set();
13238
13245
  scheduledMicroActions = [];
@@ -13808,14 +13815,14 @@ var getDefaultObservedAppState = () => {
13808
13815
  viewBackgroundColor: COLOR_PALETTE2.white,
13809
13816
  selectedElementIds: {},
13810
13817
  selectedGroupIds: {},
13811
- editingLinearElementId: null,
13812
- selectedLinearElementId: null,
13818
+ activeLinearElement: null,
13813
13819
  croppingElementId: null,
13814
13820
  activeLockedId: null,
13815
13821
  lockedMultiSelections: {}
13816
13822
  };
13817
13823
  };
13818
13824
  var getObservedAppState = (appState) => {
13825
+ const selectedLinearElement = appState.selectedLinearElement;
13819
13826
  const observedAppState = {
13820
13827
  name: appState.name,
13821
13828
  editingGroupId: appState.editingGroupId,
@@ -13825,10 +13832,10 @@ var getObservedAppState = (appState) => {
13825
13832
  croppingElementId: appState.croppingElementId,
13826
13833
  activeLockedId: appState.activeLockedId,
13827
13834
  lockedMultiSelections: appState.lockedMultiSelections,
13828
- editingLinearElementId: appState.editingLinearElement?.elementId ?? // prefer app state, as it's likely newer
13829
- appState.editingLinearElementId ?? // fallback to observed app state, as it's likely older coming from a previous snapshot
13830
- null,
13831
- selectedLinearElementId: appState.selectedLinearElement?.elementId ?? appState.selectedLinearElementId ?? null
13835
+ activeLinearElement: selectedLinearElement ? {
13836
+ id: selectedLinearElement.elementId,
13837
+ isEditing: !!selectedLinearElement.isEditing
13838
+ } : appState.activeLinearElement ?? null
13832
13839
  };
13833
13840
  Reflect.defineProperty(observedAppState, hiddenObservedAppStateProp, {
13834
13841
  value: true,
@@ -14632,6 +14639,15 @@ var Delta = class _Delta {
14632
14639
  static isEmpty(delta) {
14633
14640
  return !Object.keys(delta.deleted).length && !Object.keys(delta.inserted).length;
14634
14641
  }
14642
+ /**
14643
+ * Merges two deltas into a new one.
14644
+ */
14645
+ static merge(delta1, delta2) {
14646
+ return _Delta.create(
14647
+ { ...delta1.deleted, ...delta2.deleted },
14648
+ { ...delta1.inserted, ...delta2.inserted }
14649
+ );
14650
+ }
14635
14651
  /**
14636
14652
  * Merges deleted and inserted object partials.
14637
14653
  */
@@ -14877,6 +14893,10 @@ var AppStateDelta = class _AppStateDelta {
14877
14893
  const inversedDelta = Delta.create(this.delta.inserted, this.delta.deleted);
14878
14894
  return new _AppStateDelta(inversedDelta);
14879
14895
  }
14896
+ squash(delta) {
14897
+ this.delta = Delta.merge(this.delta, delta.delta);
14898
+ return this;
14899
+ }
14880
14900
  applyTo(appState, nextElements) {
14881
14901
  try {
14882
14902
  const {
@@ -14886,8 +14906,7 @@ var AppStateDelta = class _AppStateDelta {
14886
14906
  const {
14887
14907
  selectedElementIds: addedSelectedElementIds = {},
14888
14908
  selectedGroupIds: addedSelectedGroupIds = {},
14889
- selectedLinearElementId,
14890
- editingLinearElementId,
14909
+ activeLinearElement,
14891
14910
  ...directlyApplicablePartial
14892
14911
  } = this.delta.inserted;
14893
14912
  const mergedSelectedElementIds = Delta.mergeObjects(
@@ -14900,27 +14919,19 @@ var AppStateDelta = class _AppStateDelta {
14900
14919
  addedSelectedGroupIds,
14901
14920
  removedSelectedGroupIds
14902
14921
  );
14903
- const selectedLinearElement = selectedLinearElementId && nextElements.has(selectedLinearElementId) ? new LinearElementEditor(
14922
+ const selectedLinearElement = activeLinearElement && nextElements.has(activeLinearElement.id) ? new LinearElementEditor(
14904
14923
  nextElements.get(
14905
- selectedLinearElementId
14924
+ activeLinearElement.id
14906
14925
  ),
14907
- nextElements
14908
- ) : null;
14909
- const editingLinearElement = editingLinearElementId && nextElements.has(editingLinearElementId) ? new LinearElementEditor(
14910
- nextElements.get(
14911
- editingLinearElementId
14912
- ),
14913
- nextElements
14926
+ nextElements,
14927
+ activeLinearElement.isEditing
14914
14928
  ) : null;
14915
14929
  const nextAppState = {
14916
14930
  ...appState,
14917
14931
  ...directlyApplicablePartial,
14918
14932
  selectedElementIds: mergedSelectedElementIds,
14919
14933
  selectedGroupIds: mergedSelectedGroupIds,
14920
- selectedLinearElement: typeof selectedLinearElementId !== "undefined" ? selectedLinearElement : appState.selectedLinearElement,
14921
- // otherwise assign what we had before
14922
- editingLinearElement: typeof editingLinearElementId !== "undefined" ? editingLinearElement : appState.editingLinearElement
14923
- // otherwise assign what we had before
14934
+ selectedLinearElement: typeof activeLinearElement !== "undefined" ? selectedLinearElement : appState.selectedLinearElement
14924
14935
  };
14925
14936
  const constainsVisibleChanges = this.filterInvisibleChanges(
14926
14937
  appState,
@@ -15010,14 +15021,13 @@ var AppStateDelta = class _AppStateDelta {
15010
15021
  nextAppState[key] = null;
15011
15022
  }
15012
15023
  break;
15013
- case "selectedLinearElementId":
15014
- case "editingLinearElementId":
15024
+ case "activeLinearElement":
15015
15025
  const appStateKey = _AppStateDelta.convertToAppStateKey(key);
15016
- const linearElement = nextAppState[appStateKey];
15017
- if (!linearElement) {
15026
+ const nextLinearElement = nextAppState[appStateKey];
15027
+ if (!nextLinearElement) {
15018
15028
  visibleDifferenceFlag.value = true;
15019
15029
  } else {
15020
- const element = nextElements.get(linearElement.elementId);
15030
+ const element = nextElements.get(nextLinearElement.elementId);
15021
15031
  if (element && !element.isDeleted) {
15022
15032
  visibleDifferenceFlag.value = true;
15023
15033
  } else {
@@ -15025,29 +15035,26 @@ var AppStateDelta = class _AppStateDelta {
15025
15035
  }
15026
15036
  }
15027
15037
  break;
15028
- case "lockedMultiSelections": {
15038
+ case "lockedMultiSelections":
15029
15039
  const prevLockedUnits = prevAppState[key] || {};
15030
15040
  const nextLockedUnits = nextAppState[key] || {};
15031
15041
  if (!isShallowEqual2(prevLockedUnits, nextLockedUnits)) {
15032
15042
  visibleDifferenceFlag.value = true;
15033
15043
  }
15034
15044
  break;
15035
- }
15036
- case "activeLockedId": {
15045
+ case "activeLockedId":
15037
15046
  const prevHitLockedId = prevAppState[key] || null;
15038
15047
  const nextHitLockedId = nextAppState[key] || null;
15039
15048
  if (prevHitLockedId !== nextHitLockedId) {
15040
15049
  visibleDifferenceFlag.value = true;
15041
15050
  }
15042
15051
  break;
15043
- }
15044
- default: {
15052
+ default:
15045
15053
  assertNever4(
15046
15054
  key,
15047
15055
  `Unknown ObservedElementsAppState's key "${key}"`,
15048
15056
  true
15049
15057
  );
15050
- }
15051
15058
  }
15052
15059
  }
15053
15060
  }
@@ -15055,10 +15062,8 @@ var AppStateDelta = class _AppStateDelta {
15055
15062
  }
15056
15063
  static convertToAppStateKey(key) {
15057
15064
  switch (key) {
15058
- case "selectedLinearElementId":
15065
+ case "activeLinearElement":
15059
15066
  return "selectedLinearElement";
15060
- case "editingLinearElementId":
15061
- return "editingLinearElement";
15062
15067
  }
15063
15068
  }
15064
15069
  static filterSelectedElements(selectedElementIds, elements, visibleDifferenceFlag) {
@@ -15099,8 +15104,7 @@ var AppStateDelta = class _AppStateDelta {
15099
15104
  editingGroupId,
15100
15105
  selectedGroupIds,
15101
15106
  selectedElementIds,
15102
- editingLinearElementId,
15103
- selectedLinearElementId,
15107
+ activeLinearElement,
15104
15108
  croppingElementId,
15105
15109
  lockedMultiSelections,
15106
15110
  activeLockedId,
@@ -15319,8 +15323,8 @@ var ElementsDelta = class _ElementsDelta {
15319
15323
  inverse() {
15320
15324
  const inverseInternal = (deltas) => {
15321
15325
  const inversedDeltas = {};
15322
- for (const [id, delta] of Object.entries(deltas)) {
15323
- inversedDeltas[id] = Delta.create(delta.inserted, delta.deleted);
15326
+ for (const [id, { inserted, deleted }] of Object.entries(deltas)) {
15327
+ inversedDeltas[id] = Delta.create({ ...inserted }, { ...deleted });
15324
15328
  }
15325
15329
  return inversedDeltas;
15326
15330
  };
@@ -15452,6 +15456,34 @@ var ElementsDelta = class _ElementsDelta {
15452
15456
  return [nextElements, flags.containsVisibleDifference];
15453
15457
  }
15454
15458
  }
15459
+ squash(delta) {
15460
+ const { added, removed, updated } = delta;
15461
+ for (const [id, nextDelta] of Object.entries(added)) {
15462
+ const prevDelta = this.added[id];
15463
+ if (!prevDelta) {
15464
+ this.added[id] = nextDelta;
15465
+ } else {
15466
+ this.added[id] = Delta.merge(prevDelta, nextDelta);
15467
+ }
15468
+ }
15469
+ for (const [id, nextDelta] of Object.entries(removed)) {
15470
+ const prevDelta = this.removed[id];
15471
+ if (!prevDelta) {
15472
+ this.removed[id] = nextDelta;
15473
+ } else {
15474
+ this.removed[id] = Delta.merge(prevDelta, nextDelta);
15475
+ }
15476
+ }
15477
+ for (const [id, nextDelta] of Object.entries(updated)) {
15478
+ const prevDelta = this.updated[id];
15479
+ if (!prevDelta) {
15480
+ this.updated[id] = nextDelta;
15481
+ } else {
15482
+ this.updated[id] = Delta.merge(prevDelta, nextDelta);
15483
+ }
15484
+ }
15485
+ return this;
15486
+ }
15455
15487
  static createApplier = (nextElements, snapshot, options, flags) => (deltas) => {
15456
15488
  const getElement = _ElementsDelta.createGetter(
15457
15489
  nextElements,
@@ -15595,19 +15627,10 @@ var ElementsDelta = class _ElementsDelta {
15595
15627
  const prevAffectedElements = new Map(
15596
15628
  Array.from(prevElements).filter(([id]) => nextAffectedElements.has(id))
15597
15629
  );
15598
- const { added, removed, updated } = _ElementsDelta.calculate(
15599
- prevAffectedElements,
15600
- nextAffectedElements
15630
+ this.squash(
15631
+ // technically we could do better here if perf. would become an issue
15632
+ _ElementsDelta.calculate(prevAffectedElements, nextAffectedElements)
15601
15633
  );
15602
- for (const [id, delta] of Object.entries(added)) {
15603
- this.added[id] = delta;
15604
- }
15605
- for (const [id, delta] of Object.entries(removed)) {
15606
- this.removed[id] = delta;
15607
- }
15608
- for (const [id, delta] of Object.entries(updated)) {
15609
- this.updated[id] = delta;
15610
- }
15611
15634
  return nextAffectedElements;
15612
15635
  }
15613
15636
  /**
@@ -18453,7 +18476,7 @@ var getTransformHandles = (element, zoom, elementsMap, pointerType = "mouse", om
18453
18476
  );
18454
18477
  };
18455
18478
  var shouldShowBoundingBox = (elements, appState) => {
18456
- if (appState.editingLinearElement) {
18479
+ if (appState.selectedLinearElement?.isEditing) {
18457
18480
  return false;
18458
18481
  }
18459
18482
  if (elements.length > 1) {