@elixpo/lixsketch 5.5.19 → 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/Circle-6POZCUZD.js +9 -0
- package/dist/react/{CopyPaste-JMIXWUUO.js → CopyPaste-FJN7K5LS.js} +43 -14
- package/dist/react/CopyPaste-FJN7K5LS.js.map +7 -0
- package/dist/react/{EventDispatcher-H5EA4KZN.js → EventDispatcher-O7HCQQNM.js} +14 -13
- package/dist/react/{EventDispatcher-H5EA4KZN.js.map → EventDispatcher-O7HCQQNM.js.map} +1 -1
- package/dist/react/Frame-RLSMJJSK.js +11 -0
- package/dist/react/FreehandStroke-U6GYZOM4.js +9 -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/Rectangle-S7XUKWYD.js +9 -0
- package/dist/react/{SceneSerializer-ARTKPZVR.js → SceneSerializer-GSJR7ZHC.js} +36 -11
- package/dist/react/SceneSerializer-GSJR7ZHC.js.map +7 -0
- package/dist/react/{Selection-YJNZRBON.js → Selection-ZL3G6IAO.js} +5 -4
- package/dist/react/{SketchEngine-ZGYBIZG7.js → SketchEngine-BFLHJPCG.js} +25 -25
- package/dist/react/{UndoRedo-BZ6W4QTV.js → UndoRedo-NL7KLR5B.js} +2 -2
- package/dist/react/{ZoomPan-NYPDJBD5.js → ZoomPan-FAWA5OPS.js} +5 -1
- package/dist/react/ZoomPan-FAWA5OPS.js.map +7 -0
- 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-QYNTPZON.js → chunk-2THKDSWW.js} +9 -5
- package/dist/react/chunk-2THKDSWW.js.map +7 -0
- 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-FV3EPR4L.js → chunk-AH4PWNEB.js} +19 -11
- package/dist/react/chunk-AH4PWNEB.js.map +7 -0
- package/dist/react/{chunk-XCJOF6BM.js → chunk-FETTJLCV.js} +5 -1
- package/dist/react/chunk-FETTJLCV.js.map +7 -0
- package/dist/react/{chunk-JJTII2UQ.js → chunk-GC3KTQDA.js} +78 -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-3VSGFP6U.js → chunk-HFQZYCHJ.js} +8 -4
- package/dist/react/chunk-HFQZYCHJ.js.map +7 -0
- package/dist/react/{chunk-C72OHQLE.js → chunk-ILGAFR56.js} +3 -3
- package/dist/react/{chunk-CF7AK4ES.js → chunk-KVAQPCUH.js} +26 -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-PAKA6HUX.js +59 -0
- package/dist/react/chunk-PAKA6HUX.js.map +7 -0
- package/dist/react/{chunk-HKYUJUD7.js → chunk-PXFPPO3R.js} +5 -1
- package/dist/react/chunk-PXFPPO3R.js.map +7 -0
- package/dist/react/{chunk-6G3ITAS5.js → chunk-SZD7DKYJ.js} +18 -9
- package/dist/react/chunk-SZD7DKYJ.js.map +7 -0
- package/dist/react/{chunk-N7NZLF6P.js → chunk-TKXKJNTX.js} +5 -1
- package/dist/react/chunk-TKXKJNTX.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-73VA5ALZ.js → chunk-XFQECTTF.js} +48 -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-O2Z7ZXGP.js → codeTool-NCQ73R6M.js} +5 -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-AUHRLOO2.js → iconTool-LSW2DYGB.js} +5 -4
- package/dist/react/{imageTool-DRKDCPUV.js → imageTool-2DSR32RX.js} +5 -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-UORBAAJE.js → textTool-IQOYPELP.js} +6 -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/ScreenSpaceControls.js +60 -0
- package/src/core/Selection.js +19 -11
- package/src/core/UndoRedo.js +47 -3
- package/src/core/ZoomPan.js +3 -0
- 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/Circle.js +2 -0
- package/src/shapes/Frame.js +26 -2
- package/src/shapes/FreehandStroke.js +2 -0
- package/src/shapes/IconShape.js +23 -25
- package/src/shapes/ImageShape.js +6 -2
- package/src/shapes/Rectangle.js +2 -0
- package/src/tools/codeTool.js +3 -2
- package/src/tools/frameTool.js +19 -9
- package/src/tools/iconTool.js +63 -26
- package/src/tools/imageTool.js +80 -14
- package/src/tools/textTool.js +3 -1
- package/dist/react/Circle-QQMKCKFR.js +0 -8
- package/dist/react/CopyPaste-JMIXWUUO.js.map +0 -7
- package/dist/react/Frame-VADA625S.js +0 -10
- package/dist/react/FreehandStroke-BOWDNAVC.js +0 -8
- 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/Rectangle-MZ6ZB6KM.js +0 -8
- package/dist/react/SceneSerializer-ARTKPZVR.js.map +0 -7
- package/dist/react/ZoomPan-NYPDJBD5.js.map +0 -7
- package/dist/react/chunk-3VSGFP6U.js.map +0 -7
- package/dist/react/chunk-6G3ITAS5.js.map +0 -7
- package/dist/react/chunk-73VA5ALZ.js.map +0 -7
- package/dist/react/chunk-C62SXFBL.js.map +0 -7
- package/dist/react/chunk-CF7AK4ES.js.map +0 -7
- package/dist/react/chunk-FV3EPR4L.js.map +0 -7
- package/dist/react/chunk-HKYUJUD7.js.map +0 -7
- package/dist/react/chunk-JJTII2UQ.js.map +0 -7
- package/dist/react/chunk-MYYBFZD3.js.map +0 -7
- package/dist/react/chunk-N7NZLF6P.js.map +0 -7
- package/dist/react/chunk-QYNTPZON.js.map +0 -7
- package/dist/react/chunk-XCJOF6BM.js.map +0 -7
- /package/dist/react/{Circle-QQMKCKFR.js.map → Circle-6POZCUZD.js.map} +0 -0
- /package/dist/react/{Frame-VADA625S.js.map → Frame-RLSMJJSK.js.map} +0 -0
- /package/dist/react/{FreehandStroke-BOWDNAVC.js.map → FreehandStroke-U6GYZOM4.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/{Rectangle-MZ6ZB6KM.js.map → Rectangle-S7XUKWYD.js.map} +0 -0
- /package/dist/react/{Selection-YJNZRBON.js.map → Selection-ZL3G6IAO.js.map} +0 -0
- /package/dist/react/{SketchEngine-ZGYBIZG7.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-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-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-O2Z7ZXGP.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-AUHRLOO2.js.map → iconTool-LSW2DYGB.js.map} +0 -0
- /package/dist/react/{imageTool-DRKDCPUV.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-UORBAAJE.js.map → textTool-IQOYPELP.js.map} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/shapes/Circle.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable */\nimport { registerRotationAnchor } from '../core/ScreenSpaceControls.js';\n// Circle shape class - extracted from drawCircle.js\n// Depends on globals: svg, shapes, rough, currentShape, currentZoom, rc\n\nconst rc = rough.svg(svg);\nlet isDraggingShapeCircle = false;\nlet isResizingShapeCircle = false;\nlet isRotatingShapeCircle = false;\nlet hoveredFrameCircle = null;\nconst colorOptionsCircle = document.querySelectorAll(\".circleStrokeSpan\");\nconst backgroundColorOptionsCircle = document.querySelectorAll(\".circleBackgroundSpan\");\nconst fillStyleOptionsCircle = document.querySelectorAll(\".circleFillStyleSpan\");\nconst strokeThicknessValueCircle = document.querySelectorAll(\".circleStrokeThickSpan\");\nconst outlineStyleValueCircle = document.querySelectorAll(\".circleOutlineStyle\");\n\nclass Circle {\n constructor(x, y, rx, ry, options = {}) {\n this.x = x; \n this.y = y; \n this.rx = rx; \n this.ry = ry; \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 = \"circle\";\n this.shapeID = `circle-${String(Date.now()).slice(0, 8)}-${Math.floor(Math.random() * 10000)}`;\n this.group.setAttribute('id', this.shapeID);\n\n // Frame attachment properties\n this.parentFrame = null;\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';\n this._shadeEllipse = 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._setupLabelDblClick();\n this.draw();\n }\n\n // Add width and height properties for frame compatibility\n get width() {\n return this.rx * 2;\n }\n \n set width(value) {\n this.rx = value / 2;\n }\n \n get height() {\n return this.ry * 2;\n }\n \n set height(value) {\n this.ry = value / 2;\n }\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._shadeEllipse) {\n if (preserveSet && preserveSet.has(child)) continue;\n childrenToRemove.push(child);\n }\n }\n childrenToRemove.forEach(child => this.group.removeChild(child));\n const optionsString = JSON.stringify(this.options);\n const isInitialDraw = this.element === null;\n const sizeChanged = this.rx !== this._lastDrawn.rx || this.ry !== this._lastDrawn.ry;\n const optionsChanged = optionsString !== this._lastDrawn.options;\n if (isInitialDraw || optionsChanged || sizeChanged) {\n if (this.element && this.element.parentNode === this.group) {\n this.group.removeChild(this.element);\n }\n\n const roughEllipse = rc.ellipse(0, 0, this.rx * 2, this.ry * 2, this.options);\n this.element = roughEllipse;\n this.group.appendChild(roughEllipse);\n\n this._lastDrawn.rx = this.rx;\n this._lastDrawn.ry = this.ry;\n this._lastDrawn.options = optionsString;\n }\n\n // Hit area for dblclick detection\n if (!this._hitArea) {\n this._hitArea = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse');\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('cx', 0);\n this._hitArea.setAttribute('cy', 0);\n this._hitArea.setAttribute('rx', this.rx);\n this._hitArea.setAttribute('ry', this.ry);\n\n // Shading / gradient overlay\n this._updateShade();\n\n // Update embedded label\n this._updateLabelElement();\n\n this.group.setAttribute('transform', `translate(${this.x}, ${this.y}) rotate(${this.rotation}, 0, 0)`);\n if (this.isSelected) {\n if (this._skipAnchors) {\n this.updateSelectionControls();\n } else {\n this.addAnchors();\n }\n }\n if (!this.group.parentNode) {\n svg.appendChild(this.group);\n }\n }\n\n move(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 this.group.setAttribute('transform', `translate(${this.x}, ${this.y}) rotate(${this.rotation}, 0, 0)`);\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 (isDraggingShapeCircle && !this.isBeingMovedByFrame) {\n this.updateFrameContainment();\n }\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 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 && isDraggingShapeCircle) {\n this.parentFrame.temporarilyRemoveFromFrame(this);\n }\n \n // Update frame highlighting\n if (hoveredFrameCircle && hoveredFrameCircle !== targetFrame) {\n hoveredFrameCircle.removeHighlight();\n }\n \n if (targetFrame && targetFrame !== hoveredFrameCircle) {\n targetFrame.highlightFrame();\n }\n \n hoveredFrameCircle = targetFrame;\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.rx - this.selectionPadding;\n const expandedY = -this.ry - this.selectionPadding; \n const expandedWidth = this.rx * 2 + 2 * this.selectionPadding;\n const expandedHeight = this.ry * 2 + 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 (!isResizingShapeCircle && !isDraggingShapeCircle && !isRotatingShapeCircle) {\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 registerRotationAnchor(this.rotationAnchor, { radius: 8, edgeY: expandedY });\n\n this.rotationAnchor.addEventListener('mouseover', function () {\n if (!isResizingShapeCircle && !isDraggingShapeCircle && !isRotatingShapeCircle) {\n svg.style.cursor = 'grab';\n }\n });\n this.rotationAnchor.addEventListener('mouseout', function () {\n if (!isResizingShapeCircle && !isDraggingShapeCircle && !isRotatingShapeCircle) {\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('vector-effect', 'non-scaling-stroke');\n outline.setAttribute('stroke-dasharray', '4 2');\n outline.setAttribute('style', 'pointer-events: none;');\n this.group.appendChild(outline);\n this.selectionOutline = outline;\n\n disableAllSideBars();\n circleSideBar.classList.remove(\"hidden\");\n if (window.__showSidebarForShape) window.__showSidebarForShape('circle');\n this.updateSidebar();\n }\n\n updateSelectionControls() {\n if (!this.selectionOutline || this.anchors.length === 0) return;\n\n const zoom = window.currentZoom || 1;\n const anchorSize = 10 / zoom;\n const expandedX = -this.rx - this.selectionPadding;\n const expandedY = -this.ry - this.selectionPadding;\n const expandedWidth = this.rx * 2 + 2 * this.selectionPadding;\n const expandedHeight = this.ry * 2 + 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 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 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 if (this.rotationAnchor) {\n this.rotationAnchor.setAttribute('cx', expandedX + expandedWidth / 2);\n this.rotationAnchor.setAttribute('cy', expandedY - 30 / zoom);\n }\n }\n\n removeSelection() {\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 contains(x, y) {\n if (!this.element || !this.rx || !this.ry) return false;\n // Mouse coordinates are in canvas space; invert the circle's own\n // translation/rotation without mixing in the viewport CTM.\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 * Math.cos(angle) - translatedY * Math.sin(angle);\n const dy = translatedX * Math.sin(angle) + translatedY * Math.cos(angle);\n const rx = this.rx;\n const ry = this.ry;\n return ((dx * dx) / (rx * rx) + (dy * dy) / (ry * ry)) <= 1.05; \n }\n isNearAnchor(x, y) {\n if (!this.isSelected) return null;\n const buffer = 10 / currentZoom; // Scale buffer by zoom level\n const anchorSize = 10 / currentZoom; // Scale anchor size by zoom level\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 \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 \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 \n const rotateAnchorRadius = parseFloat(this.rotationAnchor.getAttribute('r')) / currentZoom;\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 updatePosition(anchorIndex, newMouseX, newMouseY) {\n const CTM = this.group.getCTM();\n if (!CTM) return;\n \n const inverseCTM = CTM.inverse();\n const svgPoint = svg.createSVGPoint();\n svgPoint.x = newMouseX;\n svgPoint.y = newMouseY;\n const transformedPoint = svgPoint.matrixTransform(inverseCTM);\n \n const dx = transformedPoint.x;\n const dy = transformedPoint.y;\n \n const MIN_RADIUS = 10;\n \n switch (anchorIndex) {\n case 0: // top-left\n case 1: // top-right\n case 2: // bottom-left\n case 3: // bottom-right\n this.rx = Math.max(Math.abs(dx), MIN_RADIUS);\n this.ry = Math.max(Math.abs(dy), MIN_RADIUS);\n break;\n \n case 4: // top-center\n case 5: // bottom-center\n this.ry = Math.max(Math.abs(dy), MIN_RADIUS);\n break;\n \n case 6: // left-center\n case 7: // right-center\n this.rx = Math.max(Math.abs(dx), MIN_RADIUS);\n break;\n }\n this.updateAttachedArrows();\n }\n updateAttachedArrows() {\n shapes.forEach(shape => {\n if (shape && shape.shapeName === 'arrow' && typeof shape.updateAttachments === 'function') {\n if ((shape.attachedToStart && shape.attachedToStart.shape === this) ||\n (shape.attachedToEnd && shape.attachedToEnd.shape === this)) {\n shape.updateAttachments();\n }\n }\n });\n }\n _updateShade() {\n if (!this.shadeColor) {\n if (this._shadeEllipse && this._shadeEllipse.parentNode === this.group) {\n this.group.removeChild(this._shadeEllipse);\n this._shadeEllipse = 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 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', 'radialGradient');\n this._shadeGradient.setAttribute('id', gradId);\n defs.appendChild(this._shadeGradient);\n }\n\n // Radial gradient for circles - center to edge fade\n this._shadeGradient.setAttribute('cx', '50%');\n this._shadeGradient.setAttribute('cy', '50%');\n this._shadeGradient.setAttribute('r', '50%');\n\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 if (!this._shadeEllipse) {\n this._shadeEllipse = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse');\n this._shadeEllipse.setAttribute('pointer-events', 'none');\n }\n this._shadeEllipse.setAttribute('cx', 0);\n this._shadeEllipse.setAttribute('cy', 0);\n this._shadeEllipse.setAttribute('rx', this.rx);\n this._shadeEllipse.setAttribute('ry', this.ry);\n this._shadeEllipse.setAttribute('fill', `url(#${gradId})`);\n\n if (this._shadeEllipse.parentNode === this.group) this.group.removeChild(this._shadeEllipse);\n if (this.element && this.element.nextSibling) {\n this.group.insertBefore(this._shadeEllipse, this.element.nextSibling);\n } else {\n this.group.appendChild(this._shadeEllipse);\n }\n }\n\n _updateLabelElement() {\n if (!this.label) {\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 // Circle center is at (0, 0) in local coords\n this.labelElement.setAttribute('x', 0);\n this.labelElement.setAttribute('y', 0);\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', -bgW / 2);\n this._labelBg.setAttribute('y', -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 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 ellipse bounding box to screen coords\n const pt1 = svg.createSVGPoint();\n pt1.x = -this.rx; pt1.y = -this.ry;\n const screenTL = pt1.matrixTransform(ctm);\n const pt2 = svg.createSVGPoint();\n pt2.x = this.rx; pt2.y = this.ry;\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.rx * 2, 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 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 rotate(angle) {\n angle = angle % 360;\n if (angle < 0) angle += 360;\n this.rotation = angle;\n }\n // No-op: React sidebar handles UI updates via Zustand store\n updateSidebar() {}\n\n}\n\nexport { Circle };\n"],
|
|
5
|
+
"mappings": ";;;;;;AAKA,IAAM,KAAK,MAAM,IAAI,GAAG;AACxB,IAAI,wBAAwB;AAC5B,IAAI,wBAAwB;AAC5B,IAAI,wBAAwB;AAC5B,IAAI,qBAAqB;AACzB,IAAM,qBAAqB,SAAS,iBAAiB,mBAAmB;AACxE,IAAM,+BAA+B,SAAS,iBAAiB,uBAAuB;AACtF,IAAM,yBAAyB,SAAS,iBAAiB,sBAAsB;AAC/E,IAAM,6BAA6B,SAAS,iBAAiB,wBAAwB;AACrF,IAAM,0BAA0B,SAAS,iBAAiB,qBAAqB;AAE/E,IAAM,SAAN,MAAa;AAAA,EACT,YAAY,GAAG,GAAG,IAAI,IAAI,UAAU,CAAC,GAAG;AACpC,SAAK,IAAI;AACT,SAAK,IAAI;AACT,SAAK,KAAK;AACV,SAAK,KAAK;AACV,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,gBAAgB,8BAA8B,GAAG;AACvE,SAAK,UAAU,CAAC;AAChB,SAAK,iBAAiB;AACtB,SAAK,mBAAmB;AACxB,SAAK,mBAAmB;AACxB,SAAK,YAAY;AACjB,SAAK,UAAU,UAAU,OAAO,KAAK,IAA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+
}
|
|
@@ -22,11 +22,17 @@ function getCurrentSelectedElement() {
|
|
|
22
22
|
function updateSelectedElement(element) {
|
|
23
23
|
selectedElement = element;
|
|
24
24
|
}
|
|
25
|
-
function pushCreateAction(shape) {
|
|
26
|
-
|
|
25
|
+
function pushCreateAction(shape, meta = null) {
|
|
26
|
+
const action = {
|
|
27
27
|
type: "create",
|
|
28
28
|
shape
|
|
29
|
-
}
|
|
29
|
+
};
|
|
30
|
+
if (meta?.frameCreation && shape?.shapeName === "frame") {
|
|
31
|
+
action.frameCreation = true;
|
|
32
|
+
action.containedShapes = [...meta.containedShapes || shape.containedShapes || []];
|
|
33
|
+
action.shapeIndex = Array.isArray(shapes) ? shapes.indexOf(shape) : -1;
|
|
34
|
+
}
|
|
35
|
+
undoStack.push(action);
|
|
30
36
|
redoStack.length = 0;
|
|
31
37
|
notifyCollaboration();
|
|
32
38
|
}
|
|
@@ -464,7 +470,20 @@ function undo() {
|
|
|
464
470
|
return;
|
|
465
471
|
}
|
|
466
472
|
if (action.type === "create") {
|
|
467
|
-
if (action.shape.
|
|
473
|
+
if (action.frameCreation && action.shape.shapeName === "frame") {
|
|
474
|
+
for (const child of action.containedShapes || []) {
|
|
475
|
+
if (child?.parentFrame === action.shape) action.shape.removeShapeFromFrame(child);
|
|
476
|
+
}
|
|
477
|
+
if (currentShape === action.shape) {
|
|
478
|
+
action.shape.removeSelection?.();
|
|
479
|
+
currentShape = null;
|
|
480
|
+
}
|
|
481
|
+
const idx = shapes.indexOf(action.shape);
|
|
482
|
+
if (idx !== -1) shapes.splice(idx, 1);
|
|
483
|
+
action.shape.group?.remove();
|
|
484
|
+
action.shape.clipGroup?.remove();
|
|
485
|
+
action.shape.clipPath?.remove();
|
|
486
|
+
} else if (action.shape.type === "text") {
|
|
468
487
|
if (action.shape.element && action.shape.element.parentNode) {
|
|
469
488
|
action.shape.element.parentNode.removeChild(action.shape.element);
|
|
470
489
|
} else if (action.shape.parentNode) {
|
|
@@ -828,7 +847,27 @@ function redo() {
|
|
|
828
847
|
return;
|
|
829
848
|
}
|
|
830
849
|
if (action.type === "create") {
|
|
831
|
-
if (action.shape.
|
|
850
|
+
if (action.frameCreation && action.shape.shapeName === "frame") {
|
|
851
|
+
const frame = action.shape;
|
|
852
|
+
let defs = svg?.querySelector("defs");
|
|
853
|
+
if (!defs && svg) {
|
|
854
|
+
defs = document.createElementNS("http://www.w3.org/2000/svg", "defs");
|
|
855
|
+
svg.appendChild(defs);
|
|
856
|
+
}
|
|
857
|
+
if (defs && frame.clipPath && !frame.clipPath.parentNode) defs.appendChild(frame.clipPath);
|
|
858
|
+
if (svg && frame.group && !frame.group.parentNode) svg.appendChild(frame.group);
|
|
859
|
+
if (svg && frame.clipGroup && !frame.clipGroup.parentNode) svg.appendChild(frame.clipGroup);
|
|
860
|
+
if (shapes.indexOf(frame) === -1) {
|
|
861
|
+
const index = action.shapeIndex >= 0 ? Math.min(action.shapeIndex, shapes.length) : shapes.length;
|
|
862
|
+
shapes.splice(index, 0, frame);
|
|
863
|
+
}
|
|
864
|
+
frame.containedShapes = [];
|
|
865
|
+
frame.draw();
|
|
866
|
+
frame.updateClipPath();
|
|
867
|
+
for (const child of action.containedShapes || []) {
|
|
868
|
+
if (child && shapes.includes(child)) frame.addShapeToFrame(child);
|
|
869
|
+
}
|
|
870
|
+
} else if (action.shape.type === "text") {
|
|
832
871
|
if (svg) {
|
|
833
872
|
svg.appendChild(action.shape.element || action.shape);
|
|
834
873
|
shapes.push(action.shape.element || action.shape);
|
|
@@ -1145,4 +1184,4 @@ export {
|
|
|
1145
1184
|
undo,
|
|
1146
1185
|
redo
|
|
1147
1186
|
};
|
|
1148
|
-
//# sourceMappingURL=chunk-
|
|
1187
|
+
//# sourceMappingURL=chunk-U3TB4KRS.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/core/UndoRedo.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable */\n// Undo/Redo system - copied from undoAndRedo.js\n\n// Stacks for undo/redo\nconst undoStack = [];\nconst redoStack = [];\n\n// Import references to text-related variables and functions\nlet selectedElement = null;\nlet updateSelectionFeedback = null;\nlet svg = null;\n\nfunction notifyCollaboration() {\n if (typeof window !== 'undefined' && typeof window.__collabSceneChanged === 'function') {\n window.__collabSceneChanged();\n }\n}\n\n// Function to set references from other modules\nexport function setTextReferences(element, updateFn, svgElement) {\n selectedElement = element;\n updateSelectionFeedback = updateFn;\n svg = svgElement;\n}\n\n// Function to get current selectedElement (called from other modules)\nexport function getCurrentSelectedElement() {\n return selectedElement;\n}\n\n// Function to update selectedElement reference (called from other modules)\nexport function updateSelectedElement(element) {\n selectedElement = element;\n}\n\n// Call this after creating a new shape (e.g., Rectangle)\nexport function pushCreateAction(shape, meta = null) {\n const action = {\n type: 'create',\n shape: shape\n };\n if (meta?.frameCreation && shape?.shapeName === 'frame') {\n action.frameCreation = true;\n action.containedShapes = [...(meta.containedShapes || shape.containedShapes || [])];\n action.shapeIndex = Array.isArray(shapes) ? shapes.indexOf(shape) : -1;\n }\n undoStack.push(action);\n \n // Clear redo stack when new action is performed\n redoStack.length = 0;\n notifyCollaboration();\n}\n\nexport function pushDeleteAction(shape, meta = null) {\n // Issue #24 bug #7: when the deleted shape is a frame, the caller may\n // pass `meta.childSnapshot` \u2014 the contained shape REFERENCES at the\n // time of delete. The undo branch uses this to re-attach the children\n // when the frame is restored, instead of leaving an empty box.\n const action = { type: 'delete', shape };\n if (meta && meta.childSnapshot) action.childSnapshot = meta.childSnapshot;\n undoStack.push(action);\n\n // Clear redo stack when new action is performed\n redoStack.length = 0;\n notifyCollaboration();\n}\n\n// Enhanced delete action to clean up attached arrows\nexport function pushDeleteActionWithAttachments(shape) {\n let affectedArrows = [];\n \n // If deleting a text element, find all attached arrows\n if (shape.type === 'text' || shape.shapeName === 'text') {\n affectedArrows = shapes.filter(s => s.shapeName === 'arrow' && \n (s.attachedToStart?.shape === shape || s.attachedToEnd?.shape === shape))\n .map(arrow => ({\n arrow: arrow,\n oldAttachments: arrow.getAttachmentState(),\n oldPoints: {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n }\n }));\n }\n \n undoStack.push({\n type: 'delete',\n shape: shape,\n affectedArrows: affectedArrows\n });\n \n // Clear redo stack when new action is performed\n redoStack.length = 0;\n notifyCollaboration();\n}\n\nexport function pushFrameAttachmentAction(frame, shape, action, oldFrame = null) {\n undoStack.push({\n type: 'frameAttachment',\n frame: frame,\n shape: shape,\n action: action, // 'attach' or 'detach'\n oldFrame: oldFrame, // Previous frame if shape was moved between frames\n // Store shape position for potential restoration\n shapeState: {\n x: shape.x,\n y: shape.y,\n width: shape.width || 0,\n height: shape.height || 0,\n rotation: shape.rotation || 0\n }\n });\n \n // Clear redo stack when new action is performed\n redoStack.length = 0;\n notifyCollaboration();\n}\n\nexport function pushCreateActionWithAttachments(shape) {\n undoStack.push({\n type: 'create',\n shape: shape,\n // Store any arrows that might need to reattach when this is undone\n potentialAttachments: []\n });\n \n // Clear redo stack when new action is performed\n redoStack.length = 0;\n notifyCollaboration();\n}\n\nexport function pushTransformAction(shape, oldPos, newPos) {\n if (shape.shapeName === 'frame') {\n // Handle frame transformation with contained shapes\n const containedShapesStates = shape.containedShapes.map(containedShape => ({\n shape: containedShape,\n oldState: {\n x: containedShape.x - (newPos.x - oldPos.x),\n y: containedShape.y - (newPos.y - oldPos.y),\n width: containedShape.width || 0,\n height: containedShape.height || 0,\n rotation: containedShape.rotation || 0\n },\n newState: {\n x: containedShape.x,\n y: containedShape.y,\n width: containedShape.width || 0,\n height: containedShape.height || 0,\n rotation: containedShape.rotation || 0\n }\n }));\n\n undoStack.push({\n type: 'frameTransform',\n shape: shape,\n oldPos: {\n x: oldPos.x,\n y: oldPos.y,\n width: oldPos.width,\n height: oldPos.height,\n rotation: oldPos.rotation,\n frameName: oldPos.frameName || shape.frameName\n },\n newPos: {\n x: newPos.x,\n y: newPos.y,\n width: newPos.width,\n height: newPos.height,\n rotation: newPos.rotation,\n frameName: newPos.frameName || shape.frameName\n },\n containedShapes: containedShapesStates\n });\n } else if (shape.type === 'text') {\n // Enhanced text handling - also track frame attachment changes\n const currentFrame = shape.parentFrame || null;\n \n undoStack.push({\n type: 'transform',\n shape: shape,\n oldPos: {\n x: oldPos.x,\n y: oldPos.y,\n rotation: oldPos.rotation,\n fontSize: oldPos.fontSize\n },\n newPos: {\n x: newPos.x,\n y: newPos.y,\n rotation: newPos.rotation,\n fontSize: newPos.fontSize\n },\n // Track frame attachment state\n frameAttachment: {\n oldFrame: oldPos.parentFrame || null,\n newFrame: currentFrame\n },\n // Store affected arrows with their attachment states\n affectedArrows: shapes.filter(s => s.shapeName === 'arrow' && \n (s.attachedToStart?.shape === shape || s.attachedToEnd?.shape === shape))\n .map(arrow => ({\n arrow: arrow,\n oldAttachments: arrow.getAttachmentState(),\n oldPoints: {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n }\n }))\n });\n } else if (shape.type === 'image') {\n // Enhanced image handling - also track frame attachment changes\n const currentFrame = shape.parentFrame || null;\n \n undoStack.push({\n type: 'transform',\n shape: shape,\n oldPos: {\n x: oldPos.x,\n y: oldPos.y,\n width: oldPos.width,\n height: oldPos.height,\n rotation: oldPos.rotation\n },\n newPos: {\n x: newPos.x,\n y: newPos.y,\n width: newPos.width,\n height: newPos.height,\n rotation: newPos.rotation\n },\n // Track frame attachment state\n frameAttachment: {\n oldFrame: oldPos.parentFrame || null,\n newFrame: currentFrame\n },\n // Store affected arrows with their attachment states\n affectedArrows: shapes.filter(s => s.shapeName === 'arrow' && \n (s.attachedToStart?.shape === shape || s.attachedToEnd?.shape === shape))\n .map(arrow => ({\n arrow: arrow,\n oldAttachments: arrow.getAttachmentState(),\n oldPoints: {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n }\n }))\n });\n } else if (shape.shapeName === 'circle') {\n // Enhanced circle handling - also track frame attachment changes\n const currentFrame = shape.parentFrame || null;\n \n undoStack.push({\n type: 'transform',\n shape: shape,\n oldPos: {\n x: oldPos.x,\n y: oldPos.y,\n rx: oldPos.rx,\n ry: oldPos.ry,\n rotation: oldPos.rotation\n },\n newPos: {\n x: newPos.x,\n y: newPos.y,\n rx: newPos.rx,\n ry: newPos.ry,\n rotation: newPos.rotation\n },\n // Track frame attachment state\n frameAttachment: {\n oldFrame: oldPos.parentFrame || null,\n newFrame: currentFrame\n },\n // Store affected arrows with their attachment states\n affectedArrows: shapes.filter(s => s.shapeName === 'arrow' && \n (s.attachedToStart?.shape === shape || s.attachedToEnd?.shape === shape))\n .map(arrow => ({\n arrow: arrow,\n oldAttachments: arrow.getAttachmentState(),\n oldPoints: {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n }\n }))\n });\n } else if (shape.shapeName === \"rectangle\") {\n // Enhanced rectangle handling - also track frame attachment changes\n const currentFrame = shape.parentFrame || null;\n \n undoStack.push({\n type: 'transform',\n shape: shape,\n oldPos: { \n x: oldPos.x, \n y: oldPos.y, \n width: oldPos.width, \n height: oldPos.height, \n rotation: oldPos.rotation\n },\n newPos: { \n x: newPos.x, \n y: newPos.y, \n width: newPos.width, \n height: newPos.height, \n rotation: newPos.rotation\n },\n // Track frame attachment state\n frameAttachment: {\n oldFrame: oldPos.parentFrame || null,\n newFrame: currentFrame\n },\n // Store affected arrows with their attachment states\n affectedArrows: shapes.filter(s => s.shapeName === 'arrow' && \n (s.attachedToStart?.shape === shape || s.attachedToEnd?.shape === shape))\n .map(arrow => ({\n arrow: arrow,\n oldAttachments: arrow.getAttachmentState(),\n oldPoints: {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n }\n }))\n });\n } \n else if (shape.shapeName === 'line') {\n // Enhanced line handling with curve support\n const currentFrame = shape.parentFrame || null;\n \n undoStack.push({\n type: 'transform',\n shape: shape,\n oldPos: {\n startPoint: { x: oldPos.startPoint.x, y: oldPos.startPoint.y },\n endPoint: { x: oldPos.endPoint.x, y: oldPos.endPoint.y },\n controlPoint: oldPos.controlPoint ? { x: oldPos.controlPoint.x, y: oldPos.controlPoint.y } : null,\n isCurved: oldPos.isCurved || false\n },\n newPos: {\n startPoint: { x: newPos.startPoint.x, y: newPos.startPoint.y },\n endPoint: { x: newPos.endPoint.x, y: newPos.endPoint.y },\n controlPoint: newPos.controlPoint ? { x: newPos.controlPoint.x, y: newPos.controlPoint.y } : null,\n isCurved: newPos.isCurved || false\n },\n // Track frame attachment state\n frameAttachment: {\n oldFrame: oldPos.parentFrame || null,\n newFrame: currentFrame\n }\n });\n }\n else if (shape.shapeName === 'arrow') {\n // Handle arrow transform with attachment state\n undoStack.push({\n type: 'transform',\n shape: shape,\n oldPos: {\n startPoint: { x: oldPos.startPoint.x, y: oldPos.startPoint.y },\n endPoint: { x: oldPos.endPoint.x, y: oldPos.endPoint.y },\n controlPoint1: oldPos.controlPoint1 ? { x: oldPos.controlPoint1.x, y: oldPos.controlPoint1.y } : null,\n controlPoint2: oldPos.controlPoint2 ? { x: oldPos.controlPoint2.x, y: oldPos.controlPoint2.y } : null,\n attachments: oldPos.attachments || shape.getAttachmentState()\n },\n newPos: {\n startPoint: { x: newPos.startPoint.x, y: newPos.startPoint.y },\n endPoint: { x: newPos.endPoint.x, y: newPos.endPoint.y },\n controlPoint1: newPos.controlPoint1 ? { x: newPos.controlPoint1.x, y: newPos.controlPoint1.y } : null,\n controlPoint2: newPos.controlPoint2 ? { x: newPos.controlPoint2.x, y: newPos.controlPoint2.y } : null,\n attachments: newPos.attachments || shape.getAttachmentState()\n }\n });\n } \n else if (shape.type === 'icon') {\n // Enhanced icon handling - also track frame attachment changes\n const currentFrame = shape.parentFrame || null;\n \n undoStack.push({\n type: 'transform',\n shape: shape,\n oldPos: {\n x: oldPos.x,\n y: oldPos.y,\n width: oldPos.width,\n height: oldPos.height,\n rotation: oldPos.rotation\n },\n newPos: {\n x: newPos.x,\n y: newPos.y,\n width: newPos.width,\n height: newPos.height,\n rotation: newPos.rotation\n },\n // Track frame attachment state\n frameAttachment: {\n oldFrame: oldPos.parentFrame || null,\n newFrame: currentFrame\n },\n // Store affected arrows with their attachment states\n affectedArrows: shapes.filter(s => s.shapeName === 'arrow' && \n (s.attachedToStart?.shape === shape || s.attachedToEnd?.shape === shape))\n .map(arrow => ({\n arrow: arrow,\n oldAttachments: arrow.getAttachmentState(),\n oldPoints: {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n }\n }))\n });\n}\n else if (shape.shapeName === 'freehandStroke') {\n // Handle freehand stroke transform\n undoStack.push({\n type: 'transform',\n shape: shape,\n oldPos: {\n points: JSON.parse(JSON.stringify(oldPos.points)),\n rotation: oldPos.rotation\n },\n newPos: {\n points: JSON.parse(JSON.stringify(newPos.points)),\n rotation: newPos.rotation\n }\n });\n }\n \n // Clear redo stack when new action is performed\n redoStack.length = 0;\n notifyCollaboration();\n}\n\nexport function pushOptionsChangeAction(shape, oldOptions) {\n undoStack.push({\n type: 'optionsChange',\n shape: shape,\n oldOptions: oldOptions\n });\n \n // Clear redo stack when new action is performed\n redoStack.length = 0;\n notifyCollaboration();\n}\n\n// Issue #34 bug #4: refresh the multi-selection outline + handles so it\n// follows the reverted geometry. Without this the selection rect stays\n// pinned to the pre-undo coordinates and the user sees a ghost rect\n// floating away from the shapes it claims to wrap.\nfunction refreshSelectionAfterAction() {\n const ms = (typeof window !== 'undefined') ? window.multiSelection : null;\n if (!ms) return;\n if (typeof ms.updateControls !== 'function') return;\n if (!ms.selectedShapes || ms.selectedShapes.size === 0) return;\n try { ms.updateControls(); } catch (err) { console.warn('[UndoRedo] selection refresh failed:', err); }\n}\n\nexport function undo() {\n if (undoStack.length === 0) return;\n const action = undoStack.pop();\n try {\n if (action.type === 'frameTransform') {\n // Handle frame transformation undo\n action.shape.x = action.oldPos.x;\n action.shape.y = action.oldPos.y;\n action.shape.width = action.oldPos.width;\n action.shape.height = action.oldPos.height;\n action.shape.rotation = action.oldPos.rotation;\n action.shape.frameName = action.oldPos.frameName;\n \n // Restore contained shapes to their old positions\n action.containedShapes.forEach(shapeData => {\n const shape = shapeData.shape;\n shape.x = shapeData.oldState.x;\n shape.y = shapeData.oldState.y;\n shape.width = shapeData.oldState.width;\n shape.height = shapeData.oldState.height;\n shape.rotation = shapeData.oldState.rotation;\n \n if (typeof shape.draw === 'function') {\n shape.draw();\n }\n });\n \n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n action.shape.updateClipPath();\n \n redoStack.push(action);\n return;\n }\n \n if (action.type === 'frameAttachment') {\n // Handle frame attachment/detachment undo WITHOUT calling the methods that track undo\n if (action.action === 'attach') {\n // Undo attach: manually remove shape from frame\n const frameIndex = action.frame.containedShapes.indexOf(action.shape);\n if (frameIndex > -1) {\n action.frame.containedShapes.splice(frameIndex, 1);\n action.shape.parentFrame = null;\n \n // Move shape back to main SVG\n if (action.shape.group && action.shape.group.parentNode === action.frame.clipGroup) {\n action.frame.clipGroup.removeChild(action.shape.group);\n svg.appendChild(action.shape.group);\n }\n }\n \n // If shape was moved from another frame, restore it there\n if (action.oldFrame) {\n action.oldFrame.containedShapes.push(action.shape);\n action.shape.parentFrame = action.oldFrame;\n \n // Move to old frame's clipped group\n if (action.shape.group && action.shape.group.parentNode === svg) {\n svg.removeChild(action.shape.group);\n action.oldFrame.clipGroup.appendChild(action.shape.group);\n }\n }\n } else if (action.action === 'detach') {\n // Undo detach: manually add shape back to frame\n if (!action.frame.containedShapes.includes(action.shape)) {\n action.frame.containedShapes.push(action.shape);\n action.shape.parentFrame = action.frame;\n \n // Move to frame's clipped group\n if (action.shape.group && action.shape.group.parentNode === svg) {\n svg.removeChild(action.shape.group);\n action.frame.clipGroup.appendChild(action.shape.group);\n }\n }\n }\n \n // Restore shape state\n action.shape.x = action.shapeState.x;\n action.shape.y = action.shapeState.y;\n action.shape.width = action.shapeState.width;\n action.shape.height = action.shapeState.height;\n action.shape.rotation = action.shapeState.rotation;\n \n if (typeof action.shape.draw === 'function') {\n action.shape.draw();\n }\n \n redoStack.push(action);\n return;\n }\n\n // Handle mode conversion undo (code \u2194 text)\n if (action.type === 'create' && action.shape.type === 'modeConvert') {\n // Undo: remove the new shape, restore the old shape\n const newShape = action.shape.newShape;\n const newElement = action.shape.newElement;\n const oldShape = action.shape.oldShape;\n const oldElement = action.shape.oldElement;\n\n // Remove new shape from DOM and shapes array\n if (newElement && newElement.parentNode) {\n newElement.parentNode.removeChild(newElement);\n }\n const newIdx = shapes.indexOf(newShape);\n if (newIdx !== -1) shapes.splice(newIdx, 1);\n\n // Restore old shape to DOM and shapes array\n if (svg && oldElement) {\n svg.appendChild(oldElement);\n }\n if (oldShape) {\n shapes.push(oldShape);\n }\n\n redoStack.push(action);\n return;\n }\n\n if (action.type === 'create') {\n if (action.frameCreation && action.shape.shapeName === 'frame') {\n // Treat a manually-created frame and its initial membership as one\n // atomic action. Children remain on the canvas when the frame is\n // undone and are clipped back into it on redo.\n for (const child of action.containedShapes || []) {\n if (child?.parentFrame === action.shape) action.shape.removeShapeFromFrame(child);\n }\n if (currentShape === action.shape) {\n action.shape.removeSelection?.();\n currentShape = null;\n }\n const idx = shapes.indexOf(action.shape);\n if (idx !== -1) shapes.splice(idx, 1);\n action.shape.group?.remove();\n action.shape.clipGroup?.remove();\n action.shape.clipPath?.remove();\n } else\n if (action.shape.type === 'text') {\n // Handle text creation undo\n if (action.shape.element && action.shape.element.parentNode) {\n action.shape.element.parentNode.removeChild(action.shape.element);\n } else if (action.shape.parentNode) {\n action.shape.parentNode.removeChild(action.shape);\n }\n\n // Remove from shapes array\n const idx = shapes.indexOf(action.shape.element || action.shape);\n if (idx !== -1) shapes.splice(idx, 1);\n\n // Clean up any arrow attachments to this text\n if (typeof cleanupAttachments === 'function') {\n cleanupAttachments(action.shape.element || action.shape);\n }\n } else if (action.shape.type === 'image') {\n // Handle image creation undo\n action.shape.remove();\n } else if (action.shape.type === 'icon') {\n // Handle icon creation undo - call the remove method\n action.shape.remove();\n } else {\n // Handle other shape creation undo\n const idx = shapes.indexOf(action.shape);\n if (idx !== -1) shapes.splice(idx, 1);\n if (action.shape.group && action.shape.group.parentNode) {\n action.shape.group.parentNode.removeChild(action.shape.group);\n }\n \n // Handle frame cleanup\n if (action.shape.shapeName === 'frame') {\n action.shape.destroy();\n }\n }\n redoStack.push(action);\n return;\n}\n \n if (action.type === 'delete') {\n if (action.shape.type === 'text') {\n // Handle text deletion undo\n if (svg) {\n svg.appendChild(action.shape.element || action.shape);\n // Add back to shapes array\n shapes.push(action.shape.element || action.shape);\n }\n \n // Restore arrow attachments if any existed\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore the old attachment state\n arrow.restoreAttachmentState(arrowData.oldAttachments);\n });\n }\n } else if (action.shape.type === 'image') {\n // Handle image deletion undo\n action.shape.restore();\n } else {\n // Handle other shape deletion undo\n shapes.push(action.shape);\n if (svg) {\n svg.appendChild(action.shape.group);\n }\n\n // Issue #24 bug #7: rehydrate frame state. The delete path\n // orphaned the frame (removed <g>, clipGroup, clipPath from\n // DOM) but kept the JS object intact. Re-attach clipGroup +\n // clipPath, then re-parent every child from the snapshot via\n // addShapeToFrame. Skip children that were subsequently\n // deleted (they'll get re-added when their own delete action\n // is undone in turn).\n if (action.shape.shapeName === 'frame' && svg) {\n if (action.shape.clipGroup && !action.shape.clipGroup.parentNode) {\n svg.appendChild(action.shape.clipGroup);\n }\n if (action.shape.clipPath && !action.shape.clipPath.parentNode) {\n const defs = svg.querySelector('defs');\n if (defs) defs.appendChild(action.shape.clipPath);\n else svg.insertBefore(action.shape.clipPath, svg.firstChild);\n }\n if (action.childSnapshot && Array.isArray(action.childSnapshot)) {\n for (const child of action.childSnapshot) {\n if (!child) continue;\n if (shapes.indexOf(child) === -1) continue;\n if (typeof action.shape.addShapeToFrame === 'function') {\n action.shape.addShapeToFrame(child);\n }\n }\n }\n }\n }\n redoStack.push(action);\n return;\n }\n \n if (action.type === 'transform') {\n // Handle frame attachment changes first\n if (action.frameAttachment) {\n // Use manual frame operations to avoid undo recursion\n if (action.frameAttachment.newFrame) {\n const frameIndex = action.frameAttachment.newFrame.containedShapes.indexOf(action.shape);\n if (frameIndex > -1) {\n action.frameAttachment.newFrame.containedShapes.splice(frameIndex, 1);\n if (action.shape.group && action.shape.group.parentNode === action.frameAttachment.newFrame.clipGroup) {\n action.frameAttachment.newFrame.clipGroup.removeChild(action.shape.group);\n svg.appendChild(action.shape.group);\n }\n }\n }\n if (action.frameAttachment.oldFrame) {\n if (!action.frameAttachment.oldFrame.containedShapes.includes(action.shape)) {\n action.frameAttachment.oldFrame.containedShapes.push(action.shape);\n action.shape.parentFrame = action.frameAttachment.oldFrame;\n if (action.shape.group && action.shape.group.parentNode === svg) {\n svg.removeChild(action.shape.group);\n action.frameAttachment.oldFrame.clipGroup.appendChild(action.shape.group);\n }\n }\n } else {\n action.shape.parentFrame = null;\n }\n }\n \n if (action.shape.type === 'text') {\n // Enhanced text transform undo\n const textElement = (action.shape.element || action.shape).querySelector('text');\n if (textElement && action.oldPos.fontSize !== undefined) {\n textElement.setAttribute('font-size', action.oldPos.fontSize + 'px');\n }\n \n // Restore position and rotation\n const centerX = textElement ? textElement.getBBox().x + textElement.getBBox().width / 2 : 0;\n const centerY = textElement ? textElement.getBBox().y + textElement.getBBox().height / 2 : 0;\n \n (action.shape.element || action.shape).setAttribute('transform', \n `translate(${action.oldPos.x}, ${action.oldPos.y}) rotate(${action.oldPos.rotation}, ${centerX}, ${centerY})`\n );\n \n (action.shape.element || action.shape).setAttribute('data-x', action.oldPos.x);\n (action.shape.element || action.shape).setAttribute('data-y', action.oldPos.y);\n \n // Update attached arrows after text undo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore arrow attachments to old state\n arrow.restoreAttachmentState(arrowData.oldAttachments);\n \n // Store current state for redo\n arrowData.newPoints = {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n };\n arrowData.newAttachments = arrow.getAttachmentState();\n });\n }\n \n // Update feedback if selected\n if (selectedElement === (action.shape.element || action.shape) && updateSelectionFeedback) {\n setTimeout(updateSelectionFeedback, 0);\n }\n } else if (action.shape.type === 'image') {\n // Enhanced image transform undo\n action.shape.restore(action.oldPos);\n \n // Update attached arrows after image undo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore arrow attachments to old state\n arrow.restoreAttachmentState(arrowData.oldAttachments);\n \n // Store current state for redo\n arrowData.newPoints = {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n };\n arrowData.newAttachments = arrow.getAttachmentState();\n });\n }\n } else if (action.shape.shapeName === 'circle') {\n // Enhanced circle transform undo\n action.shape.x = action.oldPos.x;\n action.shape.y = action.oldPos.y;\n action.shape.rx = action.oldPos.rx;\n action.shape.ry = action.oldPos.ry;\n action.shape.rotation = action.oldPos.rotation;\n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n\n // Update attached arrows after circle undo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore arrow attachments to old state\n arrow.restoreAttachmentState(arrowData.oldAttachments);\n \n // Store current state for redo\n arrowData.newPoints = {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n };\n arrowData.newAttachments = arrow.getAttachmentState();\n });\n }\n } else if (action.shape.shapeName === 'line') {\n // Enhanced line transform undo with curve support\n action.shape.startPoint = { x: action.oldPos.startPoint.x, y: action.oldPos.startPoint.y };\n action.shape.endPoint = { x: action.oldPos.endPoint.x, y: action.oldPos.endPoint.y };\n \n // Restore curve state\n action.shape.isCurved = action.oldPos.isCurved || false;\n if (action.oldPos.controlPoint) {\n action.shape.controlPoint = { x: action.oldPos.controlPoint.x, y: action.oldPos.controlPoint.y };\n } else {\n action.shape.controlPoint = null;\n }\n \n // Handle frame attachment changes\n if (action.frameAttachment) {\n // Remove from new frame if it exists\n if (action.frameAttachment.newFrame) {\n const frameIndex = action.frameAttachment.newFrame.containedShapes.indexOf(action.shape);\n if (frameIndex > -1) {\n action.frameAttachment.newFrame.containedShapes.splice(frameIndex, 1);\n if (action.shape.group && action.shape.group.parentNode === action.frameAttachment.newFrame.clipGroup) {\n action.frameAttachment.newFrame.clipGroup.removeChild(action.shape.group);\n svg.appendChild(action.shape.group);\n }\n }\n }\n \n // Add back to old frame if it exists\n if (action.frameAttachment.oldFrame) {\n if (!action.frameAttachment.oldFrame.containedShapes.includes(action.shape)) {\n action.frameAttachment.oldFrame.containedShapes.push(action.shape);\n action.shape.parentFrame = action.frameAttachment.oldFrame;\n if (action.shape.group && action.shape.group.parentNode === svg) {\n svg.removeChild(action.shape.group);\n action.frameAttachment.oldFrame.clipGroup.appendChild(action.shape.group);\n }\n }\n } else {\n action.shape.parentFrame = null;\n }\n }\n \n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n }\n else if (action.shape.shapeName === 'arrow') {\n // Enhanced arrow transform undo with attachment restoration\n action.shape.startPoint = { x: action.oldPos.startPoint.x, y: action.oldPos.startPoint.y };\n action.shape.endPoint = { x: action.oldPos.endPoint.x, y: action.oldPos.endPoint.y };\n action.shape.controlPoint1 = action.oldPos.controlPoint1 ? \n { x: action.oldPos.controlPoint1.x, y: action.oldPos.controlPoint1.y } : null;\n action.shape.controlPoint2 = action.oldPos.controlPoint2 ? \n { x: action.oldPos.controlPoint2.x, y: action.oldPos.controlPoint2.y } : null;\n \n // Restore attachment state\n if (action.oldPos.attachments) {\n action.shape.restoreAttachmentState(action.oldPos.attachments);\n } else {\n // Clear attachments if none existed before\n action.shape.attachedToStart = null;\n action.shape.attachedToEnd = null;\n }\n \n action.shape.isSelected = false;\n action.shape.draw();\n \n\n \n } \n else if (action.shape.type === 'icon') {\n \n action.shape.restore(action.oldPos);\n \n // Update attached arrows after icon undo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore arrow attachments to old state\n arrow.restoreAttachmentState(arrowData.oldAttachments);\n \n // Store current state for redo\n arrowData.newPoints = {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n };\n arrowData.newAttachments = arrow.getAttachmentState();\n });\n }\n }\n else if (action.shape.shapeName === 'freehandStroke') {\n // Handle freehand stroke transform undo\n action.shape.points = JSON.parse(JSON.stringify(action.oldPos.points));\n action.shape.rotation = action.oldPos.rotation;\n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n } else if (action.shape.shapeName === \"rectangle\") {\n action.shape.x = action.oldPos.x;\n action.shape.y = action.oldPos.y;\n action.shape.height = action.oldPos.height;\n action.shape.width = action.oldPos.width;\n action.shape.rotation = action.oldPos.rotation;\n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n\n // Update attached arrows after rectangle undo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n arrow.restoreAttachmentState(arrowData.oldAttachments);\n arrowData.newPoints = {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n };\n arrowData.newAttachments = arrow.getAttachmentState();\n });\n }\n }\n redoStack.push(action);\n return;\n }\n \n if (action.type === 'optionsChange') {\n if (action.shape.type === 'text') {\n // Handle text options change undo\n const textElement = (action.shape.element || action.shape).querySelector('text');\n if (textElement) {\n if (action.oldOptions.color) textElement.setAttribute('fill', action.oldOptions.color);\n if (action.oldOptions.font) textElement.setAttribute('font-family', action.oldOptions.font);\n if (action.oldOptions.size) textElement.setAttribute('font-size', action.oldOptions.size);\n if (action.oldOptions.align) textElement.setAttribute('text-anchor', action.oldOptions.align);\n \n // Update feedback if selected\n if (selectedElement === (action.shape.element || action.shape) && updateSelectionFeedback) {\n setTimeout(updateSelectionFeedback, 0);\n }\n }\n } else if (action.shape.shapeName === 'arrow') {\n // Handle arrow options change undo\n action.shape.options = { ...action.oldOptions };\n action.shape.arrowOutlineStyle = action.oldOptions.arrowOutlineStyle;\n action.shape.arrowHeadStyle = action.oldOptions.arrowHeadStyle;\n action.shape.arrowCurved = action.oldOptions.arrowCurved;\n action.shape.arrowCurveAmount = action.oldOptions.arrowCurveAmount;\n action.shape.draw();\n } else {\n // Handle other shape options change undo\n action.shape.options = action.oldOptions;\n action.shape.draw();\n }\n redoStack.push(action);\n return;\n }\n } finally {\n refreshSelectionAfterAction();\n notifyCollaboration();\n }\n}\n\nexport function redo() {\n if (redoStack.length === 0) return;\n const action = redoStack.pop();\n try {\n if (action.type === 'frameTransform') {\n // Handle frame transformation redo\n action.shape.x = action.newPos.x;\n action.shape.y = action.newPos.y;\n action.shape.width = action.newPos.width;\n action.shape.height = action.newPos.height;\n action.shape.rotation = action.newPos.rotation;\n action.shape.frameName = action.newPos.frameName;\n \n // Restore contained shapes to their new positions\n action.containedShapes.forEach(shapeData => {\n const shape = shapeData.shape;\n shape.x = shapeData.newState.x;\n shape.y = shapeData.newState.y;\n shape.width = shapeData.newState.width;\n shape.height = shapeData.newState.height;\n shape.rotation = shapeData.newState.rotation;\n \n if (typeof shape.draw === 'function') {\n shape.draw();\n }\n });\n \n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n action.shape.updateClipPath();\n \n undoStack.push(action);\n return;\n }\n\n \n if (action.type === 'frameAttachment') {\n // Handle frame attachment/detachment redo WITHOUT calling the methods that track undo\n if (action.action === 'attach') {\n // Redo attach: manually add shape to frame\n if (action.oldFrame) {\n // Remove from old frame\n const oldFrameIndex = action.oldFrame.containedShapes.indexOf(action.shape);\n if (oldFrameIndex > -1) {\n action.oldFrame.containedShapes.splice(oldFrameIndex, 1);\n if (action.shape.group && action.shape.group.parentNode === action.oldFrame.clipGroup) {\n action.oldFrame.clipGroup.removeChild(action.shape.group);\n svg.appendChild(action.shape.group);\n }\n }\n }\n \n // Add to new frame\n if (!action.frame.containedShapes.includes(action.shape)) {\n action.frame.containedShapes.push(action.shape);\n action.shape.parentFrame = action.frame;\n \n if (action.shape.group && action.shape.group.parentNode === svg) {\n svg.removeChild(action.shape.group);\n action.frame.clipGroup.appendChild(action.shape.group);\n }\n }\n } else if (action.action === 'detach') {\n // Redo detach: manually remove shape from frame\n const frameIndex = action.frame.containedShapes.indexOf(action.shape);\n if (frameIndex > -1) {\n action.frame.containedShapes.splice(frameIndex, 1);\n action.shape.parentFrame = null;\n \n if (action.shape.group && action.shape.group.parentNode === action.frame.clipGroup) {\n action.frame.clipGroup.removeChild(action.shape.group);\n svg.appendChild(action.shape.group);\n }\n }\n }\n \n if (typeof action.shape.draw === 'function') {\n action.shape.draw();\n }\n \n undoStack.push(action);\n return;\n }\n\n // Handle mode conversion redo (code \u2194 text)\n if (action.type === 'create' && action.shape.type === 'modeConvert') {\n // Redo: remove the old shape, restore the new shape\n const newShape = action.shape.newShape;\n const newElement = action.shape.newElement;\n const oldShape = action.shape.oldShape;\n const oldElement = action.shape.oldElement;\n\n // Remove old shape from DOM and shapes array\n if (oldElement && oldElement.parentNode) {\n oldElement.parentNode.removeChild(oldElement);\n }\n const oldIdx = shapes.indexOf(oldShape);\n if (oldIdx !== -1) shapes.splice(oldIdx, 1);\n\n // Restore new shape to DOM and shapes array\n if (svg && newElement) {\n svg.appendChild(newElement);\n }\n if (newShape) {\n shapes.push(newShape);\n }\n\n undoStack.push(action);\n return;\n }\n\n if (action.type === 'create') {\n if (action.frameCreation && action.shape.shapeName === 'frame') {\n const frame = action.shape;\n let defs = svg?.querySelector('defs');\n if (!defs && svg) {\n defs = document.createElementNS('http://www.w3.org/2000/svg', 'defs');\n svg.appendChild(defs);\n }\n if (defs && frame.clipPath && !frame.clipPath.parentNode) defs.appendChild(frame.clipPath);\n if (svg && frame.group && !frame.group.parentNode) svg.appendChild(frame.group);\n if (svg && frame.clipGroup && !frame.clipGroup.parentNode) svg.appendChild(frame.clipGroup);\n if (shapes.indexOf(frame) === -1) {\n const index = action.shapeIndex >= 0 ? Math.min(action.shapeIndex, shapes.length) : shapes.length;\n shapes.splice(index, 0, frame);\n }\n frame.containedShapes = [];\n frame.draw();\n frame.updateClipPath();\n for (const child of action.containedShapes || []) {\n if (child && shapes.includes(child)) frame.addShapeToFrame(child);\n }\n } else\n if (action.shape.type === 'text') {\n // Handle text creation redo\n if (svg) {\n svg.appendChild(action.shape.element || action.shape);\n // Add back to shapes array\n shapes.push(action.shape.element || action.shape);\n }\n }\n else if (action.shape.type === 'image') {\n // Handle image creation redo\n action.shape.restore();\n } else if (action.shape.type === 'icon') {\n // Handle icon creation redo - append the group, not the shape object\n if (svg && action.shape.group) {\n svg.appendChild(action.shape.group);\n }\n // Add back to shapes array\n if (shapes.indexOf(action.shape) === -1) {\n shapes.push(action.shape);\n }\n } else {\n // Handle other shape creation redo\n shapes.push(action.shape);\n if (svg) {\n svg.appendChild(action.shape.group);\n }\n }\n undoStack.push(action);\n return;\n}\n \n if (action.type === 'delete') {\n if (action.shape.type === 'text') {\n // Handle text deletion redo\n if ((action.shape.element || action.shape).parentNode) {\n (action.shape.element || action.shape).parentNode.removeChild(action.shape.element || action.shape);\n }\n // Remove from shapes array\n const idx = shapes.indexOf(action.shape.element || action.shape);\n if (idx !== -1) shapes.splice(idx, 1);\n \n // Clean up arrow attachments again\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Detach from the deleted text\n if (arrow.attachedToStart && arrow.attachedToStart.shape === (action.shape.element || action.shape)) {\n arrow.detachFromShape(true);\n }\n if (arrow.attachedToEnd && arrow.attachedToEnd.shape === (action.shape.element || action.shape)) {\n arrow.detachFromShape(false);\n }\n arrow.draw();\n });\n }\n }\n else if (action.shape.type === 'image') {\n // Handle image deletion redo\n action.shape.remove();\n } else {\n // Handle other shape deletion redo\n const idx = shapes.indexOf(action.shape);\n if (idx !== -1) shapes.splice(idx, 1);\n\n // Issue #24 bug #7: for a regular frame, re-orphan instead of\n // destroy() \u2014 releases children visually, detaches the frame's\n // own DOM bits, but keeps the JS object and child references\n // intact so a subsequent undo can rehydrate again.\n if (action.shape.shapeName === 'frame' && !action.shape._diagramType && action.childSnapshot) {\n for (const child of action.childSnapshot) {\n if (!child) continue;\n const el = child.group || child.element;\n if (el && svg) {\n if (action.shape.clipGroup && el.parentNode === action.shape.clipGroup) {\n action.shape.clipGroup.removeChild(el);\n }\n if (el.parentNode !== svg) svg.appendChild(el);\n }\n child.parentFrame = null;\n delete child.isBeingMovedByFrame;\n }\n action.shape.containedShapes = [];\n if (action.shape.group && action.shape.group.parentNode) action.shape.group.parentNode.removeChild(action.shape.group);\n if (action.shape.clipGroup && action.shape.clipGroup.parentNode) action.shape.clipGroup.parentNode.removeChild(action.shape.clipGroup);\n if (action.shape.clipPath && action.shape.clipPath.parentNode) action.shape.clipPath.parentNode.removeChild(action.shape.clipPath);\n } else {\n if (action.shape.group && action.shape.group.parentNode) {\n action.shape.group.parentNode.removeChild(action.shape.group);\n }\n // Diagram frame OR no snapshot \u2192 fall back to destroy().\n if (action.shape.shapeName === 'frame' && typeof action.shape.destroy === 'function') {\n action.shape.destroy();\n }\n }\n }\n undoStack.push(action);\n return;\n }\n \n if (action.type === 'transform') {\n // Handle frame attachment changes first\n if (action.frameAttachment) {\n // Use manual frame operations to avoid undo recursion\n if (action.frameAttachment.oldFrame) {\n const oldFrameIndex = action.frameAttachment.oldFrame.containedShapes.indexOf(action.shape);\n if (oldFrameIndex > -1) {\n action.frameAttachment.oldFrame.containedShapes.splice(oldFrameIndex, 1);\n if (action.shape.group && action.shape.group.parentNode === action.frameAttachment.oldFrame.clipGroup) {\n action.frameAttachment.oldFrame.clipGroup.removeChild(action.shape.group);\n svg.appendChild(action.shape.group);\n }\n }\n }\n if (action.frameAttachment.newFrame) {\n if (!action.frameAttachment.newFrame.containedShapes.includes(action.shape)) {\n action.frameAttachment.newFrame.containedShapes.push(action.shape);\n action.shape.parentFrame = action.frameAttachment.newFrame;\n if (action.shape.group && action.shape.group.parentNode === svg) {\n svg.removeChild(action.shape.group);\n action.frameAttachment.newFrame.clipGroup.appendChild(action.shape.group);\n }\n }\n } else {\n action.shape.parentFrame = null;\n }\n }\n \n if (action.shape.type === 'text') {\n // Enhanced text transform redo\n const textElement = (action.shape.element || action.shape).querySelector('text');\n if (textElement && action.newPos.fontSize !== undefined) {\n textElement.setAttribute('font-size', action.newPos.fontSize + 'px');\n }\n \n // Restore position and rotation\n const centerX = textElement ? textElement.getBBox().x + textElement.getBBox().width / 2 : 0;\n const centerY = textElement ? textElement.getBBox().y + textElement.getBBox().height / 2 : 0;\n \n (action.shape.element || action.shape).setAttribute('transform', \n `translate(${action.newPos.x}, ${action.newPos.y}) rotate(${action.newPos.rotation}, ${centerX}, ${centerY})`\n );\n \n (action.shape.element || action.shape).setAttribute('data-x', action.newPos.x);\n (action.shape.element || action.shape).setAttribute('data-y', action.newPos.y);\n \n // Update attached arrows after text redo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore arrow attachments to new state\n if (arrowData.newAttachments) {\n arrow.restoreAttachmentState(arrowData.newAttachments);\n } else {\n // If no new attachments stored, recalculate based on current text position\n arrow.updateAttachments();\n }\n });\n }\n \n // Update feedback if selected\n if (selectedElement === (action.shape.element || action.shape) && updateSelectionFeedback) {\n setTimeout(updateSelectionFeedback, 0);\n }\n } else if (action.shape.type === 'image') {\n // Enhanced image transform redo\n action.shape.restore(action.newPos);\n \n // Update attached arrows after image redo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore arrow attachments to new state\n if (arrowData.newAttachments) {\n arrow.restoreAttachmentState(arrowData.newAttachments);\n } else {\n // If no new attachments stored, recalculate based on current image position\n arrow.updateAttachments();\n }\n });\n }\n } else if (action.shape.shapeName === 'circle') {\n // Enhanced circle transform redo\n action.shape.x = action.newPos.x;\n action.shape.y = action.newPos.y;\n action.shape.rx = action.newPos.rx;\n action.shape.ry = action.newPos.ry;\n action.shape.rotation = action.newPos.rotation;\n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n\n // Update attached arrows after circle redo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore arrow attachments to new state\n if (arrowData.newAttachments) {\n arrow.restoreAttachmentState(arrowData.newAttachments);\n } else {\n // If no new attachments stored, recalculate based on current circle position\n arrow.updateAttachments();\n }\n });\n }\n } else if (action.shape.shapeName === 'line') {\n // Enhanced line transform redo with curve support\n action.shape.startPoint = { x: action.newPos.startPoint.x, y: action.newPos.startPoint.y };\n action.shape.endPoint = { x: action.newPos.endPoint.x, y: action.newPos.endPoint.y };\n \n // Restore curve state\n action.shape.isCurved = action.newPos.isCurved || false;\n if (action.newPos.controlPoint) {\n action.shape.controlPoint = { x: action.newPos.controlPoint.x, y: action.newPos.controlPoint.y };\n } else {\n action.shape.controlPoint = null;\n }\n \n // Handle frame attachment changes\n if (action.frameAttachment) {\n // Remove from old frame if it exists\n if (action.frameAttachment.oldFrame) {\n const oldFrameIndex = action.frameAttachment.oldFrame.containedShapes.indexOf(action.shape);\n if (oldFrameIndex > -1) {\n action.frameAttachment.oldFrame.containedShapes.splice(oldFrameIndex, 1);\n if (action.shape.group && action.shape.group.parentNode === action.frameAttachment.oldFrame.clipGroup) {\n action.frameAttachment.oldFrame.clipGroup.removeChild(action.shape.group);\n svg.appendChild(action.shape.group);\n }\n }\n }\n \n // Add to new frame if it exists\n if (action.frameAttachment.newFrame) {\n if (!action.frameAttachment.newFrame.containedShapes.includes(action.shape)) {\n action.frameAttachment.newFrame.containedShapes.push(action.shape);\n action.shape.parentFrame = action.frameAttachment.newFrame;\n if (action.shape.group && action.shape.group.parentNode === svg) {\n svg.removeChild(action.shape.group);\n action.frameAttachment.newFrame.clipGroup.appendChild(action.shape.group);\n }\n }\n } else {\n action.shape.parentFrame = null;\n }\n }\n \n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n }\n else if (action.shape.shapeName === 'arrow') {\n // Enhanced arrow transform redo with attachment restoration\n action.shape.startPoint = { x: action.newPos.startPoint.x, y: action.newPos.startPoint.y };\n action.shape.endPoint = { x: action.newPos.endPoint.x, y: action.newPos.endPoint.y };\n action.shape.controlPoint1 = action.newPos.controlPoint1 ? \n { x: action.newPos.controlPoint1.x, y: action.newPos.controlPoint1.y } : null;\n action.shape.controlPoint2 = action.newPos.controlPoint2 ? \n { x: action.newPos.controlPoint2.x, y: action.newPos.controlPoint2.y } : null;\n \n // Restore attachment state\n if (action.newPos.attachments) {\n action.shape.restoreAttachmentState(action.newPos.attachments);\n } else {\n // Clear attachments if none should exist\n action.shape.attachedToStart = null;\n action.shape.attachedToEnd = null;\n }\n \n action.shape.isSelected = false;\n action.shape.draw();\n \n } \n else if (action.shape.type === 'icon') {\n action.shape.restore(action.newPos);\n \n // Update attached arrows after icon redo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore arrow attachments to new state\n if (arrowData.newAttachments) {\n arrow.restoreAttachmentState(arrowData.newAttachments);\n } else {\n // If no new attachments stored, recalculate based on current icon position\n arrow.updateAttachments();\n }\n });\n }\n }\n else if (action.shape.shapeName === 'freehandStroke') {\n // Handle freehand stroke transform redo\n action.shape.points = JSON.parse(JSON.stringify(action.newPos.points));\n action.shape.rotation = action.newPos.rotation;\n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n } else if (action.shape.shapeName === \"rectangle\") {\n // Enhanced rectangle transform redo\n action.shape.x = action.newPos.x;\n action.shape.y = action.newPos.y;\n action.shape.height = action.newPos.height;\n action.shape.width = action.newPos.width;\n action.shape.rotation = action.newPos.rotation;\n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n\n // Update attached arrows after rectangle redo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore arrow attachments to new state\n if (arrowData.newAttachments) {\n arrow.restoreAttachmentState(arrowData.newAttachments);\n } else {\n // If no new attachments stored, recalculate based on current rectangle position\n arrow.updateAttachments();\n }\n });\n }\n }\n undoStack.push(action);\n return;\n }\n \n if (action.type === 'optionsChange') {\n if (action.shape.type === 'text') {\n // Handle text options change redo\n const textElement = (action.shape.element || action.shape).querySelector('text');\n if (textElement) {\n if (action.newOptions.color) textElement.setAttribute('fill', action.newOptions.color);\n if (action.newOptions.font) textElement.setAttribute('font-family', action.newOptions.font);\n if (action.newOptions.size) textElement.setAttribute('font-size', action.newOptions.size);\n if (action.newOptions.align) textElement.setAttribute('text-anchor', action.newOptions.align);\n \n // Update feedback if selected\n if (selectedElement === (action.shape.element || action.shape) && updateSelectionFeedback) {\n setTimeout(updateSelectionFeedback, 0);\n }\n }\n } else if (action.shape.shapeName === 'arrow') {\n // Handle arrow options change redo - we need to get current options as newOptions\n const currentOptions = {\n ...action.shape.options,\n arrowOutlineStyle: action.shape.arrowOutlineStyle,\n arrowHeadStyle: action.shape.arrowHeadStyle,\n arrowCurved: action.shape.arrowCurved,\n arrowCurveAmount: action.shape.arrowCurveAmount\n };\n \n // Store current state for potential future undo\n action.newOptions = currentOptions;\n \n action.shape.draw();\n } else {\n // Handle other shape options change redo - we need to get current options as newOptions\n action.newOptions = action.shape.options;\n action.shape.draw();\n }\n undoStack.push(action);\n return;\n }\n } finally {\n refreshSelectionAfterAction();\n notifyCollaboration();\n }\n}\n\n// Optional: Keyboard shortcuts\ndocument.addEventListener('keydown', (e) => {\n if ((e.ctrlKey || e.metaKey) && e.key === 'z') {\n e.preventDefault();\n undo();\n }\n if ((e.ctrlKey || e.metaKey) && (e.key === 'y' || (e.shiftKey && e.key === 'z'))) {\n e.preventDefault();\n redo();\n }\n});\n\n// Attach to buttons\ndocument.getElementById('undo')?.addEventListener('click', undo);\ndocument.getElementById('redo')?.addEventListener('click', redo);\n\n// Expose globally for plain scripts\nwindow.pushCreateAction = pushCreateAction;\nwindow.pushDeleteAction = pushDeleteAction;\nwindow.pushDeleteActionWithAttachments = pushDeleteActionWithAttachments;\nwindow.pushTransformAction = pushTransformAction;\nwindow.pushOptionsChangeAction = pushOptionsChangeAction;\nwindow.pushCreateActionWithAttachments = pushCreateActionWithAttachments;\nwindow.undo = undo;\nwindow.redo = redo;\n"],
|
|
5
|
+
"mappings": ";;;AAIA,IAAM,YAAY,CAAC;AACnB,IAAM,YAAY,CAAC;AAGnB,IAAI,kBAAkB;AACtB,IAAI,0BAA0B;AAC9B,IAAI,MAAM;AAEV,SAAS,sBAAsB;AAC3B,MAAI,OAAO,WAAW,eAAe,OAAO,OAAO,yBAAyB,YAAY;AACpF,WAAO,qBAAqB;AAAA,EAChC;AACJ;AAGO,SAAS,kBAAkB,SAAS,UAAU,YAAY;AAC7D,oBAAkB;AAClB,4BAA0B;AAC1B,QAAM;AACV;AAGO,SAAS,4BAA4B;AACxC,SAAO;AACX;AAGO,SAAS,sBAAsB,SAAS;AAC3C,oBAAkB;AACtB;AAGO,SAAS,iBAAiB,OAAO,OAAO,MAAM;AACjD,QAAM,SAAS;AAAA,IACX,MAAM;AAAA,IACN;AAAA,EACJ;AACA,MAAI,MAAM,iBAAiB,OAAO,cAAc,SAAS;AACrD,WAAO,gBAAgB;AACvB,WAAO,kBAAkB,CAAC,GAAI,KAAK,mBAAmB,MAAM,mBAAmB,CAAC,CAAE;AAClF,WAAO,aAAa,MAAM,QAAQ,MAAM,IAAI,OAAO,QAAQ,KAAK,IAAI;AAAA,EACxE;AACA,YAAU,KAAK,MAAM;AAGrB,YAAU,SAAS;AACnB,sBAAoB;AACxB;AAEO,SAAS,iBAAiB,OAAO,OAAO,MAAM;A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Aa,OAAO,MAAM;AACjC,eAAO,MAAM,KAAK;AAAA,MACtB;AACA,gBAAU,KAAK,MAAM;AACrB;AAAA,IACJ;AAAA,EACA,UAAE;AACE,gCAA4B;AAC5B,wBAAoB;AAAA,EACxB;AACJ;AAGA,SAAS,iBAAiB,WAAW,CAAC,MAAM;AACxC,OAAK,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,KAAK;AAC3C,MAAE,eAAe;AACjB,SAAK;AAAA,EACT;AACA,OAAK,EAAE,WAAW,EAAE,aAAa,EAAE,QAAQ,OAAQ,EAAE,YAAY,EAAE,QAAQ,MAAO;AAC9E,MAAE,eAAe;AACjB,SAAK;AAAA,EACT;AACJ,CAAC;AAGD,SAAS,eAAe,MAAM,GAAG,iBAAiB,SAAS,IAAI;AAC/D,SAAS,eAAe,MAAM,GAAG,iBAAiB,SAAS,IAAI;AAG/D,OAAO,mBAAmB;AAC1B,OAAO,mBAAmB;AAC1B,OAAO,kCAAkC;AACzC,OAAO,sBAAsB;AAC7B,OAAO,0BAA0B;AACjC,OAAO,kCAAkC;AACzC,OAAO,OAAO;AACd,OAAO,OAAO;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
updateAttachedArrows
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-YF3TK7SC.js";
|
|
5
5
|
|
|
6
6
|
// src/shapes/Line.js
|
|
7
7
|
var rc = rough.svg(svg);
|
|
@@ -625,4 +625,4 @@ var Line = class {
|
|
|
625
625
|
export {
|
|
626
626
|
Line
|
|
627
627
|
};
|
|
628
|
-
//# sourceMappingURL=chunk-
|
|
628
|
+
//# sourceMappingURL=chunk-V2QTYSBK.js.map
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import {
|
|
3
|
+
registerRotationAnchor
|
|
4
|
+
} from "./chunk-PAKA6HUX.js";
|
|
2
5
|
import {
|
|
3
6
|
cleanupAttachments,
|
|
4
7
|
updateAttachedArrows
|
|
5
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-YF3TK7SC.js";
|
|
6
9
|
import {
|
|
7
10
|
pushCreateAction,
|
|
8
11
|
pushDeleteAction,
|
|
9
12
|
pushFrameAttachmentAction,
|
|
10
13
|
pushTransformAction
|
|
11
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-U3TB4KRS.js";
|
|
12
15
|
|
|
13
16
|
// src/tools/iconTool.js
|
|
14
17
|
var isDraggingIcon = false;
|
|
@@ -213,6 +216,16 @@ var handleMouseDownIcon = async (e) => {
|
|
|
213
216
|
}
|
|
214
217
|
return;
|
|
215
218
|
}
|
|
219
|
+
function getInheritedAttr2(element, attrName) {
|
|
220
|
+
let curr = element;
|
|
221
|
+
while (curr && curr.nodeType === 1) {
|
|
222
|
+
if (curr.getAttribute(attrName)) {
|
|
223
|
+
return curr.getAttribute(attrName);
|
|
224
|
+
}
|
|
225
|
+
curr = curr.parentElement;
|
|
226
|
+
}
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
216
229
|
if (!isDraggingIcon || !iconToPlace || !isIconToolActive) {
|
|
217
230
|
return;
|
|
218
231
|
}
|
|
@@ -265,25 +278,40 @@ var handleMouseDownIcon = async (e) => {
|
|
|
265
278
|
backgroundRect.setAttribute("stroke", "none");
|
|
266
279
|
backgroundRect.setAttribute("style", "pointer-events: all; cursor: pointer;");
|
|
267
280
|
finalIconGroup.appendChild(backgroundRect);
|
|
281
|
+
const isDark = document.body && document.body.classList.contains("theme-dark");
|
|
282
|
+
const targetDarkColor = "#1a1a2e";
|
|
283
|
+
const bgDarkColor = "#15111f";
|
|
284
|
+
const applyThemeStyle = (element) => {
|
|
285
|
+
if (element.nodeType === 1) {
|
|
286
|
+
const fill = getInheritedAttr2(element, "fill");
|
|
287
|
+
const stroke = getInheritedAttr2(element, "stroke");
|
|
288
|
+
const normFill = fill ? fill.toLowerCase().trim() : null;
|
|
289
|
+
const normStroke = stroke ? stroke.toLowerCase().trim() : null;
|
|
290
|
+
if (normFill === "none" || normFill === "transparent") {
|
|
291
|
+
element.setAttribute("fill", "none");
|
|
292
|
+
} else if (!normFill || ["#000", "#000000", "black", "currentcolor", "#1a1a2e"].includes(normFill)) {
|
|
293
|
+
element.setAttribute("fill", isDark ? "#ffffff" : targetDarkColor);
|
|
294
|
+
} else if (["#fff", "#ffffff", "white", "#15111f"].includes(normFill)) {
|
|
295
|
+
element.setAttribute("fill", isDark ? bgDarkColor : "#ffffff");
|
|
296
|
+
}
|
|
297
|
+
if (normStroke === "none" || normStroke === "transparent") {
|
|
298
|
+
element.setAttribute("stroke", "none");
|
|
299
|
+
} else if (normStroke && ["#000", "#000000", "black", "currentcolor", "#1a1a2e"].includes(normStroke)) {
|
|
300
|
+
element.setAttribute("stroke", isDark ? "#ffffff" : targetDarkColor);
|
|
301
|
+
} else if (normStroke && ["#fff", "#ffffff", "white", "#15111f"].includes(normStroke)) {
|
|
302
|
+
element.setAttribute("stroke", isDark ? bgDarkColor : "#ffffff");
|
|
303
|
+
}
|
|
304
|
+
for (let j = 0; j < element.children.length; j++) {
|
|
305
|
+
applyThemeStyle(element.children[j]);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
for (let i = 0; i < originalSvgElement.children.length; i++) {
|
|
310
|
+
applyThemeStyle(originalSvgElement.children[i]);
|
|
311
|
+
}
|
|
268
312
|
const allChildren = originalSvgElement.children;
|
|
269
313
|
for (let i = 0; i < allChildren.length; i++) {
|
|
270
314
|
const clonedChild = allChildren[i].cloneNode(true);
|
|
271
|
-
const applyWhiteStyle = (element) => {
|
|
272
|
-
if (element.nodeType === 1) {
|
|
273
|
-
const fill = element.getAttribute("fill");
|
|
274
|
-
const stroke = element.getAttribute("stroke");
|
|
275
|
-
if (!fill || fill === "#000" || fill === "#000000" || fill === "black" || fill === "currentColor") {
|
|
276
|
-
element.setAttribute("fill", "#ffffff");
|
|
277
|
-
}
|
|
278
|
-
if (stroke === "#000" || stroke === "#000000" || stroke === "black" || stroke === "currentColor") {
|
|
279
|
-
element.setAttribute("stroke", "#ffffff");
|
|
280
|
-
}
|
|
281
|
-
for (let j = 0; j < element.children.length; j++) {
|
|
282
|
-
applyWhiteStyle(element.children[j]);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
applyWhiteStyle(clonedChild);
|
|
287
315
|
finalIconGroup.appendChild(clonedChild);
|
|
288
316
|
}
|
|
289
317
|
finalIconGroup.setAttribute("x", finalX);
|
|
@@ -515,6 +543,7 @@ function addRotationAnchor(x, y, width, height, centerX, centerY, iconWidth, rot
|
|
|
515
543
|
rotationAnchor.setAttribute("style", "pointer-events: all; cursor: grab;");
|
|
516
544
|
rotationAnchor.setAttribute("transform", `rotate(${rotation}, ${centerX}, ${centerY})`);
|
|
517
545
|
svg.appendChild(rotationAnchor);
|
|
546
|
+
registerRotationAnchor(rotationAnchor, { radius: 5, edgeY: y });
|
|
518
547
|
rotationAnchor.addEventListener("pointerdown", startRotation);
|
|
519
548
|
rotationAnchor.addEventListener("pointerup", stopRotation);
|
|
520
549
|
rotationAnchor.addEventListener("mouseover", function() {
|
|
@@ -932,4 +961,4 @@ export {
|
|
|
932
961
|
startDrag,
|
|
933
962
|
stopDrag
|
|
934
963
|
};
|
|
935
|
-
//# sourceMappingURL=chunk-
|
|
964
|
+
//# sourceMappingURL=chunk-XFQECTTF.js.map
|