@elixpo/lixsketch 5.5.13 → 5.5.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react/Circle-ZH76FPOR.js +8 -0
- package/dist/react/CodeShape-TE74XP5V.js +8 -0
- package/dist/react/{CopyPaste-VUM5WRDX.js → CopyPaste-UTU5MPKY.js} +14 -10
- package/dist/react/{CopyPaste-VUM5WRDX.js.map → CopyPaste-UTU5MPKY.js.map} +2 -2
- package/dist/react/{EventDispatcher-BZQRHROG.js → EventDispatcher-K4CNNBAU.js} +2 -2
- package/dist/react/FreehandStroke-BOWDNAVC.js +8 -0
- package/dist/react/Rectangle-2F7BAXG4.js +8 -0
- package/dist/react/{SceneSerializer-3RWFYSLY.js → SceneSerializer-34VQFJN7.js} +6 -6
- package/dist/react/{Selection-VVUHY5YJ.js → Selection-XLRY6VYO.js} +2 -2
- package/dist/react/{SketchEngine-WW5LIHNT.js → SketchEngine-P3XNZA56.js} +10 -10
- package/dist/react/TextShape-QRDG4P7F.js +8 -0
- package/dist/react/{chunk-42O6W7DF.js → chunk-62W6XTCZ.js} +13 -9
- package/dist/react/{chunk-42O6W7DF.js.map → chunk-62W6XTCZ.js.map} +2 -2
- package/dist/react/{chunk-AJAZC37E.js → chunk-GZ6NPDAB.js} +7 -11
- package/dist/react/{chunk-AJAZC37E.js.map → chunk-GZ6NPDAB.js.map} +2 -2
- package/dist/react/{chunk-ABZEV54U.js → chunk-HKYUJUD7.js} +12 -1
- package/dist/react/chunk-HKYUJUD7.js.map +7 -0
- package/dist/react/{chunk-Q2GA4MBZ.js → chunk-IW2NRHNK.js} +11 -2
- package/dist/react/{chunk-Q2GA4MBZ.js.map → chunk-IW2NRHNK.js.map} +2 -2
- package/dist/react/{chunk-7TZSIR6V.js → chunk-MB7VS6MK.js} +13 -9
- package/dist/react/{chunk-7TZSIR6V.js.map → chunk-MB7VS6MK.js.map} +2 -2
- package/dist/react/{chunk-T6ZVV5ZO.js → chunk-Z4YVT54E.js} +11 -9
- package/dist/react/{chunk-T6ZVV5ZO.js.map → chunk-Z4YVT54E.js.map} +2 -2
- package/dist/react/index.js +2 -2
- package/package.json +1 -1
- package/src/core/CopyPaste.js +11 -5
- package/src/core/Selection.js +15 -2
- package/src/shapes/Circle.js +8 -12
- package/src/shapes/CodeShape.js +17 -12
- package/src/shapes/FreehandStroke.js +18 -0
- package/src/shapes/Rectangle.js +14 -11
- package/src/shapes/TextShape.js +17 -12
- package/dist/react/Circle-KPG7TKIX.js +0 -8
- package/dist/react/CodeShape-K4DIZAIV.js +0 -8
- package/dist/react/FreehandStroke-JKTCTOKU.js +0 -8
- package/dist/react/Rectangle-6FE7RN6W.js +0 -8
- package/dist/react/TextShape-U6ZZKB35.js +0 -8
- package/dist/react/chunk-ABZEV54U.js.map +0 -7
- /package/dist/react/{Circle-KPG7TKIX.js.map → Circle-ZH76FPOR.js.map} +0 -0
- /package/dist/react/{CodeShape-K4DIZAIV.js.map → CodeShape-TE74XP5V.js.map} +0 -0
- /package/dist/react/{EventDispatcher-BZQRHROG.js.map → EventDispatcher-K4CNNBAU.js.map} +0 -0
- /package/dist/react/{FreehandStroke-JKTCTOKU.js.map → FreehandStroke-BOWDNAVC.js.map} +0 -0
- /package/dist/react/{Rectangle-6FE7RN6W.js.map → Rectangle-2F7BAXG4.js.map} +0 -0
- /package/dist/react/{SceneSerializer-3RWFYSLY.js.map → SceneSerializer-34VQFJN7.js.map} +0 -0
- /package/dist/react/{Selection-VVUHY5YJ.js.map → Selection-XLRY6VYO.js.map} +0 -0
- /package/dist/react/{SketchEngine-WW5LIHNT.js.map → SketchEngine-P3XNZA56.js.map} +0 -0
- /package/dist/react/{TextShape-U6ZZKB35.js.map → TextShape-QRDG4P7F.js.map} +0 -0
|
@@ -178,14 +178,18 @@ var CodeShape = class {
|
|
|
178
178
|
return false;
|
|
179
179
|
}
|
|
180
180
|
const padding = 8;
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
const
|
|
184
|
-
const
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
const
|
|
188
|
-
|
|
181
|
+
const transform = this.group.getAttribute("transform") || "";
|
|
182
|
+
const translate = transform.match(/translate\(\s*([^,\s)]+)[,\s]+([^\s)]+)/);
|
|
183
|
+
const tx = Number.isFinite(parseFloat(this.group.getAttribute("data-x"))) ? parseFloat(this.group.getAttribute("data-x")) : parseFloat(translate?.[1]) || 0;
|
|
184
|
+
const ty = Number.isFinite(parseFloat(this.group.getAttribute("data-y"))) ? parseFloat(this.group.getAttribute("data-y")) : parseFloat(translate?.[2]) || 0;
|
|
185
|
+
const centerX = bbox.x + bbox.width / 2;
|
|
186
|
+
const centerY = bbox.y + bbox.height / 2;
|
|
187
|
+
const angle = -extractRotationFromTransform(this.group) * Math.PI / 180;
|
|
188
|
+
const dx = x - tx - centerX;
|
|
189
|
+
const dy = y - ty - centerY;
|
|
190
|
+
const localX = dx * Math.cos(angle) - dy * Math.sin(angle) + centerX;
|
|
191
|
+
const localY = dx * Math.sin(angle) + dy * Math.cos(angle) + centerY;
|
|
192
|
+
return localX >= bbox.x - padding && localX <= bbox.x + bbox.width + padding && localY >= bbox.y - padding && localY <= bbox.y + bbox.height + padding;
|
|
189
193
|
}
|
|
190
194
|
// Add draw method for consistency with other shapes
|
|
191
195
|
draw() {
|
|
@@ -207,4 +211,4 @@ var CodeShape = class {
|
|
|
207
211
|
export {
|
|
208
212
|
CodeShape
|
|
209
213
|
};
|
|
210
|
-
//# sourceMappingURL=chunk-
|
|
214
|
+
//# sourceMappingURL=chunk-MB7VS6MK.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/shapes/CodeShape.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable */\n// CodeShape class - extracted from writeCode.js\n// Depends on globals: svg, shapes, currentShape\n\nfunction extractRotationFromTransform(el) {\n const t = el.getAttribute(\"transform\") || \"\";\n const m = t.match(/rotate\\(([^,)]+)/);\n return m ? parseFloat(m[1]) : 0;\n}\nfunction updateAttachedArrows(wrapper) {\n if (!wrapper || typeof shapes === \"undefined\") return;\n shapes.forEach(s => {\n if (s && s.shapeName === \"arrow\" && typeof s.updateAttachments === \"function\") {\n if ((s.attachedToStart && s.attachedToStart.shape === wrapper) ||\n (s.attachedToEnd && s.attachedToEnd.shape === wrapper)) {\n s.updateAttachments();\n }\n }\n });\n}\nfunction adjustCodeEditorSize(editor) {\n if (!editor) return;\n editor.style.height = \"auto\";\n editor.style.height = editor.scrollHeight + \"px\";\n}\nlet isCodeDragging = false;\nlet hoveredCodeFrame = null;\nlet selectedCodeBlock = null;\nfunction updateCodeSelectionFeedback() {}\nfunction deselectCodeBlock() { selectedCodeBlock = null; }\nfunction selectCodeBlock(el) { selectedCodeBlock = el; }\n\nclass CodeShape {\n constructor(groupElement) {\n this.group = groupElement;\n this.shapeName = 'code';\n this.shapeID = groupElement.getAttribute('id') || `code-${String(Date.now()).slice(0, 8)}-${Math.floor(Math.random() * 10000)}`;\n \n // Frame attachment properties\n this.parentFrame = null;\n \n // Update group attributes \u2014 ensure data-type is set for codeTool interaction\n this.group.setAttribute('type', 'code');\n this.group.setAttribute('data-type', 'code-group');\n this.group.shapeName = 'code';\n this.group.shapeID = this.shapeID;\n }\n \n // Position and dimension properties for frame compatibility\n get x() {\n const transform = this.group.transform.baseVal.consolidate();\n return transform ? transform.matrix.e : parseFloat(this.group.getAttribute('data-x')) || 0;\n }\n \n set x(value) {\n const transform = this.group.transform.baseVal.consolidate();\n const currentY = transform ? transform.matrix.f : parseFloat(this.group.getAttribute('data-y')) || 0;\n const rotation = extractRotationFromTransform(this.group) || 0;\n const codeBlockContainer = this.group.querySelector('foreignObject');\n if (codeBlockContainer) {\n const bbox = codeBlockContainer.getBBox();\n const centerX = bbox.x + bbox.width / 2;\n const centerY = bbox.y + bbox.height / 2;\n this.group.setAttribute('transform', `translate(${value}, ${currentY}) rotate(${rotation}, ${centerX}, ${centerY})`);\n } else {\n this.group.setAttribute('transform', `translate(${value}, ${currentY})`);\n }\n this.group.setAttribute('data-x', value);\n }\n \n get y() {\n const transform = this.group.transform.baseVal.consolidate();\n return transform ? transform.matrix.f : parseFloat(this.group.getAttribute('data-y')) || 0;\n }\n \n set y(value) {\n const transform = this.group.transform.baseVal.consolidate();\n const currentX = transform ? transform.matrix.e : parseFloat(this.group.getAttribute('data-x')) || 0;\n const rotation = extractRotationFromTransform(this.group) || 0;\n const codeBlockContainer = this.group.querySelector('foreignObject');\n if (codeBlockContainer) {\n const bbox = codeBlockContainer.getBBox();\n const centerX = bbox.x + bbox.width / 2;\n const centerY = bbox.y + bbox.height / 2;\n this.group.setAttribute('transform', `translate(${currentX}, ${value}) rotate(${rotation}, ${centerX}, ${centerY})`);\n } else {\n this.group.setAttribute('transform', `translate(${currentX}, ${value})`);\n }\n this.group.setAttribute('data-y', value);\n }\n \n get width() {\n const codeElement = this.group.querySelector('text');\n if (codeElement) {\n return codeElement.getBBox().width;\n }\n return 0;\n }\n \n set width(value) {\n const codeBlockContainer = this.group.querySelector('foreignObject');\n if (codeBlockContainer) {\n codeBlockContainer.setAttribute('width', value);\n // This might trigger a reflow in the foreignObject content\n const codeEditor = codeBlockContainer.querySelector('.svg-code-editor');\n if (codeEditor) {\n codeEditor.style.width = `${value}px`;\n adjustCodeEditorSize(codeEditor);\n }\n }\n }\n \n get height() {\n const codeElement = this.group.querySelector('text');\n if (codeElement) {\n return codeElement.getBBox().height;\n }\n return 0;\n }\n \n set height(value) {\n const codeBlockContainer = this.group.querySelector('foreignObject');\n if (codeBlockContainer) {\n codeBlockContainer.setAttribute('height', value);\n const codeEditor = codeBlockContainer.querySelector('.svg-code-editor');\n if (codeEditor) {\n codeEditor.style.height = `${value}px`;\n adjustCodeEditorSize(codeEditor);\n }\n }\n }\n \n get rotation() {\n return extractRotationFromTransform(this.group) || 0;\n }\n \n set rotation(value) {\n const currentTransform = this.group.transform.baseVal.consolidate();\n const currentX = currentTransform ? currentTransform.matrix.e : 0;\n const currentY = currentTransform ? currentTransform.matrix.f : 0;\n const codeBlockContainer = this.group.querySelector('foreignObject');\n if (codeBlockContainer) {\n const bbox = codeBlockContainer.getBBox();\n const centerX = bbox.x + bbox.width / 2;\n const centerY = bbox.y + bbox.height / 2;\n this.group.setAttribute('transform', `translate(${currentX}, ${currentY}) rotate(${value}, ${centerX}, ${centerY})`);\n }\n }\n\n move(dx, dy) {\n const currentTransform = this.group.transform.baseVal.consolidate();\n const currentX = currentTransform ? currentTransform.matrix.e : 0;\n const currentY = currentTransform ? currentTransform.matrix.f : 0;\n\n this.x = currentX + dx;\n this.y = currentY + dy;\n\n // Only update frame containment if we're actively dragging the shape itself\n // and not being moved by a parent frame\n if (isCodeDragging && !this.isBeingMovedByFrame) {\n this.updateFrameContainment();\n }\n\n this.updateAttachedArrows();\n }\n\n updateAttachedArrows() {\n updateAttachedArrows(this);\n }\n\n updateFrameContainment() {\n // Don't update if we're being moved by a frame\n if (this.isBeingMovedByFrame) return;\n \n let targetFrame = null;\n \n // Find which frame this shape is over\n if (typeof shapes !== 'undefined' && Array.isArray(shapes)) {\n shapes.forEach(shape => {\n if (shape.shapeName === 'frame' && shape.isShapeInFrame(this)) {\n targetFrame = shape;\n }\n });\n }\n \n // If we have a parent frame and we're being dragged, temporarily remove clipping\n if (this.parentFrame && isCodeDragging) {\n this.parentFrame.temporarilyRemoveFromFrame(this);\n }\n \n // Update frame highlighting\n if (hoveredCodeFrame && hoveredCodeFrame !== targetFrame) {\n hoveredCodeFrame.removeHighlight();\n }\n \n if (targetFrame && targetFrame !== hoveredCodeFrame) {\n targetFrame.highlightFrame();\n }\n \n hoveredCodeFrame = targetFrame;\n }\n\n contains(x, y) {\n const codeElement = this.group.querySelector('text');\n if (!codeElement || typeof codeElement.getBBox !== 'function') return false;\n\n let bbox;\n try { bbox = codeElement.getBBox(); } catch { return false; }\n const padding = 8; // Selection padding\n\n const
|
|
5
|
-
"mappings": ";;;AAI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BAAqB,aAAa;AACtD,uBAAiB,gBAAgB;AAAA,IACrC;AAEA,QAAI,eAAe,gBAAgB,kBAAkB;AACjD,kBAAY,eAAe;AAAA,IAC/B;AAEA,uBAAmB;AAAA,EACvB;AAAA,EAEA,SAAS,GAAG,GAAG;AACX,UAAM,cAAc,KAAK,MAAM,cAAc,MAAM;AACnD,QAAI,CAAC,eAAe,OAAO,YAAY,YAAY,WAAY,QAAO;AAEtE,QAAI;AACJ,QAAI;AAAE,aAAO,YAAY,QAAQ;AAAA,IAAG,QAAQ;AAAE,aAAO;AAAA,IAAO;AAC5D,UAAM,UAAU;AAEhB,UAAM,MAAM,KAAK,MAAM,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable */\n// CodeShape class - extracted from writeCode.js\n// Depends on globals: svg, shapes, currentShape\n\nfunction extractRotationFromTransform(el) {\n const t = el.getAttribute(\"transform\") || \"\";\n const m = t.match(/rotate\\(([^,)]+)/);\n return m ? parseFloat(m[1]) : 0;\n}\nfunction updateAttachedArrows(wrapper) {\n if (!wrapper || typeof shapes === \"undefined\") return;\n shapes.forEach(s => {\n if (s && s.shapeName === \"arrow\" && typeof s.updateAttachments === \"function\") {\n if ((s.attachedToStart && s.attachedToStart.shape === wrapper) ||\n (s.attachedToEnd && s.attachedToEnd.shape === wrapper)) {\n s.updateAttachments();\n }\n }\n });\n}\nfunction adjustCodeEditorSize(editor) {\n if (!editor) return;\n editor.style.height = \"auto\";\n editor.style.height = editor.scrollHeight + \"px\";\n}\nlet isCodeDragging = false;\nlet hoveredCodeFrame = null;\nlet selectedCodeBlock = null;\nfunction updateCodeSelectionFeedback() {}\nfunction deselectCodeBlock() { selectedCodeBlock = null; }\nfunction selectCodeBlock(el) { selectedCodeBlock = el; }\n\nclass CodeShape {\n constructor(groupElement) {\n this.group = groupElement;\n this.shapeName = 'code';\n this.shapeID = groupElement.getAttribute('id') || `code-${String(Date.now()).slice(0, 8)}-${Math.floor(Math.random() * 10000)}`;\n \n // Frame attachment properties\n this.parentFrame = null;\n \n // Update group attributes \u2014 ensure data-type is set for codeTool interaction\n this.group.setAttribute('type', 'code');\n this.group.setAttribute('data-type', 'code-group');\n this.group.shapeName = 'code';\n this.group.shapeID = this.shapeID;\n }\n \n // Position and dimension properties for frame compatibility\n get x() {\n const transform = this.group.transform.baseVal.consolidate();\n return transform ? transform.matrix.e : parseFloat(this.group.getAttribute('data-x')) || 0;\n }\n \n set x(value) {\n const transform = this.group.transform.baseVal.consolidate();\n const currentY = transform ? transform.matrix.f : parseFloat(this.group.getAttribute('data-y')) || 0;\n const rotation = extractRotationFromTransform(this.group) || 0;\n const codeBlockContainer = this.group.querySelector('foreignObject');\n if (codeBlockContainer) {\n const bbox = codeBlockContainer.getBBox();\n const centerX = bbox.x + bbox.width / 2;\n const centerY = bbox.y + bbox.height / 2;\n this.group.setAttribute('transform', `translate(${value}, ${currentY}) rotate(${rotation}, ${centerX}, ${centerY})`);\n } else {\n this.group.setAttribute('transform', `translate(${value}, ${currentY})`);\n }\n this.group.setAttribute('data-x', value);\n }\n \n get y() {\n const transform = this.group.transform.baseVal.consolidate();\n return transform ? transform.matrix.f : parseFloat(this.group.getAttribute('data-y')) || 0;\n }\n \n set y(value) {\n const transform = this.group.transform.baseVal.consolidate();\n const currentX = transform ? transform.matrix.e : parseFloat(this.group.getAttribute('data-x')) || 0;\n const rotation = extractRotationFromTransform(this.group) || 0;\n const codeBlockContainer = this.group.querySelector('foreignObject');\n if (codeBlockContainer) {\n const bbox = codeBlockContainer.getBBox();\n const centerX = bbox.x + bbox.width / 2;\n const centerY = bbox.y + bbox.height / 2;\n this.group.setAttribute('transform', `translate(${currentX}, ${value}) rotate(${rotation}, ${centerX}, ${centerY})`);\n } else {\n this.group.setAttribute('transform', `translate(${currentX}, ${value})`);\n }\n this.group.setAttribute('data-y', value);\n }\n \n get width() {\n const codeElement = this.group.querySelector('text');\n if (codeElement) {\n return codeElement.getBBox().width;\n }\n return 0;\n }\n \n set width(value) {\n const codeBlockContainer = this.group.querySelector('foreignObject');\n if (codeBlockContainer) {\n codeBlockContainer.setAttribute('width', value);\n // This might trigger a reflow in the foreignObject content\n const codeEditor = codeBlockContainer.querySelector('.svg-code-editor');\n if (codeEditor) {\n codeEditor.style.width = `${value}px`;\n adjustCodeEditorSize(codeEditor);\n }\n }\n }\n \n get height() {\n const codeElement = this.group.querySelector('text');\n if (codeElement) {\n return codeElement.getBBox().height;\n }\n return 0;\n }\n \n set height(value) {\n const codeBlockContainer = this.group.querySelector('foreignObject');\n if (codeBlockContainer) {\n codeBlockContainer.setAttribute('height', value);\n const codeEditor = codeBlockContainer.querySelector('.svg-code-editor');\n if (codeEditor) {\n codeEditor.style.height = `${value}px`;\n adjustCodeEditorSize(codeEditor);\n }\n }\n }\n \n get rotation() {\n return extractRotationFromTransform(this.group) || 0;\n }\n \n set rotation(value) {\n const currentTransform = this.group.transform.baseVal.consolidate();\n const currentX = currentTransform ? currentTransform.matrix.e : 0;\n const currentY = currentTransform ? currentTransform.matrix.f : 0;\n const codeBlockContainer = this.group.querySelector('foreignObject');\n if (codeBlockContainer) {\n const bbox = codeBlockContainer.getBBox();\n const centerX = bbox.x + bbox.width / 2;\n const centerY = bbox.y + bbox.height / 2;\n this.group.setAttribute('transform', `translate(${currentX}, ${currentY}) rotate(${value}, ${centerX}, ${centerY})`);\n }\n }\n\n move(dx, dy) {\n const currentTransform = this.group.transform.baseVal.consolidate();\n const currentX = currentTransform ? currentTransform.matrix.e : 0;\n const currentY = currentTransform ? currentTransform.matrix.f : 0;\n\n this.x = currentX + dx;\n this.y = currentY + dy;\n\n // Only update frame containment if we're actively dragging the shape itself\n // and not being moved by a parent frame\n if (isCodeDragging && !this.isBeingMovedByFrame) {\n this.updateFrameContainment();\n }\n\n this.updateAttachedArrows();\n }\n\n updateAttachedArrows() {\n updateAttachedArrows(this);\n }\n\n updateFrameContainment() {\n // Don't update if we're being moved by a frame\n if (this.isBeingMovedByFrame) return;\n \n let targetFrame = null;\n \n // Find which frame this shape is over\n if (typeof shapes !== 'undefined' && Array.isArray(shapes)) {\n shapes.forEach(shape => {\n if (shape.shapeName === 'frame' && shape.isShapeInFrame(this)) {\n targetFrame = shape;\n }\n });\n }\n \n // If we have a parent frame and we're being dragged, temporarily remove clipping\n if (this.parentFrame && isCodeDragging) {\n this.parentFrame.temporarilyRemoveFromFrame(this);\n }\n \n // Update frame highlighting\n if (hoveredCodeFrame && hoveredCodeFrame !== targetFrame) {\n hoveredCodeFrame.removeHighlight();\n }\n \n if (targetFrame && targetFrame !== hoveredCodeFrame) {\n targetFrame.highlightFrame();\n }\n \n hoveredCodeFrame = targetFrame;\n }\n\n contains(x, y) {\n const codeElement = this.group.querySelector('text');\n if (!codeElement || typeof codeElement.getBBox !== 'function') return false;\n\n let bbox;\n try { bbox = codeElement.getBBox(); } catch { return false; }\n const padding = 8; // Selection padding\n\n const transform = this.group.getAttribute('transform') || '';\n const translate = transform.match(/translate\\(\\s*([^,\\s)]+)[,\\s]+([^\\s)]+)/);\n const tx = Number.isFinite(parseFloat(this.group.getAttribute('data-x')))\n ? parseFloat(this.group.getAttribute('data-x')) : parseFloat(translate?.[1]) || 0;\n const ty = Number.isFinite(parseFloat(this.group.getAttribute('data-y')))\n ? parseFloat(this.group.getAttribute('data-y')) : parseFloat(translate?.[2]) || 0;\n const centerX = bbox.x + bbox.width / 2;\n const centerY = bbox.y + bbox.height / 2;\n const angle = -extractRotationFromTransform(this.group) * Math.PI / 180;\n const dx = x - tx - centerX;\n const dy = y - ty - centerY;\n const localX = dx * Math.cos(angle) - dy * Math.sin(angle) + centerX;\n const localY = dx * Math.sin(angle) + dy * Math.cos(angle) + centerY;\n \n return localX >= bbox.x - padding &&\n localX <= bbox.x + bbox.width + padding &&\n localY >= bbox.y - padding &&\n localY <= bbox.y + bbox.height + padding;\n }\n\n // Add draw method for consistency with other shapes\n draw() {\n if (selectedCodeBlock === this.group) {\n updateCodeSelectionFeedback();\n }\n }\n\n // Add methods for frame compatibility\n removeSelection() {\n if (selectedCod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KAAK,KAAK,IAAI,KAAK,IAAI;AAE7D,WAAO,UAAU,KAAK,IAAI,WACnB,UAAU,KAAK,IAAI,KAAK,QAAQ,WAChC,UAAU,KAAK,IAAI,WACnB,UAAU,KAAK,IAAI,KAAK,SAAS;AAAA,EAC5C;AAAA;AAAA,EAGA,OAAO;AACH,QAAI,sBAAsB,KAAK,OAAO;AAClC,kCAA4B;AAAA,IAChC;AAAA,EACJ;AAAA;AAAA,EAGA,kBAAkB;AACd,QAAI,sBAAsB,KAAK,OAAO;AAClC,wBAAkB;AAAA,IACtB;AAAA,EACJ;AAAA,EAEA,cAAc;AACV,oBAAgB,KAAK,KAAK;AAAA,EAC9B;AACJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -528,15 +528,17 @@ var Rectangle = class {
|
|
|
528
528
|
}
|
|
529
529
|
contains(x, y) {
|
|
530
530
|
if (!this.element) return false;
|
|
531
|
-
const
|
|
532
|
-
|
|
533
|
-
const
|
|
534
|
-
const
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
const
|
|
531
|
+
const centerX = this.width / 2;
|
|
532
|
+
const centerY = this.height / 2;
|
|
533
|
+
const angle = -(this.rotation || 0) * Math.PI / 180;
|
|
534
|
+
const translatedX = x - this.x;
|
|
535
|
+
const translatedY = y - this.y;
|
|
536
|
+
const dx = translatedX - centerX;
|
|
537
|
+
const dy = translatedY - centerY;
|
|
538
|
+
const localX = dx * Math.cos(angle) - dy * Math.sin(angle) + centerX;
|
|
539
|
+
const localY = dx * Math.sin(angle) + dy * Math.cos(angle) + centerY;
|
|
538
540
|
const tolerance = 5;
|
|
539
|
-
return
|
|
541
|
+
return localX >= -tolerance && localX <= this.width + tolerance && localY >= -tolerance && localY <= this.height + tolerance;
|
|
540
542
|
}
|
|
541
543
|
// Helper to check if a point is near an anchor
|
|
542
544
|
isNearAnchor(x, y) {
|
|
@@ -711,4 +713,4 @@ var Rectangle = class {
|
|
|
711
713
|
export {
|
|
712
714
|
Rectangle
|
|
713
715
|
};
|
|
714
|
-
//# sourceMappingURL=chunk-
|
|
716
|
+
//# sourceMappingURL=chunk-Z4YVT54E.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/shapes/Rectangle.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable */\n// Rectangle shape class - extracted from drawSquare.js\n// Depends on globals: svg, shapes, rough, currentShape, currentZoom, rc\n\n// Create local rc from globals; tool-state vars default to false\nconst rc = rough.svg(svg);\nlet isDraggingShapeSquare = false;\nlet isResizingShapeSquare = false;\nlet isRotatingShapeSquare = false;\nlet hoveredFrame = null;\nconst SquarecolorOptions = document.querySelectorAll(\".squareStrokeSpan\");\nconst backgroundColorOptionsSquare = document.querySelectorAll(\".squareBackgroundSpan\");\nconst fillStyleOptions = document.querySelectorAll(\".squareFillStyleSpan\");\nconst squareStrokeThicknessValue = document.querySelectorAll(\".squareStrokeThickSpan\");\nconst squareOutlineStyleValue = document.querySelectorAll(\".squareOutlineStyle\");\n// Depends on globals: squareStrokecolor, squareBackgroundColor, squareFillStyleValue, squareStrokeThicknes, squareOutlineStyle\n// Depends on globals: isDraggingShapeSquare, isResizingShapeSquare, isRotatingShapeSquare\n// Depends on globals: squareSideBar, disableAllSideBars\n// Depends on DOM query: SquarecolorOptions, backgroundColorOptionsSquare, fillStyleOptions, squareStrokeThicknessValue, squareOutlineStyleValue\n\nclass Rectangle {\n constructor(x, y, width, height, options = {}) {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n this.options = {\n roughness: 1.5,\n stroke: \"#fff\",\n strokeWidth: 2,\n fill: \"transparent\",\n fillStyle: \"none\",\n strokeDasharray: \"\",\n ...options\n };\n this.element = null;\n this.isSelected = false;\n this.rotation = 0;\n this.group = document.createElementNS('http://www.w3.org/2000/svg', 'g');\n this.anchors = [];\n this.rotationAnchor = null;\n this.selectionPadding = 8;\n this.selectionOutline = null;\n this.shapeName = 'rectangle';\n this.shapeID = `rectangle-${String(Date.now()).slice(0, 8)}-${Math.floor(Math.random() * 10000)}`;\n this.group.setAttribute('id', this.shapeID);\n\n // Embedded label support\n this.label = options.label || '';\n this.labelElement = null;\n this.labelColor = options.labelColor || '#e0e0e0';\n this.labelFontSize = options.labelFontSize || 14;\n this._isEditingLabel = false;\n this._hitArea = null;\n this._labelBg = null;\n\n // Shading / gradient support for research paper style diagrams\n this.shadeColor = options.shadeColor || null;\n this.shadeOpacity = options.shadeOpacity !== undefined ? options.shadeOpacity : 0.15;\n this.shadeDirection = options.shadeDirection || 'bottom'; // 'top' | 'bottom' | 'left' | 'right'\n this._shadeRect = null;\n this._shadeGradient = null;\n\n if (!this.group.parentNode) {\n svg.appendChild(this.group);\n }\n this._lastDrawn = {\n width: null,\n height: null,\n options: null\n };\n this.isBeingDrawn = false;\n this._setupLabelDblClick();\n this.draw();\n }\n draw() {\n const childrenToRemove = [];\n const preserveSet = this._skipAnchors ? new Set([...this.anchors, this.selectionOutline, this.rotationAnchor].filter(Boolean)) : null;\n for (let i = 0; i < this.group.children.length; i++) {\n const child = this.group.children[i];\n if (child !== this.element && child !== this.labelElement && child !== this._hitArea && child !== this._labelBg && child !== this._shadeRect) {\n if (preserveSet && preserveSet.has(child)) continue;\n childrenToRemove.push(child);\n }\n }\n childrenToRemove.forEach(child => this.group.removeChild(child));\n\n const optionsString = JSON.stringify(this.options);\n const isInitialDraw = this.element === null;\n const optionsChanged = optionsString !== this._lastDrawn.options;\n const sizeChanged = this.width !== this._lastDrawn.width || this.height !== this._lastDrawn.height;\n\n // Only regenerate rough element if it's not being actively drawn OR if options changed OR initial draw\n if (isInitialDraw || optionsChanged || (!this.isBeingDrawn && sizeChanged)) {\n if (this.element && this.element.parentNode === this.group) {\n this.group.removeChild(this.element);\n }\n const roughRect = rc.rectangle(0, 0, this.width, this.height, this.options);\n this.element = roughRect;\n this.group.appendChild(roughRect);\n\n // Cache the values\n this._lastDrawn.width = this.width;\n this._lastDrawn.height = this.height;\n this._lastDrawn.options = optionsString;\n }\n\n // Hit area for dblclick detection (transparent rect that captures pointer events)\n if (!this._hitArea) {\n this._hitArea = document.createElementNS('http://www.w3.org/2000/svg', 'rect');\n this._hitArea.setAttribute('fill', 'transparent');\n this._hitArea.setAttribute('stroke', 'none');\n this._hitArea.setAttribute('style', 'pointer-events: all;');\n this.group.insertBefore(this._hitArea, this.group.firstChild);\n }\n this._hitArea.setAttribute('x', 0);\n this._hitArea.setAttribute('y', 0);\n this._hitArea.setAttribute('width', this.width);\n this._hitArea.setAttribute('height', this.height);\n\n // Shading / gradient overlay\n this._updateShade();\n\n // Update embedded label\n this._updateLabelElement();\n\n const rotateCenterX = this.width / 2;\n const rotateCenterY = this.height / 2;\n this.group.setAttribute('transform', `translate(${this.x}, ${this.y}) rotate(${this.rotation}, ${rotateCenterX}, ${rotateCenterY})`);\n\n if (this.isSelected) {\n if (this._skipAnchors) {\n this.updateSelectionControls();\n } else {\n this.addAnchors();\n }\n }\n if (!this.group.parentNode) {\n this.updateAttachedArrows();\n svg.appendChild(this.group);\n }\n }\n\n _updateShade() {\n if (!this.shadeColor) {\n if (this._shadeRect && this._shadeRect.parentNode === this.group) {\n this.group.removeChild(this._shadeRect);\n this._shadeRect = null;\n }\n if (this._shadeGradient && this._shadeGradient.parentNode) {\n this._shadeGradient.parentNode.removeChild(this._shadeGradient);\n this._shadeGradient = null;\n }\n return;\n }\n\n // Create or update gradient in SVG defs\n let defs = svg.querySelector('defs');\n if (!defs) {\n defs = document.createElementNS('http://www.w3.org/2000/svg', 'defs');\n svg.appendChild(defs);\n }\n\n const gradId = `shade-${this.shapeID}`;\n if (!this._shadeGradient) {\n this._shadeGradient = document.createElementNS('http://www.w3.org/2000/svg', 'linearGradient');\n this._shadeGradient.setAttribute('id', gradId);\n defs.appendChild(this._shadeGradient);\n }\n\n // Direction mapping\n const dirs = {\n top: { x1: '0%', y1: '0%', x2: '0%', y2: '100%' },\n bottom: { x1: '0%', y1: '100%', x2: '0%', y2: '0%' },\n left: { x1: '0%', y1: '0%', x2: '100%', y2: '0%' },\n right: { x1: '100%', y1: '0%', x2: '0%', y2: '0%' },\n };\n const d = dirs[this.shadeDirection] || dirs.bottom;\n this._shadeGradient.setAttribute('x1', d.x1);\n this._shadeGradient.setAttribute('y1', d.y1);\n this._shadeGradient.setAttribute('x2', d.x2);\n this._shadeGradient.setAttribute('y2', d.y2);\n\n // Rebuild stops\n while (this._shadeGradient.firstChild) this._shadeGradient.removeChild(this._shadeGradient.firstChild);\n const stop1 = document.createElementNS('http://www.w3.org/2000/svg', 'stop');\n stop1.setAttribute('offset', '0%');\n stop1.setAttribute('stop-color', this.shadeColor);\n stop1.setAttribute('stop-opacity', this.shadeOpacity);\n const stop2 = document.createElementNS('http://www.w3.org/2000/svg', 'stop');\n stop2.setAttribute('offset', '100%');\n stop2.setAttribute('stop-color', this.shadeColor);\n stop2.setAttribute('stop-opacity', '0');\n this._shadeGradient.appendChild(stop1);\n this._shadeGradient.appendChild(stop2);\n\n // Create or update shade rect\n if (!this._shadeRect) {\n this._shadeRect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');\n this._shadeRect.setAttribute('pointer-events', 'none');\n }\n this._shadeRect.setAttribute('x', 0);\n this._shadeRect.setAttribute('y', 0);\n this._shadeRect.setAttribute('width', this.width);\n this._shadeRect.setAttribute('height', this.height);\n this._shadeRect.setAttribute('fill', `url(#${gradId})`);\n this._shadeRect.setAttribute('rx', 2);\n\n // Insert after rough element\n if (this._shadeRect.parentNode === this.group) this.group.removeChild(this._shadeRect);\n if (this.element && this.element.nextSibling) {\n this.group.insertBefore(this._shadeRect, this.element.nextSibling);\n } else {\n this.group.appendChild(this._shadeRect);\n }\n }\n\n _updateLabelElement() {\n if (!this.label) {\n // Remove label element if label is empty\n if (this.labelElement && this.labelElement.parentNode === this.group) {\n this.group.removeChild(this.labelElement);\n this.labelElement = null;\n }\n if (this._labelBg && this._labelBg.parentNode === this.group) {\n this.group.removeChild(this._labelBg);\n this._labelBg = null;\n }\n return;\n }\n\n if (!this.labelElement) {\n this.labelElement = document.createElementNS('http://www.w3.org/2000/svg', 'text');\n this.labelElement.setAttribute('class', 'shape-label');\n this.labelElement.setAttribute('pointer-events', 'none');\n }\n\n // Position at center of rectangle\n this.labelElement.setAttribute('x', this.width / 2);\n this.labelElement.setAttribute('y', this.height / 2);\n this.labelElement.setAttribute('text-anchor', 'middle');\n this.labelElement.setAttribute('dominant-baseline', 'central');\n this.labelElement.setAttribute('fill', this.labelColor);\n this.labelElement.setAttribute('font-size', this.labelFontSize);\n this.labelElement.setAttribute('font-family', 'lixFont, sans-serif');\n this.labelElement.textContent = this.label;\n\n // Background padding rect behind text (like arrows have)\n const canvasBg = window.getComputedStyle(svg).backgroundColor || '#000';\n if (!this._labelBg) {\n this._labelBg = document.createElementNS('http://www.w3.org/2000/svg', 'rect');\n this._labelBg.setAttribute('pointer-events', 'none');\n }\n this._labelBg.setAttribute('fill', canvasBg);\n const hPadding = 6;\n const vPadding = 2;\n const charWidth = this.labelFontSize * 0.6;\n const bgW = this.label.length * charWidth + hPadding * 2;\n const bgH = this.labelFontSize + vPadding * 2;\n this._labelBg.setAttribute('x', this.width / 2 - bgW / 2);\n this._labelBg.setAttribute('y', this.height / 2 - bgH / 2);\n this._labelBg.setAttribute('width', bgW);\n this._labelBg.setAttribute('height', bgH);\n this._labelBg.setAttribute('rx', 3);\n\n // Re-append bg then text on top\n if (this._labelBg.parentNode === this.group) this.group.removeChild(this._labelBg);\n if (this.labelElement.parentNode === this.group) this.group.removeChild(this.labelElement);\n this.group.appendChild(this._labelBg);\n this.group.appendChild(this.labelElement);\n }\n\n _setupLabelDblClick() {\n this.group.addEventListener('dblclick', (e) => {\n e.stopPropagation();\n e.preventDefault();\n this.startLabelEdit();\n });\n }\n\n startLabelEdit() {\n if (this._isEditingLabel) return;\n this._isEditingLabel = true;\n\n // Hide label element during editing\n if (this.labelElement) {\n this.labelElement.setAttribute('visibility', 'hidden');\n }\n\n // Get shape's screen position via CTM\n const ctm = this.group.getScreenCTM();\n if (!ctm) { this._isEditingLabel = false; return; }\n\n // Map the shape corners to screen coords\n const pt1 = svg.createSVGPoint();\n pt1.x = 0; pt1.y = 0;\n const screenTL = pt1.matrixTransform(ctm);\n const pt2 = svg.createSVGPoint();\n pt2.x = this.width; pt2.y = this.height;\n const screenBR = pt2.matrixTransform(ctm);\n\n const screenW = Math.abs(screenBR.x - screenTL.x);\n const screenH = Math.abs(screenBR.y - screenTL.y);\n const screenX = Math.min(screenTL.x, screenBR.x);\n const screenY = Math.min(screenTL.y, screenBR.y);\n\n // Create HTML overlay\n const overlay = document.createElement('div');\n overlay.className = 'shape-label-editor';\n overlay.style.cssText = `\n position: fixed; z-index: 10000;\n left: ${screenX}px; top: ${screenY}px;\n width: ${screenW}px; height: ${screenH}px;\n display: flex; align-items: center; justify-content: center;\n pointer-events: auto;\n `;\n\n const canvasBg = window.getComputedStyle(svg).backgroundColor || '#000';\n const input = document.createElement('div');\n input.setAttribute('contenteditable', 'true');\n input.style.cssText = `\n max-width: ${screenW - 8}px; min-width: 30px; min-height: 20px;\n background: ${canvasBg}; border: none;\n outline: none; padding: 2px 6px;\n color: ${this.labelColor}; font-size: ${Math.max(12, this.labelFontSize * (screenW / Math.max(this.width, 1)))}px;\n font-family: lixFont, sans-serif; text-align: center;\n white-space: pre-wrap; word-break: break-word;\n cursor: text;\n `;\n if (this.label) {\n input.textContent = this.label;\n } else {\n input.innerHTML = ' ';\n }\n\n overlay.appendChild(input);\n document.body.appendChild(overlay);\n\n // Focus and select all text\n setTimeout(() => {\n input.focus();\n const sel = window.getSelection();\n const range = document.createRange();\n range.selectNodeContents(input);\n sel.removeAllRanges();\n sel.addRange(range);\n }, 10);\n\n const finishEdit = () => {\n const newText = input.textContent.trim().replace(/\\u00A0/g, '');\n this.label = newText;\n this._isEditingLabel = false;\n\n if (overlay.parentNode) overlay.parentNode.removeChild(overlay);\n if (this.labelElement) this.labelElement.setAttribute('visibility', 'visible');\n this.draw();\n };\n\n input.addEventListener('blur', finishEdit);\n input.addEventListener('keydown', (e) => {\n e.stopPropagation();\n if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); input.blur(); }\n if (e.key === 'Escape') { input.textContent = this.label; input.blur(); }\n });\n input.addEventListener('pointerdown', (e) => e.stopPropagation());\n input.addEventListener('pointermove', (e) => e.stopPropagation());\n input.addEventListener('pointerup', (e) => e.stopPropagation());\n }\n\n setLabel(text, color, fontSize) {\n this.label = text || '';\n if (color) this.labelColor = color;\n if (fontSize) this.labelFontSize = fontSize;\n this.draw();\n }\n\n setDrawingState(isDrawing) {\n this.isBeingDrawn = isDrawing;\n }\n\n getRotatedCursor(direction, angle) {\n const directions = ['ns', 'nesw', 'ew', 'nwse'];\n angle = angle % 360;\n if (angle < 0) angle += 360;\n\n const baseDirectionMap = {\n '0': 'nwse', '1': 'nesw', \n '2': 'nesw', '3': 'nwse', \n '4': 'ns', '5': 'ns', \n '6': 'ew', '7': 'ew' \n };\n const baseDirection = baseDirectionMap[direction];\n let effectiveAngle = angle; \n if (baseDirection === 'nesw') {\n effectiveAngle += 45;\n } else if (baseDirection === 'ew') {\n effectiveAngle += 90;\n } else if (baseDirection === 'nwse') {\n effectiveAngle += 135;\n }\n effectiveAngle = effectiveAngle % 360;\n if (effectiveAngle < 0) effectiveAngle += 360;\n const index = Math.round(effectiveAngle / 45) % 4; \n let finalIndex;\n if (effectiveAngle >= 337.5 || effectiveAngle < 22.5) finalIndex = 0; \n else if (effectiveAngle >= 22.5 && effectiveAngle < 67.5) finalIndex = 1; \n else if (effectiveAngle >= 67.5 && effectiveAngle < 112.5) finalIndex = 2; \n else if (effectiveAngle >= 112.5 && effectiveAngle < 157.5) finalIndex = 3;\n else if (effectiveAngle >= 157.5 && effectiveAngle < 202.5) finalIndex = 0; \n else if (effectiveAngle >= 202.5 && effectiveAngle < 247.5) finalIndex = 1; \n else if (effectiveAngle >= 247.5 && effectiveAngle < 292.5) finalIndex = 2; \n else if (effectiveAngle >= 292.5 && effectiveAngle < 337.5) finalIndex = 3; \n else finalIndex = 0; \n return directions[finalIndex];\n }\n addAnchors() {\n const zoom = window.currentZoom || 1;\n const anchorSize = 10 / zoom;\n const anchorStrokeWidth = 2;\n const self = this;\n const expandedX = -this.selectionPadding; \n const expandedY = -this.selectionPadding; \n const expandedWidth = this.width + 2 * this.selectionPadding;\n const expandedHeight = this.height + 2 * this.selectionPadding;\n\n const positions = [\n { x: expandedX, y: expandedY }, \n { x: expandedX + expandedWidth, y: expandedY }, \n { x: expandedX, y: expandedY + expandedHeight }, \n { x: expandedX + expandedWidth, y: expandedY + expandedHeight }, \n { x: expandedX + expandedWidth / 2, y: expandedY }, \n { x: expandedX + expandedWidth / 2, y: expandedY + expandedHeight }, \n { x: expandedX, y: expandedHeight / 2 + expandedY }, \n { x: expandedX + expandedWidth, y: expandedHeight / 2 + expandedY } \n ];\n\n const outlinePoints = [\n [positions[0].x, positions[0].y],\n [positions[1].x, positions[1].y],\n [positions[3].x, positions[3].y],\n [positions[2].x, positions[2].y],\n [positions[0].x, positions[0].y]\n ];\n\n this.anchors.forEach(anchor => {\n if (anchor.parentNode === this.group) {\n this.group.removeChild(anchor);\n }\n });\n if (this.rotationAnchor && this.rotationAnchor.parentNode === this.group) {\n this.group.removeChild(this.rotationAnchor);\n }\n if (this.selectionOutline && this.selectionOutline.parentNode === this.group) {\n this.group.removeChild(this.selectionOutline);\n }\n\n this.anchors = [];\n const anchorDirections = {\n 0: 'nwse', \n 1: 'nesw', \n 2: 'nesw', \n 3: 'nwse', \n 4: 'ns', \n 5: 'ns', \n 6: 'ew', \n 7: 'ew' \n };\n\n positions.forEach((pos, i) => {\n const anchor = document.createElementNS('http://www.w3.org/2000/svg', 'rect');\n anchor.setAttribute('x', pos.x - anchorSize / 2);\n anchor.setAttribute('y', pos.y - anchorSize / 2);\n anchor.setAttribute('width', anchorSize);\n anchor.setAttribute('height', anchorSize);\n anchor.setAttribute('class', 'anchor');\n anchor.setAttribute('data-index', i);\n anchor.setAttribute('fill', '#121212');\n anchor.setAttribute('stroke', '#5B57D1');\n anchor.setAttribute('stroke-width', anchorStrokeWidth);\n anchor.setAttribute('vector-effect', 'non-scaling-stroke');\n anchor.setAttribute('style', 'pointer-events: all;');\n\n anchor.addEventListener('mouseover', function () {\n const index = this.getAttribute('data-index');\n const baseDirection = anchorDirections[index];\n const rotatedCursor = self.getRotatedCursor(index, self.rotation); \n svg.style.cursor = rotatedCursor + '-resize';\n });\n\n anchor.addEventListener('mouseout', function () {\n if (!isResizingShapeSquare && !isDraggingShapeSquare && !isRotatingShapeSquare) {\n svg.style.cursor = 'default';\n }\n });\n\n this.group.appendChild(anchor);\n this.anchors[i] = anchor;\n });\n const rotationAnchorPos = { x: expandedX + expandedWidth / 2, y: expandedY - 30 / zoom };\n this.rotationAnchor = document.createElementNS('http://www.w3.org/2000/svg', 'circle');\n this.rotationAnchor.setAttribute('cx', rotationAnchorPos.x);\n this.rotationAnchor.setAttribute('cy', rotationAnchorPos.y);\n this.rotationAnchor.setAttribute('r', 8 / zoom);\n this.rotationAnchor.setAttribute('class', 'rotate-anchor');\n this.rotationAnchor.setAttribute('fill', '#121212');\n this.rotationAnchor.setAttribute('stroke', '#5B57D1');\n this.rotationAnchor.setAttribute('stroke-width', anchorStrokeWidth);\n this.rotationAnchor.setAttribute('vector-effect', 'non-scaling-stroke');\n this.rotationAnchor.setAttribute('style', 'pointer-events: all;');\n this.group.appendChild(this.rotationAnchor);\n\n this.rotationAnchor.addEventListener('mouseover', function () {\n if (!isResizingShapeSquare && !isDraggingShapeSquare && !isRotatingShapeSquare) {\n svg.style.cursor = 'grab';\n }\n });\n this.rotationAnchor.addEventListener('mouseout', function () {\n if (!isResizingShapeSquare && !isDraggingShapeSquare && !isRotatingShapeSquare) {\n svg.style.cursor = 'default';\n }\n });\n\n const pointsAttr = outlinePoints.map(p => p.join(',')).join(' ');\n const outline = document.createElementNS('http://www.w3.org/2000/svg', 'polyline');\n outline.setAttribute('points', pointsAttr);\n outline.setAttribute('fill', 'none');\n outline.setAttribute('stroke', '#5B57D1');\n outline.setAttribute('stroke-width', 1.5);\n outline.setAttribute('stroke-dasharray', '4 2');\n outline.setAttribute('vector-effect', 'non-scaling-stroke');\n outline.setAttribute('style', 'pointer-events: none;');\n this.group.appendChild(outline);\n this.selectionOutline = outline;\n\n // Show relevant sidebar\n disableAllSideBars();\n squareSideBar.classList.remove(\"hidden\");\n if (window.__showSidebarForShape) window.__showSidebarForShape('rectangle');\n this.updateSidebar();\n }\n\n updateSelectionControls() {\n if (!this.selectionOutline || this.anchors.length === 0) return;\n\n const anchorSize = 10;\n const expandedX = -this.selectionPadding;\n const expandedY = -this.selectionPadding;\n const expandedWidth = this.width + 2 * this.selectionPadding;\n const expandedHeight = this.height + 2 * this.selectionPadding;\n\n const positions = [\n { x: expandedX, y: expandedY },\n { x: expandedX + expandedWidth, y: expandedY },\n { x: expandedX, y: expandedY + expandedHeight },\n { x: expandedX + expandedWidth, y: expandedY + expandedHeight },\n { x: expandedX + expandedWidth / 2, y: expandedY },\n { x: expandedX + expandedWidth / 2, y: expandedY + expandedHeight },\n { x: expandedX, y: expandedHeight / 2 + expandedY },\n { x: expandedX + expandedWidth, y: expandedHeight / 2 + expandedY }\n ];\n\n // Update anchor positions\n positions.forEach((pos, i) => {\n if (this.anchors[i]) {\n this.anchors[i].setAttribute('x', pos.x - anchorSize / 2);\n this.anchors[i].setAttribute('y', pos.y - anchorSize / 2);\n }\n });\n\n // Update outline\n const outlinePoints = [\n [positions[0].x, positions[0].y],\n [positions[1].x, positions[1].y],\n [positions[3].x, positions[3].y],\n [positions[2].x, positions[2].y],\n [positions[0].x, positions[0].y]\n ];\n this.selectionOutline.setAttribute('points', outlinePoints.map(p => p.join(',')).join(' '));\n\n // Update rotation anchor\n if (this.rotationAnchor) {\n this.rotationAnchor.setAttribute('cx', expandedX + expandedWidth / 2);\n this.rotationAnchor.setAttribute('cy', expandedY - 30);\n }\n }\n\n removeSelection() {\n // Remove selection elements (anchors, outline, rotation anchor) from the group\n this.anchors.forEach(anchor => {\n if (anchor.parentNode === this.group) {\n this.group.removeChild(anchor);\n }\n });\n if (this.rotationAnchor && this.rotationAnchor.parentNode === this.group) {\n this.group.removeChild(this.rotationAnchor);\n }\n if (this.selectionOutline && this.selectionOutline.parentNode === this.group) {\n this.group.removeChild(this.selectionOutline);\n }\n this.anchors = [];\n this.rotationAnchor = null;\n this.selectionOutline = null;\n this.isSelected = false;\n }\n\n contains(x, y) {\n if (!this.element) return false; \n const CTM = this.group.getCTM();\n if (!CTM) return false; \n const inverseCTM = CTM.inverse();\n\n const svgPoint = svg.createSVGPoint();\n svgPoint.x = x;\n svgPoint.y = y;\n const transformedPoint = svgPoint.matrixTransform(inverseCTM);\n const tolerance = 5;\n return transformedPoint.x >= -tolerance && transformedPoint.x <= this.width + tolerance &&\n transformedPoint.y >= -tolerance && transformedPoint.y <= this.height + tolerance;\n }\n\n // Helper to check if a point is near an anchor\n isNearAnchor(x, y) {\n if (!this.isSelected) return null;\n const buffer = 10; \n const anchorSize = 10; \n\n // Iterate through anchors\n for (let i = 0; i < this.anchors.length; i++) {\n const anchor = this.anchors[i];\n const anchorLocalX = parseFloat(anchor.getAttribute('x')) + anchorSize / 2;\n const anchorLocalY = parseFloat(anchor.getAttribute('y')) + anchorSize / 2;\n const svgPoint = svg.createSVGPoint();\n svgPoint.x = anchorLocalX;\n svgPoint.y = anchorLocalY;\n const transformedPoint = svgPoint.matrixTransform(this.group.getCTM());\n const anchorLeft = transformedPoint.x - anchorSize/2 - buffer;\n const anchorRight = transformedPoint.x + anchorSize/2 + buffer;\n const anchorTop = transformedPoint.y - anchorSize/2 - buffer;\n const anchorBottom = transformedPoint.y + anchorSize/2 + buffer;\n if (x >= anchorLeft && x <= anchorRight && y >= anchorTop && y <= anchorBottom) {\n return { type: 'resize', index: i };\n }\n }\n\n // Check rotation anchor\n if (this.rotationAnchor) {\n const rotateAnchorLocalX = parseFloat(this.rotationAnchor.getAttribute('cx'));\n const rotateAnchorLocalY = parseFloat(this.rotationAnchor.getAttribute('cy'));\n const svgPoint = svg.createSVGPoint();\n svgPoint.x = rotateAnchorLocalX;\n svgPoint.y = rotateAnchorLocalY;\n const transformedPoint = svgPoint.matrixTransform(this.group.getCTM());\n const rotateAnchorRadius = parseFloat(this.rotationAnchor.getAttribute('r'));\n const distSq = (x - transformedPoint.x)**2 + (y - transformedPoint.y)**2;\n if (distSq <= (rotateAnchorRadius + buffer)**2) {\n return { type: 'rotate' };\n }\n }\n\n return null;\n }\n\n\nmove(dx, dy) {\n this.x += dx;\n this.y += dy;\n\n // Fast path: just update the transform \u2014 no need to rebuild RoughJS element\n const rotateCenterX = this.width / 2;\n const rotateCenterY = this.height / 2;\n this.group.setAttribute('transform', `translate(${this.x}, ${this.y}) rotate(${this.rotation}, ${rotateCenterX}, ${rotateCenterY})`);\n\n this.updateAttachedArrows();\n\n // Only update frame containment if we're actively dragging the shape itself\n // and not being moved by a parent frame\n if (isDraggingShapeSquare && !this.isBeingMovedByFrame) {\n this.updateFrameContainment();\n }\n}\n\nupdateFrameContainment() {\n // Don't update if we're being moved by a frame\n if (this.isBeingMovedByFrame) return;\n \n let targetFrame = null;\n \n // Find which frame this shape is over\n shapes.forEach(shape => {\n if (shape.shapeName === 'frame' && shape.isShapeInFrame(this)) {\n targetFrame = shape;\n }\n });\n \n // If we have a parent frame and we're being dragged, temporarily remove clipping\n if (this.parentFrame && isDraggingShapeSquare) {\n this.parentFrame.temporarilyRemoveFromFrame(this);\n }\n \n // Update frame highlighting\n if (hoveredFrame && hoveredFrame !== targetFrame) {\n hoveredFrame.removeHighlight();\n }\n \n if (targetFrame && targetFrame !== hoveredFrame) {\n targetFrame.highlightFrame();\n }\n \n hoveredFrame = targetFrame;\n}\n\n updatePosition(anchorIndex, newMouseX, newMouseY) {\n const CTM = this.group.getCTM();\n if (!CTM) return;\n const inverseCTM = CTM.inverse();\n const svgPoint = svg.createSVGPoint();\n svgPoint.x = newMouseX;\n svgPoint.y = newMouseY;\n const localMouse = svgPoint.matrixTransform(inverseCTM);\n\n const oldW = this.width;\n const oldH = this.height;\n\n // Determine fixed point in old local coords and compute raw new dimensions\n let fixedOldX, fixedOldY, rawW, rawH;\n switch (anchorIndex) {\n case 0: fixedOldX = oldW; fixedOldY = oldH; rawW = oldW - localMouse.x; rawH = oldH - localMouse.y; break;\n case 1: fixedOldX = 0; fixedOldY = oldH; rawW = localMouse.x; rawH = oldH - localMouse.y; break;\n case 2: fixedOldX = oldW; fixedOldY = 0; rawW = oldW - localMouse.x; rawH = localMouse.y; break;\n case 3: fixedOldX = 0; fixedOldY = 0; rawW = localMouse.x; rawH = localMouse.y; break;\n case 4: fixedOldX = 0; fixedOldY = oldH; rawW = oldW; rawH = oldH - localMouse.y; break;\n case 5: fixedOldX = 0; fixedOldY = 0; rawW = oldW; rawH = localMouse.y; break;\n case 6: fixedOldX = oldW; fixedOldY = 0; rawW = oldW - localMouse.x; rawH = oldH; break;\n case 7: fixedOldX = 0; fixedOldY = 0; rawW = localMouse.x; rawH = oldH; break;\n }\n\n // Get world position of the fixed point using current CTM\n const fp = svg.createSVGPoint();\n fp.x = fixedOldX;\n fp.y = fixedOldY;\n const fixedWorld = fp.matrixTransform(CTM);\n\n // Handle negative dimensions (dragged past opposite edge)\n const newW = Math.abs(rawW);\n const newH = Math.abs(rawH);\n\n // Fixed point in new local coords (flips if dimension went negative)\n const fixedNewX = fixedOldX === 0 ? (rawW >= 0 ? 0 : newW) : (rawW >= 0 ? newW : 0);\n const fixedNewY = fixedOldY === 0 ? (rawH >= 0 ? 0 : newH) : (rawH >= 0 ? newH : 0);\n\n // Solve for new x, y so the fixed corner stays in place\n // Transform: translate(x, y) rotate(\u03B8, newW/2, newH/2)\n const rad = this.rotation * Math.PI / 180;\n const cosR = Math.cos(rad);\n const sinR = Math.sin(rad);\n const ncx = newW / 2;\n const ncy = newH / 2;\n const dx = fixedNewX - ncx;\n const dy = fixedNewY - ncy;\n const rotX = ncx + dx * cosR - dy * sinR;\n const rotY = ncy + dx * sinR + dy * cosR;\n\n this.x = fixedWorld.x - rotX;\n this.y = fixedWorld.y - rotY;\n this.width = newW;\n this.height = newH;\n\n this.updateAttachedArrows();\n }\n\n updateAttachedArrows() {\n shapes.forEach(shape => {\n if (shape && shape.shapeName === 'arrow' && typeof shape.updateAttachments === 'function') {\n \n if ((shape.attachedToStart && shape.attachedToStart.shape === this) ||\n (shape.attachedToEnd && shape.attachedToEnd.shape === this)) {\n shape.updateAttachments();\n }\n }\n });\n } \n\n rotate(angle) {\n angle = angle % 360;\n if (angle < 0) angle += 360;\n this.rotation = angle;\n }\n\n // Method to update the sidebar based on the shape's current options\n // No-op: React sidebar handles UI updates via Zustand store\n updateSidebar() {}\n}\n\nexport { Rectangle };\n"],
|
|
5
|
-
"mappings": ";;;AAKA,IAAM,KAAK,MAAM,IAAI,GAAG;AACxB,IAAI,wBAAwB;AAC5B,IAAI,wBAAwB;AAC5B,IAAI,wBAAwB;AAC5B,IAAI,eAAe;AACnB,IAAM,qBAAqB,SAAS,iBAAiB,mBAAmB;AACxE,IAAM,+BAA+B,SAAS,iBAAiB,uBAAuB;AACtF,IAAM,mBAAmB,SAAS,iBAAiB,sBAAsB;AACzE,IAAM,6BAA6B,SAAS,iBAAiB,wBAAwB;AACrF,IAAM,0BAA0B,SAAS,iBAAiB,qBAAqB;AAM/E,IAAM,YAAN,MAAgB;AAAA,EACZ,YAAY,GAAG,GAAG,OAAO,QAAQ,UAAU,CAAC,GAAG;AAC3C,SAAK,IAAI;AACT,SAAK,IAAI;AACT,SAAK,QAAQ;AACb,SAAK,SAAS;AACd,SAAK,UAAU;AAAA,MACX,WAAW;AAAA,MACX,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,MAAM;AAAA,MACN,WAAW;AAAA,MACX,iBAAiB;AAAA,MACjB,GAAG;AAAA,IACP;AACA,SAAK,UAAU;AACf,SAAK,aAAa;AAClB,SAAK,WAAW;AAChB,SAAK,QAAQ,SAAS,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L;AAAA,EAEA,OAAO,OAAO;AACV,YAAQ,QAAQ;AAChB,QAAI,QAAQ,EAAG,UAAS;AACxB,SAAK,WAAW;AAAA,EACpB;AAAA;AAAA;AAAA,EAIA,gBAAgB;AAAA,EAAC;AACrB;",
|
|
4
|
+
"sourcesContent": ["/* eslint-disable */\n// Rectangle shape class - extracted from drawSquare.js\n// Depends on globals: svg, shapes, rough, currentShape, currentZoom, rc\n\n// Create local rc from globals; tool-state vars default to false\nconst rc = rough.svg(svg);\nlet isDraggingShapeSquare = false;\nlet isResizingShapeSquare = false;\nlet isRotatingShapeSquare = false;\nlet hoveredFrame = null;\nconst SquarecolorOptions = document.querySelectorAll(\".squareStrokeSpan\");\nconst backgroundColorOptionsSquare = document.querySelectorAll(\".squareBackgroundSpan\");\nconst fillStyleOptions = document.querySelectorAll(\".squareFillStyleSpan\");\nconst squareStrokeThicknessValue = document.querySelectorAll(\".squareStrokeThickSpan\");\nconst squareOutlineStyleValue = document.querySelectorAll(\".squareOutlineStyle\");\n// Depends on globals: squareStrokecolor, squareBackgroundColor, squareFillStyleValue, squareStrokeThicknes, squareOutlineStyle\n// Depends on globals: isDraggingShapeSquare, isResizingShapeSquare, isRotatingShapeSquare\n// Depends on globals: squareSideBar, disableAllSideBars\n// Depends on DOM query: SquarecolorOptions, backgroundColorOptionsSquare, fillStyleOptions, squareStrokeThicknessValue, squareOutlineStyleValue\n\nclass Rectangle {\n constructor(x, y, width, height, options = {}) {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n this.options = {\n roughness: 1.5,\n stroke: \"#fff\",\n strokeWidth: 2,\n fill: \"transparent\",\n fillStyle: \"none\",\n strokeDasharray: \"\",\n ...options\n };\n this.element = null;\n this.isSelected = false;\n this.rotation = 0;\n this.group = document.createElementNS('http://www.w3.org/2000/svg', 'g');\n this.anchors = [];\n this.rotationAnchor = null;\n this.selectionPadding = 8;\n this.selectionOutline = null;\n this.shapeName = 'rectangle';\n this.shapeID = `rectangle-${String(Date.now()).slice(0, 8)}-${Math.floor(Math.random() * 10000)}`;\n this.group.setAttribute('id', this.shapeID);\n\n // Embedded label support\n this.label = options.label || '';\n this.labelElement = null;\n this.labelColor = options.labelColor || '#e0e0e0';\n this.labelFontSize = options.labelFontSize || 14;\n this._isEditingLabel = false;\n this._hitArea = null;\n this._labelBg = null;\n\n // Shading / gradient support for research paper style diagrams\n this.shadeColor = options.shadeColor || null;\n this.shadeOpacity = options.shadeOpacity !== undefined ? options.shadeOpacity : 0.15;\n this.shadeDirection = options.shadeDirection || 'bottom'; // 'top' | 'bottom' | 'left' | 'right'\n this._shadeRect = null;\n this._shadeGradient = null;\n\n if (!this.group.parentNode) {\n svg.appendChild(this.group);\n }\n this._lastDrawn = {\n width: null,\n height: null,\n options: null\n };\n this.isBeingDrawn = false;\n this._setupLabelDblClick();\n this.draw();\n }\n draw() {\n const childrenToRemove = [];\n const preserveSet = this._skipAnchors ? new Set([...this.anchors, this.selectionOutline, this.rotationAnchor].filter(Boolean)) : null;\n for (let i = 0; i < this.group.children.length; i++) {\n const child = this.group.children[i];\n if (child !== this.element && child !== this.labelElement && child !== this._hitArea && child !== this._labelBg && child !== this._shadeRect) {\n if (preserveSet && preserveSet.has(child)) continue;\n childrenToRemove.push(child);\n }\n }\n childrenToRemove.forEach(child => this.group.removeChild(child));\n\n const optionsString = JSON.stringify(this.options);\n const isInitialDraw = this.element === null;\n const optionsChanged = optionsString !== this._lastDrawn.options;\n const sizeChanged = this.width !== this._lastDrawn.width || this.height !== this._lastDrawn.height;\n\n // Only regenerate rough element if it's not being actively drawn OR if options changed OR initial draw\n if (isInitialDraw || optionsChanged || (!this.isBeingDrawn && sizeChanged)) {\n if (this.element && this.element.parentNode === this.group) {\n this.group.removeChild(this.element);\n }\n const roughRect = rc.rectangle(0, 0, this.width, this.height, this.options);\n this.element = roughRect;\n this.group.appendChild(roughRect);\n\n // Cache the values\n this._lastDrawn.width = this.width;\n this._lastDrawn.height = this.height;\n this._lastDrawn.options = optionsString;\n }\n\n // Hit area for dblclick detection (transparent rect that captures pointer events)\n if (!this._hitArea) {\n this._hitArea = document.createElementNS('http://www.w3.org/2000/svg', 'rect');\n this._hitArea.setAttribute('fill', 'transparent');\n this._hitArea.setAttribute('stroke', 'none');\n this._hitArea.setAttribute('style', 'pointer-events: all;');\n this.group.insertBefore(this._hitArea, this.group.firstChild);\n }\n this._hitArea.setAttribute('x', 0);\n this._hitArea.setAttribute('y', 0);\n this._hitArea.setAttribute('width', this.width);\n this._hitArea.setAttribute('height', this.height);\n\n // Shading / gradient overlay\n this._updateShade();\n\n // Update embedded label\n this._updateLabelElement();\n\n const rotateCenterX = this.width / 2;\n const rotateCenterY = this.height / 2;\n this.group.setAttribute('transform', `translate(${this.x}, ${this.y}) rotate(${this.rotation}, ${rotateCenterX}, ${rotateCenterY})`);\n\n if (this.isSelected) {\n if (this._skipAnchors) {\n this.updateSelectionControls();\n } else {\n this.addAnchors();\n }\n }\n if (!this.group.parentNode) {\n this.updateAttachedArrows();\n svg.appendChild(this.group);\n }\n }\n\n _updateShade() {\n if (!this.shadeColor) {\n if (this._shadeRect && this._shadeRect.parentNode === this.group) {\n this.group.removeChild(this._shadeRect);\n this._shadeRect = null;\n }\n if (this._shadeGradient && this._shadeGradient.parentNode) {\n this._shadeGradient.parentNode.removeChild(this._shadeGradient);\n this._shadeGradient = null;\n }\n return;\n }\n\n // Create or update gradient in SVG defs\n let defs = svg.querySelector('defs');\n if (!defs) {\n defs = document.createElementNS('http://www.w3.org/2000/svg', 'defs');\n svg.appendChild(defs);\n }\n\n const gradId = `shade-${this.shapeID}`;\n if (!this._shadeGradient) {\n this._shadeGradient = document.createElementNS('http://www.w3.org/2000/svg', 'linearGradient');\n this._shadeGradient.setAttribute('id', gradId);\n defs.appendChild(this._shadeGradient);\n }\n\n // Direction mapping\n const dirs = {\n top: { x1: '0%', y1: '0%', x2: '0%', y2: '100%' },\n bottom: { x1: '0%', y1: '100%', x2: '0%', y2: '0%' },\n left: { x1: '0%', y1: '0%', x2: '100%', y2: '0%' },\n right: { x1: '100%', y1: '0%', x2: '0%', y2: '0%' },\n };\n const d = dirs[this.shadeDirection] || dirs.bottom;\n this._shadeGradient.setAttribute('x1', d.x1);\n this._shadeGradient.setAttribute('y1', d.y1);\n this._shadeGradient.setAttribute('x2', d.x2);\n this._shadeGradient.setAttribute('y2', d.y2);\n\n // Rebuild stops\n while (this._shadeGradient.firstChild) this._shadeGradient.removeChild(this._shadeGradient.firstChild);\n const stop1 = document.createElementNS('http://www.w3.org/2000/svg', 'stop');\n stop1.setAttribute('offset', '0%');\n stop1.setAttribute('stop-color', this.shadeColor);\n stop1.setAttribute('stop-opacity', this.shadeOpacity);\n const stop2 = document.createElementNS('http://www.w3.org/2000/svg', 'stop');\n stop2.setAttribute('offset', '100%');\n stop2.setAttribute('stop-color', this.shadeColor);\n stop2.setAttribute('stop-opacity', '0');\n this._shadeGradient.appendChild(stop1);\n this._shadeGradient.appendChild(stop2);\n\n // Create or update shade rect\n if (!this._shadeRect) {\n this._shadeRect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');\n this._shadeRect.setAttribute('pointer-events', 'none');\n }\n this._shadeRect.setAttribute('x', 0);\n this._shadeRect.setAttribute('y', 0);\n this._shadeRect.setAttribute('width', this.width);\n this._shadeRect.setAttribute('height', this.height);\n this._shadeRect.setAttribute('fill', `url(#${gradId})`);\n this._shadeRect.setAttribute('rx', 2);\n\n // Insert after rough element\n if (this._shadeRect.parentNode === this.group) this.group.removeChild(this._shadeRect);\n if (this.element && this.element.nextSibling) {\n this.group.insertBefore(this._shadeRect, this.element.nextSibling);\n } else {\n this.group.appendChild(this._shadeRect);\n }\n }\n\n _updateLabelElement() {\n if (!this.label) {\n // Remove label element if label is empty\n if (this.labelElement && this.labelElement.parentNode === this.group) {\n this.group.removeChild(this.labelElement);\n this.labelElement = null;\n }\n if (this._labelBg && this._labelBg.parentNode === this.group) {\n this.group.removeChild(this._labelBg);\n this._labelBg = null;\n }\n return;\n }\n\n if (!this.labelElement) {\n this.labelElement = document.createElementNS('http://www.w3.org/2000/svg', 'text');\n this.labelElement.setAttribute('class', 'shape-label');\n this.labelElement.setAttribute('pointer-events', 'none');\n }\n\n // Position at center of rectangle\n this.labelElement.setAttribute('x', this.width / 2);\n this.labelElement.setAttribute('y', this.height / 2);\n this.labelElement.setAttribute('text-anchor', 'middle');\n this.labelElement.setAttribute('dominant-baseline', 'central');\n this.labelElement.setAttribute('fill', this.labelColor);\n this.labelElement.setAttribute('font-size', this.labelFontSize);\n this.labelElement.setAttribute('font-family', 'lixFont, sans-serif');\n this.labelElement.textContent = this.label;\n\n // Background padding rect behind text (like arrows have)\n const canvasBg = window.getComputedStyle(svg).backgroundColor || '#000';\n if (!this._labelBg) {\n this._labelBg = document.createElementNS('http://www.w3.org/2000/svg', 'rect');\n this._labelBg.setAttribute('pointer-events', 'none');\n }\n this._labelBg.setAttribute('fill', canvasBg);\n const hPadding = 6;\n const vPadding = 2;\n const charWidth = this.labelFontSize * 0.6;\n const bgW = this.label.length * charWidth + hPadding * 2;\n const bgH = this.labelFontSize + vPadding * 2;\n this._labelBg.setAttribute('x', this.width / 2 - bgW / 2);\n this._labelBg.setAttribute('y', this.height / 2 - bgH / 2);\n this._labelBg.setAttribute('width', bgW);\n this._labelBg.setAttribute('height', bgH);\n this._labelBg.setAttribute('rx', 3);\n\n // Re-append bg then text on top\n if (this._labelBg.parentNode === this.group) this.group.removeChild(this._labelBg);\n if (this.labelElement.parentNode === this.group) this.group.removeChild(this.labelElement);\n this.group.appendChild(this._labelBg);\n this.group.appendChild(this.labelElement);\n }\n\n _setupLabelDblClick() {\n this.group.addEventListener('dblclick', (e) => {\n e.stopPropagation();\n e.preventDefault();\n this.startLabelEdit();\n });\n }\n\n startLabelEdit() {\n if (this._isEditingLabel) return;\n this._isEditingLabel = true;\n\n // Hide label element during editing\n if (this.labelElement) {\n this.labelElement.setAttribute('visibility', 'hidden');\n }\n\n // Get shape's screen position via CTM\n const ctm = this.group.getScreenCTM();\n if (!ctm) { this._isEditingLabel = false; return; }\n\n // Map the shape corners to screen coords\n const pt1 = svg.createSVGPoint();\n pt1.x = 0; pt1.y = 0;\n const screenTL = pt1.matrixTransform(ctm);\n const pt2 = svg.createSVGPoint();\n pt2.x = this.width; pt2.y = this.height;\n const screenBR = pt2.matrixTransform(ctm);\n\n const screenW = Math.abs(screenBR.x - screenTL.x);\n const screenH = Math.abs(screenBR.y - screenTL.y);\n const screenX = Math.min(screenTL.x, screenBR.x);\n const screenY = Math.min(screenTL.y, screenBR.y);\n\n // Create HTML overlay\n const overlay = document.createElement('div');\n overlay.className = 'shape-label-editor';\n overlay.style.cssText = `\n position: fixed; z-index: 10000;\n left: ${screenX}px; top: ${screenY}px;\n width: ${screenW}px; height: ${screenH}px;\n display: flex; align-items: center; justify-content: center;\n pointer-events: auto;\n `;\n\n const canvasBg = window.getComputedStyle(svg).backgroundColor || '#000';\n const input = document.createElement('div');\n input.setAttribute('contenteditable', 'true');\n input.style.cssText = `\n max-width: ${screenW - 8}px; min-width: 30px; min-height: 20px;\n background: ${canvasBg}; border: none;\n outline: none; padding: 2px 6px;\n color: ${this.labelColor}; font-size: ${Math.max(12, this.labelFontSize * (screenW / Math.max(this.width, 1)))}px;\n font-family: lixFont, sans-serif; text-align: center;\n white-space: pre-wrap; word-break: break-word;\n cursor: text;\n `;\n if (this.label) {\n input.textContent = this.label;\n } else {\n input.innerHTML = ' ';\n }\n\n overlay.appendChild(input);\n document.body.appendChild(overlay);\n\n // Focus and select all text\n setTimeout(() => {\n input.focus();\n const sel = window.getSelection();\n const range = document.createRange();\n range.selectNodeContents(input);\n sel.removeAllRanges();\n sel.addRange(range);\n }, 10);\n\n const finishEdit = () => {\n const newText = input.textContent.trim().replace(/\\u00A0/g, '');\n this.label = newText;\n this._isEditingLabel = false;\n\n if (overlay.parentNode) overlay.parentNode.removeChild(overlay);\n if (this.labelElement) this.labelElement.setAttribute('visibility', 'visible');\n this.draw();\n };\n\n input.addEventListener('blur', finishEdit);\n input.addEventListener('keydown', (e) => {\n e.stopPropagation();\n if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); input.blur(); }\n if (e.key === 'Escape') { input.textContent = this.label; input.blur(); }\n });\n input.addEventListener('pointerdown', (e) => e.stopPropagation());\n input.addEventListener('pointermove', (e) => e.stopPropagation());\n input.addEventListener('pointerup', (e) => e.stopPropagation());\n }\n\n setLabel(text, color, fontSize) {\n this.label = text || '';\n if (color) this.labelColor = color;\n if (fontSize) this.labelFontSize = fontSize;\n this.draw();\n }\n\n setDrawingState(isDrawing) {\n this.isBeingDrawn = isDrawing;\n }\n\n getRotatedCursor(direction, angle) {\n const directions = ['ns', 'nesw', 'ew', 'nwse'];\n angle = angle % 360;\n if (angle < 0) angle += 360;\n\n const baseDirectionMap = {\n '0': 'nwse', '1': 'nesw', \n '2': 'nesw', '3': 'nwse', \n '4': 'ns', '5': 'ns', \n '6': 'ew', '7': 'ew' \n };\n const baseDirection = baseDirectionMap[direction];\n let effectiveAngle = angle; \n if (baseDirection === 'nesw') {\n effectiveAngle += 45;\n } else if (baseDirection === 'ew') {\n effectiveAngle += 90;\n } else if (baseDirection === 'nwse') {\n effectiveAngle += 135;\n }\n effectiveAngle = effectiveAngle % 360;\n if (effectiveAngle < 0) effectiveAngle += 360;\n const index = Math.round(effectiveAngle / 45) % 4; \n let finalIndex;\n if (effectiveAngle >= 337.5 || effectiveAngle < 22.5) finalIndex = 0; \n else if (effectiveAngle >= 22.5 && effectiveAngle < 67.5) finalIndex = 1; \n else if (effectiveAngle >= 67.5 && effectiveAngle < 112.5) finalIndex = 2; \n else if (effectiveAngle >= 112.5 && effectiveAngle < 157.5) finalIndex = 3;\n else if (effectiveAngle >= 157.5 && effectiveAngle < 202.5) finalIndex = 0; \n else if (effectiveAngle >= 202.5 && effectiveAngle < 247.5) finalIndex = 1; \n else if (effectiveAngle >= 247.5 && effectiveAngle < 292.5) finalIndex = 2; \n else if (effectiveAngle >= 292.5 && effectiveAngle < 337.5) finalIndex = 3; \n else finalIndex = 0; \n return directions[finalIndex];\n }\n addAnchors() {\n const zoom = window.currentZoom || 1;\n const anchorSize = 10 / zoom;\n const anchorStrokeWidth = 2;\n const self = this;\n const expandedX = -this.selectionPadding; \n const expandedY = -this.selectionPadding; \n const expandedWidth = this.width + 2 * this.selectionPadding;\n const expandedHeight = this.height + 2 * this.selectionPadding;\n\n const positions = [\n { x: expandedX, y: expandedY }, \n { x: expandedX + expandedWidth, y: expandedY }, \n { x: expandedX, y: expandedY + expandedHeight }, \n { x: expandedX + expandedWidth, y: expandedY + expandedHeight }, \n { x: expandedX + expandedWidth / 2, y: expandedY }, \n { x: expandedX + expandedWidth / 2, y: expandedY + expandedHeight }, \n { x: expandedX, y: expandedHeight / 2 + expandedY }, \n { x: expandedX + expandedWidth, y: expandedHeight / 2 + expandedY } \n ];\n\n const outlinePoints = [\n [positions[0].x, positions[0].y],\n [positions[1].x, positions[1].y],\n [positions[3].x, positions[3].y],\n [positions[2].x, positions[2].y],\n [positions[0].x, positions[0].y]\n ];\n\n this.anchors.forEach(anchor => {\n if (anchor.parentNode === this.group) {\n this.group.removeChild(anchor);\n }\n });\n if (this.rotationAnchor && this.rotationAnchor.parentNode === this.group) {\n this.group.removeChild(this.rotationAnchor);\n }\n if (this.selectionOutline && this.selectionOutline.parentNode === this.group) {\n this.group.removeChild(this.selectionOutline);\n }\n\n this.anchors = [];\n const anchorDirections = {\n 0: 'nwse', \n 1: 'nesw', \n 2: 'nesw', \n 3: 'nwse', \n 4: 'ns', \n 5: 'ns', \n 6: 'ew', \n 7: 'ew' \n };\n\n positions.forEach((pos, i) => {\n const anchor = document.createElementNS('http://www.w3.org/2000/svg', 'rect');\n anchor.setAttribute('x', pos.x - anchorSize / 2);\n anchor.setAttribute('y', pos.y - anchorSize / 2);\n anchor.setAttribute('width', anchorSize);\n anchor.setAttribute('height', anchorSize);\n anchor.setAttribute('class', 'anchor');\n anchor.setAttribute('data-index', i);\n anchor.setAttribute('fill', '#121212');\n anchor.setAttribute('stroke', '#5B57D1');\n anchor.setAttribute('stroke-width', anchorStrokeWidth);\n anchor.setAttribute('vector-effect', 'non-scaling-stroke');\n anchor.setAttribute('style', 'pointer-events: all;');\n\n anchor.addEventListener('mouseover', function () {\n const index = this.getAttribute('data-index');\n const baseDirection = anchorDirections[index];\n const rotatedCursor = self.getRotatedCursor(index, self.rotation); \n svg.style.cursor = rotatedCursor + '-resize';\n });\n\n anchor.addEventListener('mouseout', function () {\n if (!isResizingShapeSquare && !isDraggingShapeSquare && !isRotatingShapeSquare) {\n svg.style.cursor = 'default';\n }\n });\n\n this.group.appendChild(anchor);\n this.anchors[i] = anchor;\n });\n const rotationAnchorPos = { x: expandedX + expandedWidth / 2, y: expandedY - 30 / zoom };\n this.rotationAnchor = document.createElementNS('http://www.w3.org/2000/svg', 'circle');\n this.rotationAnchor.setAttribute('cx', rotationAnchorPos.x);\n this.rotationAnchor.setAttribute('cy', rotationAnchorPos.y);\n this.rotationAnchor.setAttribute('r', 8 / zoom);\n this.rotationAnchor.setAttribute('class', 'rotate-anchor');\n this.rotationAnchor.setAttribute('fill', '#121212');\n this.rotationAnchor.setAttribute('stroke', '#5B57D1');\n this.rotationAnchor.setAttribute('stroke-width', anchorStrokeWidth);\n this.rotationAnchor.setAttribute('vector-effect', 'non-scaling-stroke');\n this.rotationAnchor.setAttribute('style', 'pointer-events: all;');\n this.group.appendChild(this.rotationAnchor);\n\n this.rotationAnchor.addEventListener('mouseover', function () {\n if (!isResizingShapeSquare && !isDraggingShapeSquare && !isRotatingShapeSquare) {\n svg.style.cursor = 'grab';\n }\n });\n this.rotationAnchor.addEventListener('mouseout', function () {\n if (!isResizingShapeSquare && !isDraggingShapeSquare && !isRotatingShapeSquare) {\n svg.style.cursor = 'default';\n }\n });\n\n const pointsAttr = outlinePoints.map(p => p.join(',')).join(' ');\n const outline = document.createElementNS('http://www.w3.org/2000/svg', 'polyline');\n outline.setAttribute('points', pointsAttr);\n outline.setAttribute('fill', 'none');\n outline.setAttribute('stroke', '#5B57D1');\n outline.setAttribute('stroke-width', 1.5);\n outline.setAttribute('stroke-dasharray', '4 2');\n outline.setAttribute('vector-effect', 'non-scaling-stroke');\n outline.setAttribute('style', 'pointer-events: none;');\n this.group.appendChild(outline);\n this.selectionOutline = outline;\n\n // Show relevant sidebar\n disableAllSideBars();\n squareSideBar.classList.remove(\"hidden\");\n if (window.__showSidebarForShape) window.__showSidebarForShape('rectangle');\n this.updateSidebar();\n }\n\n updateSelectionControls() {\n if (!this.selectionOutline || this.anchors.length === 0) return;\n\n const anchorSize = 10;\n const expandedX = -this.selectionPadding;\n const expandedY = -this.selectionPadding;\n const expandedWidth = this.width + 2 * this.selectionPadding;\n const expandedHeight = this.height + 2 * this.selectionPadding;\n\n const positions = [\n { x: expandedX, y: expandedY },\n { x: expandedX + expandedWidth, y: expandedY },\n { x: expandedX, y: expandedY + expandedHeight },\n { x: expandedX + expandedWidth, y: expandedY + expandedHeight },\n { x: expandedX + expandedWidth / 2, y: expandedY },\n { x: expandedX + expandedWidth / 2, y: expandedY + expandedHeight },\n { x: expandedX, y: expandedHeight / 2 + expandedY },\n { x: expandedX + expandedWidth, y: expandedHeight / 2 + expandedY }\n ];\n\n // Update anchor positions\n positions.forEach((pos, i) => {\n if (this.anchors[i]) {\n this.anchors[i].setAttribute('x', pos.x - anchorSize / 2);\n this.anchors[i].setAttribute('y', pos.y - anchorSize / 2);\n }\n });\n\n // Update outline\n const outlinePoints = [\n [positions[0].x, positions[0].y],\n [positions[1].x, positions[1].y],\n [positions[3].x, positions[3].y],\n [positions[2].x, positions[2].y],\n [positions[0].x, positions[0].y]\n ];\n this.selectionOutline.setAttribute('points', outlinePoints.map(p => p.join(',')).join(' '));\n\n // Update rotation anchor\n if (this.rotationAnchor) {\n this.rotationAnchor.setAttribute('cx', expandedX + expandedWidth / 2);\n this.rotationAnchor.setAttribute('cy', expandedY - 30);\n }\n }\n\n removeSelection() {\n // Remove selection elements (anchors, outline, rotation anchor) from the group\n this.anchors.forEach(anchor => {\n if (anchor.parentNode === this.group) {\n this.group.removeChild(anchor);\n }\n });\n if (this.rotationAnchor && this.rotationAnchor.parentNode === this.group) {\n this.group.removeChild(this.rotationAnchor);\n }\n if (this.selectionOutline && this.selectionOutline.parentNode === this.group) {\n this.group.removeChild(this.selectionOutline);\n }\n this.anchors = [];\n this.rotationAnchor = null;\n this.selectionOutline = null;\n this.isSelected = false;\n }\n\n contains(x, y) {\n if (!this.element) return false;\n // x/y are already canvas (viewBox) coordinates. getCTM() operates in\n // viewport coordinates and made hit testing drift after pan/zoom.\n const centerX = this.width / 2;\n const centerY = this.height / 2;\n const angle = -(this.rotation || 0) * Math.PI / 180;\n const translatedX = x - this.x;\n const translatedY = y - this.y;\n const dx = translatedX - centerX;\n const dy = translatedY - centerY;\n const localX = dx * Math.cos(angle) - dy * Math.sin(angle) + centerX;\n const localY = dx * Math.sin(angle) + dy * Math.cos(angle) + centerY;\n const tolerance = 5;\n return localX >= -tolerance && localX <= this.width + tolerance &&\n localY >= -tolerance && localY <= this.height + tolerance;\n }\n\n // Helper to check if a point is near an anchor\n isNearAnchor(x, y) {\n if (!this.isSelected) return null;\n const buffer = 10; \n const anchorSize = 10; \n\n // Iterate through anchors\n for (let i = 0; i < this.anchors.length; i++) {\n const anchor = this.anchors[i];\n const anchorLocalX = parseFloat(anchor.getAttribute('x')) + anchorSize / 2;\n const anchorLocalY = parseFloat(anchor.getAttribute('y')) + anchorSize / 2;\n const svgPoint = svg.createSVGPoint();\n svgPoint.x = anchorLocalX;\n svgPoint.y = anchorLocalY;\n const transformedPoint = svgPoint.matrixTransform(this.group.getCTM());\n const anchorLeft = transformedPoint.x - anchorSize/2 - buffer;\n const anchorRight = transformedPoint.x + anchorSize/2 + buffer;\n const anchorTop = transformedPoint.y - anchorSize/2 - buffer;\n const anchorBottom = transformedPoint.y + anchorSize/2 + buffer;\n if (x >= anchorLeft && x <= anchorRight && y >= anchorTop && y <= anchorBottom) {\n return { type: 'resize', index: i };\n }\n }\n\n // Check rotation anchor\n if (this.rotationAnchor) {\n const rotateAnchorLocalX = parseFloat(this.rotationAnchor.getAttribute('cx'));\n const rotateAnchorLocalY = parseFloat(this.rotationAnchor.getAttribute('cy'));\n const svgPoint = svg.createSVGPoint();\n svgPoint.x = rotateAnchorLocalX;\n svgPoint.y = rotateAnchorLocalY;\n const transformedPoint = svgPoint.matrixTransform(this.group.getCTM());\n const rotateAnchorRadius = parseFloat(this.rotationAnchor.getAttribute('r'));\n const distSq = (x - transformedPoint.x)**2 + (y - transformedPoint.y)**2;\n if (distSq <= (rotateAnchorRadius + buffer)**2) {\n return { type: 'rotate' };\n }\n }\n\n return null;\n }\n\n\nmove(dx, dy) {\n this.x += dx;\n this.y += dy;\n\n // Fast path: just update the transform \u2014 no need to rebuild RoughJS element\n const rotateCenterX = this.width / 2;\n const rotateCenterY = this.height / 2;\n this.group.setAttribute('transform', `translate(${this.x}, ${this.y}) rotate(${this.rotation}, ${rotateCenterX}, ${rotateCenterY})`);\n\n this.updateAttachedArrows();\n\n // Only update frame containment if we're actively dragging the shape itself\n // and not being moved by a parent frame\n if (isDraggingShapeSquare && !this.isBeingMovedByFrame) {\n this.updateFrameContainment();\n }\n}\n\nupdateFrameContainment() {\n // Don't update if we're being moved by a frame\n if (this.isBeingMovedByFrame) return;\n \n let targetFrame = null;\n \n // Find which frame this shape is over\n shapes.forEach(shape => {\n if (shape.shapeName === 'frame' && shape.isShapeInFrame(this)) {\n targetFrame = shape;\n }\n });\n \n // If we have a parent frame and we're being dragged, temporarily remove clipping\n if (this.parentFrame && isDraggingShapeSquare) {\n this.parentFrame.temporarilyRemoveFromFrame(this);\n }\n \n // Update frame highlighting\n if (hoveredFrame && hoveredFrame !== targetFrame) {\n hoveredFrame.removeHighlight();\n }\n \n if (targetFrame && targetFrame !== hoveredFrame) {\n targetFrame.highlightFrame();\n }\n \n hoveredFrame = targetFrame;\n}\n\n updatePosition(anchorIndex, newMouseX, newMouseY) {\n const CTM = this.group.getCTM();\n if (!CTM) return;\n const inverseCTM = CTM.inverse();\n const svgPoint = svg.createSVGPoint();\n svgPoint.x = newMouseX;\n svgPoint.y = newMouseY;\n const localMouse = svgPoint.matrixTransform(inverseCTM);\n\n const oldW = this.width;\n const oldH = this.height;\n\n // Determine fixed point in old local coords and compute raw new dimensions\n let fixedOldX, fixedOldY, rawW, rawH;\n switch (anchorIndex) {\n case 0: fixedOldX = oldW; fixedOldY = oldH; rawW = oldW - localMouse.x; rawH = oldH - localMouse.y; break;\n case 1: fixedOldX = 0; fixedOldY = oldH; rawW = localMouse.x; rawH = oldH - localMouse.y; break;\n case 2: fixedOldX = oldW; fixedOldY = 0; rawW = oldW - localMouse.x; rawH = localMouse.y; break;\n case 3: fixedOldX = 0; fixedOldY = 0; rawW = localMouse.x; rawH = localMouse.y; break;\n case 4: fixedOldX = 0; fixedOldY = oldH; rawW = oldW; rawH = oldH - localMouse.y; break;\n case 5: fixedOldX = 0; fixedOldY = 0; rawW = oldW; rawH = localMouse.y; break;\n case 6: fixedOldX = oldW; fixedOldY = 0; rawW = oldW - localMouse.x; rawH = oldH; break;\n case 7: fixedOldX = 0; fixedOldY = 0; rawW = localMouse.x; rawH = oldH; break;\n }\n\n // Get world position of the fixed point using current CTM\n const fp = svg.createSVGPoint();\n fp.x = fixedOldX;\n fp.y = fixedOldY;\n const fixedWorld = fp.matrixTransform(CTM);\n\n // Handle negative dimensions (dragged past opposite edge)\n const newW = Math.abs(rawW);\n const newH = Math.abs(rawH);\n\n // Fixed point in new local coords (flips if dimension went negative)\n const fixedNewX = fixedOldX === 0 ? (rawW >= 0 ? 0 : newW) : (rawW >= 0 ? newW : 0);\n const fixedNewY = fixedOldY === 0 ? (rawH >= 0 ? 0 : newH) : (rawH >= 0 ? newH : 0);\n\n // Solve for new x, y so the fixed corner stays in place\n // Transform: translate(x, y) rotate(\u03B8, newW/2, newH/2)\n const rad = this.rotation * Math.PI / 180;\n const cosR = Math.cos(rad);\n const sinR = Math.sin(rad);\n const ncx = newW / 2;\n const ncy = newH / 2;\n const dx = fixedNewX - ncx;\n const dy = fixedNewY - ncy;\n const rotX = ncx + dx * cosR - dy * sinR;\n const rotY = ncy + dx * sinR + dy * cosR;\n\n this.x = fixedWorld.x - rotX;\n this.y = fixedWorld.y - rotY;\n this.width = newW;\n this.height = newH;\n\n this.updateAttachedArrows();\n }\n\n updateAttachedArrows() {\n shapes.forEach(shape => {\n if (shape && shape.shapeName === 'arrow' && typeof shape.updateAttachments === 'function') {\n \n if ((shape.attachedToStart && shape.attachedToStart.shape === this) ||\n (shape.attachedToEnd && shape.attachedToEnd.shape === this)) {\n shape.updateAttachments();\n }\n }\n });\n } \n\n rotate(angle) {\n angle = angle % 360;\n if (angle < 0) angle += 360;\n this.rotation = angle;\n }\n\n // Method to update the sidebar based on the shape's current options\n // No-op: React sidebar handles UI updates via Zustand store\n updateSidebar() {}\n}\n\nexport { Rectangle };\n"],
|
|
5
|
+
"mappings": ";;;AAKA,IAAM,KAAK,MAAM,IAAI,GAAG;AACxB,IAAI,wBAAwB;AAC5B,IAAI,wBAAwB;AAC5B,IAAI,wBAAwB;AAC5B,IAAI,eAAe;AACnB,IAAM,qBAAqB,SAAS,iBAAiB,mBAAmB;AACxE,IAAM,+BAA+B,SAAS,iBAAiB,uBAAuB;AACtF,IAAM,mBAAmB,SAAS,iBAAiB,sBAAsB;AACzE,IAAM,6BAA6B,SAAS,iBAAiB,wBAAwB;AACrF,IAAM,0BAA0B,SAAS,iBAAiB,qBAAqB;AAM/E,IAAM,YAAN,MAAgB;AAAA,EACZ,YAAY,GAAG,GAAG,OAAO,QAAQ,UAAU,CAAC,GAAG;AAC3C,SAAK,IAAI;AACT,SAAK,IAAI;AACT,SAAK,QAAQ;AACb,SAAK,SAAS;AACd,SAAK,UAAU;AAAA,MACX,WAAW;AAAA,MACX,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,MAAM;AAAA,MACN,WAAW;AAAA,MACX,iBAAiB;AAAA,MACjB,GAAG;AAAA,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AS;AACpB,UAAI,SAAS,MAAM,cAAc,WAAW,OAAO,MAAM,sBAAsB,YAAY;AAEvF,YAAK,MAAM,mBAAmB,MAAM,gBAAgB,UAAU,QACzD,MAAM,iBAAiB,MAAM,cAAc,UAAU,MAAO;AAC7D,gBAAM,kBAAkB;AAAA,QAC5B;AAAA,MACJ;AAAA,IACJ,CAAC;AAAA,EACL;AAAA,EAEA,OAAO,OAAO;AACV,YAAQ,QAAQ;AAChB,QAAI,QAAQ,EAAG,UAAS;AACxB,SAAK,WAAW;AAAA,EACpB;AAAA;AAAA;AAAA,EAIA,gBAAgB;AAAA,EAAC;AACrB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/react/index.js
CHANGED
|
@@ -431,7 +431,7 @@ function useSketchEngine(svgRef, ready = true) {
|
|
|
431
431
|
setZoom: (zoom) => useSketchStore_default.setState({ zoom }),
|
|
432
432
|
getState: () => useSketchStore_default.getState()
|
|
433
433
|
};
|
|
434
|
-
const { SketchEngine } = await import("./SketchEngine-
|
|
434
|
+
const { SketchEngine } = await import("./SketchEngine-P3XNZA56.js");
|
|
435
435
|
if (cancelled) return;
|
|
436
436
|
const engine = new SketchEngine(svgRef.current);
|
|
437
437
|
await engine.init();
|
|
@@ -4741,7 +4741,7 @@ var _saveScene = null;
|
|
|
4741
4741
|
var _loadScene = null;
|
|
4742
4742
|
async function ensureSceneSerializer() {
|
|
4743
4743
|
if (_saveScene && _loadScene) return;
|
|
4744
|
-
const m = await import("./SceneSerializer-
|
|
4744
|
+
const m = await import("./SceneSerializer-34VQFJN7.js");
|
|
4745
4745
|
_saveScene = m.saveScene;
|
|
4746
4746
|
_loadScene = m.loadScene;
|
|
4747
4747
|
}
|
package/package.json
CHANGED
package/src/core/CopyPaste.js
CHANGED
|
@@ -392,11 +392,17 @@ function createShapeFromData(data, offsetX, offsetY) {
|
|
|
392
392
|
}
|
|
393
393
|
|
|
394
394
|
case 'icon': {
|
|
395
|
-
// Parse
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
const
|
|
399
|
-
|
|
395
|
+
// Parse inside an SVG document. Parsing a copied <g> through an
|
|
396
|
+
// HTML <div> creates it in the HTML namespace, so it can be added
|
|
397
|
+
// to shapes[] but the SVG renderer will not paint it.
|
|
398
|
+
const parser = new DOMParser();
|
|
399
|
+
const parsed = parser.parseFromString(
|
|
400
|
+
`<svg xmlns="http://www.w3.org/2000/svg">${data.elementHTML}</svg>`,
|
|
401
|
+
'image/svg+xml'
|
|
402
|
+
);
|
|
403
|
+
const parsedGroup = parsed.querySelector('g');
|
|
404
|
+
if (!parsedGroup || parsed.querySelector('parsererror')) return null;
|
|
405
|
+
const clonedEl = svgEl.ownerDocument.importNode(parsedGroup, true);
|
|
400
406
|
|
|
401
407
|
const newX = data.x + offsetX;
|
|
402
408
|
const newY = data.y + offsetY;
|
package/src/core/Selection.js
CHANGED
|
@@ -1505,8 +1505,21 @@ function handleMultiSelectionMouseDown(e) {
|
|
|
1505
1505
|
let clickedOnShape = false;
|
|
1506
1506
|
let clickedShape = null;
|
|
1507
1507
|
if (typeof shapes !== 'undefined') {
|
|
1508
|
-
|
|
1508
|
+
// Prefer the actual SVG event target. This remains exact regardless
|
|
1509
|
+
// of pan/zoom and also covers shapes whose visual bounds come from a
|
|
1510
|
+
// foreignObject or imported SVG rather than simple geometry.
|
|
1509
1511
|
for (let i = shapes.length - 1; i >= 0; i--) {
|
|
1512
|
+
const shape = shapes[i];
|
|
1513
|
+
const element = shape?.group || shape?.element;
|
|
1514
|
+
if (element && (element === e.target || element.contains?.(e.target))) {
|
|
1515
|
+
clickedOnShape = true;
|
|
1516
|
+
clickedShape = shape;
|
|
1517
|
+
break;
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
let fallbackFrame = null;
|
|
1522
|
+
for (let i = shapes.length - 1; !clickedOnShape && i >= 0; i--) {
|
|
1510
1523
|
const shape = shapes[i];
|
|
1511
1524
|
if (shape.contains && shape.contains(x, y)) {
|
|
1512
1525
|
if (shape.shapeName === 'frame') {
|
|
@@ -2003,4 +2016,4 @@ export {
|
|
|
2003
2016
|
multiSelection,
|
|
2004
2017
|
isDraggingMultiSelection,
|
|
2005
2018
|
isMultiSelecting
|
|
2006
|
-
};
|
|
2019
|
+
};
|
package/src/shapes/Circle.js
CHANGED
|
@@ -415,18 +415,14 @@ class Circle {
|
|
|
415
415
|
this.isSelected = false;
|
|
416
416
|
}
|
|
417
417
|
contains(x, y) {
|
|
418
|
-
if (!this.element) return false;
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
const
|
|
422
|
-
|
|
423
|
-
const
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
const transformedPoint = svgPoint.matrixTransform(inverseCTM);
|
|
427
|
-
|
|
428
|
-
const dx = transformedPoint.x - 0;
|
|
429
|
-
const dy = transformedPoint.y - 0;
|
|
418
|
+
if (!this.element || !this.rx || !this.ry) return false;
|
|
419
|
+
// Mouse coordinates are in canvas space; invert the circle's own
|
|
420
|
+
// translation/rotation without mixing in the viewport CTM.
|
|
421
|
+
const angle = -(this.rotation || 0) * Math.PI / 180;
|
|
422
|
+
const translatedX = x - this.x;
|
|
423
|
+
const translatedY = y - this.y;
|
|
424
|
+
const dx = translatedX * Math.cos(angle) - translatedY * Math.sin(angle);
|
|
425
|
+
const dy = translatedX * Math.sin(angle) + translatedY * Math.cos(angle);
|
|
430
426
|
const rx = this.rx;
|
|
431
427
|
const ry = this.ry;
|
|
432
428
|
return ((dx * dx) / (rx * rx) + (dy * dy) / (ry * ry)) <= 1.05;
|
package/src/shapes/CodeShape.js
CHANGED
|
@@ -208,19 +208,24 @@ class CodeShape {
|
|
|
208
208
|
try { bbox = codeElement.getBBox(); } catch { return false; }
|
|
209
209
|
const padding = 8; // Selection padding
|
|
210
210
|
|
|
211
|
-
const
|
|
212
|
-
|
|
211
|
+
const transform = this.group.getAttribute('transform') || '';
|
|
212
|
+
const translate = transform.match(/translate\(\s*([^,\s)]+)[,\s]+([^\s)]+)/);
|
|
213
|
+
const tx = Number.isFinite(parseFloat(this.group.getAttribute('data-x')))
|
|
214
|
+
? parseFloat(this.group.getAttribute('data-x')) : parseFloat(translate?.[1]) || 0;
|
|
215
|
+
const ty = Number.isFinite(parseFloat(this.group.getAttribute('data-y')))
|
|
216
|
+
? parseFloat(this.group.getAttribute('data-y')) : parseFloat(translate?.[2]) || 0;
|
|
217
|
+
const centerX = bbox.x + bbox.width / 2;
|
|
218
|
+
const centerY = bbox.y + bbox.height / 2;
|
|
219
|
+
const angle = -extractRotationFromTransform(this.group) * Math.PI / 180;
|
|
220
|
+
const dx = x - tx - centerX;
|
|
221
|
+
const dy = y - ty - centerY;
|
|
222
|
+
const localX = dx * Math.cos(angle) - dy * Math.sin(angle) + centerX;
|
|
223
|
+
const localY = dx * Math.sin(angle) + dy * Math.cos(angle) + centerY;
|
|
213
224
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
const transformedPoint = svgPoint.matrixTransform(inverseCTM);
|
|
219
|
-
|
|
220
|
-
return transformedPoint.x >= bbox.x - padding &&
|
|
221
|
-
transformedPoint.x <= bbox.x + bbox.width + padding &&
|
|
222
|
-
transformedPoint.y >= bbox.y - padding &&
|
|
223
|
-
transformedPoint.y <= bbox.y + bbox.height + padding;
|
|
225
|
+
return localX >= bbox.x - padding &&
|
|
226
|
+
localX <= bbox.x + bbox.width + padding &&
|
|
227
|
+
localY >= bbox.y - padding &&
|
|
228
|
+
localY <= bbox.y + bbox.height + padding;
|
|
224
229
|
}
|
|
225
230
|
|
|
226
231
|
// Add draw method for consistency with other shapes
|
|
@@ -350,6 +350,24 @@ class FreehandStroke {
|
|
|
350
350
|
}
|
|
351
351
|
|
|
352
352
|
move(dx, dy) {
|
|
353
|
+
// Diagram polygons (currently pie sectors) are redrawn by their parent
|
|
354
|
+
// frame after every movement step. Moving them with a deferred SVG
|
|
355
|
+
// transform therefore loses the visible transform on that redraw while
|
|
356
|
+
// leaving a hidden offset behind, which makes sectors detach from the
|
|
357
|
+
// frame and jump the next time they are selected. Keep their geometry
|
|
358
|
+
// authoritative instead.
|
|
359
|
+
if (this.options.closedFill) {
|
|
360
|
+
this.points = this.points.map(point => [
|
|
361
|
+
point[0] + dx,
|
|
362
|
+
point[1] + dy,
|
|
363
|
+
point[2] || 0.5
|
|
364
|
+
]);
|
|
365
|
+
this._moveOffsetX = 0;
|
|
366
|
+
this._moveOffsetY = 0;
|
|
367
|
+
this.draw();
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
|
|
353
371
|
// Accumulate offset for transform-based movement (avoids full path rebuild)
|
|
354
372
|
this._moveOffsetX = (this._moveOffsetX || 0) + dx;
|
|
355
373
|
this._moveOffsetY = (this._moveOffsetY || 0) + dy;
|