@elixpo/lixsketch 5.5.20 → 5.5.21
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/{CopyPaste-KJZ34MIP.js → CopyPaste-FJN7K5LS.js} +39 -11
- package/dist/react/CopyPaste-FJN7K5LS.js.map +7 -0
- package/dist/react/{EventDispatcher-XDRQS7BD.js → EventDispatcher-O7HCQQNM.js} +13 -13
- package/dist/react/Frame-RLSMJJSK.js +11 -0
- package/dist/react/{GraphEngine-KQXHNTZQ.js → GraphEngine-MM6ALA2N.js} +105 -148
- package/dist/react/{GraphEngine-KQXHNTZQ.js.map → GraphEngine-MM6ALA2N.js.map} +2 -2
- package/dist/react/IconShape-7OPXAKLK.js +10 -0
- package/dist/react/ImageShape-LRNJQCF3.js +10 -0
- package/dist/react/Line-WWQFBNX5.js +10 -0
- package/dist/react/{SceneSerializer-VY3HY4PF.js → SceneSerializer-GSJR7ZHC.js} +32 -8
- package/dist/react/SceneSerializer-GSJR7ZHC.js.map +7 -0
- package/dist/react/{Selection-U2AR6NQS.js → Selection-ZL3G6IAO.js} +4 -4
- package/dist/react/{SketchEngine-ZFYUTKET.js → SketchEngine-BFLHJPCG.js} +21 -21
- package/dist/react/{UndoRedo-BZ6W4QTV.js → UndoRedo-NL7KLR5B.js} +2 -2
- package/dist/react/{arrowTool-LKFSZKXC.js → arrowTool-CNVGM6RX.js} +3 -3
- package/dist/react/{chunk-RFHMFWVR.js → chunk-2FMFOPGW.js} +5 -6
- package/dist/react/{chunk-RFHMFWVR.js.map → chunk-2FMFOPGW.js.map} +2 -2
- package/dist/react/{chunk-SBSM3GQD.js → chunk-2THKDSWW.js} +4 -4
- package/dist/react/{chunk-JOPQ27YH.js → chunk-4BLMNGTR.js} +3 -3
- package/dist/react/{chunk-C62SXFBL.js → chunk-4TAS67SL.js} +23 -22
- package/dist/react/chunk-4TAS67SL.js.map +7 -0
- package/dist/react/{chunk-7VBI7S7T.js → chunk-AH4PWNEB.js} +10 -11
- package/dist/react/chunk-AH4PWNEB.js.map +7 -0
- package/dist/react/{chunk-R5QXEVZ5.js → chunk-GC3KTQDA.js} +74 -15
- package/dist/react/chunk-GC3KTQDA.js.map +7 -0
- package/dist/react/{chunk-2V7G2PLX.js → chunk-GPIYXREE.js} +3 -3
- package/dist/react/{chunk-73VLPCBC.js → chunk-HFQZYCHJ.js} +3 -3
- package/dist/react/{chunk-C72OHQLE.js → chunk-ILGAFR56.js} +3 -3
- package/dist/react/{chunk-75G7XSZU.js → chunk-KVAQPCUH.js} +17 -3
- package/dist/react/chunk-KVAQPCUH.js.map +7 -0
- package/dist/react/{chunk-WEWMB35W.js → chunk-OFGJJKPH.js} +3 -3
- package/dist/react/{chunk-6G3ITAS5.js → chunk-SZD7DKYJ.js} +18 -9
- package/dist/react/chunk-SZD7DKYJ.js.map +7 -0
- package/dist/react/{chunk-MYYBFZD3.js → chunk-U3TB4KRS.js} +45 -6
- package/dist/react/chunk-U3TB4KRS.js.map +7 -0
- package/dist/react/{chunk-UQBT7F4K.js → chunk-V2QTYSBK.js} +2 -2
- package/dist/react/{chunk-2I3GH65Z.js → chunk-XFQECTTF.js} +44 -19
- package/dist/react/chunk-XFQECTTF.js.map +7 -0
- package/dist/react/{chunk-O64N5JPO.js → chunk-YF3TK7SC.js} +2 -2
- package/dist/react/{circleTool-RDOIMKKV.js → circleTool-KICNRQCI.js} +4 -4
- package/dist/react/{codeTool-VBDB2ES6.js → codeTool-NCQ73R6M.js} +4 -4
- package/dist/react/{frameTool-Z5ZDCX6H.js → frameTool-Y6KB67DO.js} +4 -4
- package/dist/react/{freehandTool-AAQCTMVM.js → freehandTool-MMULHCQ7.js} +4 -4
- package/dist/react/{iconTool-5WNDHI5T.js → iconTool-LSW2DYGB.js} +4 -4
- package/dist/react/{imageTool-ECPMT3BL.js → imageTool-2DSR32RX.js} +4 -4
- package/dist/react/index.js +141 -66
- package/dist/react/index.js.map +3 -3
- package/dist/react/{lineTool-XLOOZE3E.js → lineTool-N5I7IGT7.js} +4 -4
- package/dist/react/{rectangleTool-AEYDDJCA.js → rectangleTool-YUT7ZK2E.js} +4 -4
- package/dist/react/{textTool-5IJKTWVQ.js → textTool-IQOYPELP.js} +5 -5
- package/package.json +1 -1
- package/src/core/CopyPaste.js +34 -4
- package/src/core/GraphEngine.js +129 -185
- package/src/core/SceneSerializer.js +26 -0
- package/src/core/Selection.js +12 -11
- package/src/core/UndoRedo.js +47 -3
- package/src/react/components/canvas/MultiSelectActions.jsx +4 -1
- package/src/react/components/sidebars/IconSidebar.jsx +14 -23
- package/src/react/components/sidebars/ImageSidebar.jsx +47 -24
- package/src/react/store/useUIStore.js +71 -14
- package/src/shapes/Frame.js +19 -2
- package/src/shapes/IconShape.js +23 -25
- package/src/shapes/ImageShape.js +6 -2
- package/src/tools/frameTool.js +19 -9
- package/src/tools/iconTool.js +60 -25
- package/src/tools/imageTool.js +77 -13
- package/dist/react/CopyPaste-KJZ34MIP.js.map +0 -7
- package/dist/react/Frame-QLBAVLGW.js +0 -11
- package/dist/react/IconShape-32EYI2MA.js +0 -10
- package/dist/react/ImageShape-MYP2DVVH.js +0 -10
- package/dist/react/Line-FCCF2BOB.js +0 -10
- package/dist/react/SceneSerializer-VY3HY4PF.js.map +0 -7
- package/dist/react/chunk-2I3GH65Z.js.map +0 -7
- package/dist/react/chunk-6G3ITAS5.js.map +0 -7
- package/dist/react/chunk-75G7XSZU.js.map +0 -7
- package/dist/react/chunk-7VBI7S7T.js.map +0 -7
- package/dist/react/chunk-C62SXFBL.js.map +0 -7
- package/dist/react/chunk-MYYBFZD3.js.map +0 -7
- package/dist/react/chunk-R5QXEVZ5.js.map +0 -7
- /package/dist/react/{EventDispatcher-XDRQS7BD.js.map → EventDispatcher-O7HCQQNM.js.map} +0 -0
- /package/dist/react/{Frame-QLBAVLGW.js.map → Frame-RLSMJJSK.js.map} +0 -0
- /package/dist/react/{IconShape-32EYI2MA.js.map → IconShape-7OPXAKLK.js.map} +0 -0
- /package/dist/react/{ImageShape-MYP2DVVH.js.map → ImageShape-LRNJQCF3.js.map} +0 -0
- /package/dist/react/{Line-FCCF2BOB.js.map → Line-WWQFBNX5.js.map} +0 -0
- /package/dist/react/{Selection-U2AR6NQS.js.map → Selection-ZL3G6IAO.js.map} +0 -0
- /package/dist/react/{SketchEngine-ZFYUTKET.js.map → SketchEngine-BFLHJPCG.js.map} +0 -0
- /package/dist/react/{UndoRedo-BZ6W4QTV.js.map → UndoRedo-NL7KLR5B.js.map} +0 -0
- /package/dist/react/{arrowTool-LKFSZKXC.js.map → arrowTool-CNVGM6RX.js.map} +0 -0
- /package/dist/react/{chunk-SBSM3GQD.js.map → chunk-2THKDSWW.js.map} +0 -0
- /package/dist/react/{chunk-JOPQ27YH.js.map → chunk-4BLMNGTR.js.map} +0 -0
- /package/dist/react/{chunk-2V7G2PLX.js.map → chunk-GPIYXREE.js.map} +0 -0
- /package/dist/react/{chunk-73VLPCBC.js.map → chunk-HFQZYCHJ.js.map} +0 -0
- /package/dist/react/{chunk-C72OHQLE.js.map → chunk-ILGAFR56.js.map} +0 -0
- /package/dist/react/{chunk-WEWMB35W.js.map → chunk-OFGJJKPH.js.map} +0 -0
- /package/dist/react/{chunk-UQBT7F4K.js.map → chunk-V2QTYSBK.js.map} +0 -0
- /package/dist/react/{chunk-O64N5JPO.js.map → chunk-YF3TK7SC.js.map} +0 -0
- /package/dist/react/{circleTool-RDOIMKKV.js.map → circleTool-KICNRQCI.js.map} +0 -0
- /package/dist/react/{codeTool-VBDB2ES6.js.map → codeTool-NCQ73R6M.js.map} +0 -0
- /package/dist/react/{frameTool-Z5ZDCX6H.js.map → frameTool-Y6KB67DO.js.map} +0 -0
- /package/dist/react/{freehandTool-AAQCTMVM.js.map → freehandTool-MMULHCQ7.js.map} +0 -0
- /package/dist/react/{iconTool-5WNDHI5T.js.map → iconTool-LSW2DYGB.js.map} +0 -0
- /package/dist/react/{imageTool-ECPMT3BL.js.map → imageTool-2DSR32RX.js.map} +0 -0
- /package/dist/react/{lineTool-XLOOZE3E.js.map → lineTool-N5I7IGT7.js.map} +0 -0
- /package/dist/react/{rectangleTool-AEYDDJCA.js.map → rectangleTool-YUT7ZK2E.js.map} +0 -0
- /package/dist/react/{textTool-5IJKTWVQ.js.map → textTool-IQOYPELP.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/shapes/ImageShape.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable */\n// ImageShape class - extracted from imageTool.js\n// Depends on globals: svg, shapes, currentShape\n\nimport { updateAttachedArrows as updateArrowsForShape } from \"../tools/arrowTool.js\";\nlet isDragging = false;\nlet hoveredFrameImage = null;\nfunction selectImage() {} // stub - image selection handled by imageTool\n\nclass ImageShape {\n constructor(element) {\n this.element = element;\n this.shapeName = 'image';\n this.shapeID = element.shapeID || `image-${String(Date.now()).slice(0, 8)}-${Math.floor(Math.random() * 10000)}`;\n\n // Frame attachment properties\n this.parentFrame = null;\n\n // Upload pipeline state\n this.uploadStatus = 'pending'; // 'pending' | 'uploading' | 'done' | 'failed'\n this.uploadAbortController = null;\n this._uploadIndicator = null;\n\n // Update element attributes\n this.element.setAttribute('type', 'image');\n this.element.shapeID = this.shapeID;\n\n // Create a group wrapper for the image to work with frames properly\n this.group = document.createElementNS('http://www.w3.org/2000/svg', 'g');\n this.group.setAttribute('id', this.shapeID);\n\n // Move the image element into the group\n if (this.element.parentNode) {\n this.element.parentNode.removeChild(this.element);\n }\n this.group.appendChild(this.element);\n svg.appendChild(this.group);\n }\n\n showUploadIndicator() {\n if (this._uploadIndicator) return;\n const g = document.createElementNS('http://www.w3.org/2000/svg', 'g');\n g.setAttribute('class', 'upload-indicator');\n\n const x = this.x + 6;\n const y = this.y + 6;\n\n // Background circle\n const bg = document.createElementNS('http://www.w3.org/2000/svg', 'circle');\n bg.setAttribute('cx', x + 10);\n bg.setAttribute('cy', y + 10);\n bg.setAttribute('r', 12);\n bg.setAttribute('fill', 'rgba(0,0,0,0.7)');\n g.appendChild(bg);\n\n // Caution/loading icon (\u26A1 style triangle)\n const icon = document.createElementNS('http://www.w3.org/2000/svg', 'polygon');\n icon.setAttribute('points', `${x+10},${y+3} ${x+17},${y+16} ${x+3},${y+16}`);\n icon.setAttribute('fill', 'none');\n icon.setAttribute('stroke', '#FBBF24');\n icon.setAttribute('stroke-width', '1.5');\n icon.setAttribute('stroke-linejoin', 'round');\n g.appendChild(icon);\n\n // Exclamation mark inside\n const line = document.createElementNS('http://www.w3.org/2000/svg', 'line');\n line.setAttribute('x1', x + 10);\n line.setAttribute('y1', y + 8);\n line.setAttribute('x2', x + 10);\n line.setAttribute('y2', y + 12);\n line.setAttribute('stroke', '#FBBF24');\n line.setAttribute('stroke-width', '1.5');\n line.setAttribute('stroke-linecap', 'round');\n g.appendChild(line);\n\n const dot = document.createElementNS('http://www.w3.org/2000/svg', 'circle');\n dot.setAttribute('cx', x + 10);\n dot.setAttribute('cy', y + 14.5);\n dot.setAttribute('r', 0.8);\n dot.setAttribute('fill', '#FBBF24');\n g.appendChild(dot);\n\n // Pulsing animation\n const animate = document.createElementNS('http://www.w3.org/2000/svg', 'animate');\n animate.setAttribute('attributeName', 'opacity');\n animate.setAttribute('values', '1;0.4;1');\n animate.setAttribute('dur', '1.5s');\n animate.setAttribute('repeatCount', 'indefinite');\n g.appendChild(animate);\n\n // Apply same transform as image (rotation)\n const transform = this.element.getAttribute('transform');\n if (transform) g.setAttribute('transform', transform);\n\n g.style.pointerEvents = 'none';\n this.group.appendChild(g);\n this._uploadIndicator = g;\n }\n\n removeUploadIndicator() {\n if (this._uploadIndicator && this._uploadIndicator.parentNode) {\n this._uploadIndicator.parentNode.removeChild(this._uploadIndicator);\n }\n this._uploadIndicator = null;\n }\n\n updateUploadIndicatorPosition() {\n if (!this._uploadIndicator) return;\n const x = this.x + 6;\n const y = this.y + 6;\n\n const bg = this._uploadIndicator.querySelector('circle');\n if (bg) { bg.setAttribute('cx', x + 10); bg.setAttribute('cy', y + 10); }\n\n const icon = this._uploadIndicator.querySelector('polygon');\n if (icon) icon.setAttribute('points', `${x+10},${y+3} ${x+17},${y+16} ${x+3},${y+16}`);\n\n const line = this._uploadIndicator.querySelector('line');\n if (line) {\n line.setAttribute('x1', x + 10); line.setAttribute('y1', y + 8);\n line.setAttribute('x2', x + 10); line.setAttribute('y2', y + 12);\n }\n\n const dots = this._uploadIndicator.querySelectorAll('circle');\n if (dots[1]) { dots[1].setAttribute('cx', x + 10); dots[1].setAttribute('cy', y + 14.5); }\n\n const transform = this.element.getAttribute('transform');\n if (transform) this._uploadIndicator.setAttribute('transform', transform);\n }\n \n // Position and dimension properties for frame compatibility\n get x() {\n return parseFloat(this.element.getAttribute('x'));\n }\n \n set x(value) {\n this.element.setAttribute('x', value);\n this.element.setAttribute('data-shape-x', value);\n }\n \n get y() {\n return parseFloat(this.element.getAttribute('y'));\n }\n \n set y(value) {\n this.element.setAttribute('y', value);\n this.element.setAttribute('data-shape-y', value);\n }\n \n get width() {\n return parseFloat(this.element.getAttribute('width'));\n }\n \n set width(value) {\n this.element.setAttribute('width', value);\n this.element.setAttribute('data-shape-width', value);\n }\n \n get height() {\n return parseFloat(this.element.getAttribute('height'));\n }\n \n set height(value) {\n this.element.setAttribute('height', value);\n this.element.setAttribute('data-shape-height', value);\n }\n \n get rotation() {\n const transform = this.element.getAttribute('transform');\n if (transform) {\n const rotateMatch = transform.match(/rotate\\(([^,]+)/);\n if (rotateMatch) {\n return parseFloat(rotateMatch[1]);\n }\n }\n return 0;\n }\n \n set rotation(value) {\n const centerX = this.x + this.width / 2;\n const centerY = this.y + this.height / 2;\n this.element.setAttribute('transform', `rotate(${value}, ${centerX}, ${centerY})`);\n this.element.setAttribute('data-shape-rotation', value);\n }\n\n move(dx, dy) {\n this.x += dx;\n this.y += dy;\n\n // Update transform for rotation\n const centerX = this.x + this.width / 2;\n const centerY = this.y + this.height / 2;\n this.element.setAttribute('transform', `rotate(${this.rotation}, ${centerX}, ${centerY})`);\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 (isDragging && !this.isBeingMovedByFrame) {\n this.updateFrameContainment();\n }\n\n this.updateAttachedArrows();\n }\n\n updateAttachedArrows() {\n updateArrowsForShape(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 && isDragging) {\n this.parentFrame.temporarilyRemoveFromFrame(this);\n }\n \n // Update frame highlighting\n if (hoveredFrameImage && hoveredFrameImage !== targetFrame) {\n hoveredFrameImage.removeHighlight();\n }\n \n if (targetFrame && targetFrame !== hoveredFrameImage) {\n targetFrame.highlightFrame();\n }\n \n hoveredFrameImage = targetFrame;\n }\n\n contains(x, y) {\n const imgX = this.x;\n const imgY = this.y;\n const imgWidth = this.width;\n const imgHeight = this.height;\n \n // Simple bounding box check (could be enhanced for rotation)\n return x >= imgX && x <= imgX + imgWidth && y >= imgY && y <= imgY + imgHeight;\n }\n\n // Add draw method for consistency with other shapes\n draw() {\n // Images don't need redrawing like other shapes, but we need this method for consistency\n // Update any visual state if needed\n }\n\n // Add methods for frame compatibility\n removeSelection() {\n // Remove selection outlines from SVG\n svg.querySelectorAll(\".selection-outline\").forEach(el => el.remove());\n // Remove resize/rotation anchors if present\n svg.querySelectorAll(\".resize-anchor, .rotation-anchor\").forEach(el => el.remove());\n }\n\n selectShape() {\n // Select the image\n selectImage({ target: this.element, stopPropagation: () => {} });\n }\n}\n\nexport { ImageShape };\n"],
|
|
5
|
-
"mappings": ";;;;;;AAKA,IAAI,aAAa;AACjB,IAAI,oBAAoB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable */\n// ImageShape class - extracted from imageTool.js\n// Depends on globals: svg, shapes, currentShape\n\nimport { updateAttachedArrows as updateArrowsForShape } from \"../tools/arrowTool.js\";\nlet isDragging = false;\nlet hoveredFrameImage = null;\nfunction selectImage() {} // stub - image selection handled by imageTool\n\nclass ImageShape {\n constructor(element) {\n this.element = element;\n this.shapeName = 'image';\n this.shapeID = element.shapeID || `image-${String(Date.now()).slice(0, 8)}-${Math.floor(Math.random() * 10000)}`;\n\n // Frame attachment properties\n this.parentFrame = null;\n\n // Upload pipeline state\n this.uploadStatus = 'pending'; // 'pending' | 'uploading' | 'done' | 'failed'\n this.uploadAbortController = null;\n this._uploadIndicator = null;\n\n // Update element attributes\n this.element.setAttribute('type', 'image');\n this.element.shapeID = this.shapeID;\n\n // Create a group wrapper for the image to work with frames properly\n this.group = document.createElementNS('http://www.w3.org/2000/svg', 'g');\n this.group.setAttribute('id', this.shapeID);\n\n // Move the image element into the group\n if (this.element.parentNode) {\n this.element.parentNode.removeChild(this.element);\n }\n this.group.appendChild(this.element);\n svg.appendChild(this.group);\n }\n\n showUploadIndicator() {\n if (this._uploadIndicator) return;\n const g = document.createElementNS('http://www.w3.org/2000/svg', 'g');\n g.setAttribute('class', 'upload-indicator');\n\n const x = this.x + 6;\n const y = this.y + 6;\n\n // Background circle\n const bg = document.createElementNS('http://www.w3.org/2000/svg', 'circle');\n bg.setAttribute('cx', x + 10);\n bg.setAttribute('cy', y + 10);\n bg.setAttribute('r', 12);\n bg.setAttribute('fill', 'rgba(0,0,0,0.7)');\n g.appendChild(bg);\n\n // Caution/loading icon (\u26A1 style triangle)\n const icon = document.createElementNS('http://www.w3.org/2000/svg', 'polygon');\n icon.setAttribute('points', `${x+10},${y+3} ${x+17},${y+16} ${x+3},${y+16}`);\n icon.setAttribute('fill', 'none');\n icon.setAttribute('stroke', '#FBBF24');\n icon.setAttribute('stroke-width', '1.5');\n icon.setAttribute('stroke-linejoin', 'round');\n g.appendChild(icon);\n\n // Exclamation mark inside\n const line = document.createElementNS('http://www.w3.org/2000/svg', 'line');\n line.setAttribute('x1', x + 10);\n line.setAttribute('y1', y + 8);\n line.setAttribute('x2', x + 10);\n line.setAttribute('y2', y + 12);\n line.setAttribute('stroke', '#FBBF24');\n line.setAttribute('stroke-width', '1.5');\n line.setAttribute('stroke-linecap', 'round');\n g.appendChild(line);\n\n const dot = document.createElementNS('http://www.w3.org/2000/svg', 'circle');\n dot.setAttribute('cx', x + 10);\n dot.setAttribute('cy', y + 14.5);\n dot.setAttribute('r', 0.8);\n dot.setAttribute('fill', '#FBBF24');\n g.appendChild(dot);\n\n // Pulsing animation\n const animate = document.createElementNS('http://www.w3.org/2000/svg', 'animate');\n animate.setAttribute('attributeName', 'opacity');\n animate.setAttribute('values', '1;0.4;1');\n animate.setAttribute('dur', '1.5s');\n animate.setAttribute('repeatCount', 'indefinite');\n g.appendChild(animate);\n\n // Apply same transform as image (rotation)\n const transform = this.element.getAttribute('transform');\n if (transform) g.setAttribute('transform', transform);\n\n g.style.pointerEvents = 'none';\n this.group.appendChild(g);\n this._uploadIndicator = g;\n }\n\n removeUploadIndicator() {\n if (this._uploadIndicator && this._uploadIndicator.parentNode) {\n this._uploadIndicator.parentNode.removeChild(this._uploadIndicator);\n }\n this._uploadIndicator = null;\n }\n\n updateUploadIndicatorPosition() {\n if (!this._uploadIndicator) return;\n const x = this.x + 6;\n const y = this.y + 6;\n\n const bg = this._uploadIndicator.querySelector('circle');\n if (bg) { bg.setAttribute('cx', x + 10); bg.setAttribute('cy', y + 10); }\n\n const icon = this._uploadIndicator.querySelector('polygon');\n if (icon) icon.setAttribute('points', `${x+10},${y+3} ${x+17},${y+16} ${x+3},${y+16}`);\n\n const line = this._uploadIndicator.querySelector('line');\n if (line) {\n line.setAttribute('x1', x + 10); line.setAttribute('y1', y + 8);\n line.setAttribute('x2', x + 10); line.setAttribute('y2', y + 12);\n }\n\n const dots = this._uploadIndicator.querySelectorAll('circle');\n if (dots[1]) { dots[1].setAttribute('cx', x + 10); dots[1].setAttribute('cy', y + 14.5); }\n\n const transform = this.element.getAttribute('transform');\n if (transform) this._uploadIndicator.setAttribute('transform', transform);\n }\n \n // Position and dimension properties for frame compatibility\n get x() {\n return parseFloat(this.element.getAttribute('x'));\n }\n \n set x(value) {\n this.element.setAttribute('x', value);\n this.element.setAttribute('data-shape-x', value);\n }\n \n get y() {\n return parseFloat(this.element.getAttribute('y'));\n }\n \n set y(value) {\n this.element.setAttribute('y', value);\n this.element.setAttribute('data-shape-y', value);\n }\n \n get width() {\n return parseFloat(this.element.getAttribute('width'));\n }\n \n set width(value) {\n this.element.setAttribute('width', value);\n this.element.setAttribute('data-shape-width', value);\n }\n \n get height() {\n return parseFloat(this.element.getAttribute('height'));\n }\n \n set height(value) {\n this.element.setAttribute('height', value);\n this.element.setAttribute('data-shape-height', value);\n }\n \n get rotation() {\n const transform = this.element.getAttribute('transform');\n if (transform) {\n const rotateMatch = transform.match(/rotate\\(([^,]+)/);\n if (rotateMatch) {\n return parseFloat(rotateMatch[1]);\n }\n }\n return 0;\n }\n \n set rotation(value) {\n const centerX = this.x + this.width / 2;\n const centerY = this.y + this.height / 2;\n this.element.setAttribute('transform', `rotate(${value}, ${centerX}, ${centerY})`);\n this.element.setAttribute('data-shape-rotation', value);\n }\n\n move(dx, dy) {\n this.x += dx;\n this.y += dy;\n\n // Update transform for rotation\n const centerX = this.x + this.width / 2;\n const centerY = this.y + this.height / 2;\n this.element.setAttribute('transform', `rotate(${this.rotation}, ${centerX}, ${centerY})`);\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 (isDragging && !this.isBeingMovedByFrame) {\n this.updateFrameContainment();\n }\n\n this.updateAttachedArrows();\n }\n\n updateAttachedArrows() {\n updateArrowsForShape(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 && isDragging) {\n this.parentFrame.temporarilyRemoveFromFrame(this);\n }\n \n // Update frame highlighting\n if (hoveredFrameImage && hoveredFrameImage !== targetFrame) {\n hoveredFrameImage.removeHighlight();\n }\n \n if (targetFrame && targetFrame !== hoveredFrameImage) {\n targetFrame.highlightFrame();\n }\n \n hoveredFrameImage = targetFrame;\n }\n\n contains(x, y) {\n const imgX = this.x;\n const imgY = this.y;\n const imgWidth = this.width;\n const imgHeight = this.height;\n \n // Simple bounding box check (could be enhanced for rotation)\n return x >= imgX && x <= imgX + imgWidth && y >= imgY && y <= imgY + imgHeight;\n }\n\n // Add draw method for consistency with other shapes\n draw() {\n // Images don't need redrawing like other shapes, but we need this method for consistency\n // Update any visual state if needed\n }\n\n // Add methods for frame compatibility\n removeSelection() {\n // Remove selection outlines from SVG\n svg.querySelectorAll(\".selection-outline\").forEach(el => el.remove());\n // Remove resize/rotation anchors if present\n svg.querySelectorAll(\".resize-anchor, .rotation-anchor\").forEach(el => el.remove());\n }\n\n selectShape() {\n // Image interaction state lives in imageTool. Use its bridge so\n // programmatically-created images (graphs, restored scenes, paste)\n // receive the same drag/resize controls as pointer-selected images.\n if (typeof window.__selectImageElement === 'function') {\n window.__selectImageElement(this.element, { force: true });\n }\n }\n}\n\nexport { ImageShape };\n"],
|
|
5
|
+
"mappings": ";;;;;;AAKA,IAAI,aAAa;AACjB,IAAI,oBAAoB;AAGxB,IAAM,aAAN,MAAiB;AAAA,EACb,YAAY,SAAS;AACjB,SAAK,UAAU;AACf,SAAK,YAAY;AACjB,SAAK,UAAU,QAAQ,WAAW,SAAS,OAAO,KAAK,IAAI,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,KAAK,MAAM,KAAK,OAAO,IAAI,GAAK,CAAC;AAG9G,SA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,QAAI,OAAO,WAAW,eAAe,MAAM,QAAQ,MAAM,GAAG;AACxD,aAAO,QAAQ,WAAS;AACpB,YAAI,MAAM,cAAc,WAAW,MAAM,eAAe,IAAI,GAAG;AAC3D,wBAAc;AAAA,QAClB;AAAA,MACJ,CAAC;AAAA,IACL;AAGA,QAAI,KAAK,eAAe,YAAY;AAChC,WAAK,YAAY,2BAA2B,IAAI;AAAA,IACpD;AAGA,QAAI,qBAAqB,sBAAsB,aAAa;AACxD,wBAAkB,gBAAgB;AAAA,IACtC;AAEA,QAAI,eAAe,gBAAgB,mBAAmB;AAClD,kBAAY,eAAe;AAAA,IAC/B;AAEA,wBAAoB;AAAA,EACxB;AAAA,EAEA,SAAS,GAAG,GAAG;AACX,UAAM,OAAO,KAAK;AAClB,UAAM,OAAO,KAAK;AAClB,UAAM,WAAW,KAAK;AACtB,UAAM,YAAY,KAAK;AAGvB,WAAO,KAAK,QAAQ,KAAK,OAAO,YAAY,KAAK,QAAQ,KAAK,OAAO;AAAA,EACzE;AAAA;AAAA,EAGA,OAAO;AAAA,EAGP;AAAA;AAAA,EAGA,kBAAkB;AAEd,QAAI,iBAAiB,oBAAoB,EAAE,QAAQ,QAAM,GAAG,OAAO,CAAC;AAEpE,QAAI,iBAAiB,kCAAkC,EAAE,QAAQ,QAAM,GAAG,OAAO,CAAC;AAAA,EACtF;AAAA,EAEA,cAAc;AAIV,QAAI,OAAO,OAAO,yBAAyB,YAAY;AACnD,aAAO,qBAAqB,KAAK,SAAS,EAAE,OAAO,KAAK,CAAC;AAAA,IAC7D;AAAA,EACJ;AACJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -10,14 +10,14 @@ import {
|
|
|
10
10
|
setCodeLanguage,
|
|
11
11
|
updateCodeBackground,
|
|
12
12
|
wrapCodeElement
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-HFQZYCHJ.js";
|
|
14
14
|
import {
|
|
15
15
|
registerRotationAnchor
|
|
16
16
|
} from "./chunk-PAKA6HUX.js";
|
|
17
17
|
import {
|
|
18
18
|
cleanupAttachments,
|
|
19
19
|
updateAttachedArrows
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-YF3TK7SC.js";
|
|
21
21
|
import {
|
|
22
22
|
pushCreateAction,
|
|
23
23
|
pushDeleteActionWithAttachments,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
pushTransformAction,
|
|
27
27
|
setTextReferences,
|
|
28
28
|
updateSelectedElement
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-U3TB4KRS.js";
|
|
30
30
|
|
|
31
31
|
// src/tools/textTool.js
|
|
32
32
|
function getThemeStroke() {
|
|
@@ -1486,4 +1486,4 @@ export {
|
|
|
1486
1486
|
handleTextMouseUp,
|
|
1487
1487
|
updateCodeToggleForShape
|
|
1488
1488
|
};
|
|
1489
|
-
//# sourceMappingURL=chunk-
|
|
1489
|
+
//# sourceMappingURL=chunk-2THKDSWW.js.map
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
calculateSnap,
|
|
4
4
|
clearSnapGuides
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-YF3TK7SC.js";
|
|
6
6
|
import {
|
|
7
7
|
pushCreateAction,
|
|
8
8
|
pushFrameAttachmentAction,
|
|
9
9
|
pushOptionsChangeAction,
|
|
10
10
|
pushTransformAction
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-U3TB4KRS.js";
|
|
12
12
|
|
|
13
13
|
// src/tools/rectangleTool.js
|
|
14
14
|
var isDrawingSquare = false;
|
|
@@ -516,4 +516,4 @@ export {
|
|
|
516
516
|
handleMouseMoveRect,
|
|
517
517
|
handleMouseUpRect
|
|
518
518
|
};
|
|
519
|
-
//# sourceMappingURL=chunk-
|
|
519
|
+
//# sourceMappingURL=chunk-4BLMNGTR.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
cleanupAttachments,
|
|
4
4
|
updateAttachedArrows
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-YF3TK7SC.js";
|
|
6
6
|
|
|
7
7
|
// src/shapes/IconShape.js
|
|
8
8
|
var isDragging = false;
|
|
@@ -70,6 +70,23 @@ var IconShape = class {
|
|
|
70
70
|
this.element.setAttribute("height", value);
|
|
71
71
|
this.element.setAttribute("data-shape-height", value);
|
|
72
72
|
}
|
|
73
|
+
_transformMetrics() {
|
|
74
|
+
const vbWidth = parseFloat(this.element.getAttribute("data-viewbox-width")) || 24;
|
|
75
|
+
const vbHeight = parseFloat(this.element.getAttribute("data-viewbox-height")) || 24;
|
|
76
|
+
const scale = Math.min(this.width / vbWidth, this.height / vbHeight);
|
|
77
|
+
return {
|
|
78
|
+
scale,
|
|
79
|
+
localCenterX: this.width / 2 / scale,
|
|
80
|
+
localCenterY: this.height / 2 / scale
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
_applyTransform() {
|
|
84
|
+
const { scale, localCenterX, localCenterY } = this._transformMetrics();
|
|
85
|
+
this.element.setAttribute(
|
|
86
|
+
"transform",
|
|
87
|
+
`translate(${this.x}, ${this.y}) scale(${scale}) rotate(${this.rotation}, ${localCenterX}, ${localCenterY})`
|
|
88
|
+
);
|
|
89
|
+
}
|
|
73
90
|
get rotation() {
|
|
74
91
|
const dataRotation = this.element.getAttribute("data-shape-rotation");
|
|
75
92
|
if (dataRotation) {
|
|
@@ -86,22 +103,12 @@ var IconShape = class {
|
|
|
86
103
|
}
|
|
87
104
|
set rotation(value) {
|
|
88
105
|
this.element.setAttribute("data-shape-rotation", value);
|
|
89
|
-
|
|
90
|
-
const vbHeight = parseFloat(this.element.getAttribute("data-viewbox-height")) || 24;
|
|
91
|
-
const scale = this.width / Math.max(vbWidth, vbHeight);
|
|
92
|
-
const localCenterX = this.width / 2 / scale;
|
|
93
|
-
const localCenterY = this.height / 2 / scale;
|
|
94
|
-
this.element.setAttribute("transform", `translate(${this.x}, ${this.y}) scale(${scale}) rotate(${value}, ${localCenterX}, ${localCenterY})`);
|
|
106
|
+
this._applyTransform();
|
|
95
107
|
}
|
|
96
108
|
move(dx, dy) {
|
|
97
109
|
this.x += dx;
|
|
98
110
|
this.y += dy;
|
|
99
|
-
|
|
100
|
-
const vbHeight = parseFloat(this.element.getAttribute("data-viewbox-height")) || 24;
|
|
101
|
-
const scale = this.width / Math.max(vbWidth, vbHeight);
|
|
102
|
-
const localCenterX = this.width / 2 / scale;
|
|
103
|
-
const localCenterY = this.height / 2 / scale;
|
|
104
|
-
this.element.setAttribute("transform", `translate(${this.x}, ${this.y}) scale(${scale}) rotate(${this.rotation}, ${localCenterX}, ${localCenterY})`);
|
|
111
|
+
this._applyTransform();
|
|
105
112
|
this.element.setAttribute("x", this.x);
|
|
106
113
|
this.element.setAttribute("y", this.y);
|
|
107
114
|
this.element.setAttribute("data-shape-x", this.x);
|
|
@@ -143,10 +150,7 @@ var IconShape = class {
|
|
|
143
150
|
updateAttachedArrows(this);
|
|
144
151
|
}
|
|
145
152
|
draw() {
|
|
146
|
-
|
|
147
|
-
const localCenterX = this.width / 2 / scale;
|
|
148
|
-
const localCenterY = this.height / 2 / scale;
|
|
149
|
-
this.element.setAttribute("transform", `translate(${this.x}, ${this.y}) scale(${scale}) rotate(${this.rotation}, ${localCenterX}, ${localCenterY})`);
|
|
153
|
+
this._applyTransform();
|
|
150
154
|
this.element.setAttribute("data-shape-x", this.x);
|
|
151
155
|
this.element.setAttribute("data-shape-y", this.y);
|
|
152
156
|
this.element.setAttribute("data-shape-width", this.width);
|
|
@@ -203,10 +207,7 @@ var IconShape = class {
|
|
|
203
207
|
this.parentFrame = pos.parentFrame;
|
|
204
208
|
pos.parentFrame.addShapeToFrame(this);
|
|
205
209
|
}
|
|
206
|
-
|
|
207
|
-
const localCenterX = pos.width / 2 / scale;
|
|
208
|
-
const localCenterY = pos.height / 2 / scale;
|
|
209
|
-
this.element.setAttribute("transform", `translate(${pos.x}, ${pos.y}) scale(${scale}) rotate(${pos.rotation}, ${localCenterX}, ${localCenterY})`);
|
|
210
|
+
this._applyTransform();
|
|
210
211
|
this.element.setAttribute("data-shape-x", pos.x);
|
|
211
212
|
this.element.setAttribute("data-shape-y", pos.y);
|
|
212
213
|
this.element.setAttribute("data-shape-width", pos.width);
|
|
@@ -219,4 +220,4 @@ var IconShape = class {
|
|
|
219
220
|
export {
|
|
220
221
|
IconShape
|
|
221
222
|
};
|
|
222
|
-
//# sourceMappingURL=chunk-
|
|
223
|
+
//# sourceMappingURL=chunk-4TAS67SL.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/shapes/IconShape.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable */\n// IconShape class - extracted from icons.js\n// Depends on globals: svg, shapes\nimport { updateAttachedArrows as updateArrowsForShape, cleanupAttachments } from '../tools/arrowTool.js';\n\n// Module-level state shared with iconTool via window bridge\nlet isDragging = false;\nlet hoveredFrameIcon = null;\n\n// Expose setters so iconTool.js can sync these values\nwindow.__iconShapeState = {\n set isDragging(v) { isDragging = v; },\n get isDragging() { return isDragging; },\n set hoveredFrameIcon(v) { hoveredFrameIcon = v; },\n get hoveredFrameIcon() { return hoveredFrameIcon; },\n};\n\nfunction getSVGElement() {\n return document.getElementById('freehand-canvas');\n}\n\n// Delegate to iconTool's selectIcon via window bridge\nfunction selectIcon(event) {\n if (window.__iconToolSelectIcon) {\n window.__iconToolSelectIcon(event);\n }\n}\n\nclass IconShape {\n constructor(element) {\n this.element = element;\n this.shapeName = 'icon';\n this.shapeID = `icon-${String(Date.now()).slice(0, 8)}-${Math.floor(Math.random() * 10000)}`;\n this.type = 'icon';\n\n this.parentFrame = null;\n this.isDraggedOutTemporarily = false;\n\n this.element.setAttribute('type', 'icon');\n this.element.shapeID = this.shapeID;\n\n this.group = this.element;\n this.group.setAttribute('id', this.shapeID);\n }\n\n get x() {\n return parseFloat(this.element.getAttribute('x')) || 0;\n }\n\n set x(value) {\n this.element.setAttribute('x', value);\n this.element.setAttribute('data-shape-x', value);\n }\n\n get y() {\n return parseFloat(this.element.getAttribute('y')) || 0;\n }\n\n set y(value) {\n this.element.setAttribute('y', value);\n this.element.setAttribute('data-shape-y', value);\n }\n\n get width() {\n return parseFloat(this.element.getAttribute('width')) || 100;\n }\n\n set width(value) {\n this.element.setAttribute('width', value);\n this.element.setAttribute('data-shape-width', value);\n }\n\n get height() {\n return parseFloat(this.element.getAttribute('height')) || 100;\n }\n\n set height(value) {\n this.element.setAttribute('height', value);\n this.element.setAttribute('data-shape-height', value);\n }\n\n _transformMetrics() {\n const vbWidth = parseFloat(this.element.getAttribute('data-viewbox-width')) || 24;\n const vbHeight = parseFloat(this.element.getAttribute('data-viewbox-height')) || 24;\n const scale = Math.min(this.width / vbWidth, this.height / vbHeight);\n return {\n scale,\n localCenterX: this.width / 2 / scale,\n localCenterY: this.height / 2 / scale,\n };\n }\n\n _applyTransform() {\n const { scale, localCenterX, localCenterY } = this._transformMetrics();\n this.element.setAttribute(\n 'transform',\n `translate(${this.x}, ${this.y}) scale(${scale}) rotate(${this.rotation}, ${localCenterX}, ${localCenterY})`\n );\n }\n\n get rotation() {\n const dataRotation = this.element.getAttribute('data-shape-rotation');\n if (dataRotation) {\n return parseFloat(dataRotation);\n }\n\n const transform = this.element.getAttribute('transform');\n if (transform) {\n const rotateMatch = transform.match(/rotate\\(([^,\\s]+)/);\n if (rotateMatch) {\n return parseFloat(rotateMatch[1]);\n }\n }\n return 0;\n }\n\n set rotation(value) {\n this.element.setAttribute('data-shape-rotation', value);\n this._applyTransform();\n }\n\n move(dx, dy) {\n this.x += dx;\n this.y += dy;\n\n this._applyTransform();\n\n this.element.setAttribute('x', this.x);\n this.element.setAttribute('y', this.y);\n\n this.element.setAttribute('data-shape-x', this.x);\n this.element.setAttribute('data-shape-y', this.y);\n\n updateArrowsForShape(this);\n\n if (isDragging && !this.isBeingMovedByFrame) {\n this.updateFrameContainment();\n }\n }\n updateFrameContainment() {\n if (this.isBeingMovedByFrame) return;\n\n let targetFrame = null;\n\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 (this.parentFrame && isDragging) {\n this.parentFrame.temporarilyRemoveFromFrame(this);\n }\n\n if (hoveredFrameIcon && hoveredFrameIcon !== targetFrame) {\n hoveredFrameIcon.removeHighlight();\n }\n\n if (targetFrame && targetFrame !== hoveredFrameIcon) {\n targetFrame.highlightFrame();\n }\n\n hoveredFrameIcon = targetFrame;\n }\n\n contains(x, y) {\n const iconX = this.x;\n const iconY = this.y;\n const iconWidth = this.width;\n const iconHeight = this.height;\n\n return x >= iconX && x <= iconX + iconWidth && y >= iconY && y <= iconY + iconHeight;\n }\n\n updateAttachedArrows() {\n updateArrowsForShape(this);\n }\n\n draw() {\n this._applyTransform();\n\n this.element.setAttribute('data-shape-x', this.x);\n this.element.setAttribute('data-shape-y', this.y);\n this.element.setAttribute('data-shape-width', this.width);\n this.element.setAttribute('data-shape-height', this.height);\n this.element.setAttribute('data-shape-rotation', this.rotation);\n\n updateArrowsForShape(this);\n }\n\n removeSelection(params) {\n if (window.__iconToolRemoveSelection) {\n window.__iconToolRemoveSelection();\n }\n this.isSelected = false;\n }\n\n // Called by handleMultiSelectionMouseDown \u2014 same as selectShape\n addAnchors() {\n selectIcon({ target: this.element, stopPropagation: () => { } });\n }\n\n selectShape() {\n selectIcon({ target: this.element, stopPropagation: () => { } });\n }\n\n remove() {\n if (typeof shapes !== 'undefined' && Array.isArray(shapes)) {\n const idx = shapes.indexOf(this);\n if (idx !== -1) shapes.splice(idx, 1);\n }\n\n if (typeof cleanupAttachments === 'function') {\n cleanupAttachments(this.element);\n }\n\n if (this.parentFrame) {\n this.parentFrame.removeShapeFromFrame(this);\n }\n\n if (this.group && this.group.parentNode) {\n this.group.parentNode.removeChild(this.group);\n }\n }\n restore(pos) {\n const svg = getSVGElement();\n\n if (!this.group.parentNode && svg) {\n svg.appendChild(this.group);\n }\n\n if (typeof shapes !== 'undefined' && Array.isArray(shapes)) {\n if (shapes.indexOf(this) === -1) {\n shapes.push(this);\n }\n }\n\n this.x = pos.x;\n this.y = pos.y;\n this.width = pos.width;\n this.height = pos.height;\n this.rotation = pos.rotation;\n\n if (pos.parentFrame) {\n this.parentFrame = pos.parentFrame;\n pos.parentFrame.addShapeToFrame(this);\n }\n\n this._applyTransform();\n\n this.element.setAttribute('data-shape-x', pos.x);\n this.element.setAttribute('data-shape-y', pos.y);\n this.element.setAttribute('data-shape-width', pos.width);\n this.element.setAttribute('data-shape-height', pos.height);\n this.element.setAttribute('data-shape-rotation', pos.rotation);\n\n updateArrowsForShape(this);\n }\n}\n\nexport { IconShape };\n"],
|
|
5
|
+
"mappings": ";;;;;;;AAMA,IAAI,aAAa;AACjB,IAAI,mBAAmB;AAGvB,OAAO,mBAAmB;AAAA,EACtB,IAAI,WAAW,GAAG;AAAE,iBAAa;AAAA,EAAG;AAAA,EACpC,IAAI,aAAa;AAAE,WAAO;AAAA,EAAY;AAAA,EACtC,IAAI,iBAAiB,GAAG;AAAE,uBAAmB;AAAA,EAAG;AAAA,EAChD,IAAI,mBAAmB;AAAE,WAAO;AAAA,EAAkB;AACtD;AAEA,SAAS,gBAAgB;AACrB,SAAO,SAAS,eAAe,iBAAiB;AACpD;AAGA,SAAS,WAAW,OAAO;AACvB,MAAI,OAAO,sBAAsB;AAC7B,WAAO,qBAAqB,KAAK;AAAA,EACrC;AACJ;AAEA,IAAM,YAAN,MAAgB;AAAA,EACZ,YAAY,SAAS;AACjB,SAAK,UAAU;AACf,SAAK,YAAY;AACjB,SAAK,UAAU,QAAQ,OAAO,KAAK,IAAI,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,KAAK,MAAM,KAAK,OAAO,IAAI,GAAK,CAAC;AAC1F,SAAK,OAAO;AAE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a,uBAAuB,IAAI,QAAQ;AAE7D,yBAAqB,IAAI;AAAA,EAC7B;AACJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -6,12 +6,13 @@ import {
|
|
|
6
6
|
calculateSnap,
|
|
7
7
|
cleanupAttachments,
|
|
8
8
|
clearSnapGuides
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-YF3TK7SC.js";
|
|
10
10
|
import {
|
|
11
|
+
pushCreateAction,
|
|
11
12
|
pushDeleteAction,
|
|
12
13
|
pushFrameAttachmentAction,
|
|
13
14
|
pushTransformAction
|
|
14
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-U3TB4KRS.js";
|
|
15
16
|
|
|
16
17
|
// src/core/Selection.js
|
|
17
18
|
var isMultiSelecting = false;
|
|
@@ -1604,6 +1605,8 @@ function deleteSelectedShapes() {
|
|
|
1604
1605
|
}
|
|
1605
1606
|
function frameSelectedShapes() {
|
|
1606
1607
|
if (multiSelection.selectedShapes.size < 2) return;
|
|
1608
|
+
const shapesToFrame = Array.from(multiSelection.selectedShapes);
|
|
1609
|
+
if (shapesToFrame.some((shape) => shape?.shapeName === "frame" || shape?.parentFrame)) return;
|
|
1607
1610
|
const bounds = multiSelection.getBounds();
|
|
1608
1611
|
if (!bounds) return;
|
|
1609
1612
|
const padding = 20;
|
|
@@ -1618,14 +1621,6 @@ function frameSelectedShapes() {
|
|
|
1618
1621
|
}
|
|
1619
1622
|
const frame = new FrameClass(fx, fy, fw, fh);
|
|
1620
1623
|
shapes.push(frame);
|
|
1621
|
-
if (window.historyStack) {
|
|
1622
|
-
window.historyStack.push({
|
|
1623
|
-
type: window.ACTION_CREATE || "create",
|
|
1624
|
-
shape: frame,
|
|
1625
|
-
shapeName: "frame"
|
|
1626
|
-
});
|
|
1627
|
-
}
|
|
1628
|
-
const shapesToFrame = Array.from(multiSelection.selectedShapes);
|
|
1629
1624
|
multiSelection.clearSelection();
|
|
1630
1625
|
for (const shape of shapesToFrame) {
|
|
1631
1626
|
frame.addShapeToFrame(shape);
|
|
@@ -1643,6 +1638,10 @@ function frameSelectedShapes() {
|
|
|
1643
1638
|
shapes.splice(earliest, 0, frame);
|
|
1644
1639
|
}
|
|
1645
1640
|
}
|
|
1641
|
+
pushCreateAction(frame, {
|
|
1642
|
+
frameCreation: true,
|
|
1643
|
+
containedShapes: shapesToFrame
|
|
1644
|
+
});
|
|
1646
1645
|
if (typeof frame.selectFrame === "function") {
|
|
1647
1646
|
frame.selectFrame();
|
|
1648
1647
|
}
|
|
@@ -1668,4 +1667,4 @@ export {
|
|
|
1668
1667
|
handleMultiSelectionMouseMove,
|
|
1669
1668
|
handleMultiSelectionMouseUp
|
|
1670
1669
|
};
|
|
1671
|
-
//# sourceMappingURL=chunk-
|
|
1670
|
+
//# sourceMappingURL=chunk-AH4PWNEB.js.map
|