diff --git a/packages/element/src/resizeElements.ts b/packages/element/src/resizeElements.ts index 3bd038f1b..b059e0dec 100644 --- a/packages/element/src/resizeElements.ts +++ b/packages/element/src/resizeElements.ts @@ -45,6 +45,7 @@ import { import { wrapText } from "./textWrapping"; import { isArrowElement, + isBindingElement, isBoundToContainer, isElbowArrow, isFrameLikeElement, @@ -73,7 +74,9 @@ import type { ExcalidrawImageElement, ElementsMap, ExcalidrawElbowArrowElement, + ExcalidrawArrowElement, } from "./types"; +import type { ElementUpdate } from "./mutateElement"; // Returns true when transform (resizing/rotation) happened export const transformElements = ( @@ -819,13 +822,29 @@ export const resizeSingleElement = ( Number.isFinite(newOrigin.x) && Number.isFinite(newOrigin.y) ) { - const updates = { + let updates: ElementUpdate = { ...newOrigin, width: Math.abs(nextWidth), height: Math.abs(nextHeight), ...rescaledPoints, }; + if (isBindingElement(latestElement)) { + if (latestElement.startBinding) { + updates = { + ...updates, + startBinding: null, + } as ElementUpdate; + } + + if (latestElement.endBinding) { + updates = { + ...updates, + endBinding: null, + } as ElementUpdate; + } + } + scene.mutateElement(latestElement, updates, { informMutation: shouldInformMutation, isDragging: false, diff --git a/packages/element/tests/__snapshots__/linearElementEditor.test.tsx.snap b/packages/element/tests/__snapshots__/linearElementEditor.test.tsx.snap index afd9e11a3..35e940d32 100644 --- a/packages/element/tests/__snapshots__/linearElementEditor.test.tsx.snap +++ b/packages/element/tests/__snapshots__/linearElementEditor.test.tsx.snap @@ -44,8 +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" -`; diff --git a/packages/element/tests/binding.test.tsx b/packages/element/tests/binding.test.tsx index 24bd7ea65..c6fbf1a83 100644 --- a/packages/element/tests/binding.test.tsx +++ b/packages/element/tests/binding.test.tsx @@ -33,77 +33,6 @@ describe("element binding", () => { await render(); }); - it("should create valid binding if duplicate start/end points", async () => { - const rect = API.createElement({ - type: "rectangle", - x: 0, - y: 0, - width: 50, - height: 50, - }); - const arrow = API.createElement({ - type: "arrow", - x: 100, - y: 0, - width: 100, - height: 1, - points: [ - pointFrom(0, 0), - pointFrom(0, 0), - pointFrom(100, 0), - pointFrom(100, 0), - ], - }); - API.setElements([rect, arrow]); - expect(arrow.startBinding).toBe(null); - - // select arrow - mouse.clickAt(150, 0); - - // move arrow start to potential binding position - mouse.downAt(100, 0); - mouse.moveTo(55, 0); - mouse.up(0, 0); - - // Point selection is evaluated like the points are rendered, - // from right to left. So clicking on the first point should move the joint, - // not the start point. - expect(arrow.startBinding).toBe(null); - - // Now that the start point is free, move it into overlapping position - mouse.downAt(100, 0); - mouse.moveTo(55, 0); - mouse.up(0, 0); - - expect(API.getSelectedElements()).toEqual([arrow]); - - expect(arrow.startBinding).toEqual({ - elementId: rect.id, - focus: 0, - gap: 0, - fixedPoint: expect.arrayContaining([1.1, 0]), - }); - - // Move the end point to the overlapping binding position - mouse.downAt(200, 0); - mouse.moveTo(55, 0); - mouse.up(0, 0); - - // Both the start and the end points should be bound - expect(arrow.startBinding).toEqual({ - elementId: rect.id, - focus: 0, - gap: 0, - fixedPoint: expect.arrayContaining([1.1, 0]), - }); - expect(arrow.endBinding).toEqual({ - elementId: rect.id, - focus: 0, - gap: 0, - fixedPoint: expect.arrayContaining([1.1, 0]), - }); - }); - //@TODO fix the test with rotation it.skip("rotation of arrow should rebind both ends", () => { const rectLeft = UI.createElement("rectangle", { @@ -399,7 +328,7 @@ describe("element binding", () => { }); // #6459 - it("should unbind arrow only from the latest element", () => { + it("should unbind arrow when arrow is resized", () => { const rectLeft = UI.createElement("rectangle", { x: 0, width: 200, @@ -427,14 +356,13 @@ describe("element binding", () => { "mouse", ).se!; - Keyboard.keyDown(KEYS.CTRL_OR_CMD); const elX = handles[0] + handles[2] / 2; const elY = handles[1] + handles[3] / 2; mouse.downAt(elX, elY); mouse.moveTo(300, 400); mouse.up(); - expect(arrow.startBinding).not.toBe(null); + expect(arrow.startBinding).toBe(null); expect(arrow.endBinding).toBe(null); }); @@ -538,7 +466,7 @@ describe("Fixed-point arrow binding", () => { expect(arrow.y).toBe(110); }); - it("should create fixed-point binding when one of the arrow endpoint is inside rectangle", () => { + it("should create orbit binding when one of the arrow endpoint is inside rectangle", () => { // Create a filled solid rectangle UI.clickTool("rectangle"); mouse.downAt(100, 100); @@ -558,8 +486,8 @@ describe("Fixed-point arrow binding", () => { const arrow = API.getSelectedElement() as ExcalidrawLinearElement; expect(arrow.x).toBe(10); expect(arrow.y).toBe(10); - expect(arrow.width).toBe(150); - expect(arrow.height).toBe(150); + expect(arrow.width).toBeCloseTo(86.4669660940663); + expect(arrow.height).toBeCloseTo(86.46696609406821); // Should bind to the rectangle since endpoint is inside expect(arrow.startBinding).toBe(null); @@ -581,8 +509,8 @@ describe("Fixed-point arrow binding", () => { // Check if the arrow moved expect(arrow.x).toBe(10); expect(arrow.y).toBe(10); - expect(arrow.width).toBe(300); - expect(arrow.height).toBe(150); + expect(arrow.width).toBeCloseTo(235); + expect(arrow.height).toBeCloseTo(117.5); }); it("should maintain relative position when arrow start point is dragged outside and rectangle is moved", () => { @@ -759,7 +687,7 @@ describe("line segment extension binding", () => { await render(); }); - it("should use point binding when extended segment intersects element", () => { + it("should bind when extended segment intersects element", () => { // Create a rectangle that will be intersected by the extended arrow segment const rect = API.createElement({ type: "rectangle", @@ -779,14 +707,14 @@ describe("line segment extension binding", () => { const arrow = API.getSelectedElement() as ExcalidrawLinearElement; - // Should create a normal point binding since the extended line segment + // Should create a binding since the extended line segment // from the last arrow segment intersects the rectangle expect(arrow.endBinding?.elementId).toBe(rect.id); - expect(arrow.endBinding).toHaveProperty("focus"); - expect(arrow.endBinding).toHaveProperty("gap"); + expect(arrow.endBinding).toHaveProperty("mode"); + expect(arrow.endBinding).toHaveProperty("fixedPoint"); }); - it("should use fixed point binding when extended segment misses element", () => { + it("should bind even if the arrow is not pointing at the element", () => { // Create a rectangle positioned so the extended arrow segment will miss it const rect = API.createElement({ type: "rectangle", diff --git a/packages/element/tests/linearElementEditor.test.tsx b/packages/element/tests/linearElementEditor.test.tsx index f1306b872..de6085866 100644 --- a/packages/element/tests/linearElementEditor.test.tsx +++ b/packages/element/tests/linearElementEditor.test.tsx @@ -379,7 +379,7 @@ describe("Test Linear Elements", () => { expect(renderInteractiveScene.mock.calls.length).toMatchInlineSnapshot( `11`, ); - expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`6`); + expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`7`); expect(line.points.length).toEqual(3); expect(line.points).toMatchInlineSnapshot(` @@ -549,7 +549,7 @@ describe("Test Linear Elements", () => { expect(renderInteractiveScene.mock.calls.length).toMatchInlineSnapshot( `14`, ); - expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`7`); + expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`9`); expect(line.points.length).toEqual(5); @@ -600,7 +600,7 @@ describe("Test Linear Elements", () => { expect(renderInteractiveScene.mock.calls.length).toMatchInlineSnapshot( `11`, ); - expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`6`); + expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`7`); const newPoints = LinearElementEditor.getPointsGlobalCoordinates( line, @@ -641,7 +641,7 @@ describe("Test Linear Elements", () => { expect(renderInteractiveScene.mock.calls.length).toMatchInlineSnapshot( `11`, ); - expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`6`); + expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`7`); const newPoints = LinearElementEditor.getPointsGlobalCoordinates( line, @@ -689,7 +689,7 @@ describe("Test Linear Elements", () => { expect(renderInteractiveScene.mock.calls.length).toMatchInlineSnapshot( `17`, ); - expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`7`); + expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`10`); const newMidPoints = LinearElementEditor.getEditorMidPoints( line, @@ -747,7 +747,7 @@ describe("Test Linear Elements", () => { expect(renderInteractiveScene.mock.calls.length).toMatchInlineSnapshot( `14`, ); - expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`7`); + expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`9`); expect(line.points.length).toEqual(5); expect((h.elements[0] as ExcalidrawLinearElement).points) @@ -845,7 +845,7 @@ describe("Test Linear Elements", () => { expect(renderInteractiveScene.mock.calls.length).toMatchInlineSnapshot( `11`, ); - expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`6`); + expect(renderStaticScene.mock.calls.length).toMatchInlineSnapshot(`7`); const newPoints = LinearElementEditor.getPointsGlobalCoordinates( line, diff --git a/packages/excalidraw/components/Stats/index.tsx b/packages/excalidraw/components/Stats/index.tsx index bcfab8520..47fcd64be 100644 --- a/packages/excalidraw/components/Stats/index.tsx +++ b/packages/excalidraw/components/Stats/index.tsx @@ -4,9 +4,9 @@ import throttle from "lodash.throttle"; import { useEffect, useMemo, useState, memo } from "react"; import { STATS_PANELS } from "@excalidraw/common"; -import { getCommonBounds } from "@excalidraw/element"; +import { getCommonBounds, isBindingElement } from "@excalidraw/element"; import { getUncroppedWidthAndHeight } from "@excalidraw/element"; -import { isElbowArrow, isImageElement } from "@excalidraw/element"; +import { isImageElement } from "@excalidraw/element"; import { frameAndChildrenSelectedTogether } from "@excalidraw/element"; @@ -333,7 +333,7 @@ export const StatsInner = memo( appState={appState} /> - {!isElbowArrow(singleElement) && ( + {!isBindingElement(singleElement) && ( { ) as HTMLInputElement; expect(linear.startBinding).not.toBe(null); expect(inputX).not.toBeNull(); - UI.updateInput(inputX, String("204")); - expect(linear.startBinding).not.toBe(null); - }); - - it("should remain bound to linear element on small angle change", async () => { - const linear = h.elements[1] as ExcalidrawLinearElement; - const inputAngle = UI.queryStatsProperty("A")?.querySelector( - ".drag-input", - ) as HTMLInputElement; - - expect(linear.startBinding).not.toBe(null); - UI.updateInput(inputAngle, String("1")); + UI.updateInput(inputX, String("186")); expect(linear.startBinding).not.toBe(null); }); @@ -161,17 +150,6 @@ describe("binding with linear elements", () => { UI.updateInput(inputX, String("254")); expect(linear.startBinding).toBe(null); }); - - it("should remain bound to linear element on small angle change", async () => { - const linear = h.elements[1] as ExcalidrawLinearElement; - const inputAngle = UI.queryStatsProperty("A")?.querySelector( - ".drag-input", - ) as HTMLInputElement; - - expect(linear.startBinding).not.toBe(null); - UI.updateInput(inputAngle, String("45")); - expect(linear.startBinding).toBe(null); - }); }); // single element diff --git a/packages/excalidraw/data/__snapshots__/transform.test.ts.snap b/packages/excalidraw/data/__snapshots__/transform.test.ts.snap index 3e1092922..cd95bedf9 100644 --- a/packages/excalidraw/data/__snapshots__/transform.test.ts.snap +++ b/packages/excalidraw/data/__snapshots__/transform.test.ts.snap @@ -439,6 +439,388 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing t } `; +exports[`Test Transform > Test arrow bindings > should bind arrows to shapes when start / end provided without ids 1`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": [ + { + "id": "id40", + "type": "text", + }, + ], + "customData": undefined, + "elbowed": false, + "endArrowhead": "arrow", + "endBinding": { + "elementId": "id42", + "fixedPoint": [ + 0, + 0.5001, + ], + "mode": "orbit", + }, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 0, + "id": Any, + "index": "a0", + "isDeleted": false, + "lastCommittedPoint": null, + "link": null, + "locked": false, + "opacity": 100, + "points": [ + [ + 0, + 0, + ], + [ + 99, + 0, + ], + ], + "roughness": 1, + "roundness": null, + "seed": Any, + "startArrowhead": null, + "startBinding": { + "elementId": "id41", + "fixedPoint": [ + 1, + 0.5001, + ], + "mode": "orbit", + }, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "arrow", + "updated": 1, + "version": 4, + "versionNonce": Any, + "width": 100, + "x": 255.5, + "y": 239, +} +`; + +exports[`Test Transform > Test arrow bindings > should bind arrows to shapes when start / end provided without ids 2`] = ` +{ + "angle": 0, + "autoResize": true, + "backgroundColor": "transparent", + "boundElements": null, + "containerId": "id39", + "customData": undefined, + "fillStyle": "solid", + "fontFamily": 5, + "fontSize": 20, + "frameId": null, + "groupIds": [], + "height": 25, + "id": Any, + "index": "a1", + "isDeleted": false, + "lineHeight": 1.25, + "link": null, + "locked": false, + "opacity": 100, + "originalText": "HELLO WORLD!!", + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "text": "HELLO WORLD!!", + "textAlign": "center", + "type": "text", + "updated": 1, + "version": 3, + "versionNonce": Any, + "verticalAlign": "middle", + "width": 130, + "x": 240, + "y": 226.5, +} +`; + +exports[`Test Transform > Test arrow bindings > should bind arrows to shapes when start / end provided without ids 3`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": [ + { + "id": "id39", + "type": "arrow", + }, + ], + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 100, + "id": Any, + "index": "a2", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 3, + "versionNonce": Any, + "width": 100, + "x": 155, + "y": 189, +} +`; + +exports[`Test Transform > Test arrow bindings > should bind arrows to shapes when start / end provided without ids 4`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": [ + { + "id": "id39", + "type": "arrow", + }, + ], + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 100, + "id": Any, + "index": "a3", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "ellipse", + "updated": 1, + "version": 3, + "versionNonce": Any, + "width": 100, + "x": 355, + "y": 189, +} +`; + +exports[`Test Transform > Test arrow bindings > should bind arrows to text when start / end provided without ids 1`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": [ + { + "id": "id44", + "type": "text", + }, + ], + "customData": undefined, + "elbowed": false, + "endArrowhead": "arrow", + "endBinding": { + "elementId": "id46", + "fixedPoint": [ + 0, + 0.5001, + ], + "mode": "orbit", + }, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 0, + "id": Any, + "index": "a0", + "isDeleted": false, + "lastCommittedPoint": null, + "link": null, + "locked": false, + "opacity": 100, + "points": [ + [ + 0, + 0, + ], + [ + 99, + 0, + ], + ], + "roughness": 1, + "roundness": null, + "seed": Any, + "startArrowhead": null, + "startBinding": { + "elementId": "id45", + "fixedPoint": [ + 1, + 0.5001, + ], + "mode": "orbit", + }, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "arrow", + "updated": 1, + "version": 4, + "versionNonce": Any, + "width": 100, + "x": 255.5, + "y": 239, +} +`; + +exports[`Test Transform > Test arrow bindings > should bind arrows to text when start / end provided without ids 2`] = ` +{ + "angle": 0, + "autoResize": true, + "backgroundColor": "transparent", + "boundElements": null, + "containerId": "id43", + "customData": undefined, + "fillStyle": "solid", + "fontFamily": 5, + "fontSize": 20, + "frameId": null, + "groupIds": [], + "height": 25, + "id": Any, + "index": "a1", + "isDeleted": false, + "lineHeight": 1.25, + "link": null, + "locked": false, + "opacity": 100, + "originalText": "HELLO WORLD!!", + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "text": "HELLO WORLD!!", + "textAlign": "center", + "type": "text", + "updated": 1, + "version": 3, + "versionNonce": Any, + "verticalAlign": "middle", + "width": 130, + "x": 240, + "y": 226.5, +} +`; + +exports[`Test Transform > Test arrow bindings > should bind arrows to text when start / end provided without ids 3`] = ` +{ + "angle": 0, + "autoResize": true, + "backgroundColor": "transparent", + "boundElements": [ + { + "id": "id43", + "type": "arrow", + }, + ], + "containerId": null, + "customData": undefined, + "fillStyle": "solid", + "fontFamily": 5, + "fontSize": 20, + "frameId": null, + "groupIds": [], + "height": 25, + "id": Any, + "index": "a2", + "isDeleted": false, + "lineHeight": 1.25, + "link": null, + "locked": false, + "opacity": 100, + "originalText": "HEYYYYY", + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "text": "HEYYYYY", + "textAlign": "left", + "type": "text", + "updated": 1, + "version": 3, + "versionNonce": Any, + "verticalAlign": "top", + "width": 70, + "x": 185, + "y": 226.5, +} +`; + +exports[`Test Transform > Test arrow bindings > should bind arrows to text when start / end provided without ids 4`] = ` +{ + "angle": 0, + "autoResize": true, + "backgroundColor": "transparent", + "boundElements": [ + { + "id": "id43", + "type": "arrow", + }, + ], + "containerId": null, + "customData": undefined, + "fillStyle": "solid", + "fontFamily": 5, + "fontSize": 20, + "frameId": null, + "groupIds": [], + "height": 25, + "id": Any, + "index": "a3", + "isDeleted": false, + "lineHeight": 1.25, + "link": null, + "locked": false, + "opacity": 100, + "originalText": "WHATS UP ?", + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "text": "WHATS UP ?", + "textAlign": "left", + "type": "text", + "updated": 1, + "version": 3, + "versionNonce": Any, + "verticalAlign": "top", + "width": 100, + "x": 355, + "y": 226.5, +} +`; + exports[`Test Transform > should not allow duplicate ids 1`] = ` { "angle": 0, diff --git a/packages/excalidraw/data/transform.test.ts b/packages/excalidraw/data/transform.test.ts index b1b1570e9..b620abfe5 100644 --- a/packages/excalidraw/data/transform.test.ts +++ b/packages/excalidraw/data/transform.test.ts @@ -432,12 +432,9 @@ describe("Test Transform", () => { boundElements: [{ id: text.id, type: "text" }], startBinding: { elementId: rectangle.id, - focus: 0, - gap: 0, }, endBinding: { elementId: ellipse.id, - focus: 0, }, }); @@ -517,12 +514,9 @@ describe("Test Transform", () => { boundElements: [{ id: text1.id, type: "text" }], startBinding: { elementId: text2.id, - focus: 0, - gap: 0, }, endBinding: { elementId: text3.id, - focus: 0, }, }); @@ -780,8 +774,8 @@ describe("Test Transform", () => { const [arrow, rect] = excalidrawElements; expect((arrow as ExcalidrawArrowElement).endBinding).toStrictEqual({ elementId: "rect-1", - focus: -0, - gap: 25, + fixedPoint: [-2.05, 0.5001], + mode: "orbit", }); expect(rect.boundElements).toStrictEqual([ { diff --git a/packages/excalidraw/tests/__snapshots__/history.test.tsx.snap b/packages/excalidraw/tests/__snapshots__/history.test.tsx.snap index f78db0491..3c24fbb7e 100644 --- a/packages/excalidraw/tests/__snapshots__/history.test.tsx.snap +++ b/packages/excalidraw/tests/__snapshots__/history.test.tsx.snap @@ -31,74 +31,10 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "currentItemStrokeStyle": "solid", "currentItemStrokeWidth": 2, "currentItemTextAlign": "left", - "cursorButton": "up", + "cursorButton": "down", "defaultSidebarDockedPreference": false, "editingFrame": null, "editingGroupId": null, - "editingLinearElement": { - "customLineAngle": null, - "elbowed": false, - "elementId": "id4", - "hoverPointIndex": -1, - "isDragging": false, - "isEditing": false, - "lastUncommittedPoint": null, - "pointerDownState": { - "arrowOriginalStartPoint": [ - 0, - 0, - ], - "lastClickedIsEndPoint": false, - "lastClickedPoint": -1, - "origin": null, - "prevSelectedPointsIndices": null, - "segmentMidpoint": { - "added": false, - "index": null, - "value": null, - }, - }, - "pointerOffset": { - "x": 0, - "y": 0, - }, - "segmentMidPointHoveredCoords": null, - "selectedPointsIndices": null, - "startBindingElement": { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": [ - { - "id": "id4", - "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": 1, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 2, - "type": "rectangle", - "updated": 1, - "version": 3, - "versionNonce": 493213705, - "width": 100, - "x": -100, - "y": -50, - }, - }, "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, @@ -155,7 +91,35 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl }, "selectedElementsAreBeingDragged": false, "selectedGroupIds": {}, - "selectionElement": null, + "selectionElement": { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 0, + "id": "id12", + "index": null, + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": null, + "seed": 2004587015, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "selection", + "updated": 1, + "version": 1, + "versionNonce": 0, + "width": 0, + "x": 100, + "y": 0, + }, "shouldCacheIgnoreZoom": false, "showHyperlinkPopup": false, "showWelcomeScreen": true, @@ -260,15 +224,15 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "endBinding": { "elementId": "id1", "fixedPoint": [ - "-0.05000", - "0.50997", + 0, + "0.50010", ], "mode": "orbit", }, "fillStyle": "solid", "frameId": null, "groupIds": [], - "height": "0.04737", + "height": "0.00047", "id": "id4", "index": "a2", "isDeleted": false, @@ -283,7 +247,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl ], [ 90, - "0.04737", + "0.00047", ], ], "roughness": 1, @@ -294,8 +258,8 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "startBinding": { "elementId": "id0", "fixedPoint": [ - "1.05000", - "0.50950", + 1, + "0.50010", ], "mode": "orbit", }, @@ -304,10 +268,10 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "strokeWidth": 2, "type": "arrow", "updated": 1, - "version": 9, + "version": 12, "width": 90, "x": 5, - "y": "0.95000", + "y": "0.00950", } `; @@ -463,14 +427,14 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", - "version": 5, + "version": 6, "width": 100, "x": 0, "y": 0, }, "inserted": { "isDeleted": true, - "version": 4, + "version": 5, }, }, }, @@ -526,7 +490,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl ], "mode": "inside", }, - "version": 6, + "version": 7, "width": 95, "x": 5, "y": "0.95000", @@ -551,7 +515,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl ], "mode": "inside", }, - "version": 5, + "version": 6, "width": 100, "x": 0, "y": 0, @@ -574,17 +538,40 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "updated": { "id4": { "deleted": { + "height": "0.00950", + "points": [ + [ + 0, + 0, + ], + [ + 95, + "-0.00950", + ], + ], "startBinding": { "elementId": "id0", "fixedPoint": [ - "1.05000", - "0.50950", + 1, + "0.50010", ], "mode": "orbit", }, - "version": 7, + "version": 9, + "y": "0.00950", }, "inserted": { + "height": "0.95000", + "points": [ + [ + 0, + 0, + ], + [ + 95, + "-0.95000", + ], + ], "startBinding": { "elementId": "id0", "fixedPoint": [ @@ -593,7 +580,8 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl ], "mode": "inside", }, - "version": 6, + "version": 7, + "y": "0.95000", }, }, }, @@ -613,7 +601,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "updated": { "id4": { "deleted": { - "height": "0.04737", + "height": "0.93837", "points": [ [ 0, @@ -621,23 +609,22 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl ], [ 90, - "0.04737", + "0.93837", ], ], "startBinding": { "elementId": "id0", "fixedPoint": [ - "1.05000", - "0.50950", + 1, + "0.50010", ], "mode": "orbit", }, - "version": 8, + "version": 10, "width": 90, - "y": "0.95000", }, "inserted": { - "height": "0.95000", + "height": "0.00950", "points": [ [ 0, @@ -645,20 +632,19 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl ], [ 95, - "-0.95000", + "-0.00950", ], ], "startBinding": { "elementId": "id0", "fixedPoint": [ - "1.05000", - "0.50950", + 1, + "0.50010", ], "mode": "orbit", }, - "version": 7, + "version": 9, "width": 95, - "y": "0.95000", }, }, }, @@ -696,32 +682,54 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "endBinding": { "elementId": "id1", "fixedPoint": [ - "-0.05000", - "0.50997", + 0, + "0.50010", ], "mode": "orbit", }, + "height": "0.00047", + "points": [ + [ + 0, + 0, + ], + [ + 90, + "0.00047", + ], + ], "startBinding": { "elementId": "id0", "fixedPoint": [ - "1.05000", - "0.50950", + 1, + "0.50010", ], "mode": "orbit", }, - "version": 9, + "version": 12, }, "inserted": { "endBinding": null, + "height": "0.93837", + "points": [ + [ + 0, + 0, + ], + [ + 90, + "0.93837", + ], + ], "startBinding": { "elementId": "id0", "fixedPoint": [ - "1.05000", - "0.50950", + 1, + "0.50010", ], "mode": "orbit", }, - "version": 8, + "version": 10, }, }, }, @@ -762,74 +770,10 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "currentItemStrokeStyle": "solid", "currentItemStrokeWidth": 2, "currentItemTextAlign": "left", - "cursorButton": "up", + "cursorButton": "down", "defaultSidebarDockedPreference": false, "editingFrame": null, "editingGroupId": null, - "editingLinearElement": { - "customLineAngle": null, - "elbowed": false, - "elementId": "id4", - "hoverPointIndex": -1, - "isDragging": false, - "isEditing": false, - "lastUncommittedPoint": null, - "pointerDownState": { - "arrowOriginalStartPoint": [ - 0, - 0, - ], - "lastClickedIsEndPoint": false, - "lastClickedPoint": -1, - "origin": null, - "prevSelectedPointsIndices": null, - "segmentMidpoint": { - "added": false, - "index": null, - "value": null, - }, - }, - "pointerOffset": { - "x": 0, - "y": 0, - }, - "segmentMidPointHoveredCoords": null, - "selectedPointsIndices": null, - "startBindingElement": { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": [ - { - "id": "id4", - "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": 1, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 2, - "type": "rectangle", - "updated": 1, - "version": 3, - "versionNonce": 493213705, - "width": 100, - "x": -100, - "y": -50, - }, - }, "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, @@ -886,7 +830,35 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl }, "selectedElementsAreBeingDragged": false, "selectedGroupIds": {}, - "selectionElement": null, + "selectionElement": { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 0, + "id": "id14", + "index": null, + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": null, + "seed": 1292308681, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "selection", + "updated": 1, + "version": 1, + "versionNonce": 0, + "width": 0, + "x": 100, + "y": 0, + }, "shouldCacheIgnoreZoom": false, "showHyperlinkPopup": false, "showWelcomeScreen": true, @@ -991,7 +963,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "endBinding": { "elementId": "id1", "fixedPoint": [ - "-0.05000", + 0, "0.50010", ], "mode": "orbit", @@ -999,7 +971,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "fillStyle": "solid", "frameId": null, "groupIds": [], - "height": "0.00947", + "height": "0.04676", "id": "id4", "index": "a2", "isDeleted": false, @@ -1014,7 +986,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl ], [ 90, - "-0.00947", + "-0.04676", ], ], "roughness": 1, @@ -1025,7 +997,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "startBinding": { "elementId": "id0", "fixedPoint": [ - "1.05000", + 1, "0.50010", ], "mode": "orbit", @@ -1035,10 +1007,10 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "strokeWidth": 2, "type": "arrow", "updated": 1, - "version": 11, + "version": 14, "width": 90, "x": 5, - "y": "0.01000", + "y": "0.05936", } `; @@ -1194,14 +1166,14 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", - "version": 5, + "version": 6, "width": 100, "x": 0, "y": 0, }, "inserted": { "isDeleted": true, - "version": 4, + "version": 5, }, }, }, @@ -1257,7 +1229,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl ], "mode": "inside", }, - "version": 6, + "version": 7, "width": 95, "x": 5, "y": "0.95000", @@ -1282,7 +1254,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl ], "mode": "inside", }, - "version": 5, + "version": 6, "width": 100, "x": 0, "y": 0, @@ -1324,7 +1296,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl ], "mode": "inside", }, - "version": 7, + "version": 8, "y": 0, }, "inserted": { @@ -1347,7 +1319,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl ], "mode": "inside", }, - "version": 6, + "version": 7, "y": "0.95000", }, }, @@ -1368,17 +1340,40 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "updated": { "id4": { "deleted": { + "height": "0.00950", + "points": [ + [ + 0, + 0, + ], + [ + 95, + "-0.00950", + ], + ], "startBinding": { "elementId": "id0", "fixedPoint": [ - "1.05000", + 1, "0.50010", ], "mode": "orbit", }, - "version": 8, + "version": 10, + "y": "0.00950", }, "inserted": { + "height": 0, + "points": [ + [ + 0, + 0, + ], + [ + 95, + 0, + ], + ], "startBinding": { "elementId": "id0", "fixedPoint": [ @@ -1387,7 +1382,8 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl ], "mode": "inside", }, - "version": 7, + "version": 8, + "y": 0, }, }, }, @@ -1407,31 +1403,30 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "updated": { "id4": { "deleted": { - "height": "0.93737", + "height": "0.93837", "points": [ [ 0, 0, ], [ - "90.00000", - "0.93737", + 90, + "0.93837", ], ], "startBinding": { "elementId": "id0", "fixedPoint": [ - "1.05000", + 1, "0.50010", ], "mode": "orbit", }, - "version": 9, - "width": "90.00000", - "y": "0.01000", + "version": 11, + "width": 90, }, "inserted": { - "height": 0, + "height": "0.00950", "points": [ [ 0, @@ -1439,20 +1434,19 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl ], [ 95, - 0, + "-0.00950", ], ], "startBinding": { "elementId": "id0", "fixedPoint": [ - "1.05000", + 1, "0.50010", ], "mode": "orbit", }, - "version": 8, + "version": 10, "width": 95, - "y": 0, }, }, }, @@ -1472,7 +1466,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "updated": { "id4": { "deleted": { - "height": "0.00947", + "height": "0.05886", "points": [ [ 0, @@ -1480,42 +1474,42 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl ], [ 90, - "-0.00947", + "-0.05886", ], ], "startBinding": { "elementId": "id0", "fixedPoint": [ - "1.05000", + 1, "0.50010", ], "mode": "orbit", }, - "version": 10, - "width": 90, + "version": 12, + "y": "0.05936", }, "inserted": { - "height": "0.93737", + "height": "0.93837", "points": [ [ 0, 0, ], [ - "90.00000", - "0.93737", + 90, + "0.93837", ], ], "startBinding": { "elementId": "id0", "fixedPoint": [ - "1.05000", + 1, "0.50010", ], "mode": "orbit", }, - "version": 9, - "width": "90.00000", + "version": 11, + "y": "0.00950", }, }, }, @@ -1553,32 +1547,54 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "endBinding": { "elementId": "id1", "fixedPoint": [ - "-0.05000", + 0, "0.50010", ], "mode": "orbit", }, + "height": "0.04676", + "points": [ + [ + 0, + 0, + ], + [ + 90, + "-0.04676", + ], + ], "startBinding": { "elementId": "id0", "fixedPoint": [ - "1.05000", + 1, "0.50010", ], "mode": "orbit", }, - "version": 11, + "version": 14, }, "inserted": { "endBinding": null, + "height": "0.05886", + "points": [ + [ + 0, + 0, + ], + [ + 90, + "-0.05886", + ], + ], "startBinding": { "elementId": "id0", "fixedPoint": [ - "1.05000", + 1, "0.50010", ], "mode": "orbit", }, - "version": 10, + "version": 12, }, }, }, @@ -1736,7 +1752,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl 0, ], [ - 90, + "90.00000", "31.25668", ], ], @@ -1757,7 +1773,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "type": "arrow", "updated": 1, "version": 7, - "width": 90, + "width": "90.00000", "x": 5, "y": "1.67603", } @@ -2593,74 +2609,10 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "currentItemStrokeStyle": "solid", "currentItemStrokeWidth": 2, "currentItemTextAlign": "left", - "cursorButton": "up", + "cursorButton": "down", "defaultSidebarDockedPreference": false, "editingFrame": null, "editingGroupId": null, - "editingLinearElement": { - "customLineAngle": null, - "elbowed": false, - "elementId": "id4", - "hoverPointIndex": -1, - "isDragging": false, - "isEditing": false, - "lastUncommittedPoint": null, - "pointerDownState": { - "arrowOriginalStartPoint": [ - 0, - 0, - ], - "lastClickedIsEndPoint": false, - "lastClickedPoint": -1, - "origin": null, - "prevSelectedPointsIndices": null, - "segmentMidpoint": { - "added": false, - "index": null, - "value": null, - }, - }, - "pointerOffset": { - "x": 0, - "y": 0, - }, - "segmentMidPointHoveredCoords": null, - "selectedPointsIndices": null, - "startBindingElement": { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": [ - { - "id": "id4", - "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": 1, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 2, - "type": "rectangle", - "updated": 1, - "version": 3, - "versionNonce": 493213705, - "width": 100, - "x": -100, - "y": -50, - }, - }, "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, @@ -2710,7 +2662,9 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "scrollX": 0, "scrollY": 0, "searchMatches": null, - "selectedElementIds": {}, + "selectedElementIds": { + "id4": true, + }, "selectedElementsAreBeingDragged": false, "selectedGroupIds": {}, "selectionElement": null, @@ -2741,7 +2695,12 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl { "angle": 0, "backgroundColor": "transparent", - "boundElements": [], + "boundElements": [ + { + "id": "id4", + "type": "arrow", + }, + ], "customData": undefined, "fillStyle": "solid", "frameId": null, @@ -2760,7 +2719,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "strokeWidth": 2, "type": "rectangle", "updated": 1, - "version": 4, + "version": 7, "width": 100, "x": -100, "y": -50, @@ -2771,7 +2730,12 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl { "angle": 0, "backgroundColor": "transparent", - "boundElements": [], + "boundElements": [ + { + "id": "id4", + "type": "arrow", + }, + ], "customData": undefined, "fillStyle": "solid", "frameId": null, @@ -2790,10 +2754,10 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "strokeWidth": 2, "type": "rectangle", "updated": 1, - "version": 4, + "version": 8, "width": 100, - "x": 100, - "y": -50, + "x": 500, + "y": -500, } `; @@ -2808,7 +2772,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "endBinding": { "elementId": "id1", "fixedPoint": [ - "0.50010", + 0, "0.50010", ], "mode": "orbit", @@ -2816,13 +2780,14 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "fillStyle": "solid", "frameId": null, "groupIds": [], - "height": "0.00633", + "height": "440.95500", "id": "id4", "index": "a2", - "isDeleted": true, + "isDeleted": false, "lastCommittedPoint": null, "link": null, "locked": false, + "moveMidPointsWithElement": false, "opacity": 100, "points": [ [ @@ -2830,8 +2795,8 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl 0, ], [ - "95.00000", - "0.00633", + 490, + "-440.95500", ], ], "roughness": 1, @@ -2845,147 +2810,25 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl 1, "0.50010", ], - "mode": "inside", + "mode": "orbit", }, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", "updated": 1, - "version": 8, - "width": "95.00000", - "x": 0, - "y": 0, + "version": 13, + "width": 490, + "x": 5, + "y": "-4.48954", } `; 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`] = `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] 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] redo stack 1`] = ` -[ - { - "appState": AppStateDelta { - "delta": Delta { - "deleted": { - "selectedElementIds": {}, - "selectedLinearElementId": null, - "selectedLinearElementIsEditing": null, - }, - "inserted": { - "selectedElementIds": { - "id4": true, - }, - "selectedLinearElementId": "id4", - "selectedLinearElementIsEditing": false, - }, - }, - }, - "elements": { - "added": { - "id4": { - "deleted": { - "isDeleted": true, - "version": 8, - }, - "inserted": { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": null, - "customData": undefined, - "elbowed": false, - "endArrowhead": "arrow", - "endBinding": { - "elementId": "id1", - "fixedPoint": [ - "0.50010", - "0.50010", - ], - "mode": "orbit", - }, - "fillStyle": "solid", - "frameId": null, - "groupIds": [], - "height": "0.00633", - "index": "a2", - "isDeleted": false, - "lastCommittedPoint": null, - "link": null, - "locked": false, - "opacity": 100, - "points": [ - [ - 0, - 0, - ], - [ - "95.00000", - "0.00633", - ], - ], - "roughness": 1, - "roundness": { - "type": 2, - }, - "startArrowhead": null, - "startBinding": { - "elementId": "id0", - "fixedPoint": [ - 1, - "0.50010", - ], - "mode": "inside", - }, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 2, - "type": "arrow", - "version": 7, - "width": "95.00000", - "x": 0, - "y": 0, - }, - }, - }, - "removed": {}, - "updated": { - "id0": { - "deleted": { - "boundElements": [], - "version": 4, - }, - "inserted": { - "boundElements": [ - { - "id": "id4", - "type": "arrow", - }, - ], - "version": 3, - }, - }, - "id1": { - "deleted": { - "boundElements": [], - "version": 4, - }, - "inserted": { - "boundElements": [ - { - "id": "id4", - "type": "arrow", - }, - ], - "version": 3, - }, - }, - }, - }, - "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] 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] undo stack 1`] = ` [ @@ -3097,13 +2940,16 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "endArrowhead": "arrow", "endBinding": { "elementId": "id1", - "focus": -0, - "gap": 1, + "fixedPoint": [ + 0, + "0.50010", + ], + "mode": "orbit", }, "fillStyle": "solid", "frameId": null, "groupIds": [], - "height": "370.26975", + "height": "440.95500", "index": "a2", "isDeleted": false, "lastCommittedPoint": null, @@ -3116,8 +2962,8 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl 0, ], [ - "498.00000", - "-370.26975", + 490, + "-440.95500", ], ], "roughness": 1, @@ -3127,21 +2973,24 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "startArrowhead": null, "startBinding": { "elementId": "id0", - "focus": 0, - "gap": 1, + "fixedPoint": [ + 1, + "0.50010", + ], + "mode": "orbit", }, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", - "version": 10, - "width": "498.00000", - "x": 1, - "y": "-37.92697", + "version": 13, + "width": 490, + "x": 5, + "y": "-4.48954", }, "inserted": { "isDeleted": true, - "version": 7, + "version": 10, }, }, }, @@ -7656,37 +7505,6 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh "defaultSidebarDockedPreference": false, "editingFrame": null, "editingGroupId": null, - "editingLinearElement": { - "customLineAngle": null, - "elbowed": false, - "elementId": "id0", - "hoverPointIndex": -1, - "isDragging": false, - "isEditing": false, - "lastUncommittedPoint": null, - "pointerDownState": { - "arrowOriginalStartPoint": [ - 0, - 0, - ], - "lastClickedIsEndPoint": false, - "lastClickedPoint": -1, - "origin": null, - "prevSelectedPointsIndices": null, - "segmentMidpoint": { - "added": false, - "index": null, - "value": null, - }, - }, - "pointerOffset": { - "x": 0, - "y": 0, - }, - "segmentMidPointHoveredCoords": null, - "selectedPointsIndices": null, - "startBindingElement": null, - }, "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, @@ -7807,7 +7625,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, @@ -7829,9 +7647,14 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh "selectedElementIds": { "id0": true, }, + "selectedLinearElement": { + "elementId": "id0", + "isEditing": false, + }, }, "inserted": { "selectedElementIds": {}, + "selectedLinearElement": null, }, }, }, @@ -7845,21 +7668,52 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh { "appState": AppStateDelta { "delta": Delta { - "deleted": { - "selectedLinearElement": { - "elementId": "id0", - "isEditing": false, - }, - }, - "inserted": { - "selectedLinearElement": null, - }, + "deleted": {}, + "inserted": {}, }, }, "elements": { "added": {}, "removed": {}, - "updated": {}, + "updated": { + "id0": { + "deleted": { + "height": 10, + "lastCommittedPoint": [ + 10, + 10, + ], + "points": [ + [ + 0, + 0, + ], + [ + 10, + 10, + ], + ], + "version": 8, + "width": 10, + }, + "inserted": { + "height": 0, + "lastCommittedPoint": null, + "points": [ + [ + 0, + 0, + ], + [ + 0, + 0, + ], + ], + "version": 7, + "width": 0, + }, + }, + }, }, "id": "id14", }, @@ -10593,37 +10447,6 @@ exports[`history > multiplayer undo/redo > should override remotely added points "defaultSidebarDockedPreference": false, "editingFrame": null, "editingGroupId": null, - "editingLinearElement": { - "customLineAngle": null, - "elbowed": false, - "elementId": "id0", - "hoverPointIndex": -1, - "isDragging": false, - "isEditing": false, - "lastUncommittedPoint": null, - "pointerDownState": { - "arrowOriginalStartPoint": [ - 0, - 0, - ], - "lastClickedIsEndPoint": false, - "lastClickedPoint": -1, - "origin": null, - "prevSelectedPointsIndices": null, - "segmentMidpoint": { - "added": false, - "index": null, - "value": null, - }, - }, - "pointerOffset": { - "x": 0, - "y": 0, - }, - "segmentMidPointHoveredCoords": null, - "selectedPointsIndices": null, - "startBindingElement": null, - }, "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, @@ -10714,14 +10537,11 @@ exports[`history > multiplayer undo/redo > should override remotely added points "fillStyle": "solid", "frameId": null, "groupIds": [], - "height": 30, + "height": 0, "id": "id0", "index": "a0", "isDeleted": false, - "lastCommittedPoint": [ - 30, - 30, - ], + "lastCommittedPoint": null, "link": null, "locked": false, "opacity": 100, @@ -10731,20 +10551,8 @@ exports[`history > multiplayer undo/redo > should override remotely added points 0, ], [ - 5, - 5, - ], - [ - 10, - 10, - ], - [ - 15, - 15, - ], - [ - 20, - 20, + 0, + 0, ], ], "roughness": 1, @@ -10758,8 +10566,8 @@ exports[`history > multiplayer undo/redo > should override remotely added points "strokeWidth": 2, "type": "arrow", "updated": 1, - "version": 13, - "width": 30, + "version": 10, + "width": 0, "x": 0, "y": 0, } @@ -10767,85 +10575,10 @@ exports[`history > multiplayer undo/redo > should override remotely added points exports[`history > multiplayer undo/redo > should override remotely added points on undo, but restore them on redo > [end of test] number of elements 1`] = `1`; -exports[`history > multiplayer undo/redo > should override remotely added points on undo, but restore them on redo > [end of test] number of renders 1`] = `14`; +exports[`history > multiplayer undo/redo > should override remotely added points on undo, but restore them on redo > [end of test] number of renders 1`] = `10`; -exports[`history > multiplayer undo/redo > should override remotely added points on undo, but restore them on redo > [end of test] redo stack 1`] = `[]`; - -exports[`history > multiplayer undo/redo > should override remotely added points on undo, but restore them on redo > [end of test] undo stack 1`] = ` +exports[`history > multiplayer undo/redo > should override remotely added points on undo, but restore them on redo > [end of test] redo stack 1`] = ` [ - { - "appState": AppStateDelta { - "delta": Delta { - "deleted": { - "selectedElementIds": { - "id0": true, - }, - }, - "inserted": { - "selectedElementIds": {}, - }, - }, - }, - "elements": { - "added": {}, - "removed": { - "id0": { - "deleted": { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": null, - "customData": undefined, - "elbowed": false, - "endArrowhead": "arrow", - "endBinding": null, - "fillStyle": "solid", - "frameId": null, - "groupIds": [], - "height": 10, - "index": "a0", - "isDeleted": false, - "lastCommittedPoint": [ - 10, - 10, - ], - "link": null, - "locked": false, - "opacity": 100, - "points": [ - [ - 0, - 0, - ], - [ - 10, - 10, - ], - ], - "roughness": 1, - "roundness": { - "type": 2, - }, - "startArrowhead": null, - "startBinding": null, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 2, - "type": "arrow", - "version": 12, - "width": 10, - "x": 0, - "y": 0, - }, - "inserted": { - "isDeleted": true, - "version": 11, - }, - }, - }, - "updated": {}, - }, - "id": "id10", - }, { "appState": AppStateDelta { "delta": Delta { @@ -10859,6 +10592,25 @@ exports[`history > multiplayer undo/redo > should override remotely added points "updated": { "id0": { "deleted": { + "height": 10, + "lastCommittedPoint": [ + 10, + 10, + ], + "points": [ + [ + 0, + 0, + ], + [ + 10, + 10, + ], + ], + "version": 9, + "width": 10, + }, + "inserted": { "height": 30, "lastCommittedPoint": [ 30, @@ -10886,9 +10638,42 @@ exports[`history > multiplayer undo/redo > should override remotely added points 20, ], ], - "version": 13, + "version": 8, "width": 30, }, + }, + }, + }, + "id": "id7", + }, + { + "appState": AppStateDelta { + "delta": Delta { + "deleted": {}, + "inserted": {}, + }, + }, + "elements": { + "added": {}, + "removed": {}, + "updated": { + "id0": { + "deleted": { + "height": 0, + "lastCommittedPoint": null, + "points": [ + [ + 0, + 0, + ], + [ + 0, + 0, + ], + ], + "version": 10, + "width": 0, + }, "inserted": { "height": 10, "lastCommittedPoint": [ @@ -10905,34 +10690,93 @@ exports[`history > multiplayer undo/redo > should override remotely added points 10, ], ], - "version": 12, + "version": 9, "width": 10, }, }, }, }, - "id": "id11", + "id": "id8", }, +] +`; + +exports[`history > multiplayer undo/redo > should override remotely added points on undo, but restore them on redo > [end of test] undo stack 1`] = ` +[ { "appState": AppStateDelta { "delta": Delta { "deleted": { + "selectedElementIds": { + "id0": true, + }, "selectedLinearElement": { "elementId": "id0", "isEditing": false, }, }, "inserted": { + "selectedElementIds": {}, "selectedLinearElement": null, }, }, }, "elements": { "added": {}, - "removed": {}, + "removed": { + "id0": { + "deleted": { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "elbowed": false, + "endArrowhead": "arrow", + "endBinding": null, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 0, + "index": "a0", + "isDeleted": false, + "lastCommittedPoint": null, + "link": null, + "locked": false, + "opacity": 100, + "points": [ + [ + 0, + 0, + ], + [ + 0, + 0, + ], + ], + "roughness": 1, + "roundness": { + "type": 2, + }, + "startArrowhead": null, + "startBinding": null, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "arrow", + "version": 3, + "width": 0, + "x": 0, + "y": 0, + }, + "inserted": { + "isDeleted": true, + "version": 2, + }, + }, + }, "updated": {}, }, - "id": "id12", + "id": "id2", }, ] `; @@ -16230,78 +16074,10 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "currentItemStrokeStyle": "solid", "currentItemStrokeWidth": 2, "currentItemTextAlign": "left", - "cursorButton": "up", + "cursorButton": "down", "defaultSidebarDockedPreference": false, "editingFrame": null, "editingGroupId": null, - "editingLinearElement": { - "customLineAngle": null, - "elbowed": false, - "elementId": "id13", - "hoverPointIndex": -1, - "isDragging": false, - "isEditing": false, - "lastUncommittedPoint": null, - "pointerDownState": { - "arrowOriginalStartPoint": [ - 0, - 0, - ], - "lastClickedIsEndPoint": false, - "lastClickedPoint": -1, - "origin": null, - "prevSelectedPointsIndices": null, - "segmentMidpoint": { - "added": false, - "index": null, - "value": null, - }, - }, - "pointerOffset": { - "x": 0, - "y": 0, - }, - "segmentMidPointHoveredCoords": null, - "selectedPointsIndices": null, - "startBindingElement": { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": [ - { - "id": "id1", - "type": "text", - }, - { - "id": "id13", - "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": 1, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 2, - "type": "rectangle", - "updated": 1, - "version": 4, - "versionNonce": 941653321, - "width": 100, - "x": -100, - "y": -50, - }, - }, "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, @@ -16506,7 +16282,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "endBinding": { "elementId": "id2", "fixedPoint": [ - "0.50010", + 0, "0.50010", ], "mode": "orbit", @@ -16514,7 +16290,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "fillStyle": "solid", "frameId": null, "groupIds": [], - "height": "0.00633", + "height": 0, "id": "id13", "index": "a3", "isDeleted": false, @@ -16528,8 +16304,8 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - "95.00000", - "0.00633", + 90, + 0, ], ], "roughness": 1, @@ -16543,17 +16319,17 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 1, "0.50010", ], - "mode": "inside", + "mode": "orbit", }, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", "updated": 1, - "version": 7, - "width": "95.00000", - "x": 0, - "y": 0, + "version": 9, + "width": 90, + "x": 5, + "y": "0.01000", } `; @@ -16561,85 +16337,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 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": { - "isDeleted": false, - "version": 10, - }, - "inserted": { - "isDeleted": true, - "version": 7, - }, - }, - }, - "updated": { - "id0": { - "deleted": { - "boundElements": [ - { - "id": "id13", - "type": "arrow", - }, - ], - "version": 8, - }, - "inserted": { - "boundElements": [], - "version": 5, - }, - }, - "id1": { - "deleted": { - "version": 6, - }, - "inserted": { - "version": 4, - }, - }, - "id2": { - "deleted": { - "boundElements": [ - { - "id": "id13", - "type": "arrow", - }, - ], - "version": 7, - }, - "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`] = ` [ @@ -16892,7 +16590,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "endBinding": { "elementId": "id2", "fixedPoint": [ - "0.50010", + 0, "0.50010", ], "mode": "orbit", @@ -16900,7 +16598,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "fillStyle": "solid", "frameId": null, "groupIds": [], - "height": "0.00633", + "height": 0, "index": "a3", "isDeleted": false, "lastCommittedPoint": null, @@ -16913,8 +16611,8 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - "95.00000", - "0.00633", + 90, + 0, ], ], "roughness": 1, @@ -16928,20 +16626,20 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 1, "0.50010", ], - "mode": "inside", + "mode": "orbit", }, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", - "version": 7, - "width": "95.00000", - "x": 0, - "y": 0, + "version": 9, + "width": 90, + "x": 5, + "y": "0.01000", }, "inserted": { "isDeleted": true, - "version": 6, + "version": 8, }, }, }, @@ -17014,78 +16712,10 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "currentItemStrokeStyle": "solid", "currentItemStrokeWidth": 2, "currentItemTextAlign": "left", - "cursorButton": "up", + "cursorButton": "down", "defaultSidebarDockedPreference": false, "editingFrame": null, "editingGroupId": null, - "editingLinearElement": { - "customLineAngle": null, - "elbowed": false, - "elementId": "id13", - "hoverPointIndex": -1, - "isDragging": false, - "isEditing": false, - "lastUncommittedPoint": null, - "pointerDownState": { - "arrowOriginalStartPoint": [ - 0, - 0, - ], - "lastClickedIsEndPoint": false, - "lastClickedPoint": -1, - "origin": null, - "prevSelectedPointsIndices": null, - "segmentMidpoint": { - "added": false, - "index": null, - "value": null, - }, - }, - "pointerOffset": { - "x": 0, - "y": 0, - }, - "segmentMidPointHoveredCoords": null, - "selectedPointsIndices": null, - "startBindingElement": { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": [ - { - "id": "id1", - "type": "text", - }, - { - "id": "id13", - "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": 1, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 2, - "type": "rectangle", - "updated": 1, - "version": 4, - "versionNonce": 941653321, - "width": 100, - "x": -100, - "y": -50, - }, - }, "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, @@ -17290,7 +16920,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "endBinding": { "elementId": "id2", "fixedPoint": [ - "0.50010", + 0, "0.50010", ], "mode": "orbit", @@ -17298,7 +16928,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "fillStyle": "solid", "frameId": null, "groupIds": [], - "height": "0.00633", + "height": 0, "id": "id13", "index": "a3", "isDeleted": false, @@ -17312,8 +16942,8 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - "95.00000", - "0.00633", + 90, + 0, ], ], "roughness": 1, @@ -17327,17 +16957,17 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 1, "0.50010", ], - "mode": "inside", + "mode": "orbit", }, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", "updated": 1, - "version": 7, - "width": "95.00000", - "x": 0, - "y": 0, + "version": 9, + "width": 90, + "x": 5, + "y": "0.01000", } `; @@ -17598,7 +17228,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "endBinding": { "elementId": "id2", "fixedPoint": [ - "0.50010", + 0, "0.50010", ], "mode": "orbit", @@ -17606,7 +17236,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "fillStyle": "solid", "frameId": null, "groupIds": [], - "height": "0.00633", + "height": 0, "index": "a3", "isDeleted": false, "lastCommittedPoint": null, @@ -17619,8 +17249,8 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - "95.00000", - "0.00633", + 90, + 0, ], ], "roughness": 1, @@ -17634,20 +17264,20 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 1, "0.50010", ], - "mode": "inside", + "mode": "orbit", }, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", - "version": 7, - "width": "95.00000", - "x": 0, - "y": 0, + "version": 9, + "width": 90, + "x": 5, + "y": "0.01000", }, "inserted": { "isDeleted": true, - "version": 6, + "version": 8, }, }, }, @@ -17720,78 +17350,10 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "currentItemStrokeStyle": "solid", "currentItemStrokeWidth": 2, "currentItemTextAlign": "left", - "cursorButton": "up", + "cursorButton": "down", "defaultSidebarDockedPreference": false, "editingFrame": null, "editingGroupId": null, - "editingLinearElement": { - "customLineAngle": null, - "elbowed": false, - "elementId": "id13", - "hoverPointIndex": -1, - "isDragging": false, - "isEditing": false, - "lastUncommittedPoint": null, - "pointerDownState": { - "arrowOriginalStartPoint": [ - 0, - 0, - ], - "lastClickedIsEndPoint": false, - "lastClickedPoint": -1, - "origin": null, - "prevSelectedPointsIndices": null, - "segmentMidpoint": { - "added": false, - "index": null, - "value": null, - }, - }, - "pointerOffset": { - "x": 0, - "y": 0, - }, - "segmentMidPointHoveredCoords": null, - "selectedPointsIndices": null, - "startBindingElement": { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": [ - { - "id": "id1", - "type": "text", - }, - { - "id": "id13", - "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": 1, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 2, - "type": "rectangle", - "updated": 1, - "version": 4, - "versionNonce": 941653321, - "width": 100, - "x": -100, - "y": -50, - }, - }, "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, @@ -17996,7 +17558,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "endBinding": { "elementId": "id2", "fixedPoint": [ - "0.50010", + 0, "0.50010", ], "mode": "orbit", @@ -18004,7 +17566,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "fillStyle": "solid", "frameId": null, "groupIds": [], - "height": "0.00633", + "height": 0, "id": "id13", "index": "a3", "isDeleted": false, @@ -18018,8 +17580,8 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - "95.00000", - "0.00633", + 90, + 0, ], ], "roughness": 1, @@ -18033,17 +17595,17 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 1, "0.50010", ], - "mode": "inside", + "mode": "orbit", }, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", "updated": 1, - "version": 7, - "width": "95.00000", - "x": 0, - "y": 0, + "version": 9, + "width": 90, + "x": 5, + "y": "0.01000", } `; @@ -18304,7 +17866,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "endBinding": { "elementId": "id2", "fixedPoint": [ - "0.50010", + 0, "0.50010", ], "mode": "orbit", @@ -18312,7 +17874,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "fillStyle": "solid", "frameId": null, "groupIds": [], - "height": "0.00633", + "height": 0, "index": "a3", "isDeleted": false, "lastCommittedPoint": null, @@ -18325,8 +17887,8 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - "95.00000", - "0.00633", + 90, + 0, ], ], "roughness": 1, @@ -18340,20 +17902,20 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 1, "0.50010", ], - "mode": "inside", + "mode": "orbit", }, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", - "version": 7, - "width": "95.00000", - "x": 0, - "y": 0, + "version": 9, + "width": 90, + "x": 5, + "y": "0.01000", }, "inserted": { "isDeleted": true, - "version": 6, + "version": 8, }, }, }, @@ -18426,78 +17988,10 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "currentItemStrokeStyle": "solid", "currentItemStrokeWidth": 2, "currentItemTextAlign": "left", - "cursorButton": "up", + "cursorButton": "down", "defaultSidebarDockedPreference": false, "editingFrame": null, "editingGroupId": null, - "editingLinearElement": { - "customLineAngle": null, - "elbowed": false, - "elementId": "id13", - "hoverPointIndex": -1, - "isDragging": false, - "isEditing": false, - "lastUncommittedPoint": null, - "pointerDownState": { - "arrowOriginalStartPoint": [ - 0, - 0, - ], - "lastClickedIsEndPoint": false, - "lastClickedPoint": -1, - "origin": null, - "prevSelectedPointsIndices": null, - "segmentMidpoint": { - "added": false, - "index": null, - "value": null, - }, - }, - "pointerOffset": { - "x": 0, - "y": 0, - }, - "segmentMidPointHoveredCoords": null, - "selectedPointsIndices": null, - "startBindingElement": { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": [ - { - "id": "id1", - "type": "text", - }, - { - "id": "id13", - "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": 1, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 2, - "type": "rectangle", - "updated": 1, - "version": 4, - "versionNonce": 941653321, - "width": 100, - "x": -100, - "y": -50, - }, - }, "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, @@ -18702,7 +18196,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "endBinding": { "elementId": "id2", "fixedPoint": [ - "0.50010", + 0, "0.50010", ], "mode": "orbit", @@ -18710,7 +18204,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "fillStyle": "solid", "frameId": null, "groupIds": [], - "height": "0.00633", + "height": 0, "id": "id13", "index": "a3", "isDeleted": false, @@ -18724,8 +18218,8 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - "95.00000", - "0.00633", + 90, + 0, ], ], "roughness": 1, @@ -18739,17 +18233,17 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 1, "0.50010", ], - "mode": "inside", + "mode": "orbit", }, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", "updated": 1, - "version": 7, - "width": "95.00000", - "x": 0, - "y": 0, + "version": 9, + "width": 90, + "x": 5, + "y": "0.01000", } `; @@ -19010,7 +18504,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "endBinding": { "elementId": "id2", "fixedPoint": [ - "0.50010", + 0, "0.50010", ], "mode": "orbit", @@ -19018,7 +18512,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "fillStyle": "solid", "frameId": null, "groupIds": [], - "height": "0.00633", + "height": 0, "index": "a3", "isDeleted": false, "lastCommittedPoint": null, @@ -19031,8 +18525,8 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - "95.00000", - "0.00633", + 90, + 0, ], ], "roughness": 1, @@ -19046,20 +18540,20 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 1, "0.50010", ], - "mode": "inside", + "mode": "orbit", }, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", - "version": 7, - "width": "95.00000", - "x": 0, - "y": 0, + "version": 9, + "width": 90, + "x": 5, + "y": "0.01000", }, "inserted": { "isDeleted": true, - "version": 6, + "version": 8, }, }, }, @@ -19098,33 +18592,6 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding }, "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", - }, ] `; @@ -19159,78 +18626,10 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "currentItemStrokeStyle": "solid", "currentItemStrokeWidth": 2, "currentItemTextAlign": "left", - "cursorButton": "up", + "cursorButton": "down", "defaultSidebarDockedPreference": false, "editingFrame": null, "editingGroupId": null, - "editingLinearElement": { - "customLineAngle": null, - "elbowed": false, - "elementId": "id13", - "hoverPointIndex": -1, - "isDragging": false, - "isEditing": false, - "lastUncommittedPoint": null, - "pointerDownState": { - "arrowOriginalStartPoint": [ - 0, - 0, - ], - "lastClickedIsEndPoint": false, - "lastClickedPoint": -1, - "origin": null, - "prevSelectedPointsIndices": null, - "segmentMidpoint": { - "added": false, - "index": null, - "value": null, - }, - }, - "pointerOffset": { - "x": 0, - "y": 0, - }, - "segmentMidPointHoveredCoords": null, - "selectedPointsIndices": null, - "startBindingElement": { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": [ - { - "id": "id1", - "type": "text", - }, - { - "id": "id13", - "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": 1, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 2, - "type": "rectangle", - "updated": 1, - "version": 4, - "versionNonce": 941653321, - "width": 100, - "x": -100, - "y": -50, - }, - }, "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, @@ -19435,7 +18834,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "endBinding": { "elementId": "id2", "fixedPoint": [ - "0.50010", + 0, "0.50010", ], "mode": "orbit", @@ -19443,7 +18842,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "fillStyle": "solid", "frameId": null, "groupIds": [], - "height": "0.00633", + "height": 0, "id": "id13", "index": "a3", "isDeleted": false, @@ -19457,8 +18856,8 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - "95.00000", - "0.00633", + 90, + 0, ], ], "roughness": 1, @@ -19472,17 +18871,17 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 1, "0.50010", ], - "mode": "inside", + "mode": "orbit", }, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", "updated": 1, - "version": 7, - "width": "95.00000", - "x": 0, - "y": 0, + "version": 9, + "width": 90, + "x": 5, + "y": "0.01000", } `; @@ -19743,7 +19142,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "endBinding": { "elementId": "id2", "fixedPoint": [ - "0.50010", + 0, "0.50010", ], "mode": "orbit", @@ -19751,7 +19150,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "fillStyle": "solid", "frameId": null, "groupIds": [], - "height": "0.00633", + "height": 0, "index": "a3", "isDeleted": false, "lastCommittedPoint": null, @@ -19764,8 +19163,8 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - "95.00000", - "0.00633", + 90, + 0, ], ], "roughness": 1, @@ -19779,20 +19178,20 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 1, "0.50010", ], - "mode": "inside", + "mode": "orbit", }, "strokeColor": "#1e1e1e", "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", - "version": 7, - "width": "95.00000", - "x": 0, - "y": 0, + "version": 9, + "width": 90, + "x": 5, + "y": "0.01000", }, "inserted": { "isDeleted": true, - "version": 6, + "version": 8, }, }, }, @@ -19831,53 +19230,6 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding }, "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", - }, ] `; @@ -21363,37 +20715,6 @@ exports[`history > singleplayer undo/redo > should support linear element creati "defaultSidebarDockedPreference": false, "editingFrame": null, "editingGroupId": null, - "editingLinearElement": { - "customLineAngle": null, - "elbowed": false, - "elementId": "id0", - "hoverPointIndex": -1, - "isDragging": false, - "isEditing": false, - "lastUncommittedPoint": null, - "pointerDownState": { - "arrowOriginalStartPoint": [ - 0, - 0, - ], - "lastClickedIsEndPoint": false, - "lastClickedPoint": -1, - "origin": null, - "prevSelectedPointsIndices": null, - "segmentMidpoint": { - "added": false, - "index": null, - "value": null, - }, - }, - "pointerOffset": { - "x": 0, - "y": 0, - }, - "segmentMidPointHoveredCoords": null, - "selectedPointsIndices": null, - "startBindingElement": null, - }, "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, @@ -21450,7 +20771,35 @@ exports[`history > singleplayer undo/redo > should support linear element creati }, "selectedElementsAreBeingDragged": false, "selectedGroupIds": {}, - "selectionElement": null, + "selectionElement": { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 0, + "id": "id9", + "index": null, + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": null, + "seed": 23633383, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "selection", + "updated": 1, + "version": 1, + "versionNonce": 0, + "width": 0, + "x": 20, + "y": 0, + }, "shouldCacheIgnoreZoom": false, "showHyperlinkPopup": false, "showWelcomeScreen": true, @@ -21486,7 +20835,7 @@ exports[`history > singleplayer undo/redo > should support linear element creati "fillStyle": "solid", "frameId": null, "groupIds": [], - "height": 10, + "height": 20, "id": "id0", "index": "a0", "isDeleted": false, @@ -21508,7 +20857,7 @@ exports[`history > singleplayer undo/redo > should support linear element creati ], [ 20, - 0, + 20, ], ], "roughness": 1, @@ -21522,7 +20871,7 @@ exports[`history > singleplayer undo/redo > should support linear element creati "strokeWidth": 2, "type": "arrow", "updated": 1, - "version": 10, + "version": 8, "width": 20, "x": 0, "y": 0, @@ -21531,121 +20880,9 @@ exports[`history > singleplayer undo/redo > should support linear element creati exports[`history > singleplayer undo/redo > should support linear element creation and points manipulation through the editor > [end of test] number of elements 1`] = `1`; -exports[`history > singleplayer undo/redo > should support linear element creation and points manipulation through the editor > [end of test] number of renders 1`] = `12`; +exports[`history > singleplayer undo/redo > should support linear element creation and points manipulation through the editor > [end of test] number of renders 1`] = `10`; -exports[`history > singleplayer undo/redo > should support linear element creation and points manipulation through the editor > [end of test] redo stack 1`] = ` -[ - { - "appState": AppStateDelta { - "delta": Delta { - "deleted": { - "selectedLinearElementIsEditing": true, - }, - "inserted": { - "selectedLinearElementIsEditing": false, - }, - }, - }, - "elements": { - "added": {}, - "removed": {}, - "updated": {}, - }, - "id": "id14", - }, - { - "appState": AppStateDelta { - "delta": Delta { - "deleted": {}, - "inserted": {}, - }, - }, - "elements": { - "added": {}, - "removed": {}, - "updated": { - "id0": { - "deleted": { - "height": 10, - "points": [ - [ - 0, - 0, - ], - [ - 10, - 10, - ], - [ - 20, - 0, - ], - ], - "version": 10, - }, - "inserted": { - "height": 20, - "points": [ - [ - 0, - 0, - ], - [ - 10, - 10, - ], - [ - 20, - 20, - ], - ], - "version": 9, - }, - }, - }, - }, - "id": "id18", - }, - { - "appState": AppStateDelta { - "delta": Delta { - "deleted": { - "selectedLinearElementIsEditing": false, - }, - "inserted": { - "selectedLinearElementIsEditing": true, - }, - }, - }, - "elements": { - "added": {}, - "removed": {}, - "updated": {}, - }, - "id": "id19", - }, - { - "appState": AppStateDelta { - "delta": Delta { - "deleted": { - "selectedLinearElementId": null, - "selectedLinearElementIsEditing": null, - }, - "inserted": { - "selectedLinearElementId": "id0", - "selectedLinearElementIsEditing": false, - }, - }, - }, - "elements": { - "added": {}, - "removed": {}, - "updated": {}, - }, - "id": "id20", - }, -] -`; +exports[`history > singleplayer undo/redo > should support linear element creation and points manipulation through the editor > [end of test] redo stack 1`] = `[]`; exports[`history > singleplayer undo/redo > should support linear element creation and points manipulation through the editor > [end of test] undo stack 1`] = ` [ @@ -21656,9 +20893,14 @@ exports[`history > singleplayer undo/redo > should support linear element creati "selectedElementIds": { "id0": true, }, + "selectedLinearElement": { + "elementId": "id0", + "isEditing": false, + }, }, "inserted": { "selectedElementIds": {}, + "selectedLinearElement": null, }, }, }, @@ -21677,13 +20919,10 @@ exports[`history > singleplayer undo/redo > should support linear element creati "fillStyle": "solid", "frameId": null, "groupIds": [], - "height": 10, + "height": 0, "index": "a0", "isDeleted": false, - "lastCommittedPoint": [ - 10, - 10, - ], + "lastCommittedPoint": null, "link": null, "locked": false, "opacity": 100, @@ -21693,8 +20932,8 @@ exports[`history > singleplayer undo/redo > should support linear element creati 0, ], [ - 10, - 10, + 0, + 0, ], ], "roughness": 1, @@ -21707,14 +20946,14 @@ exports[`history > singleplayer undo/redo > should support linear element creati "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", - "version": 6, - "width": 10, + "version": 3, + "width": 0, "x": 0, "y": 0, }, "inserted": { "isDeleted": true, - "version": 5, + "version": 2, }, }, }, @@ -21722,6 +20961,58 @@ exports[`history > singleplayer undo/redo > should support linear element creati }, "id": "id2", }, + { + "appState": AppStateDelta { + "delta": Delta { + "deleted": {}, + "inserted": {}, + }, + }, + "elements": { + "added": {}, + "removed": {}, + "updated": { + "id0": { + "deleted": { + "height": 10, + "lastCommittedPoint": [ + 10, + 10, + ], + "points": [ + [ + 0, + 0, + ], + [ + 10, + 10, + ], + ], + "version": 5, + "width": 10, + }, + "inserted": { + "height": 0, + "lastCommittedPoint": null, + "points": [ + [ + 0, + 0, + ], + [ + 0, + 0, + ], + ], + "version": 3, + "width": 0, + }, + }, + }, + }, + "id": "id4", + }, { "appState": AppStateDelta { "delta": Delta { @@ -21753,7 +21044,7 @@ exports[`history > singleplayer undo/redo > should support linear element creati 0, ], ], - "version": 8, + "version": 7, "width": 20, }, "inserted": { @@ -21771,34 +21062,13 @@ exports[`history > singleplayer undo/redo > should support linear element creati 10, ], ], - "version": 6, + "version": 5, "width": 10, }, }, }, }, - "id": "id24", - }, - { - "appState": AppStateDelta { - "delta": Delta { - "deleted": { - "selectedLinearElement": { - "elementId": "id0", - "isEditing": false, - }, - }, - "inserted": { - "selectedLinearElement": null, - }, - }, - }, - "elements": { - "added": {}, - "removed": {}, - "updated": {}, - }, - "id": "id25", + "id": "id6", }, { "appState": AppStateDelta { @@ -21822,7 +21092,7 @@ exports[`history > singleplayer undo/redo > should support linear element creati "removed": {}, "updated": {}, }, - "id": "id26", + "id": "id8", }, { "appState": AppStateDelta { @@ -21852,7 +21122,7 @@ exports[`history > singleplayer undo/redo > should support linear element creati 20, ], ], - "version": 15, + "version": 8, }, "inserted": { "height": 10, @@ -21870,12 +21140,12 @@ exports[`history > singleplayer undo/redo > should support linear element creati 0, ], ], - "version": 14, + "version": 7, }, }, }, }, - "id": "id27", + "id": "id11", }, { "appState": AppStateDelta { @@ -21899,7 +21169,7 @@ exports[`history > singleplayer undo/redo > should support linear element creati "removed": {}, "updated": {}, }, - "id": "id28", + "id": "id13", }, ] `; diff --git a/packages/excalidraw/tests/__snapshots__/multiPointCreate.test.tsx.snap b/packages/excalidraw/tests/__snapshots__/multiPointCreate.test.tsx.snap index ee3f02490..821f1f6be 100644 --- a/packages/excalidraw/tests/__snapshots__/multiPointCreate.test.tsx.snap +++ b/packages/excalidraw/tests/__snapshots__/multiPointCreate.test.tsx.snap @@ -49,8 +49,8 @@ exports[`multi point mode in linear elements > arrow 3`] = ` "strokeWidth": 2, "type": "arrow", "updated": 1, - "version": 8, - "versionNonce": 1604849351, + "version": 7, + "versionNonce": 400692809, "width": 70, "x": 30, "y": 30, @@ -104,8 +104,8 @@ exports[`multi point mode in linear elements > line 3`] = ` "strokeWidth": 2, "type": "line", "updated": 1, - "version": 8, - "versionNonce": 1604849351, + "version": 7, + "versionNonce": 400692809, "width": 70, "x": 30, "y": 30, diff --git a/packages/excalidraw/tests/__snapshots__/regressionTests.test.tsx.snap b/packages/excalidraw/tests/__snapshots__/regressionTests.test.tsx.snap index 57c7b85e0..b9665b0e1 100644 --- a/packages/excalidraw/tests/__snapshots__/regressionTests.test.tsx.snap +++ b/packages/excalidraw/tests/__snapshots__/regressionTests.test.tsx.snap @@ -6161,7 +6161,6 @@ exports[`regression tests > draw every type of shape > [end of test] appState 1` "defaultSidebarDockedPreference": false, "editingFrame": null, "editingGroupId": null, - "editingLinearElement": null, "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, @@ -6571,7 +6570,10 @@ exports[`regression tests > draw every type of shape > [end of test] undo stack "selectedElementIds": { "id15": true, }, - "selectedLinearElement": null, + "selectedLinearElement": { + "elementId": "id15", + "isEditing": false, + }, }, "inserted": { "selectedElementIds": { @@ -6599,13 +6601,10 @@ exports[`regression tests > draw every type of shape > [end of test] undo stack "fillStyle": "solid", "frameId": null, "groupIds": [], - "height": 10, + "height": 0, "index": "a5", "isDeleted": false, - "lastCommittedPoint": [ - 50, - 10, - ], + "lastCommittedPoint": null, "link": null, "locked": false, "opacity": 100, @@ -6615,8 +6614,8 @@ exports[`regression tests > draw every type of shape > [end of test] undo stack 0, ], [ - 50, - 10, + 0, + 0, ], ], "roughness": 1, @@ -6629,14 +6628,14 @@ exports[`regression tests > draw every type of shape > [end of test] undo stack "strokeStyle": "solid", "strokeWidth": 2, "type": "arrow", - "version": 6, - "width": 50, + "version": 3, + "width": 0, "x": 310, "y": -10, }, "inserted": { "isDeleted": true, - "version": 5, + "version": 2, }, }, }, @@ -6644,6 +6643,58 @@ exports[`regression tests > draw every type of shape > [end of test] undo stack }, "id": "id17", }, + { + "appState": AppStateDelta { + "delta": Delta { + "deleted": {}, + "inserted": {}, + }, + }, + "elements": { + "added": {}, + "removed": {}, + "updated": { + "id15": { + "deleted": { + "height": 10, + "lastCommittedPoint": [ + 50, + 10, + ], + "points": [ + [ + 0, + 0, + ], + [ + 50, + 10, + ], + ], + "version": 5, + "width": 50, + }, + "inserted": { + "height": 0, + "lastCommittedPoint": null, + "points": [ + [ + 0, + 0, + ], + [ + 0, + 0, + ], + ], + "version": 3, + "width": 0, + }, + }, + }, + }, + "id": "id19", + }, { "appState": AppStateDelta { "delta": Delta { @@ -6676,7 +6727,7 @@ exports[`regression tests > draw every type of shape > [end of test] undo stack 20, ], ], - "version": 8, + "version": 7, "width": 80, }, "inserted": { @@ -6695,42 +6746,19 @@ exports[`regression tests > draw every type of shape > [end of test] undo stack 10, ], ], - "version": 6, + "version": 5, "width": 50, }, }, }, }, - "id": "id19", - }, - { - "appState": AppStateDelta { - "delta": Delta { - "deleted": { - "selectedLinearElement": { - "elementId": "id15", - "isEditing": false, - }, - }, - "inserted": { - "selectedLinearElement": null, - }, - }, - }, - "elements": { - "added": {}, - "removed": {}, - "updated": {}, - }, "id": "id21", }, { "appState": AppStateDelta { "delta": Delta { "deleted": { - "selectedElementIds": { - "id22": true, - }, + "selectedElementIds": {}, "selectedLinearElement": null, }, "inserted": { @@ -6758,13 +6786,10 @@ exports[`regression tests > draw every type of shape > [end of test] undo stack "fillStyle": "solid", "frameId": null, "groupIds": [], - "height": 10, + "height": 0, "index": "a6", "isDeleted": false, - "lastCommittedPoint": [ - 50, - 10, - ], + "lastCommittedPoint": null, "link": null, "locked": false, "opacity": 100, @@ -6774,8 +6799,8 @@ exports[`regression tests > draw every type of shape > [end of test] undo stack 0, ], [ - 50, - 10, + 0, + 0, ], ], "polygon": false, @@ -6787,14 +6812,14 @@ exports[`regression tests > draw every type of shape > [end of test] undo stack "strokeStyle": "solid", "strokeWidth": 2, "type": "line", - "version": 6, - "width": 50, + "version": 3, + "width": 0, "x": 430, "y": -10, }, "inserted": { "isDeleted": true, - "version": 5, + "version": 2, }, }, }, @@ -6802,6 +6827,64 @@ exports[`regression tests > draw every type of shape > [end of test] undo stack }, "id": "id24", }, + { + "appState": AppStateDelta { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id22": true, + }, + }, + "inserted": { + "selectedElementIds": {}, + }, + }, + }, + "elements": { + "added": {}, + "removed": {}, + "updated": { + "id22": { + "deleted": { + "height": 10, + "lastCommittedPoint": [ + 50, + 10, + ], + "points": [ + [ + 0, + 0, + ], + [ + 50, + 10, + ], + ], + "version": 5, + "width": 50, + }, + "inserted": { + "height": 0, + "lastCommittedPoint": null, + "points": [ + [ + 0, + 0, + ], + [ + 0, + 0, + ], + ], + "version": 3, + "width": 0, + }, + }, + }, + }, + "id": "id26", + }, { "appState": AppStateDelta { "delta": Delta { @@ -6834,7 +6917,7 @@ exports[`regression tests > draw every type of shape > [end of test] undo stack 20, ], ], - "version": 8, + "version": 7, "width": 80, }, "inserted": { @@ -6853,13 +6936,13 @@ exports[`regression tests > draw every type of shape > [end of test] undo stack 10, ], ], - "version": 6, + "version": 5, "width": 50, }, }, }, }, - "id": "id26", + "id": "id28", }, { "appState": AppStateDelta { @@ -6880,7 +6963,7 @@ exports[`regression tests > draw every type of shape > [end of test] undo stack "removed": {}, "updated": {}, }, - "id": "id28", + "id": "id30", }, { "appState": AppStateDelta { @@ -6900,7 +6983,7 @@ exports[`regression tests > draw every type of shape > [end of test] undo stack "removed": {}, "updated": {}, }, - "id": "id30", + "id": "id32", }, { "appState": AppStateDelta { @@ -6919,7 +7002,7 @@ exports[`regression tests > draw every type of shape > [end of test] undo stack "elements": { "added": {}, "removed": { - "id31": { + "id33": { "deleted": { "angle": 0, "backgroundColor": "transparent", @@ -6977,7 +7060,7 @@ exports[`regression tests > draw every type of shape > [end of test] undo stack }, "updated": {}, }, - "id": "id33", + "id": "id35", }, ] `; @@ -8634,41 +8717,10 @@ exports[`regression tests > key 5 selects arrow tool > [end of test] appState 1` "currentItemStrokeStyle": "solid", "currentItemStrokeWidth": 2, "currentItemTextAlign": "left", - "cursorButton": "up", + "cursorButton": "down", "defaultSidebarDockedPreference": false, "editingFrame": null, "editingGroupId": null, - "editingLinearElement": { - "customLineAngle": null, - "elbowed": false, - "elementId": "id0", - "hoverPointIndex": -1, - "isDragging": false, - "isEditing": false, - "lastUncommittedPoint": null, - "pointerDownState": { - "arrowOriginalStartPoint": [ - 10, - 10, - ], - "lastClickedIsEndPoint": false, - "lastClickedPoint": -1, - "origin": null, - "prevSelectedPointsIndices": null, - "segmentMidpoint": { - "added": false, - "index": null, - "value": null, - }, - }, - "pointerOffset": { - "x": 0, - "y": 0, - }, - "segmentMidPointHoveredCoords": null, - "selectedPointsIndices": null, - "startBindingElement": null, - }, "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, @@ -8734,6 +8786,7 @@ exports[`regression tests > key 5 selects arrow tool > [end of test] appState 1` "isEditing": false, "lastUncommittedPoint": null, "pointerDownState": { + "arrowStartIsInside": false, "lastClickedIsEndPoint": false, "lastClickedPoint": -1, "origin": null, @@ -8896,7 +8949,6 @@ exports[`regression tests > key 6 selects line tool > [end of test] appState 1`] "defaultSidebarDockedPreference": false, "editingFrame": null, "editingGroupId": null, - "editingLinearElement": null, "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, @@ -8962,6 +9014,7 @@ exports[`regression tests > key 6 selects line tool > [end of test] appState 1`] "isEditing": false, "lastUncommittedPoint": null, "pointerDownState": { + "arrowStartIsInside": false, "lastClickedIsEndPoint": false, "lastClickedPoint": -1, "origin": null, @@ -9313,41 +9366,10 @@ exports[`regression tests > key a selects arrow tool > [end of test] appState 1` "currentItemStrokeStyle": "solid", "currentItemStrokeWidth": 2, "currentItemTextAlign": "left", - "cursorButton": "up", + "cursorButton": "down", "defaultSidebarDockedPreference": false, "editingFrame": null, "editingGroupId": null, - "editingLinearElement": { - "customLineAngle": null, - "elbowed": false, - "elementId": "id0", - "hoverPointIndex": -1, - "isDragging": false, - "isEditing": false, - "lastUncommittedPoint": null, - "pointerDownState": { - "arrowOriginalStartPoint": [ - 10, - 10, - ], - "lastClickedIsEndPoint": false, - "lastClickedPoint": -1, - "origin": null, - "prevSelectedPointsIndices": null, - "segmentMidpoint": { - "added": false, - "index": null, - "value": null, - }, - }, - "pointerOffset": { - "x": 0, - "y": 0, - }, - "segmentMidPointHoveredCoords": null, - "selectedPointsIndices": null, - "startBindingElement": null, - }, "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, @@ -9413,6 +9435,7 @@ exports[`regression tests > key a selects arrow tool > [end of test] appState 1` "isEditing": false, "lastUncommittedPoint": null, "pointerDownState": { + "arrowStartIsInside": false, "lastClickedIsEndPoint": false, "lastClickedPoint": -1, "origin": null, @@ -9754,7 +9777,6 @@ exports[`regression tests > key l selects line tool > [end of test] appState 1`] "defaultSidebarDockedPreference": false, "editingFrame": null, "editingGroupId": null, - "editingLinearElement": null, "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, @@ -9820,6 +9842,7 @@ exports[`regression tests > key l selects line tool > [end of test] appState 1`] "isEditing": false, "lastUncommittedPoint": null, "pointerDownState": { + "arrowStartIsInside": false, "lastClickedIsEndPoint": false, "lastClickedPoint": -1, "origin": null, @@ -14526,37 +14549,6 @@ exports[`regression tests > undo/redo drawing an element > [end of test] appStat "defaultSidebarDockedPreference": false, "editingFrame": null, "editingGroupId": null, - "editingLinearElement": { - "customLineAngle": null, - "elbowed": false, - "elementId": "id6", - "hoverPointIndex": -1, - "isDragging": false, - "isEditing": false, - "lastUncommittedPoint": null, - "pointerDownState": { - "arrowOriginalStartPoint": [ - 130, - 10, - ], - "lastClickedIsEndPoint": false, - "lastClickedPoint": -1, - "origin": null, - "prevSelectedPointsIndices": null, - "segmentMidpoint": { - "added": false, - "index": null, - "value": null, - }, - }, - "pointerOffset": { - "x": 0, - "y": 0, - }, - "segmentMidPointHoveredCoords": null, - "selectedPointsIndices": null, - "startBindingElement": null, - }, "editingTextElement": null, "elementsToHighlight": null, "errorMessage": null, @@ -14644,27 +14636,6 @@ exports[`regression tests > undo/redo drawing an element > [end of test] number exports[`regression tests > undo/redo drawing an element > [end of test] redo stack 1`] = ` [ - { - "appState": AppStateDelta { - "delta": Delta { - "deleted": { - "selectedLinearElement": null, - }, - "inserted": { - "selectedLinearElement": { - "elementId": "id6", - "isEditing": false, - }, - }, - }, - }, - "elements": { - "added": {}, - "removed": {}, - "updated": {}, - }, - "id": "id13", - }, { "appState": AppStateDelta { "delta": Delta { @@ -14693,7 +14664,7 @@ exports[`regression tests > undo/redo drawing an element > [end of test] redo st 10, ], ], - "version": 9, + "version": 8, "width": 60, }, "inserted": { @@ -14716,12 +14687,64 @@ exports[`regression tests > undo/redo drawing an element > [end of test] redo st 20, ], ], - "version": 8, + "version": 7, "width": 100, }, }, }, }, + "id": "id13", + }, + { + "appState": AppStateDelta { + "delta": Delta { + "deleted": {}, + "inserted": {}, + }, + }, + "elements": { + "added": {}, + "removed": {}, + "updated": { + "id6": { + "deleted": { + "height": 0, + "lastCommittedPoint": null, + "points": [ + [ + 0, + 0, + ], + [ + 0, + 0, + ], + ], + "version": 9, + "width": 0, + }, + "inserted": { + "height": 10, + "lastCommittedPoint": [ + 60, + 10, + ], + "points": [ + [ + 0, + 0, + ], + [ + 60, + 10, + ], + ], + "version": 8, + "width": 60, + }, + }, + }, + }, "id": "id14", }, { @@ -14731,11 +14754,16 @@ exports[`regression tests > undo/redo drawing an element > [end of test] redo st "selectedElementIds": { "id3": true, }, + "selectedLinearElement": null, }, "inserted": { "selectedElementIds": { "id6": true, }, + "selectedLinearElement": { + "elementId": "id6", + "isEditing": false, + }, }, }, }, @@ -14757,13 +14785,10 @@ exports[`regression tests > undo/redo drawing an element > [end of test] redo st "fillStyle": "solid", "frameId": null, "groupIds": [], - "height": 10, + "height": 0, "index": "a2", "isDeleted": false, - "lastCommittedPoint": [ - 60, - 10, - ], + "lastCommittedPoint": null, "link": null, "locked": false, "opacity": 100, @@ -14773,8 +14798,8 @@ exports[`regression tests > undo/redo drawing an element > [end of test] redo st 0, ], [ - 60, - 10, + 0, + 0, ], ], "roughness": 1, @@ -14788,7 +14813,7 @@ exports[`regression tests > undo/redo drawing an element > [end of test] redo st "strokeWidth": 2, "type": "arrow", "version": 9, - "width": 60, + "width": 0, "x": 130, "y": 10, },