From 03a6a327a853c77e65e737a139039abde13f3126 Mon Sep 17 00:00:00 2001 From: dwelle <5153846+dwelle@users.noreply.github.com> Date: Wed, 27 Aug 2025 10:00:01 +0200 Subject: [PATCH] change `appState.suggestedBindings` -> `suggestedBinding` & remove unused code --- packages/element/src/binding.ts | 88 +- packages/element/src/linearElementEditor.ts | 6 +- .../linearElementEditor.test.tsx.snap | 11 - .../excalidraw/actions/actionFinalize.tsx | 4 +- packages/excalidraw/appState.ts | 4 +- packages/excalidraw/components/App.tsx | 62 +- packages/excalidraw/components/LayerUI.tsx | 2 +- .../components/canvases/InteractiveCanvas.tsx | 2 +- .../components/canvases/StaticCanvas.tsx | 1 + .../excalidraw/renderer/interactiveScene.ts | 80 +- .../__snapshots__/contextmenu.test.tsx.snap | 34 +- .../tests/__snapshots__/history.test.tsx.snap | 2027 ++++------------- .../tests/__snapshots__/move.test.tsx.snap | 139 -- .../regressionTests.test.tsx.snap | 104 +- packages/excalidraw/tests/move.test.tsx | 2 +- packages/excalidraw/types.ts | 9 +- .../tests/__snapshots__/export.test.ts.snap | 2 +- 17 files changed, 615 insertions(+), 1962 deletions(-) diff --git a/packages/element/src/binding.ts b/packages/element/src/binding.ts index 8da990c58..b3d6e85a7 100644 --- a/packages/element/src/binding.ts +++ b/packages/element/src/binding.ts @@ -3,7 +3,6 @@ import { arrayToMap, invariant, isAlwaysInsideBinding, - tupleToCoors, } from "@excalidraw/common"; import { @@ -33,7 +32,6 @@ import { getElementBounds, } from "./bounds"; import { - bindingBorderTest, getHoveredElementForBinding, hitElementItself, intersectElementWithLineSegment, @@ -82,16 +80,6 @@ import type { BindMode, } from "./types"; -export type SuggestedBinding = - | NonDeleted - | SuggestedPointBinding; - -export type SuggestedPointBinding = [ - NonDeleted, - "start" | "end" | "both", - NonDeleted, -]; - export type BindingStrategy = // Create a new binding with this mode | { @@ -197,39 +185,6 @@ const bindOrUnbindBindingElementEdge = ( } }; -const getOriginalBindingsIfStillCloseToBindingEnds = ( - linearElement: NonDeleted, - elementsMap: NonDeletedSceneElementsMap, -): (NonDeleted | null)[] => - (["start", "end"] as const).map((edge) => { - const coors = tupleToCoors( - LinearElementEditor.getPointAtIndexGlobalCoordinates( - linearElement, - edge === "start" ? 0 : -1, - elementsMap, - ), - ); - const elementId = - edge === "start" - ? linearElement.startBinding?.elementId - : linearElement.endBinding?.elementId; - if (elementId) { - const element = elementsMap.get(elementId); - if ( - isBindableElement(element) && - bindingBorderTest( - element, - pointFrom(coors.x, coors.y), - elementsMap, - ) - ) { - return element; - } - } - - return null; - }); - export const getStartGlobalEndLocalPointsForSimpleArrowBinding = ( arrow: NonDeleted, start: BindingStrategy, @@ -665,43 +620,12 @@ export const bindOrUnbindBindingElements = ( }); }; -export const getSuggestedBindingsForBindingElements = ( - selectedElements: NonDeleted[], - elementsMap: NonDeletedSceneElementsMap, -): SuggestedBinding[] => { - // HOT PATH: Bail out if selected elements list is too large - if (selectedElements.length > 50) { - return []; - } - - return ( - selectedElements - .filter(isArrowElement) - .flatMap((element) => - getOriginalBindingsIfStillCloseToBindingEnds(element, elementsMap), - ) - .filter( - (element): element is NonDeleted => - element !== null, - ) - // Filter out bind candidates which are in the - // same selection / group with the arrow - // - // TODO: Is it worth turning the list into a set to avoid dupes? - .filter( - (element) => - selectedElements.filter((selected) => selected.id === element?.id) - .length === 0, - ) - ); -}; - export const maybeSuggestBindingsForBindingElementAtCoords = ( linearElement: NonDeleted, startOrEndOrBoth: "start" | "end" | "both", scene: Scene, pointerCoords: GlobalPoint, -): ExcalidrawBindableElement[] => { +): AppState["suggestedBinding"] => { const startCoords = startOrEndOrBoth === "start" ? pointerCoords @@ -729,7 +653,7 @@ export const maybeSuggestBindingsForBindingElementAtCoords = ( scene.getNonDeletedElementsMap(), ); - const suggestedBindings = []; + let suggestedBinding: AppState["suggestedBinding"] = null; if (startHovered != null && startHovered.id === endHovered?.id) { const hitStart = hitElementItself({ @@ -747,15 +671,15 @@ export const maybeSuggestBindingsForBindingElementAtCoords = ( overrideShouldTestInside: true, }); if (hitStart && hitEnd) { - suggestedBindings.push(startHovered); + suggestedBinding = startHovered; } } else if (startOrEndOrBoth === "start" && startHovered != null) { - suggestedBindings.push(startHovered); + suggestedBinding = startHovered; } else if (startOrEndOrBoth === "end" && endHovered != null) { - suggestedBindings.push(endHovered); + suggestedBinding = endHovered; } - return suggestedBindings; + return suggestedBinding; }; export const bindBindingElement = ( diff --git a/packages/element/src/linearElementEditor.ts b/packages/element/src/linearElementEditor.ts index 721cc9f91..6e0f4b285 100644 --- a/packages/element/src/linearElementEditor.ts +++ b/packages/element/src/linearElementEditor.ts @@ -421,7 +421,7 @@ export class LinearElementEditor { } // suggest bindings for first and last point if selected - let suggestedBindings: ExcalidrawBindableElement[] = []; + let suggestedBinding: AppState["suggestedBinding"] = null; if (isBindingElement(element, false)) { const firstIndexIsSelected = selectedPointsIndices[0] === 0; const lastIndexIsSelected = @@ -458,7 +458,7 @@ export class LinearElementEditor { } if (coords.length) { - suggestedBindings = maybeSuggestBindingsForBindingElementAtCoords( + suggestedBinding = maybeSuggestBindingsForBindingElementAtCoords( element, firstIndexIsSelected && lastIndexIsSelected ? "both" @@ -494,7 +494,7 @@ export class LinearElementEditor { return { selectedLinearElement: newLinearElementEditor, - suggestedBindings, + suggestedBinding, } as Pick; } diff --git a/packages/element/tests/__snapshots__/linearElementEditor.test.tsx.snap b/packages/element/tests/__snapshots__/linearElementEditor.test.tsx.snap index 67639e5bd..35e940d32 100644 --- a/packages/element/tests/__snapshots__/linearElementEditor.test.tsx.snap +++ b/packages/element/tests/__snapshots__/linearElementEditor.test.tsx.snap @@ -44,14 +44,3 @@ exports[`Test Linear Elements > Test bound text element > should resize and posi "Online whiteboard collaboration made easy" `; - -exports[`Test Linear Elements > Test bound text element > should wrap the bound text when arrow bound container moves 1`] = ` -"Online whiteboard -collaboration made easy" -`; - -exports[`Test Linear Elements > Test bound text element > should wrap the bound text when arrow bound container moves 2`] = ` -"Online whiteboard -collaboration made -easy" -`; diff --git a/packages/excalidraw/actions/actionFinalize.tsx b/packages/excalidraw/actions/actionFinalize.tsx index d03a04bb7..3a9be5831 100644 --- a/packages/excalidraw/actions/actionFinalize.tsx +++ b/packages/excalidraw/actions/actionFinalize.tsx @@ -153,7 +153,7 @@ export const actionFinalize = register({ isEditing: false, }, selectionElement: null, - suggestedBindings: [], + suggestedBinding: null, newElement: null, multiElement: null, }, @@ -302,7 +302,7 @@ export const actionFinalize = register({ multiElement: null, editingTextElement: null, startBoundElement: null, - suggestedBindings: [], + suggestedBinding: null, selectedElementIds: element && !appState.activeTool.locked && diff --git a/packages/excalidraw/appState.ts b/packages/excalidraw/appState.ts index 6b9e2ad31..7bcc89595 100644 --- a/packages/excalidraw/appState.ts +++ b/packages/excalidraw/appState.ts @@ -96,7 +96,7 @@ export const getDefaultAppState = (): Omit< panels: STATS_PANELS.generalStats | STATS_PANELS.elementProperties, }, startBoundElement: null, - suggestedBindings: [], + suggestedBinding: null, frameRendering: { enabled: true, clip: true, name: true, outline: true }, frameToHighlight: null, editingFrame: null, @@ -225,7 +225,7 @@ const APP_STATE_STORAGE_CONF = (< shouldCacheIgnoreZoom: { browser: true, export: false, server: false }, stats: { browser: true, export: false, server: false }, startBoundElement: { browser: false, export: false, server: false }, - suggestedBindings: { browser: false, export: false, server: false }, + suggestedBinding: { browser: false, export: false, server: false }, frameRendering: { browser: false, export: false, server: false }, frameToHighlight: { browser: false, export: false, server: false }, editingFrame: { browser: false, export: false, server: false }, diff --git a/packages/excalidraw/components/App.tsx b/packages/excalidraw/components/App.tsx index 34972ffe1..0a0780858 100644 --- a/packages/excalidraw/components/App.tsx +++ b/packages/excalidraw/components/App.tsx @@ -118,7 +118,6 @@ import { isBindingEnabled, shouldEnableBindingForPointerEvent, updateBoundElements, - getSuggestedBindingsForBindingElements, LinearElementEditor, newElementWith, newFrameElement, @@ -4586,10 +4585,6 @@ class App extends React.Component { includeElementsInFrames: true, }); - const elbowArrow = selectedElements.find(isElbowArrow) as - | ExcalidrawArrowElement - | undefined; - const arrowIdsToRemove = new Set(); selectedElements @@ -4652,15 +4647,6 @@ class App extends React.Component { }); }); - this.setState({ - suggestedBindings: getSuggestedBindingsForBindingElements( - selectedElements.filter( - (element) => element.id !== elbowArrow?.id || step !== 0, - ), - this.scene.getNonDeletedElementsMap(), - ), - }); - this.scene.triggerUpdate(); event.preventDefault(); @@ -4951,7 +4937,7 @@ class App extends React.Component { } }); - this.setState({ suggestedBindings: [] }); + this.setState({ suggestedBinding: null }); } if (!event.altKey) { @@ -5050,7 +5036,7 @@ class App extends React.Component { this.focusContainer(); } if (!isLinearElementType(nextActiveTool.type)) { - this.setState({ suggestedBindings: [] }); + this.setState({ suggestedBinding: null }); } if (nextActiveTool.type === "image") { this.onImageAction(); @@ -6212,7 +6198,7 @@ class App extends React.Component { const { newElement } = this.state; if (isBindingElement(newElement, false)) { this.setState({ - suggestedBindings: maybeSuggestBindingsForBindingElementAtCoords( + suggestedBinding: maybeSuggestBindingsForBindingElementAtCoords( newElement, "end", this.scene, @@ -6806,7 +6792,7 @@ class App extends React.Component { newElement: null, editingTextElement: null, startBoundElement: null, - suggestedBindings: [], + suggestedBinding: null, selectedElementIds: makeNextSelectedElementIds( Object.keys(this.state.selectedElementIds) .filter((key) => key !== element.id) @@ -8060,7 +8046,7 @@ class App extends React.Component { this.setState({ newElement: element, startBoundElement: boundElement, - suggestedBindings: [], + suggestedBinding: null, }); }; @@ -8439,7 +8425,7 @@ class App extends React.Component { bindMode: "orbit", newElement: element, startBoundElement: boundElement, - suggestedBindings: boundElement ? [boundElement] : [], + suggestedBinding: boundElement || null, selectedElementIds: nextSelectedElementIds, selectedLinearElement: linearElementEditor, }; @@ -8825,10 +8811,7 @@ class App extends React.Component { // NOTE: Optimize setState calls because it // affects history and performance if ( - !isShallowEqual( - newState.suggestedBindings ?? [], - this.state.suggestedBindings, - ) || + newState.suggestedBinding !== this.state.suggestedBinding || !isShallowEqual( newState.selectedLinearElement?.selectedPointsIndices ?? [], this.state.selectedLinearElement?.selectedPointsIndices ?? [], @@ -9074,18 +9057,6 @@ class App extends React.Component { selectionElement: null, }); - if ( - selectedElements.length !== 1 || - !isElbowArrow(selectedElements[0]) - ) { - this.setState({ - suggestedBindings: getSuggestedBindingsForBindingElements( - selectedElements, - this.scene.getNonDeletedElementsMap(), - ), - }); - } - // We duplicate the selected element if alt is pressed on pointer move if (event.altKey && !pointerDownState.hit.hasBeenDuplicated) { // Move the currently selected elements to the top of the z index stack, and @@ -9387,7 +9358,7 @@ class App extends React.Component { if (isBindingElement(newElement, false)) { // When creating a linear element by dragging this.setState({ - suggestedBindings: maybeSuggestBindingsForBindingElementAtCoords( + suggestedBinding: maybeSuggestBindingsForBindingElementAtCoords( newElement, "end", this.scene, @@ -9679,7 +9650,7 @@ class App extends React.Component { if (editingLinearElement !== this.state.selectedLinearElement) { this.setState({ selectedLinearElement: editingLinearElement, - suggestedBindings: [], + suggestedBinding: null, }); } } @@ -9840,7 +9811,7 @@ class App extends React.Component { sceneCoords, }); } - this.setState({ suggestedBindings: [], startBoundElement: null }); + this.setState({ suggestedBinding: null, startBoundElement: null }); if (!activeTool.locked) { resetCursor(this.interactiveCanvas); this.setState((prevState) => ({ @@ -10455,7 +10426,7 @@ class App extends React.Component { resetCursor(this.interactiveCanvas); this.setState({ newElement: null, - suggestedBindings: [], + suggestedBinding: null, activeTool: updateActiveTool(this.state, { type: this.defaultSelectionTool, }), @@ -10463,7 +10434,7 @@ class App extends React.Component { } else { this.setState({ newElement: null, - suggestedBindings: [], + suggestedBinding: null, }); } @@ -10940,8 +10911,7 @@ class App extends React.Component { this.scene.getNonDeletedElementsMap(), ); this.setState({ - suggestedBindings: - hoveredBindableElement != null ? [hoveredBindableElement] : [], + suggestedBinding: hoveredBindableElement ?? null, }); }; @@ -11557,11 +11527,6 @@ class App extends React.Component { pointerDownState.resize.center.y, ) ) { - const suggestedBindings = getSuggestedBindingsForBindingElements( - selectedElements, - this.scene.getNonDeletedElementsMap(), - ); - const elementsToHighlight = new Set(); selectedFrames.forEach((frame) => { getElementsInResizingFrame( @@ -11574,7 +11539,6 @@ class App extends React.Component { this.setState({ elementsToHighlight: [...elementsToHighlight], - suggestedBindings, }); return true; diff --git a/packages/excalidraw/components/LayerUI.tsx b/packages/excalidraw/components/LayerUI.tsx index d216f1d46..cdadbec08 100644 --- a/packages/excalidraw/components/LayerUI.tsx +++ b/packages/excalidraw/components/LayerUI.tsx @@ -582,7 +582,7 @@ const LayerUI = ({ const stripIrrelevantAppStateProps = (appState: AppState): UIAppState => { const { - suggestedBindings, + suggestedBinding, startBoundElement, cursorButton, scrollX, diff --git a/packages/excalidraw/components/canvases/InteractiveCanvas.tsx b/packages/excalidraw/components/canvases/InteractiveCanvas.tsx index 1ff0ddbe7..1a7b3b865 100644 --- a/packages/excalidraw/components/canvases/InteractiveCanvas.tsx +++ b/packages/excalidraw/components/canvases/InteractiveCanvas.tsx @@ -203,7 +203,7 @@ const getRelevantAppStateProps = ( multiElement: appState.multiElement, newElement: appState.newElement, isBindingEnabled: appState.isBindingEnabled, - suggestedBindings: appState.suggestedBindings, + suggestedBinding: appState.suggestedBinding, isRotating: appState.isRotating, elementsToHighlight: appState.elementsToHighlight, collaborators: appState.collaborators, // Necessary for collab. sessions diff --git a/packages/excalidraw/components/canvases/StaticCanvas.tsx b/packages/excalidraw/components/canvases/StaticCanvas.tsx index 9e23fa500..9e6a3324a 100644 --- a/packages/excalidraw/components/canvases/StaticCanvas.tsx +++ b/packages/excalidraw/components/canvases/StaticCanvas.tsx @@ -99,6 +99,7 @@ const getRelevantAppStateProps = (appState: AppState): StaticCanvasAppState => { editingGroupId: appState.editingGroupId, currentHoveredFontFamily: appState.currentHoveredFontFamily, croppingElementId: appState.croppingElementId, + suggestedBinding: appState.suggestedBinding, }; return relevantAppStateProps; diff --git a/packages/excalidraw/renderer/interactiveScene.ts b/packages/excalidraw/renderer/interactiveScene.ts index d741db5f7..cdeb20bbe 100644 --- a/packages/excalidraw/renderer/interactiveScene.ts +++ b/packages/excalidraw/renderer/interactiveScene.ts @@ -45,11 +45,6 @@ import { import { getCommonBounds, getElementAbsoluteCoords } from "@excalidraw/element"; -import type { - SuggestedBinding, - SuggestedPointBinding, -} from "@excalidraw/element"; - import type { TransformHandles, TransformHandleType, @@ -57,7 +52,6 @@ import type { import type { ElementsMap, - ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawImageElement, @@ -186,47 +180,6 @@ const renderSingleLinearPoint = ( ); }; -const renderBindingHighlightForBindableElement = ( - context: CanvasRenderingContext2D, - element: ExcalidrawBindableElement, - _elementsMap: ElementsMap, - appState: Pick, -) => { - context.translate(element.x, element.y); - - const rc = rough.canvas(context.canvas); - const drawable = ShapeCache.generateBindableElementHighlight( - element, - appState, - ); - rc.draw(drawable); -}; - -const renderBindingHighlightForSuggestedPointBinding = ( - context: CanvasRenderingContext2D, - suggestedBinding: SuggestedPointBinding, - elementsMap: ElementsMap, - appState: Pick, -) => { - const [element, startOrEnd] = suggestedBinding; - - const threshold = 0; - - context.strokeStyle = "rgba(0,0,0,0)"; - context.fillStyle = "rgba(0,0,0,.05)"; - - const pointIndices = - startOrEnd === "both" ? [0, -1] : startOrEnd === "start" ? [0] : [-1]; - pointIndices.forEach((index) => { - const [x, y] = LinearElementEditor.getPointAtIndexGlobalCoordinates( - element, - index, - elementsMap, - ); - fillCircle(context, x, y, threshold, true); - }); -}; - type ElementSelectionBorder = { angle: number; x1: number; @@ -299,16 +252,20 @@ const renderSelectionBorder = ( const renderBindingHighlight = ( context: CanvasRenderingContext2D, appState: InteractiveCanvasAppState, - suggestedBinding: SuggestedBinding, - elementsMap: ElementsMap, + suggestedBinding: NonNullable, ) => { - const renderHighlight = Array.isArray(suggestedBinding) - ? renderBindingHighlightForSuggestedPointBinding - : renderBindingHighlightForBindableElement; - context.save(); - context.translate(appState.scrollX, appState.scrollY); - renderHighlight(context, suggestedBinding as any, elementsMap, appState); + + context.translate( + appState.scrollX + suggestedBinding.x, + appState.scrollY + suggestedBinding.y, + ); + + const drawable = ShapeCache.generateBindableElementHighlight( + suggestedBinding, + appState, + ); + rough.canvas(context.canvas).draw(drawable); context.restore(); }; @@ -773,17 +730,8 @@ const _renderInteractiveScene = ({ } } - if (appState.isBindingEnabled) { - appState.suggestedBindings - .filter((binding) => binding != null) - .forEach((suggestedBinding) => { - renderBindingHighlight( - context, - appState, - suggestedBinding!, - elementsMap, - ); - }); + if (appState.isBindingEnabled && appState.suggestedBinding) { + renderBindingHighlight(context, appState, appState.suggestedBinding); } if (appState.frameToHighlight) { diff --git a/packages/excalidraw/tests/__snapshots__/contextmenu.test.tsx.snap b/packages/excalidraw/tests/__snapshots__/contextmenu.test.tsx.snap index 962a6e957..62e0cb6cc 100644 --- a/packages/excalidraw/tests/__snapshots__/contextmenu.test.tsx.snap +++ b/packages/excalidraw/tests/__snapshots__/contextmenu.test.tsx.snap @@ -982,7 +982,7 @@ exports[`contextMenu element > right-clicking on a group should select whole gro "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -1174,7 +1174,7 @@ exports[`contextMenu element > selecting 'Add to library' in context menu adds e "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": { "message": "Added to library", @@ -1387,7 +1387,7 @@ exports[`contextMenu element > selecting 'Bring forward' in context menu brings "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -1717,7 +1717,7 @@ exports[`contextMenu element > selecting 'Bring to front' in context menu brings "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -2047,7 +2047,7 @@ exports[`contextMenu element > selecting 'Copy styles' in context menu copies st "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": { "message": "Copied styles.", @@ -2258,7 +2258,7 @@ exports[`contextMenu element > selecting 'Delete' in context menu deletes elemen "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -2500,7 +2500,7 @@ exports[`contextMenu element > selecting 'Duplicate' in context menu duplicates "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -2802,7 +2802,7 @@ exports[`contextMenu element > selecting 'Group selection' in context menu group "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -3168,7 +3168,7 @@ exports[`contextMenu element > selecting 'Paste styles' in context menu pastes s "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": { "message": "Copied styles.", @@ -3660,7 +3660,7 @@ exports[`contextMenu element > selecting 'Send backward' in context menu sends e "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -3982,7 +3982,7 @@ exports[`contextMenu element > selecting 'Send to back' in context menu sends el "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -4307,7 +4307,7 @@ exports[`contextMenu element > selecting 'Ungroup selection' in context menu ung "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -5591,7 +5591,7 @@ exports[`contextMenu element > shows 'Group selection' in context menu for multi "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -6809,7 +6809,7 @@ exports[`contextMenu element > shows 'Ungroup selection' in context menu for gro "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -7739,7 +7739,7 @@ exports[`contextMenu element > shows context menu for canvas > [end of test] app "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -8737,7 +8737,7 @@ exports[`contextMenu element > shows context menu for element > [end of test] ap "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -9730,7 +9730,7 @@ exports[`contextMenu element > shows context menu for element > [end of test] ap "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, diff --git a/packages/excalidraw/tests/__snapshots__/history.test.tsx.snap b/packages/excalidraw/tests/__snapshots__/history.test.tsx.snap index fd7077c20..26846e0b7 100644 --- a/packages/excalidraw/tests/__snapshots__/history.test.tsx.snap +++ b/packages/excalidraw/tests/__snapshots__/history.test.tsx.snap @@ -101,7 +101,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -119,12 +119,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl { "angle": 0, "backgroundColor": "transparent", - "boundElements": [ - { - "id": "id4", - "type": "arrow", - }, - ], + "boundElements": null, "customData": undefined, "fillStyle": "solid", "frameId": null, @@ -143,7 +138,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "strokeWidth": 2, "type": "rectangle", "updated": 1, - "version": 13, + "version": 2, "width": 100, "x": -100, "y": -50, @@ -154,7 +149,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl { "angle": 0, "backgroundColor": "transparent", - "boundElements": [], + "boundElements": null, "customData": undefined, "fillStyle": "solid", "frameId": null, @@ -173,7 +168,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "strokeWidth": 2, "type": "rectangle", "updated": 1, - "version": 9, + "version": 2, "width": 100, "x": 100, "y": -50, @@ -188,25 +183,17 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "customData": undefined, "elbowed": false, "endArrowhead": "arrow", - "endBinding": { - "elementId": "id15", - "fixedPoint": [ - "0.50000", - 1, - ], - "mode": "orbit", - }, + "endBinding": null, "fillStyle": "solid", "frameId": null, "groupIds": [], - "height": "113.98784", + "height": 0, "id": "id4", "index": "a2", "isDeleted": false, "lastCommittedPoint": null, "link": null, "locked": false, - "moveMidPointsWithElement": false, "opacity": 100, "points": [ [ @@ -214,8 +201,8 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl 0, ], [ - 95, - "113.98784", + 100, + 0, ], ], "roughness": 1, @@ -223,245 +210,24 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "type": 2, }, "startArrowhead": null, - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - 1, - "0.50010", - ], - "mode": "inside", - }, + "startBinding": null, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", "updated": 1, - "version": 37, - "width": 95, + "version": 6, + "width": 100, "x": 0, - "y": "0.01000", + "y": 10, } `; -exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and the arrow got bound to a different element in the meantime > [end of test] element 3 1`] = ` -{ - "angle": 0, - "backgroundColor": "transparent", - "boundElements": [ - { - "id": "id4", - "type": "arrow", - }, - ], - "customData": undefined, - "fillStyle": "solid", - "frameId": null, - "groupIds": [], - "height": 50, - "id": "id15", - "index": "a3", - "isDeleted": false, - "link": null, - "locked": false, - "opacity": 100, - "roughness": 1, - "roundness": null, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 2, - "type": "rectangle", - "updated": 1, - "version": 10, - "width": 50, - "x": 100, - "y": 100, -} -`; +exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and the arrow got bound to a different element in the meantime > [end of test] number of elements 1`] = `3`; -exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and the arrow got bound to a different element in the meantime > [end of test] number of elements 1`] = `4`; +exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and the arrow got bound to a different element in the meantime > [end of test] number of renders 1`] = `10`; -exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and the arrow got bound to a different element in the meantime > [end of test] number of renders 1`] = `21`; - -exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and the arrow got bound to a different element in the meantime > [end of test] redo stack 1`] = ` -[ - { - "appState": AppStateDelta { - "delta": Delta { - "deleted": {}, - "inserted": {}, - }, - }, - "elements": { - "added": {}, - "removed": {}, - "updated": { - "id1": { - "deleted": { - "boundElements": [], - "version": 9, - }, - "inserted": { - "boundElements": [ - { - "id": "id4", - "type": "arrow", - }, - ], - "version": 8, - }, - }, - "id15": { - "deleted": { - "boundElements": [ - { - "id": "id4", - "type": "arrow", - }, - ], - "version": 9, - }, - "inserted": { - "boundElements": [], - "version": 8, - }, - }, - "id4": { - "deleted": { - "endBinding": { - "elementId": "id15", - "fixedPoint": [ - "0.50000", - 1, - ], - "mode": "orbit", - }, - "height": "100.79596", - "points": [ - [ - 0, - 0, - ], - [ - 90, - "100.79596", - ], - ], - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - 1, - "0.60000", - ], - "mode": "orbit", - }, - "version": 36, - "width": 90, - }, - "inserted": { - "endBinding": { - "elementId": "id1", - "fixedPoint": [ - 0, - "0.60000", - ], - "mode": "orbit", - }, - "height": "0.00000", - "points": [ - [ - 0, - 0, - ], - [ - 90, - "0.00000", - ], - ], - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - 1, - "0.60000", - ], - "mode": "orbit", - }, - "version": 33, - "width": 90, - }, - }, - }, - }, - "id": "id22", - }, - { - "appState": AppStateDelta { - "delta": Delta { - "deleted": {}, - "inserted": {}, - }, - }, - "elements": { - "added": {}, - "removed": {}, - "updated": { - "id4": { - "deleted": { - "height": "113.98784", - "points": [ - [ - 0, - 0, - ], - [ - 95, - "113.98784", - ], - ], - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - 1, - "0.50010", - ], - "mode": "inside", - }, - "version": 37, - "width": 95, - "x": 0, - "y": "0.01000", - }, - "inserted": { - "height": "100.79596", - "points": [ - [ - 0, - 0, - ], - [ - 90, - "100.79596", - ], - ], - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - 1, - "0.60000", - ], - "mode": "orbit", - }, - "version": 36, - "width": 90, - "x": 5, - "y": "15.52629", - }, - }, - }, - }, - "id": "id23", - }, -] -`; +exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and the arrow got bound to a different element in the meantime > [end of test] redo stack 1`] = `[]`; exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and the arrow got bound to a different element in the meantime > [end of test] undo stack 1`] = ` [ @@ -597,48 +363,117 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "type": 2, }, "startArrowhead": null, - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - 1, - "0.50010", - ], - "mode": "inside", - }, + "startBinding": null, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", - "version": 6, + "version": 4, "width": 100, "x": 0, "y": 0, }, "inserted": { "isDeleted": true, - "version": 5, + "version": 3, }, }, }, + "updated": {}, + }, + "id": "id6", + }, + { + "appState": AppStateDelta { + "delta": Delta { + "deleted": {}, + "inserted": {}, + }, + }, + "elements": { + "added": {}, + "removed": {}, "updated": { - "id0": { + "id4": { "deleted": { - "boundElements": [ - { - "id": "id4", - "type": "arrow", - }, + "height": 10, + "points": [ + [ + 0, + 0, + ], + [ + 100, + -10, + ], ], - "version": 3, + "version": 5, + "y": 10, }, "inserted": { - "boundElements": [], - "version": 2, + "height": 0, + "points": [ + [ + 0, + 0, + ], + [ + 100, + 0, + ], + ], + "version": 4, + "y": 0, }, }, }, }, - "id": "id6", + "id": "id9", + }, + { + "appState": AppStateDelta { + "delta": Delta { + "deleted": {}, + "inserted": {}, + }, + }, + "elements": { + "added": {}, + "removed": {}, + "updated": { + "id4": { + "deleted": { + "height": 0, + "points": [ + [ + 0, + 0, + ], + [ + 100, + 0, + ], + ], + "version": 6, + }, + "inserted": { + "height": 10, + "points": [ + [ + 0, + 0, + ], + [ + 100, + -10, + ], + ], + "version": 5, + }, + }, + }, + }, + "id": "id12", }, ] `; @@ -744,7 +579,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -762,12 +597,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl { "angle": 0, "backgroundColor": "transparent", - "boundElements": [ - { - "id": "id4", - "type": "arrow", - }, - ], + "boundElements": null, "customData": undefined, "fillStyle": "solid", "frameId": null, @@ -786,9 +616,9 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "strokeWidth": 2, "type": "rectangle", "updated": 1, - "version": 14, + "version": 2, "width": 100, - "x": 150, + "x": -100, "y": -50, } `; @@ -797,7 +627,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl { "angle": 0, "backgroundColor": "transparent", - "boundElements": [], + "boundElements": null, "customData": undefined, "fillStyle": "solid", "frameId": null, @@ -816,9 +646,9 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "strokeWidth": 2, "type": "rectangle", "updated": 1, - "version": 9, + "version": 2, "width": 100, - "x": 150, + "x": 100, "y": -50, } `; @@ -835,14 +665,13 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "fillStyle": "solid", "frameId": null, "groupIds": [], - "height": "0.01000", + "height": 0, "id": "id4", "index": "a2", "isDeleted": false, "lastCommittedPoint": null, "link": null, "locked": false, - "moveMidPointsWithElement": false, "opacity": 100, "points": [ [ @@ -850,8 +679,8 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl 0, ], [ + 100, 0, - "-0.01000", ], ], "roughness": 1, @@ -859,190 +688,24 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "type": 2, }, "startArrowhead": null, - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - 1, - "0.50010", - ], - "mode": "inside", - }, + "startBinding": null, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", "updated": 1, - "version": 30, - "width": 0, - "x": 250, - "y": "0.01000", + "version": 6, + "width": 100, + "x": 0, + "y": 10, } `; exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and there are no conflicting updates in the meantime > [end of test] number of elements 1`] = `3`; -exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and there are no conflicting updates in the meantime > [end of test] number of renders 1`] = `23`; +exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and there are no conflicting updates in the meantime > [end of test] number of renders 1`] = `10`; -exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and there are no conflicting updates in the meantime > [end of test] redo stack 1`] = ` -[ - { - "appState": AppStateDelta { - "delta": Delta { - "deleted": {}, - "inserted": {}, - }, - }, - "elements": { - "added": {}, - "removed": {}, - "updated": { - "id1": { - "deleted": { - "boundElements": [], - "version": 9, - }, - "inserted": { - "boundElements": [ - { - "id": "id4", - "type": "arrow", - }, - ], - "version": 8, - }, - }, - "id4": { - "deleted": { - "endBinding": null, - "height": "3.00000", - "points": [ - [ - 0, - 0, - ], - [ - -45, - "-3.00000", - ], - ], - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - 1, - "0.60000", - ], - "mode": "orbit", - }, - "version": 29, - "width": 45, - "y": "3.00000", - }, - "inserted": { - "endBinding": { - "elementId": "id1", - "fixedPoint": [ - 0, - "0.60000", - ], - "mode": "orbit", - }, - "height": 0, - "points": [ - [ - 0, - 0, - ], - [ - 0, - 0, - ], - ], - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - 1, - "0.60000", - ], - "mode": "orbit", - }, - "version": 28, - "width": 0, - "y": "9.99861", - }, - }, - }, - }, - "id": "id21", - }, - { - "appState": AppStateDelta { - "delta": Delta { - "deleted": {}, - "inserted": {}, - }, - }, - "elements": { - "added": {}, - "removed": {}, - "updated": { - "id4": { - "deleted": { - "height": "0.01000", - "points": [ - [ - 0, - 0, - ], - [ - 0, - "-0.01000", - ], - ], - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - 1, - "0.50010", - ], - "mode": "inside", - }, - "version": 30, - "width": 0, - "x": 250, - "y": "0.01000", - }, - "inserted": { - "height": "3.00000", - "points": [ - [ - 0, - 0, - ], - [ - -45, - "-3.00000", - ], - ], - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - 1, - "0.60000", - ], - "mode": "orbit", - }, - "version": 29, - "width": 45, - "x": 145, - "y": "3.00000", - }, - }, - }, - }, - "id": "id22", - }, -] -`; +exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and there are no conflicting updates in the meantime > [end of test] redo stack 1`] = `[]`; exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should rebind bindings when both are updated through the history and there are no conflicting updates in the meantime > [end of test] undo stack 1`] = ` [ @@ -1178,48 +841,117 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "type": 2, }, "startArrowhead": null, - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - 1, - "0.50010", - ], - "mode": "inside", - }, + "startBinding": null, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", - "version": 6, + "version": 4, "width": 100, "x": 0, "y": 0, }, "inserted": { "isDeleted": true, - "version": 5, + "version": 3, }, }, }, + "updated": {}, + }, + "id": "id6", + }, + { + "appState": AppStateDelta { + "delta": Delta { + "deleted": {}, + "inserted": {}, + }, + }, + "elements": { + "added": {}, + "removed": {}, "updated": { - "id0": { + "id4": { "deleted": { - "boundElements": [ - { - "id": "id4", - "type": "arrow", - }, + "height": 10, + "points": [ + [ + 0, + 0, + ], + [ + 100, + -10, + ], ], - "version": 3, + "version": 5, + "y": 10, }, "inserted": { - "boundElements": [], - "version": 2, + "height": 0, + "points": [ + [ + 0, + 0, + ], + [ + 100, + 0, + ], + ], + "version": 4, + "y": 0, }, }, }, }, - "id": "id6", + "id": "id9", + }, + { + "appState": AppStateDelta { + "delta": Delta { + "deleted": {}, + "inserted": {}, + }, + }, + "elements": { + "added": {}, + "removed": {}, + "updated": { + "id4": { + "deleted": { + "height": 0, + "points": [ + [ + 0, + 0, + ], + [ + 100, + 0, + ], + ], + "version": 6, + }, + "inserted": { + "height": 10, + "points": [ + [ + 0, + 0, + ], + [ + 100, + -10, + ], + ], + "version": 5, + }, + }, + }, + }, + "id": "id12", }, ] `; @@ -1324,7 +1056,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -1684,7 +1416,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -2047,7 +1779,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -2293,9 +2025,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "scrollX": 0, "scrollY": 0, "searchMatches": null, - "selectedElementIds": { - "id4": true, - }, + "selectedElementIds": {}, "selectedElementsAreBeingDragged": false, "selectedGroupIds": {}, "selectionElement": null, @@ -2308,7 +2038,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -2326,12 +2056,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl { "angle": 0, "backgroundColor": "transparent", - "boundElements": [ - { - "id": "id4", - "type": "arrow", - }, - ], + "boundElements": null, "customData": undefined, "fillStyle": "solid", "frameId": null, @@ -2350,7 +2075,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "strokeWidth": 2, "type": "rectangle", "updated": 1, - "version": 5, + "version": 2, "width": 100, "x": -100, "y": -50, @@ -2361,12 +2086,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl { "angle": 0, "backgroundColor": "transparent", - "boundElements": [ - { - "id": "id4", - "type": "arrow", - }, - ], + "boundElements": null, "customData": undefined, "fillStyle": "solid", "frameId": null, @@ -2385,10 +2105,10 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "strokeWidth": 2, "type": "rectangle", "updated": 1, - "version": 6, + "version": 2, "width": 100, - "x": 500, - "y": -500, + "x": 100, + "y": -50, } `; @@ -2400,25 +2120,17 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "customData": undefined, "elbowed": false, "endArrowhead": "arrow", - "endBinding": { - "elementId": "id1", - "fixedPoint": [ - 0, - "0.50010", - ], - "mode": "orbit", - }, + "endBinding": null, "fillStyle": "solid", "frameId": null, "groupIds": [], - "height": "440.95500", + "height": 0, "id": "id4", "index": "a2", - "isDeleted": false, + "isDeleted": true, "lastCommittedPoint": null, "link": null, "locked": false, - "moveMidPointsWithElement": false, "opacity": 100, "points": [ [ @@ -2426,8 +2138,8 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl 0, ], [ - 490, - "-440.95500", + 100, + 0, ], ], "roughness": 1, @@ -2435,31 +2147,102 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "type": 2, }, "startArrowhead": null, - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - 1, - "0.50010", - ], - "mode": "orbit", - }, + "startBinding": null, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", "updated": 1, - "version": 13, - "width": 490, - "x": 5, - "y": "-4.48954", + "version": 5, + "width": 100, + "x": 0, + "y": 0, } `; exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should update bound element points when rectangle was remotely moved and arrow is added back through the history > [end of test] number of elements 1`] = `3`; -exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should update bound element points when rectangle was remotely moved and arrow is added back through the history > [end of test] number of renders 1`] = `9`; +exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should update bound element points when rectangle was remotely moved and arrow is added back through the history > [end of test] number of renders 1`] = `7`; -exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should update bound element points when rectangle was remotely moved and arrow is added back through the history > [end of test] redo stack 1`] = `[]`; +exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should update bound element points when rectangle was remotely moved and arrow is added back through the history > [end of test] redo stack 1`] = ` +[ + { + "appState": AppStateDelta { + "delta": Delta { + "deleted": { + "selectedElementIds": {}, + "selectedLinearElement": null, + }, + "inserted": { + "selectedElementIds": { + "id4": true, + }, + "selectedLinearElement": { + "elementId": "id4", + "isEditing": false, + }, + }, + }, + }, + "elements": { + "added": { + "id4": { + "deleted": { + "isDeleted": true, + "version": 5, + }, + "inserted": { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "elbowed": false, + "endArrowhead": "arrow", + "endBinding": null, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 0, + "index": "a2", + "isDeleted": false, + "lastCommittedPoint": null, + "link": null, + "locked": false, + "opacity": 100, + "points": [ + [ + 0, + 0, + ], + [ + 100, + 0, + ], + ], + "roughness": 1, + "roundness": { + "type": 2, + }, + "startArrowhead": null, + "startBinding": null, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "arrow", + "version": 4, + "width": 100, + "x": 0, + "y": 0, + }, + }, + }, + "removed": {}, + "updated": {}, + }, + "id": "id7", + }, +] +`; exports[`history > multiplayer undo/redo > conflicts in arrows and their bindable elements > should update bound element points when rectangle was remotely moved and arrow is added back through the history > [end of test] undo stack 1`] = ` [ @@ -2540,126 +2323,6 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl }, "id": "id3", }, - { - "appState": AppStateDelta { - "delta": Delta { - "deleted": { - "selectedElementIds": { - "id4": true, - }, - "selectedLinearElement": { - "elementId": "id4", - "isEditing": false, - }, - }, - "inserted": { - "selectedElementIds": {}, - "selectedLinearElement": null, - }, - }, - }, - "elements": { - "added": {}, - "removed": { - "id4": { - "deleted": { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": null, - "customData": undefined, - "elbowed": false, - "endArrowhead": "arrow", - "endBinding": { - "elementId": "id1", - "fixedPoint": [ - 0, - "0.50010", - ], - "mode": "orbit", - }, - "fillStyle": "solid", - "frameId": null, - "groupIds": [], - "height": "440.95500", - "index": "a2", - "isDeleted": false, - "lastCommittedPoint": null, - "link": null, - "locked": false, - "opacity": 100, - "points": [ - [ - 0, - 0, - ], - [ - 490, - "-440.95500", - ], - ], - "roughness": 1, - "roundness": { - "type": 2, - }, - "startArrowhead": null, - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - 1, - "0.50010", - ], - "mode": "orbit", - }, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 2, - "type": "arrow", - "version": 13, - "width": 490, - "x": 5, - "y": "-4.48954", - }, - "inserted": { - "isDeleted": true, - "version": 10, - }, - }, - }, - "updated": { - "id0": { - "deleted": { - "boundElements": [ - { - "id": "id4", - "type": "arrow", - }, - ], - "version": 5, - }, - "inserted": { - "boundElements": [], - "version": 4, - }, - }, - "id1": { - "deleted": { - "boundElements": [ - { - "id": "id4", - "type": "arrow", - }, - ], - "version": 6, - }, - "inserted": { - "boundElements": [], - "version": 5, - }, - }, - }, - }, - "id": "id8", - }, ] `; @@ -2763,7 +2426,7 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -3065,7 +2728,7 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -3383,7 +3046,7 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -3676,7 +3339,7 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -3961,7 +3624,7 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -4195,7 +3858,7 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -4451,7 +4114,7 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -4721,7 +4384,7 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -4949,7 +4612,7 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -5177,7 +4840,7 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -5423,7 +5086,7 @@ exports[`history > multiplayer undo/redo > conflicts in bound text elements and "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -5678,7 +5341,7 @@ exports[`history > multiplayer undo/redo > conflicts in frames and their childre "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -5934,7 +5597,7 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -6262,7 +5925,7 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -6691,7 +6354,7 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -7070,7 +6733,7 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -7370,7 +7033,7 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -7428,7 +7091,7 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh "strokeWidth": 2, "type": "arrow", "updated": 1, - "version": 7, + "version": 8, "width": 10, "x": 0, "y": 0, @@ -7507,14 +7170,14 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", - "version": 9, + "version": 8, "width": 10, "x": 0, "y": 0, }, "inserted": { "isDeleted": true, - "version": 8, + "version": 7, }, }, }, @@ -7669,7 +7332,7 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -7898,7 +7561,7 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -8249,7 +7912,7 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -8606,7 +8269,7 @@ exports[`history > multiplayer undo/redo > should not let remote changes to inte "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -9005,7 +8668,7 @@ exports[`history > multiplayer undo/redo > should not let remote changes to inte "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -9293,7 +8956,7 @@ exports[`history > multiplayer undo/redo > should not let remote changes to inte "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -9556,7 +9219,7 @@ exports[`history > multiplayer undo/redo > should not override remote changes on "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -9820,7 +9483,7 @@ exports[`history > multiplayer undo/redo > should not override remote changes on "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -10052,7 +9715,7 @@ exports[`history > multiplayer undo/redo > should override remotely added groups "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -10347,7 +10010,7 @@ exports[`history > multiplayer undo/redo > should override remotely added points "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -10677,7 +10340,7 @@ exports[`history > multiplayer undo/redo > should redistribute deltas when eleme "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -10915,7 +10578,7 @@ exports[`history > multiplayer undo/redo > should redraw arrows on undo > [end o "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -11357,7 +11020,7 @@ exports[`history > multiplayer undo/redo > should update history entries after r "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -11614,7 +11277,7 @@ exports[`history > singleplayer undo/redo > remounting undo/redo buttons should "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -11850,7 +11513,7 @@ exports[`history > singleplayer undo/redo > should clear the redo stack on eleme "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -12084,7 +11747,7 @@ exports[`history > singleplayer undo/redo > should create entry when selecting f "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -12491,7 +12154,7 @@ exports[`history > singleplayer undo/redo > should create new history entry on e "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -12700,7 +12363,7 @@ exports[`history > singleplayer undo/redo > should create new history entry on e "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -12909,7 +12572,7 @@ exports[`history > singleplayer undo/redo > should create new history entry on i "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -13132,7 +12795,7 @@ exports[`history > singleplayer undo/redo > should create new history entry on i "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -13353,7 +13016,7 @@ exports[`history > singleplayer undo/redo > should create new history entry on s "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -13596,7 +13259,7 @@ exports[`history > singleplayer undo/redo > should disable undo/redo buttons whe "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -13832,7 +13495,7 @@ exports[`history > singleplayer undo/redo > should end up with no history entry "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -14068,7 +13731,7 @@ exports[`history > singleplayer undo/redo > should iterate through the history w "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -14314,7 +13977,7 @@ exports[`history > singleplayer undo/redo > should not clear the redo stack on s "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -14645,7 +14308,7 @@ exports[`history > singleplayer undo/redo > should not collapse when applying co "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -14816,7 +14479,7 @@ exports[`history > singleplayer undo/redo > should not end up with history entry "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -15097,7 +14760,7 @@ exports[`history > singleplayer undo/redo > should not end up with history entry "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -15359,7 +15022,7 @@ exports[`history > singleplayer undo/redo > should not modify anything on unrela "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -15512,7 +15175,7 @@ exports[`history > singleplayer undo/redo > should not override appstate changes "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -15792,7 +15455,7 @@ exports[`history > singleplayer undo/redo > should support appstate name or view "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -15954,7 +15617,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -15977,10 +15640,6 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "id": "id1", "type": "text", }, - { - "id": "id13", - "type": "arrow", - }, ], "customData": undefined, "fillStyle": "solid", @@ -16000,7 +15659,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "strokeWidth": 2, "type": "rectangle", "updated": 1, - "version": 6, + "version": 3, "width": 100, "x": -100, "y": -50, @@ -16038,7 +15697,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "textAlign": "center", "type": "text", "updated": 1, - "version": 5, + "version": 4, "verticalAlign": "middle", "width": 30, "x": -65, @@ -16050,12 +15709,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding { "angle": 0, "backgroundColor": "transparent", - "boundElements": [ - { - "id": "id13", - "type": "arrow", - }, - ], + "boundElements": null, "customData": undefined, "fillStyle": "solid", "frameId": null, @@ -16074,7 +15728,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "strokeWidth": 2, "type": "rectangle", "updated": 1, - "version": 5, + "version": 2, "width": 100, "x": 100, "y": -50, @@ -16089,14 +15743,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "customData": undefined, "elbowed": false, "endArrowhead": "arrow", - "endBinding": { - "elementId": "id2", - "fixedPoint": [ - 0, - "0.50010", - ], - "mode": "orbit", - }, + "endBinding": null, "fillStyle": "solid", "frameId": null, "groupIds": [], @@ -16107,7 +15754,6 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "lastCommittedPoint": null, "link": null, "locked": false, - "moveMidPointsWithElement": false, "opacity": 100, "points": [ [ @@ -16115,7 +15761,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - 90, + 100, 0, ], ], @@ -16124,133 +15770,24 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "type": 2, }, "startArrowhead": null, - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - 1, - "0.50010", - ], - "mode": "orbit", - }, + "startBinding": null, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", "updated": 1, - "version": 12, - "width": 90, - "x": 5, - "y": "0.01000", + "version": 4, + "width": 100, + "x": 0, + "y": 0, } `; exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind arrow from non deleted bindable elements on deletion and rebind on undo > [end of test] number of elements 1`] = `4`; -exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind arrow from non deleted bindable elements on deletion and rebind on undo > [end of test] number of renders 1`] = `12`; +exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind arrow from non deleted bindable elements on deletion and rebind on undo > [end of test] number of renders 1`] = `10`; -exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind arrow from non deleted bindable elements on deletion and rebind on undo > [end of test] redo stack 1`] = ` -[ - { - "appState": AppStateDelta { - "delta": Delta { - "deleted": { - "selectedElementIds": { - "id13": true, - }, - "selectedLinearElement": { - "elementId": "id13", - "isEditing": false, - }, - }, - "inserted": { - "selectedElementIds": {}, - "selectedLinearElement": null, - }, - }, - }, - "elements": { - "added": {}, - "removed": { - "id13": { - "deleted": { - "endBinding": { - "elementId": "id2", - "fixedPoint": [ - 0, - "0.50010", - ], - "mode": "orbit", - }, - "isDeleted": false, - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - 1, - "0.50010", - ], - "mode": "orbit", - }, - "version": 12, - }, - "inserted": { - "endBinding": { - "elementId": "id2", - "fixedPoint": [ - 0, - "0.50010", - ], - "mode": "orbit", - }, - "isDeleted": true, - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - 1, - "0.50010", - ], - "mode": "orbit", - }, - "version": 10, - }, - }, - }, - "updated": { - "id0": { - "deleted": { - "boundElements": [ - { - "id": "id13", - "type": "arrow", - }, - ], - "version": 6, - }, - "inserted": { - "boundElements": [], - "version": 5, - }, - }, - "id2": { - "deleted": { - "boundElements": [ - { - "id": "id13", - "type": "arrow", - }, - ], - "version": 5, - }, - "inserted": { - "boundElements": [], - "version": 4, - }, - }, - }, - }, - "id": "id18", - }, -] -`; +exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind arrow from non deleted bindable elements on deletion and rebind on undo > [end of test] redo stack 1`] = `[]`; exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind arrow from non deleted bindable elements on deletion and rebind on undo > [end of test] undo stack 1`] = ` [ @@ -16500,14 +16037,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "customData": undefined, "elbowed": false, "endArrowhead": "arrow", - "endBinding": { - "elementId": "id2", - "fixedPoint": [ - 0, - "0.50010", - ], - "mode": "orbit", - }, + "endBinding": null, "fillStyle": "solid", "frameId": null, "groupIds": [], @@ -16524,7 +16054,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - 90, + 100, 0, ], ], @@ -16533,61 +16063,23 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "type": 2, }, "startArrowhead": null, - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - 1, - "0.50010", - ], - "mode": "orbit", - }, + "startBinding": null, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", - "version": 9, - "width": 90, - "x": 5, - "y": "0.01000", + "version": 4, + "width": 100, + "x": 0, + "y": 0, }, "inserted": { "isDeleted": true, - "version": 8, - }, - }, - }, - "updated": { - "id0": { - "deleted": { - "boundElements": [ - { - "id": "id13", - "type": "arrow", - }, - ], - "version": 4, - }, - "inserted": { - "boundElements": [], "version": 3, }, }, - "id2": { - "deleted": { - "boundElements": [ - { - "id": "id13", - "type": "arrow", - }, - ], - "version": 3, - }, - "inserted": { - "boundElements": [], - "version": 2, - }, - }, }, + "updated": {}, }, "id": "id15", }, @@ -16695,7 +16187,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -16718,10 +16210,6 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "id": "id1", "type": "text", }, - { - "id": "id13", - "type": "arrow", - }, ], "customData": undefined, "fillStyle": "solid", @@ -16741,7 +16229,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "strokeWidth": 2, "type": "rectangle", "updated": 1, - "version": 6, + "version": 3, "width": 100, "x": -100, "y": -50, @@ -16779,7 +16267,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "textAlign": "center", "type": "text", "updated": 1, - "version": 6, + "version": 4, "verticalAlign": "middle", "width": 30, "x": -65, @@ -16791,12 +16279,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding { "angle": 0, "backgroundColor": "transparent", - "boundElements": [ - { - "id": "id13", - "type": "arrow", - }, - ], + "boundElements": null, "customData": undefined, "fillStyle": "solid", "frameId": null, @@ -16815,7 +16298,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "strokeWidth": 2, "type": "rectangle", "updated": 1, - "version": 5, + "version": 2, "width": 100, "x": 100, "y": -50, @@ -16830,14 +16313,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "customData": undefined, "elbowed": false, "endArrowhead": "arrow", - "endBinding": { - "elementId": "id2", - "fixedPoint": [ - 0, - "0.50010", - ], - "mode": "orbit", - }, + "endBinding": null, "fillStyle": "solid", "frameId": null, "groupIds": [], @@ -16848,7 +16324,6 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "lastCommittedPoint": null, "link": null, "locked": false, - "moveMidPointsWithElement": false, "opacity": 100, "points": [ [ @@ -16856,7 +16331,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - 90, + 100, 0, ], ], @@ -16865,29 +16340,22 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "type": 2, }, "startArrowhead": null, - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - 1, - "0.50010", - ], - "mode": "orbit", - }, + "startBinding": null, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", "updated": 1, - "version": 12, - "width": 90, - "x": 5, - "y": "0.01000", + "version": 4, + "width": 100, + "x": 0, + "y": 0, } `; exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind arrow from non deleted bindable elements on undo and rebind on redo > [end of test] number of elements 1`] = `4`; -exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind arrow from non deleted bindable elements on undo and rebind on redo > [end of test] number of renders 1`] = `12`; +exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind arrow from non deleted bindable elements on undo and rebind on redo > [end of test] number of renders 1`] = `10`; exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind arrow from non deleted bindable elements on undo and rebind on redo > [end of test] redo stack 1`] = `[]`; @@ -17139,14 +16607,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "customData": undefined, "elbowed": false, "endArrowhead": "arrow", - "endBinding": { - "elementId": "id2", - "fixedPoint": [ - 0, - "0.50010", - ], - "mode": "orbit", - }, + "endBinding": null, "fillStyle": "solid", "frameId": null, "groupIds": [], @@ -17163,7 +16624,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - 90, + 100, 0, ], ], @@ -17172,71 +16633,25 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "type": 2, }, "startArrowhead": null, - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - 1, - "0.50010", - ], - "mode": "orbit", - }, + "startBinding": null, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", - "version": 12, - "width": 90, - "x": 5, - "y": "0.01000", + "version": 4, + "width": 100, + "x": 0, + "y": 0, }, "inserted": { "isDeleted": true, - "version": 10, - }, - }, - }, - "updated": { - "id0": { - "deleted": { - "boundElements": [ - { - "id": "id13", - "type": "arrow", - }, - ], - "version": 6, - }, - "inserted": { - "boundElements": [], - "version": 5, - }, - }, - "id1": { - "deleted": { - "version": 6, - }, - "inserted": { - "version": 5, - }, - }, - "id2": { - "deleted": { - "boundElements": [ - { - "id": "id13", - "type": "arrow", - }, - ], - "version": 5, - }, - "inserted": { - "boundElements": [], - "version": 4, + "version": 3, }, }, }, + "updated": {}, }, - "id": "id17", + "id": "id15", }, ] `; @@ -17342,7 +16757,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -17365,10 +16780,6 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "id": "id1", "type": "text", }, - { - "id": "id13", - "type": "arrow", - }, ], "customData": undefined, "fillStyle": "solid", @@ -17388,7 +16799,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "strokeWidth": 2, "type": "rectangle", "updated": 1, - "version": 10, + "version": 3, "width": 100, "x": -100, "y": -50, @@ -17426,7 +16837,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "textAlign": "center", "type": "text", "updated": 1, - "version": 10, + "version": 4, "verticalAlign": "middle", "width": 30, "x": -65, @@ -17438,12 +16849,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding { "angle": 0, "backgroundColor": "transparent", - "boundElements": [ - { - "id": "id13", - "type": "arrow", - }, - ], + "boundElements": null, "customData": undefined, "fillStyle": "solid", "frameId": null, @@ -17462,7 +16868,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "strokeWidth": 2, "type": "rectangle", "updated": 1, - "version": 7, + "version": 2, "width": 100, "x": 100, "y": -50, @@ -17477,14 +16883,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "customData": undefined, "elbowed": false, "endArrowhead": "arrow", - "endBinding": { - "elementId": "id2", - "fixedPoint": [ - 0, - "0.50010", - ], - "mode": "orbit", - }, + "endBinding": null, "fillStyle": "solid", "frameId": null, "groupIds": [], @@ -17495,7 +16894,6 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "lastCommittedPoint": null, "link": null, "locked": false, - "moveMidPointsWithElement": false, "opacity": 100, "points": [ [ @@ -17503,7 +16901,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - 90, + 100, 0, ], ], @@ -17512,29 +16910,22 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "type": 2, }, "startArrowhead": null, - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - 1, - "0.50010", - ], - "mode": "orbit", - }, + "startBinding": null, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", "updated": 1, - "version": 12, - "width": 90, - "x": 5, - "y": "0.01000", + "version": 4, + "width": 100, + "x": 0, + "y": 0, } `; exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind everything from non deleted elements when iterating through the whole undo stack and vice versa rebind everything on redo > [end of test] number of elements 1`] = `4`; -exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind everything from non deleted elements when iterating through the whole undo stack and vice versa rebind everything on redo > [end of test] number of renders 1`] = `20`; +exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind everything from non deleted elements when iterating through the whole undo stack and vice versa rebind everything on redo > [end of test] number of renders 1`] = `10`; exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind everything from non deleted elements when iterating through the whole undo stack and vice versa rebind everything on redo > [end of test] redo stack 1`] = `[]`; @@ -17571,14 +16962,14 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "strokeStyle": "solid", "strokeWidth": 2, "type": "rectangle", - "version": 8, + "version": 2, "width": 100, "x": -100, "y": -50, }, "inserted": { "isDeleted": true, - "version": 7, + "version": 1, }, }, "id1": { @@ -17610,7 +17001,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "text": "ola", "textAlign": "left", "type": "text", - "version": 8, + "version": 2, "verticalAlign": "top", "width": 100, "x": -200, @@ -17618,7 +17009,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding }, "inserted": { "isDeleted": true, - "version": 7, + "version": 1, }, }, "id2": { @@ -17642,20 +17033,20 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "strokeStyle": "solid", "strokeWidth": 2, "type": "rectangle", - "version": 6, + "version": 2, "width": 100, "x": 100, "y": -50, }, "inserted": { "isDeleted": true, - "version": 5, + "version": 1, }, }, }, "updated": {}, }, - "id": "id21", + "id": "id4", }, { "appState": AppStateDelta { @@ -17675,7 +17066,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "removed": {}, "updated": {}, }, - "id": "id22", + "id": "id7", }, { "appState": AppStateDelta { @@ -17695,7 +17086,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "removed": {}, "updated": {}, }, - "id": "id23", + "id": "id10", }, { "appState": AppStateDelta { @@ -17722,11 +17113,11 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "type": "text", }, ], - "version": 9, + "version": 3, }, "inserted": { "boundElements": [], - "version": 8, + "version": 2, }, }, "id1": { @@ -17734,7 +17125,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "containerId": "id0", "height": 25, "textAlign": "center", - "version": 9, + "version": 4, "verticalAlign": "middle", "width": 30, "x": -65, @@ -17744,7 +17135,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "containerId": null, "height": 100, "textAlign": "left", - "version": 8, + "version": 2, "verticalAlign": "top", "width": 100, "x": -200, @@ -17753,7 +17144,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding }, }, }, - "id": "id24", + "id": "id12", }, { "appState": AppStateDelta { @@ -17786,14 +17177,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "customData": undefined, "elbowed": false, "endArrowhead": "arrow", - "endBinding": { - "elementId": "id2", - "fixedPoint": [ - 0, - "0.50010", - ], - "mode": "orbit", - }, + "endBinding": null, "fillStyle": "solid", "frameId": null, "groupIds": [], @@ -17810,7 +17194,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - 90, + 100, 0, ], ], @@ -17819,71 +17203,25 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "type": 2, }, "startArrowhead": null, - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - 1, - "0.50010", - ], - "mode": "orbit", - }, + "startBinding": null, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", - "version": 12, - "width": 90, - "x": 5, - "y": "0.01000", + "version": 4, + "width": 100, + "x": 0, + "y": 0, }, "inserted": { "isDeleted": true, - "version": 10, - }, - }, - }, - "updated": { - "id0": { - "deleted": { - "boundElements": [ - { - "id": "id13", - "type": "arrow", - }, - ], - "version": 10, - }, - "inserted": { - "boundElements": [], - "version": 9, - }, - }, - "id1": { - "deleted": { - "version": 10, - }, - "inserted": { - "version": 9, - }, - }, - "id2": { - "deleted": { - "boundElements": [ - { - "id": "id13", - "type": "arrow", - }, - ], - "version": 7, - }, - "inserted": { - "boundElements": [], - "version": 6, + "version": 3, }, }, }, + "updated": {}, }, - "id": "id25", + "id": "id15", }, ] `; @@ -17967,13 +17305,15 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding }, "penDetected": false, "penMode": false, - "previousSelectedElementIds": {}, + "previousSelectedElementIds": { + "id0": true, + }, "resizingElement": null, "scrollX": 0, "scrollY": 0, "searchMatches": null, "selectedElementIds": { - "id0": true, + "id13": true, }, "selectedElementsAreBeingDragged": false, "selectedGroupIds": {}, @@ -17987,7 +17327,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -18006,10 +17346,6 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "angle": 0, "backgroundColor": "transparent", "boundElements": [ - { - "id": "id13", - "type": "arrow", - }, { "id": "id1", "type": "text", @@ -18033,7 +17369,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "strokeWidth": 2, "type": "rectangle", "updated": 1, - "version": 6, + "version": 3, "width": 100, "x": -100, "y": -50, @@ -18071,7 +17407,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "textAlign": "center", "type": "text", "updated": 1, - "version": 6, + "version": 4, "verticalAlign": "middle", "width": 30, "x": -65, @@ -18083,12 +17419,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding { "angle": 0, "backgroundColor": "transparent", - "boundElements": [ - { - "id": "id13", - "type": "arrow", - }, - ], + "boundElements": null, "customData": undefined, "fillStyle": "solid", "frameId": null, @@ -18107,7 +17438,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "strokeWidth": 2, "type": "rectangle", "updated": 1, - "version": 4, + "version": 2, "width": 100, "x": 100, "y": -50, @@ -18122,14 +17453,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "customData": undefined, "elbowed": false, "endArrowhead": "arrow", - "endBinding": { - "elementId": "id2", - "fixedPoint": [ - 0, - "0.50010", - ], - "mode": "orbit", - }, + "endBinding": null, "fillStyle": "solid", "frameId": null, "groupIds": [], @@ -18140,7 +17464,6 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "lastCommittedPoint": null, "link": null, "locked": false, - "moveMidPointsWithElement": false, "opacity": 100, "points": [ [ @@ -18148,7 +17471,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - 90, + 100, 0, ], ], @@ -18157,109 +17480,24 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "type": 2, }, "startArrowhead": null, - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - 1, - "0.50010", - ], - "mode": "orbit", - }, + "startBinding": null, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", "updated": 1, - "version": 12, - "width": 90, - "x": 5, - "y": "0.01000", + "version": 4, + "width": 100, + "x": 0, + "y": 0, } `; exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind rectangle from arrow on deletion and rebind on undo > [end of test] number of elements 1`] = `4`; -exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind rectangle from arrow on deletion and rebind on undo > [end of test] number of renders 1`] = `14`; +exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind rectangle from arrow on deletion and rebind on undo > [end of test] number of renders 1`] = `10`; -exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind rectangle from arrow on deletion and rebind on undo > [end of test] redo stack 1`] = ` -[ - { - "appState": AppStateDelta { - "delta": Delta { - "deleted": { - "selectedElementIds": { - "id0": true, - }, - }, - "inserted": { - "selectedElementIds": {}, - }, - }, - }, - "elements": { - "added": {}, - "removed": { - "id0": { - "deleted": { - "isDeleted": false, - "version": 6, - }, - "inserted": { - "isDeleted": true, - "version": 5, - }, - }, - "id1": { - "deleted": { - "isDeleted": false, - "version": 6, - }, - "inserted": { - "isDeleted": true, - "version": 5, - }, - }, - }, - "updated": { - "id13": { - "deleted": { - "endBinding": { - "elementId": "id2", - "fixedPoint": [ - 0, - "0.50010", - ], - "mode": "orbit", - }, - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - 1, - "0.50010", - ], - "mode": "orbit", - }, - "version": 12, - }, - "inserted": { - "endBinding": { - "elementId": "id2", - "fixedPoint": [ - 0, - "0.50010", - ], - "mode": "orbit", - }, - "startBinding": null, - "version": 10, - }, - }, - }, - }, - "id": "id21", - }, -] -`; +exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind rectangle from arrow on deletion and rebind on undo > [end of test] redo stack 1`] = `[]`; exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind rectangle from arrow on deletion and rebind on undo > [end of test] undo stack 1`] = ` [ @@ -18509,14 +17747,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "customData": undefined, "elbowed": false, "endArrowhead": "arrow", - "endBinding": { - "elementId": "id2", - "fixedPoint": [ - 0, - "0.50010", - ], - "mode": "orbit", - }, + "endBinding": null, "fillStyle": "solid", "frameId": null, "groupIds": [], @@ -18533,7 +17764,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - 90, + 100, 0, ], ], @@ -18542,90 +17773,25 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "type": 2, }, "startArrowhead": null, - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - 1, - "0.50010", - ], - "mode": "orbit", - }, + "startBinding": null, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", - "version": 9, - "width": 90, - "x": 5, - "y": "0.01000", + "version": 4, + "width": 100, + "x": 0, + "y": 0, }, "inserted": { "isDeleted": true, - "version": 8, - }, - }, - }, - "updated": { - "id0": { - "deleted": { - "boundElements": [ - { - "id": "id13", - "type": "arrow", - }, - ], - "version": 4, - }, - "inserted": { - "boundElements": [], "version": 3, }, }, - "id2": { - "deleted": { - "boundElements": [ - { - "id": "id13", - "type": "arrow", - }, - ], - "version": 3, - }, - "inserted": { - "boundElements": [], - "version": 2, - }, - }, }, - }, - "id": "id15", - }, - { - "appState": AppStateDelta { - "delta": Delta { - "deleted": { - "selectedElementIds": { - "id0": true, - }, - "selectedLinearElement": null, - }, - "inserted": { - "selectedElementIds": { - "id13": true, - }, - "selectedLinearElement": { - "elementId": "id13", - "isEditing": false, - }, - }, - }, - }, - "elements": { - "added": {}, - "removed": {}, "updated": {}, }, - "id": "id18", + "id": "id15", }, ] `; @@ -18717,8 +17883,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "scrollY": 0, "searchMatches": null, "selectedElementIds": { - "id0": true, - "id2": true, + "id13": true, }, "selectedElementsAreBeingDragged": false, "selectedGroupIds": {}, @@ -18732,7 +17897,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -18751,10 +17916,6 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "angle": 0, "backgroundColor": "transparent", "boundElements": [ - { - "id": "id13", - "type": "arrow", - }, { "id": "id1", "type": "text", @@ -18778,7 +17939,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "strokeWidth": 2, "type": "rectangle", "updated": 1, - "version": 6, + "version": 3, "width": 100, "x": -100, "y": -50, @@ -18816,7 +17977,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "textAlign": "center", "type": "text", "updated": 1, - "version": 6, + "version": 4, "verticalAlign": "middle", "width": 30, "x": -65, @@ -18828,12 +17989,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding { "angle": 0, "backgroundColor": "transparent", - "boundElements": [ - { - "id": "id13", - "type": "arrow", - }, - ], + "boundElements": null, "customData": undefined, "fillStyle": "solid", "frameId": null, @@ -18852,7 +18008,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "strokeWidth": 2, "type": "rectangle", "updated": 1, - "version": 5, + "version": 2, "width": 100, "x": 100, "y": -50, @@ -18867,14 +18023,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "customData": undefined, "elbowed": false, "endArrowhead": "arrow", - "endBinding": { - "elementId": "id2", - "fixedPoint": [ - 0, - "0.50010", - ], - "mode": "orbit", - }, + "endBinding": null, "fillStyle": "solid", "frameId": null, "groupIds": [], @@ -18885,7 +18034,6 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "lastCommittedPoint": null, "link": null, "locked": false, - "moveMidPointsWithElement": false, "opacity": 100, "points": [ [ @@ -18893,7 +18041,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - 90, + 100, 0, ], ], @@ -18902,113 +18050,24 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "type": 2, }, "startArrowhead": null, - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - 1, - "0.50010", - ], - "mode": "orbit", - }, + "startBinding": null, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", "updated": 1, - "version": 13, - "width": 90, - "x": 5, - "y": "0.01000", + "version": 4, + "width": 100, + "x": 0, + "y": 0, } `; exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind rectangles from arrow on deletion and rebind on undo > [end of test] number of elements 1`] = `4`; -exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind rectangles from arrow on deletion and rebind on undo > [end of test] number of renders 1`] = `15`; +exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind rectangles from arrow on deletion and rebind on undo > [end of test] number of renders 1`] = `10`; -exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind rectangles from arrow on deletion and rebind on undo > [end of test] redo stack 1`] = ` -[ - { - "appState": AppStateDelta { - "delta": Delta { - "deleted": { - "selectedElementIds": { - "id0": true, - "id2": true, - }, - }, - "inserted": { - "selectedElementIds": {}, - }, - }, - }, - "elements": { - "added": {}, - "removed": { - "id0": { - "deleted": { - "isDeleted": false, - "version": 6, - }, - "inserted": { - "isDeleted": true, - "version": 5, - }, - }, - "id1": { - "deleted": { - "isDeleted": false, - "version": 6, - }, - "inserted": { - "isDeleted": true, - "version": 5, - }, - }, - "id2": { - "deleted": { - "isDeleted": false, - "version": 5, - }, - "inserted": { - "isDeleted": true, - "version": 4, - }, - }, - }, - "updated": { - "id13": { - "deleted": { - "endBinding": { - "elementId": "id2", - "fixedPoint": [ - 0, - "0.50010", - ], - "mode": "orbit", - }, - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - 1, - "0.50010", - ], - "mode": "orbit", - }, - "version": 13, - }, - "inserted": { - "endBinding": null, - "startBinding": null, - "version": 11, - }, - }, - }, - }, - "id": "id24", - }, -] -`; +exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind rectangles from arrow on deletion and rebind on undo > [end of test] redo stack 1`] = `[]`; exports[`history > singleplayer undo/redo > should support bidirectional bindings > should unbind rectangles from arrow on deletion and rebind on undo > [end of test] undo stack 1`] = ` [ @@ -19258,14 +18317,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "customData": undefined, "elbowed": false, "endArrowhead": "arrow", - "endBinding": { - "elementId": "id2", - "fixedPoint": [ - 0, - "0.50010", - ], - "mode": "orbit", - }, + "endBinding": null, "fillStyle": "solid", "frameId": null, "groupIds": [], @@ -19282,7 +18334,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - 90, + 100, 0, ], ], @@ -19291,111 +18343,26 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "type": 2, }, "startArrowhead": null, - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - 1, - "0.50010", - ], - "mode": "orbit", - }, + "startBinding": null, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", - "version": 9, - "width": 90, - "x": 5, - "y": "0.01000", + "version": 4, + "width": 100, + "x": 0, + "y": 0, }, "inserted": { "isDeleted": true, - "version": 8, - }, - }, - }, - "updated": { - "id0": { - "deleted": { - "boundElements": [ - { - "id": "id13", - "type": "arrow", - }, - ], - "version": 4, - }, - "inserted": { - "boundElements": [], "version": 3, }, }, - "id2": { - "deleted": { - "boundElements": [ - { - "id": "id13", - "type": "arrow", - }, - ], - "version": 3, - }, - "inserted": { - "boundElements": [], - "version": 2, - }, - }, }, + "updated": {}, }, "id": "id15", }, - { - "appState": AppStateDelta { - "delta": Delta { - "deleted": { - "selectedElementIds": { - "id0": true, - }, - "selectedLinearElement": null, - }, - "inserted": { - "selectedElementIds": { - "id13": true, - }, - "selectedLinearElement": { - "elementId": "id13", - "isEditing": false, - }, - }, - }, - }, - "elements": { - "added": {}, - "removed": {}, - "updated": {}, - }, - "id": "id18", - }, - { - "appState": AppStateDelta { - "delta": Delta { - "deleted": { - "selectedElementIds": { - "id2": true, - }, - }, - "inserted": { - "selectedElementIds": {}, - }, - }, - }, - "elements": { - "added": {}, - "removed": {}, - "updated": {}, - }, - "id": "id21", - }, ] `; @@ -19501,7 +18468,7 @@ exports[`history > singleplayer undo/redo > should support changes in elements' "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -19982,7 +18949,7 @@ exports[`history > singleplayer undo/redo > should support duplication of groups "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -20487,7 +19454,7 @@ exports[`history > singleplayer undo/redo > should support element creation, del "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -20947,7 +19914,7 @@ exports[`history > singleplayer undo/redo > should support linear element creati "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, diff --git a/packages/excalidraw/tests/__snapshots__/move.test.tsx.snap b/packages/excalidraw/tests/__snapshots__/move.test.tsx.snap index e47ba06ff..556a41c35 100644 --- a/packages/excalidraw/tests/__snapshots__/move.test.tsx.snap +++ b/packages/excalidraw/tests/__snapshots__/move.test.tsx.snap @@ -95,142 +95,3 @@ exports[`move element > rectangle 5`] = ` "y": 40, } `; - -exports[`move element > rectangles with binding arrow 5`] = ` -{ - "angle": 0, - "backgroundColor": "transparent", - "boundElements": [ - { - "id": "id6", - "type": "arrow", - }, - ], - "customData": undefined, - "fillStyle": "solid", - "frameId": null, - "groupIds": [], - "height": 100, - "id": "id0", - "index": "a0", - "isDeleted": false, - "link": null, - "locked": false, - "opacity": 100, - "roughness": 1, - "roundness": null, - "seed": 1278240551, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 2, - "type": "rectangle", - "updated": 1, - "version": 4, - "versionNonce": 760410951, - "width": 100, - "x": 0, - "y": 0, -} -`; - -exports[`move element > rectangles with binding arrow 6`] = ` -{ - "angle": 0, - "backgroundColor": "transparent", - "boundElements": [ - { - "id": "id6", - "type": "arrow", - }, - ], - "customData": undefined, - "fillStyle": "solid", - "frameId": null, - "groupIds": [], - "height": 300, - "id": "id3", - "index": "a1", - "isDeleted": false, - "link": null, - "locked": false, - "opacity": 100, - "roughness": 1, - "roundness": null, - "seed": 1116226695, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 2, - "type": "rectangle", - "updated": 1, - "version": 7, - "versionNonce": 271613161, - "width": 300, - "x": 201, - "y": 2, -} -`; - -exports[`move element > rectangles with binding arrow 7`] = ` -{ - "angle": 0, - "backgroundColor": "transparent", - "boundElements": null, - "customData": undefined, - "elbowed": false, - "endArrowhead": "arrow", - "endBinding": { - "elementId": "id3", - "fixedPoint": [ - "-0.01667", - "0.45000", - ], - "mode": "orbit", - }, - "fillStyle": "solid", - "frameId": null, - "groupIds": [], - "height": "91.98875", - "id": "id6", - "index": "a2", - "isDeleted": false, - "lastCommittedPoint": null, - "link": null, - "locked": false, - "moveMidPointsWithElement": false, - "opacity": 100, - "points": [ - [ - 0, - 0, - ], - [ - 91, - "91.98875", - ], - ], - "roughness": 1, - "roundness": { - "type": 2, - }, - "seed": 23633383, - "startArrowhead": null, - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - "1.05000", - "0.45011", - ], - "mode": "orbit", - }, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 2, - "type": "arrow", - "updated": 1, - "version": 14, - "versionNonce": 651223591, - "width": 91, - "x": 105, - "y": "45.01062", -} -`; diff --git a/packages/excalidraw/tests/__snapshots__/regressionTests.test.tsx.snap b/packages/excalidraw/tests/__snapshots__/regressionTests.test.tsx.snap index b16d6d002..b560c4c91 100644 --- a/packages/excalidraw/tests/__snapshots__/regressionTests.test.tsx.snap +++ b/packages/excalidraw/tests/__snapshots__/regressionTests.test.tsx.snap @@ -109,7 +109,7 @@ exports[`given element A and group of elements B and given both are selected whe "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -536,7 +536,7 @@ exports[`given element A and group of elements B and given both are selected whe "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -942,7 +942,7 @@ exports[`regression tests > Cmd/Ctrl-click exclusively select element under poin "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -1507,7 +1507,7 @@ exports[`regression tests > Drags selected element when hitting only bounding bo "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -1718,7 +1718,7 @@ exports[`regression tests > adjusts z order when grouping > [end of test] appSta "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -2098,7 +2098,7 @@ exports[`regression tests > alt-drag duplicates an element > [end of test] appSt "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -2340,7 +2340,7 @@ exports[`regression tests > arrow keys > [end of test] appState 1`] = ` "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -2521,7 +2521,7 @@ exports[`regression tests > can drag element that covers another element, while "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -2843,7 +2843,7 @@ exports[`regression tests > change the properties of a shape > [end of test] app "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -3099,7 +3099,7 @@ exports[`regression tests > click on an element and drag it > [dragged] appState "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -3339,7 +3339,7 @@ exports[`regression tests > click on an element and drag it > [end of test] appS "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -3574,7 +3574,7 @@ exports[`regression tests > click to select a shape > [end of test] appState 1`] "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -3832,7 +3832,7 @@ exports[`regression tests > click-drag to select a group > [end of test] appStat "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -4144,7 +4144,7 @@ exports[`regression tests > deleting last but one element in editing group shoul "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -4606,7 +4606,7 @@ exports[`regression tests > deselects group of selected elements on pointer down "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -4860,7 +4860,7 @@ exports[`regression tests > deselects group of selected elements on pointer up w "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -5162,7 +5162,7 @@ exports[`regression tests > deselects selected element on pointer down when poin "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -5341,7 +5341,7 @@ exports[`regression tests > deselects selected element, on pointer up, when clic "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -5540,7 +5540,7 @@ exports[`regression tests > double click to edit a group > [end of test] appStat "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -5936,7 +5936,7 @@ exports[`regression tests > drags selected elements from point inside common bou "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -6226,7 +6226,7 @@ exports[`regression tests > draw every type of shape > [end of test] appState 1` "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -7068,7 +7068,7 @@ exports[`regression tests > given a group of selected elements with an element t "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -7401,7 +7401,7 @@ exports[`regression tests > given a selected element A and a not selected elemen "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -7678,7 +7678,7 @@ exports[`regression tests > given selected element A with lower z-index than uns "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -7912,7 +7912,7 @@ exports[`regression tests > given selected element A with lower z-index than uns "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -8149,7 +8149,7 @@ exports[`regression tests > key 2 selects rectangle tool > [end of test] appStat "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -8328,7 +8328,7 @@ exports[`regression tests > key 3 selects diamond tool > [end of test] appState "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -8507,7 +8507,7 @@ exports[`regression tests > key 4 selects ellipse tool > [end of test] appState "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -8712,7 +8712,7 @@ exports[`regression tests > key 5 selects arrow tool > [end of test] appState 1` "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -8940,7 +8940,7 @@ exports[`regression tests > key 6 selects line tool > [end of test] appState 1`] "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -9138,7 +9138,7 @@ exports[`regression tests > key 7 selects freedraw tool > [end of test] appState "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -9361,7 +9361,7 @@ exports[`regression tests > key a selects arrow tool > [end of test] appState 1` "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -9563,7 +9563,7 @@ exports[`regression tests > key d selects diamond tool > [end of test] appState "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -9768,7 +9768,7 @@ exports[`regression tests > key l selects line tool > [end of test] appState 1`] "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -9968,7 +9968,7 @@ exports[`regression tests > key o selects ellipse tool > [end of test] appState "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -10145,7 +10145,7 @@ exports[`regression tests > key p selects freedraw tool > [end of test] appState "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -10342,7 +10342,7 @@ exports[`regression tests > key r selects rectangle tool > [end of test] appStat "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -10529,7 +10529,7 @@ exports[`regression tests > make a group and duplicate it > [end of test] appSta "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -11053,7 +11053,7 @@ exports[`regression tests > noop interaction after undo shouldn't create history "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -11328,7 +11328,7 @@ exports[`regression tests > pinch-to-zoom works > [end of test] appState 1`] = ` "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -11452,7 +11452,7 @@ exports[`regression tests > shift click on selected element should deselect it o "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -11655,7 +11655,7 @@ exports[`regression tests > shift-click to multiselect, then drag > [end of test "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -11975,7 +11975,7 @@ exports[`regression tests > should group elements and ungroup them > [end of tes "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -12407,7 +12407,7 @@ exports[`regression tests > single-clicking on a subgroup of a selected group sh "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -13037,7 +13037,7 @@ exports[`regression tests > spacebar + drag scrolls the canvas > [end of test] a "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -13163,7 +13163,7 @@ exports[`regression tests > supports nested groups > [end of test] appState 1`] "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -13822,7 +13822,7 @@ exports[`regression tests > switches from group of selected elements to another "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -14159,7 +14159,7 @@ exports[`regression tests > switches selected element on pointer down > [end of "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -14390,7 +14390,7 @@ exports[`regression tests > two-finger scroll works > [end of test] appState 1`] "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -14514,7 +14514,7 @@ exports[`regression tests > undo/redo drawing an element > [end of test] appStat "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -14887,7 +14887,7 @@ exports[`regression tests > updates fontSize & fontFamily appState > [end of tes "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, @@ -15012,7 +15012,7 @@ exports[`regression tests > zoom hotkeys > [end of test] appState 1`] = ` "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null, diff --git a/packages/excalidraw/tests/move.test.tsx b/packages/excalidraw/tests/move.test.tsx index bb3052574..0417090bc 100644 --- a/packages/excalidraw/tests/move.test.tsx +++ b/packages/excalidraw/tests/move.test.tsx @@ -102,7 +102,7 @@ describe("move element", () => { new Pointer("mouse").clickOn(rectB); expect(renderInteractiveScene.mock.calls.length).toMatchInlineSnapshot( - `17`, + `15`, ); expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`13`); expect(h.state.selectionElement).toBeNull(); diff --git a/packages/excalidraw/types.ts b/packages/excalidraw/types.ts index ae8ae549c..0389f21c1 100644 --- a/packages/excalidraw/types.ts +++ b/packages/excalidraw/types.ts @@ -5,8 +5,6 @@ import type { MIME_TYPES, } from "@excalidraw/common"; -import type { SuggestedBinding } from "@excalidraw/element"; - import type { LinearElementEditor } from "@excalidraw/element"; import type { MaybeTransformHandleType } from "@excalidraw/element"; @@ -204,6 +202,7 @@ export type StaticCanvasAppState = Readonly< frameRendering: AppState["frameRendering"]; currentHoveredFontFamily: AppState["currentHoveredFontFamily"]; hoveredElementIds: AppState["hoveredElementIds"]; + suggestedBinding: AppState["suggestedBinding"]; // Cropping croppingElementId: AppState["croppingElementId"]; } @@ -219,7 +218,7 @@ export type InteractiveCanvasAppState = Readonly< multiElement: AppState["multiElement"]; newElement: AppState["newElement"]; isBindingEnabled: AppState["isBindingEnabled"]; - suggestedBindings: AppState["suggestedBindings"]; + suggestedBinding: AppState["suggestedBinding"]; isRotating: AppState["isRotating"]; elementsToHighlight: AppState["elementsToHighlight"]; // Collaborators @@ -293,7 +292,7 @@ export interface AppState { selectionElement: NonDeletedExcalidrawElement | null; isBindingEnabled: boolean; startBoundElement: NonDeleted | null; - suggestedBindings: SuggestedBinding[]; + suggestedBinding: NonDeleted | null; frameToHighlight: NonDeleted | null; frameRendering: { enabled: boolean; @@ -460,7 +459,7 @@ export type SearchMatch = { export type UIAppState = Omit< AppState, - | "suggestedBindings" + | "suggestedBinding" | "startBoundElement" | "cursorButton" | "scrollX" diff --git a/packages/utils/tests/__snapshots__/export.test.ts.snap b/packages/utils/tests/__snapshots__/export.test.ts.snap index 5ff32b5ef..b2840d4e3 100644 --- a/packages/utils/tests/__snapshots__/export.test.ts.snap +++ b/packages/utils/tests/__snapshots__/export.test.ts.snap @@ -101,7 +101,7 @@ exports[`exportToSvg > with default arguments 1`] = ` "open": false, "panels": 3, }, - "suggestedBindings": [], + "suggestedBinding": null, "theme": "light", "toast": null, "userToFollow": null,