diff --git a/src/data/__snapshots__/transform.test.ts.snap b/src/data/__snapshots__/transform.test.ts.snap index c907289a8e..d1eda74c3e 100644 --- a/src/data/__snapshots__/transform.test.ts.snap +++ b/src/data/__snapshots__/transform.test.ts.snap @@ -250,7 +250,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing t "textAlign": "left", "type": "text", "updated": 1, - "version": 3, + "version": 2, "versionNonce": Any, "verticalAlign": "top", "width": 70, @@ -294,7 +294,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing t "textAlign": "left", "type": "text", "updated": 1, - "version": 3, + "version": 2, "versionNonce": Any, "verticalAlign": "top", "width": 100, @@ -353,7 +353,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to existing t "strokeWidth": 1, "type": "arrow", "updated": 1, - "version": 4, + "version": 3, "versionNonce": Any, "width": 300, "x": 255, @@ -450,7 +450,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to shapes whe "strokeWidth": 1, "type": "arrow", "updated": 1, - "version": 4, + "version": 3, "versionNonce": Any, "width": 300, "x": 255, @@ -617,7 +617,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to text when "strokeWidth": 1, "type": "arrow", "updated": 1, - "version": 4, + "version": 3, "versionNonce": Any, "width": 300, "x": 255, @@ -699,7 +699,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to text when "textAlign": "left", "type": "text", "updated": 1, - "version": 3, + "version": 2, "versionNonce": Any, "verticalAlign": "top", "width": 70, @@ -743,7 +743,7 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to text when "textAlign": "left", "type": "text", "updated": 1, - "version": 3, + "version": 2, "versionNonce": Any, "verticalAlign": "top", "width": 100, @@ -1087,7 +1087,7 @@ exports[`Test Transform > should transform to labelled arrows when label provide "strokeWidth": 1, "type": "arrow", "updated": 1, - "version": 2, + "version": 1, "versionNonce": Any, "width": 300, "x": 100, @@ -1176,7 +1176,7 @@ exports[`Test Transform > should transform to labelled arrows when label provide "strokeWidth": 1, "type": "arrow", "updated": 1, - "version": 2, + "version": 1, "versionNonce": Any, "width": 300, "x": 100, @@ -1265,7 +1265,7 @@ exports[`Test Transform > should transform to labelled arrows when label provide "strokeWidth": 2, "type": "arrow", "updated": 1, - "version": 3, + "version": 2, "versionNonce": Any, "width": 300, "x": 100, @@ -1355,7 +1355,7 @@ exports[`Test Transform > should transform to labelled arrows when label provide "strokeWidth": 2, "type": "arrow", "updated": 1, - "version": 3, + "version": 2, "versionNonce": Any, "width": 300, "x": 100, @@ -1430,7 +1430,7 @@ exports[`Test Transform > should transform to text containers when label provide "strokeWidth": 1, "type": "rectangle", "updated": 1, - "version": 4, + "version": 3, "versionNonce": Any, "width": 250, "x": 100, @@ -1504,7 +1504,7 @@ exports[`Test Transform > should transform to text containers when label provide "strokeWidth": 1, "type": "ellipse", "updated": 1, - "version": 3, + "version": 2, "versionNonce": Any, "width": 200, "x": 500, @@ -1579,7 +1579,7 @@ exports[`Test Transform > should transform to text containers when label provide "strokeWidth": 1, "type": "diamond", "updated": 1, - "version": 3, + "version": 2, "versionNonce": Any, "width": 280, "x": 100, @@ -1656,7 +1656,7 @@ exports[`Test Transform > should transform to text containers when label provide "strokeWidth": 2, "type": "diamond", "updated": 1, - "version": 3, + "version": 2, "versionNonce": Any, "width": 300, "x": 100, @@ -1731,7 +1731,7 @@ exports[`Test Transform > should transform to text containers when label provide "strokeWidth": 1, "type": "rectangle", "updated": 1, - "version": 3, + "version": 2, "versionNonce": Any, "width": 200, "x": 500, @@ -1807,7 +1807,7 @@ exports[`Test Transform > should transform to text containers when label provide "strokeWidth": 1, "type": "ellipse", "updated": 1, - "version": 3, + "version": 2, "versionNonce": Any, "width": 200, "x": 500, diff --git a/src/data/transform.ts b/src/data/transform.ts index 1b027f2e79..3276b09816 100644 --- a/src/data/transform.ts +++ b/src/data/transform.ts @@ -10,7 +10,6 @@ import { redrawTextBoundingBox, } from "../element"; import { bindLinearElement } from "../element/binding"; -import { mutateElement } from "../element/mutateElement"; import { ElementConstructorOpts, newImageElement, @@ -211,7 +210,7 @@ const bindTextToContainer = ( strokeColor: textProps.strokeColor || container.strokeColor, }); - mutateElement(container, { + Object.assign(container, { boundElements: (container.boundElements || []).concat({ type: "text", id: textElement.id, @@ -254,7 +253,7 @@ const bindLinearElementToElement = ( let startBoundElement; let endBoundElement; - mutateElement(excliadrawLinearElement, { + Object.assign(excliadrawLinearElement, { startBinding: linearElement?.startBinding || null, endBinding: linearElement.endBinding || null, }); @@ -302,7 +301,7 @@ const bindLinearElementToElement = ( text, }); // to position the text correctly when coordinates not provided - mutateElement(startBoundElement, { + Object.assign(startBoundElement, { x: start.x || excliadrawLinearElement.x - startBoundElement.width, y: start.y || excliadrawLinearElement.y - startBoundElement.height / 2, @@ -370,7 +369,7 @@ const bindLinearElementToElement = ( text, }); // to position the text correctly when coordinates not provided - mutateElement(endBoundElement, { + Object.assign(endBoundElement, { y: end.y || excliadrawLinearElement.y - endBoundElement.height / 2, }); } else { @@ -551,5 +550,6 @@ export const convertToExcalidrawElements = ( } } }); + console.log(excalidrawElements.get()); return excalidrawElements.get(); };