diff --git a/packages/element/src/resizeElements.ts b/packages/element/src/resizeElements.ts index 3bd038f1ba..b059e0dec4 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 afd9e11a38..35e940d32e 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 24bd7ea655..c6fbf1a83a 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 f1306b8728..de6085866e 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 bcfab85206..47fcd64bea 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 3e1092922a..cd95bedf92 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 b1b1570e9c..b620abfe55 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 459a241476..ced728d63f 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", } `; @@ -635,14 +599,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, }, }, }, @@ -698,7 +662,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", @@ -723,7 +687,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl ], "mode": "inside", }, - "version": 5, + "version": 6, "width": 100, "x": 0, "y": 0, @@ -746,17 +710,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": [ @@ -765,7 +752,8 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl ], "mode": "inside", }, - "version": 6, + "version": 7, + "y": "0.95000", }, }, }, @@ -785,7 +773,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "updated": { "id4": { "deleted": { - "height": "0.04737", + "height": "0.93837", "points": [ [ 0, @@ -793,23 +781,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, @@ -817,20 +804,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", }, }, }, @@ -868,32 +854,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, }, }, }, @@ -934,74 +942,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, @@ -1058,7 +1002,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, @@ -1163,7 +1135,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "endBinding": { "elementId": "id1", "fixedPoint": [ - "-0.05000", + 0, "0.50010", ], "mode": "orbit", @@ -1171,7 +1143,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, @@ -1186,7 +1158,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl ], [ 90, - "-0.00947", + "-0.04676", ], ], "roughness": 1, @@ -1197,7 +1169,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "startBinding": { "elementId": "id0", "fixedPoint": [ - "1.05000", + 1, "0.50010", ], "mode": "orbit", @@ -1207,10 +1179,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", } `; @@ -1457,14 +1429,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, }, }, }, @@ -1520,7 +1492,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", @@ -1545,7 +1517,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl ], "mode": "inside", }, - "version": 5, + "version": 6, "width": 100, "x": 0, "y": 0, @@ -1587,7 +1559,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl ], "mode": "inside", }, - "version": 7, + "version": 8, "y": 0, }, "inserted": { @@ -1610,7 +1582,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl ], "mode": "inside", }, - "version": 6, + "version": 7, "y": "0.95000", }, }, @@ -1631,17 +1603,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": [ @@ -1650,7 +1645,8 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl ], "mode": "inside", }, - "version": 7, + "version": 8, + "y": 0, }, }, }, @@ -1670,31 +1666,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, @@ -1702,20 +1697,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, }, }, }, @@ -1735,7 +1729,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "updated": { "id4": { "deleted": { - "height": "0.00947", + "height": "0.05886", "points": [ [ 0, @@ -1743,42 +1737,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", }, }, }, @@ -1816,32 +1810,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, }, }, }, @@ -1999,7 +2015,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl 0, ], [ - 90, + "90.00000", "31.25668", ], ], @@ -2020,7 +2036,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", } @@ -2856,74 +2872,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, @@ -2973,7 +2925,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, @@ -3004,7 +2958,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, @@ -3023,7 +2982,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, @@ -3034,7 +2993,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, @@ -3053,10 +3017,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, } `; @@ -3071,7 +3035,7 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "endBinding": { "elementId": "id1", "fixedPoint": [ - "0.50010", + 0, "0.50010", ], "mode": "orbit", @@ -3079,13 +3043,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": [ [ @@ -3093,8 +3058,8 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl 0, ], [ - "95.00000", - "0.00633", + 490, + "-440.95500", ], ], "roughness": 1, @@ -3108,147 +3073,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`] = ` [ @@ -3360,13 +3203,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, @@ -3379,8 +3225,8 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl 0, ], [ - "498.00000", - "-370.26975", + 490, + "-440.95500", ], ], "roughness": 1, @@ -3390,21 +3236,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, }, }, }, @@ -7945,37 +7794,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, @@ -8118,9 +7936,14 @@ exports[`history > multiplayer undo/redo > should iterate through the history wh "selectedElementIds": { "id0": true, }, + "selectedLinearElement": { + "elementId": "id0", + "isEditing": false, + }, }, "inserted": { "selectedElementIds": {}, + "selectedLinearElement": null, }, }, }, @@ -8134,21 +7957,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", }, @@ -10882,37 +10736,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, @@ -11003,14 +10826,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, @@ -11020,20 +10840,8 @@ exports[`history > multiplayer undo/redo > should override remotely added points 0, ], [ - 5, - 5, - ], - [ - 10, - 10, - ], - [ - 15, - 15, - ], - [ - 20, - 20, + 0, + 0, ], ], "roughness": 1, @@ -11047,8 +10855,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, } @@ -11056,85 +10864,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 { @@ -11148,6 +10881,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, @@ -11175,9 +10927,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": [ @@ -11194,34 +10979,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", }, ] `; @@ -16519,78 +16363,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, @@ -16795,7 +16571,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "endBinding": { "elementId": "id2", "fixedPoint": [ - "0.50010", + 0, "0.50010", ], "mode": "orbit", @@ -16803,7 +16579,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, @@ -16817,8 +16593,8 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - "95.00000", - "0.00633", + 90, + 0, ], ], "roughness": 1, @@ -16832,17 +16608,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", } `; @@ -17173,7 +16949,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "endBinding": { "elementId": "id2", "fixedPoint": [ - "0.50010", + 0, "0.50010", ], "mode": "orbit", @@ -17181,7 +16957,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, @@ -17194,8 +16970,8 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - "95.00000", - "0.00633", + 90, + 0, ], ], "roughness": 1, @@ -17209,20 +16985,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, }, }, }, @@ -17295,78 +17071,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, @@ -17571,7 +17279,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "endBinding": { "elementId": "id2", "fixedPoint": [ - "0.50010", + 0, "0.50010", ], "mode": "orbit", @@ -17579,7 +17287,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, @@ -17593,8 +17301,8 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - "95.00000", - "0.00633", + 90, + 0, ], ], "roughness": 1, @@ -17608,17 +17316,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", } `; @@ -17879,7 +17587,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "endBinding": { "elementId": "id2", "fixedPoint": [ - "0.50010", + 0, "0.50010", ], "mode": "orbit", @@ -17887,7 +17595,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, @@ -17900,8 +17608,8 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - "95.00000", - "0.00633", + 90, + 0, ], ], "roughness": 1, @@ -17915,20 +17623,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, }, }, }, @@ -18001,78 +17709,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, @@ -18277,7 +17917,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "endBinding": { "elementId": "id2", "fixedPoint": [ - "0.50010", + 0, "0.50010", ], "mode": "orbit", @@ -18285,7 +17925,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, @@ -18299,8 +17939,8 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - "95.00000", - "0.00633", + 90, + 0, ], ], "roughness": 1, @@ -18314,17 +17954,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", } `; @@ -18585,7 +18225,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "endBinding": { "elementId": "id2", "fixedPoint": [ - "0.50010", + 0, "0.50010", ], "mode": "orbit", @@ -18593,7 +18233,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, @@ -18606,8 +18246,8 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - "95.00000", - "0.00633", + 90, + 0, ], ], "roughness": 1, @@ -18621,20 +18261,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, }, }, }, @@ -18707,78 +18347,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, @@ -18983,7 +18555,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "endBinding": { "elementId": "id2", "fixedPoint": [ - "0.50010", + 0, "0.50010", ], "mode": "orbit", @@ -18991,7 +18563,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, @@ -19005,8 +18577,8 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - "95.00000", - "0.00633", + 90, + 0, ], ], "roughness": 1, @@ -19020,17 +18592,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", } `; @@ -19350,7 +18922,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "endBinding": { "elementId": "id2", "fixedPoint": [ - "0.50010", + 0, "0.50010", ], "mode": "orbit", @@ -19358,7 +18930,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, @@ -19371,8 +18943,8 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - "95.00000", - "0.00633", + 90, + 0, ], ], "roughness": 1, @@ -19386,20 +18958,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, }, }, }, @@ -19438,33 +19010,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", - }, ] `; @@ -19499,78 +19044,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, @@ -19775,7 +19252,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "endBinding": { "elementId": "id2", "fixedPoint": [ - "0.50010", + 0, "0.50010", ], "mode": "orbit", @@ -19783,7 +19260,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, @@ -19797,8 +19274,8 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - "95.00000", - "0.00633", + 90, + 0, ], ], "roughness": 1, @@ -19812,17 +19289,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", } `; @@ -20083,7 +19560,7 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding "endBinding": { "elementId": "id2", "fixedPoint": [ - "0.50010", + 0, "0.50010", ], "mode": "orbit", @@ -20091,7 +19568,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, @@ -20104,8 +19581,8 @@ exports[`history > singleplayer undo/redo > should support bidirectional binding 0, ], [ - "95.00000", - "0.00633", + 90, + 0, ], ], "roughness": 1, @@ -20119,20 +19596,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, }, }, }, @@ -20171,53 +19648,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", - }, ] `; @@ -21703,37 +21133,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, @@ -21790,7 +21189,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, @@ -21826,7 +21253,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, @@ -21848,7 +21275,7 @@ exports[`history > singleplayer undo/redo > should support linear element creati ], [ 20, - 0, + 20, ], ], "roughness": 1, @@ -21862,7 +21289,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, @@ -21871,121 +21298,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`] = ` [ @@ -21996,9 +21311,14 @@ exports[`history > singleplayer undo/redo > should support linear element creati "selectedElementIds": { "id0": true, }, + "selectedLinearElement": { + "elementId": "id0", + "isEditing": false, + }, }, "inserted": { "selectedElementIds": {}, + "selectedLinearElement": null, }, }, }, @@ -22017,13 +21337,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, @@ -22033,8 +21350,8 @@ exports[`history > singleplayer undo/redo > should support linear element creati 0, ], [ - 10, - 10, + 0, + 0, ], ], "roughness": 1, @@ -22047,14 +21364,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, }, }, }, @@ -22062,6 +21379,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 { @@ -22093,7 +21462,7 @@ exports[`history > singleplayer undo/redo > should support linear element creati 0, ], ], - "version": 8, + "version": 7, "width": 20, }, "inserted": { @@ -22111,34 +21480,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 { @@ -22162,7 +21510,7 @@ exports[`history > singleplayer undo/redo > should support linear element creati "removed": {}, "updated": {}, }, - "id": "id26", + "id": "id8", }, { "appState": AppStateDelta { @@ -22192,7 +21540,7 @@ exports[`history > singleplayer undo/redo > should support linear element creati 20, ], ], - "version": 15, + "version": 8, }, "inserted": { "height": 10, @@ -22210,12 +21558,12 @@ exports[`history > singleplayer undo/redo > should support linear element creati 0, ], ], - "version": 14, + "version": 7, }, }, }, }, - "id": "id27", + "id": "id11", }, { "appState": AppStateDelta { @@ -22239,7 +21587,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 ee3f024903..821f1f6be3 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 a71387a73b..0fe17dc5f8 100644 --- a/packages/excalidraw/tests/__snapshots__/regressionTests.test.tsx.snap +++ b/packages/excalidraw/tests/__snapshots__/regressionTests.test.tsx.snap @@ -6152,7 +6152,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, @@ -6562,7 +6561,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": { @@ -6590,13 +6592,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, @@ -6606,8 +6605,8 @@ exports[`regression tests > draw every type of shape > [end of test] undo stack 0, ], [ - 50, - 10, + 0, + 0, ], ], "roughness": 1, @@ -6620,14 +6619,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, }, }, }, @@ -6635,6 +6634,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 { @@ -6667,7 +6718,7 @@ exports[`regression tests > draw every type of shape > [end of test] undo stack 20, ], ], - "version": 8, + "version": 7, "width": 80, }, "inserted": { @@ -6686,42 +6737,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": { @@ -6749,13 +6777,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, @@ -6765,8 +6790,8 @@ exports[`regression tests > draw every type of shape > [end of test] undo stack 0, ], [ - 50, - 10, + 0, + 0, ], ], "polygon": false, @@ -6778,14 +6803,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, }, }, }, @@ -6793,6 +6818,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 { @@ -6825,7 +6908,7 @@ exports[`regression tests > draw every type of shape > [end of test] undo stack 20, ], ], - "version": 8, + "version": 7, "width": 80, }, "inserted": { @@ -6844,13 +6927,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 { @@ -6871,7 +6954,7 @@ exports[`regression tests > draw every type of shape > [end of test] undo stack "removed": {}, "updated": {}, }, - "id": "id28", + "id": "id30", }, { "appState": AppStateDelta { @@ -6891,7 +6974,7 @@ exports[`regression tests > draw every type of shape > [end of test] undo stack "removed": {}, "updated": {}, }, - "id": "id30", + "id": "id32", }, { "appState": AppStateDelta { @@ -6910,7 +6993,7 @@ exports[`regression tests > draw every type of shape > [end of test] undo stack "elements": { "added": {}, "removed": { - "id31": { + "id33": { "deleted": { "angle": 0, "backgroundColor": "transparent", @@ -6968,7 +7051,7 @@ exports[`regression tests > draw every type of shape > [end of test] undo stack }, "updated": {}, }, - "id": "id33", + "id": "id35", }, ] `; @@ -8625,41 +8708,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, @@ -8725,6 +8777,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, @@ -8887,7 +8940,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, @@ -8953,6 +9005,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, @@ -9304,41 +9357,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, @@ -9404,6 +9426,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, @@ -9745,7 +9768,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, @@ -9811,6 +9833,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, @@ -14492,37 +14515,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, @@ -14610,27 +14602,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 { @@ -14659,7 +14630,7 @@ exports[`regression tests > undo/redo drawing an element > [end of test] redo st 10, ], ], - "version": 9, + "version": 8, "width": 60, }, "inserted": { @@ -14682,12 +14653,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", }, { @@ -14697,11 +14720,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, + }, }, }, }, @@ -14723,13 +14751,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, @@ -14739,8 +14764,8 @@ exports[`regression tests > undo/redo drawing an element > [end of test] redo st 0, ], [ - 60, - 10, + 0, + 0, ], ], "roughness": 1, @@ -14754,7 +14779,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, },