@elixpo/lixsketch 5.5.16 → 5.5.18

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.
Files changed (37) hide show
  1. package/dist/react/Circle-QQMKCKFR.js +8 -0
  2. package/dist/react/{CopyPaste-AAHQTNVL.js → CopyPaste-C2SHB7QD.js} +3 -3
  3. package/dist/react/{EventDispatcher-K4CNNBAU.js → EventDispatcher-ZCKWAHIX.js} +3 -3
  4. package/dist/react/Rectangle-MZ6ZB6KM.js +8 -0
  5. package/dist/react/{SceneSerializer-YK44QZ6B.js → SceneSerializer-IQGUAK45.js} +3 -3
  6. package/dist/react/{SketchEngine-B7XCB3BS.js → SketchEngine-RFEF27MN.js} +8 -8
  7. package/dist/react/{chunk-URB6MY46.js → chunk-7DC26DDU.js} +10 -6
  8. package/dist/react/chunk-7DC26DDU.js.map +7 -0
  9. package/dist/react/{chunk-GZ6NPDAB.js → chunk-N7NZLF6P.js} +4 -3
  10. package/dist/react/chunk-N7NZLF6P.js.map +7 -0
  11. package/dist/react/{chunk-VN62KLOC.js → chunk-X6AHYG5J.js} +11 -7
  12. package/dist/react/chunk-X6AHYG5J.js.map +7 -0
  13. package/dist/react/{chunk-24TW3M7X.js → chunk-XCJOF6BM.js} +4 -3
  14. package/dist/react/{chunk-24TW3M7X.js.map → chunk-XCJOF6BM.js.map} +2 -2
  15. package/dist/react/{iconTool-GPZ7O7NH.js → iconTool-YD4GRXAP.js} +2 -2
  16. package/dist/react/{imageTool-D5R4XGEU.js → imageTool-WJVV4WI3.js} +2 -2
  17. package/dist/react/index.js +3 -3
  18. package/dist/react/index.js.map +2 -2
  19. package/package.json +1 -1
  20. package/src/react/components/modals/LixScriptModal.jsx +1 -1
  21. package/src/shapes/Circle.js +3 -2
  22. package/src/shapes/Rectangle.js +3 -2
  23. package/src/tools/iconTool.js +10 -6
  24. package/src/tools/imageTool.js +9 -5
  25. package/dist/react/Circle-ZH76FPOR.js +0 -8
  26. package/dist/react/Rectangle-2LNCIQDZ.js +0 -8
  27. package/dist/react/chunk-GZ6NPDAB.js.map +0 -7
  28. package/dist/react/chunk-URB6MY46.js.map +0 -7
  29. package/dist/react/chunk-VN62KLOC.js.map +0 -7
  30. /package/dist/react/{Circle-ZH76FPOR.js.map → Circle-QQMKCKFR.js.map} +0 -0
  31. /package/dist/react/{CopyPaste-AAHQTNVL.js.map → CopyPaste-C2SHB7QD.js.map} +0 -0
  32. /package/dist/react/{EventDispatcher-K4CNNBAU.js.map → EventDispatcher-ZCKWAHIX.js.map} +0 -0
  33. /package/dist/react/{Rectangle-2LNCIQDZ.js.map → Rectangle-MZ6ZB6KM.js.map} +0 -0
  34. /package/dist/react/{SceneSerializer-YK44QZ6B.js.map → SceneSerializer-IQGUAK45.js.map} +0 -0
  35. /package/dist/react/{SketchEngine-B7XCB3BS.js.map → SketchEngine-RFEF27MN.js.map} +0 -0
  36. /package/dist/react/{iconTool-GPZ7O7NH.js.map → iconTool-YD4GRXAP.js.map} +0 -0
  37. /package/dist/react/{imageTool-D5R4XGEU.js.map → imageTool-WJVV4WI3.js.map} +0 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/tools/iconTool.js"],
4
+ "sourcesContent": ["/* eslint-disable */\n// Icon tool event handlers - extracted from icons.js\nimport { pushCreateAction, pushDeleteAction, pushTransformAction, pushFrameAttachmentAction } from '../core/UndoRedo.js';\nimport { updateAttachedArrows as updateArrowsForShape, cleanupAttachments } from './arrowTool.js';\n\n\nlet isDraggingIcon = false;\nlet iconToPlace = null;\nlet iconX = 0;\nlet iconY = 0;\nlet scaleFactor = 0.2;\nlet currentIconElement = null;\n\nlet selectedIcon = null;\nlet originalX, originalY, originalWidth, originalHeight;\nlet currentAnchor = null;\nlet isDragging = false;\nlet isRotatingIcon = false;\nlet dragOffsetX, dragOffsetY;\nlet startRotationMouseAngle = null;\nlet startIconRotation = null;\nlet iconRotation = 0;\nlet aspect_ratio_lock = true;\nconst minIconSize = 25;\nconst miniatureSize = 40;\nconst placedIconSize = 40;\nlet draggedShapeInitialFrameIcon = null;\nlet hoveredFrameIcon = null;\nlet _pendingDragChecker = null; // module-level ref so cancelDragPrep can remove it\n\nconst iconSearchInput = document.getElementById('iconSearchInput') || document.createElement('input');\nlet searchTimeout = null;\n\n\nfunction getSVGElement() {\n return document.getElementById('freehand-canvas');\n}\n\n\nfunction removeSelection() {\n const svg = getSVGElement();\n if (!svg) return;\n\n // Remove ALL selection outlines (prevents orphaned ghost elements)\n svg.querySelectorAll(\".selection-outline\").forEach(el => el.remove());\n\n removeResizeAnchors();\n removeRotationAnchor();\n\n if (selectedIcon) {\n selectedIcon.removeEventListener('pointerdown', startDrag);\n selectedIcon.removeEventListener('pointerup', stopDrag);\n selectedIcon.removeEventListener('pointerleave', stopDrag);\n }\n}\n\nfunction wrapIconElement(element) {\n const iconShape = new IconShape(element);\n return iconShape;\n}\n\ndocument.getElementById(\"importIcon\")?.addEventListener('click', () => {\n \n\n const iconContainer = document.getElementById('iconsToolBar');\n if (iconContainer) {\n if(iconContainer.classList.contains('hidden')) {\n iconContainer.classList.remove('hidden');\n iconSearchInput.focus();\n }\n else \n {\n iconContainer.classList.add('hidden');\n }\n \n }\n});\n\nfunction getSVGCoordsFromMouse(e) {\n const svg = getSVGElement();\n const viewBox = svg.viewBox.baseVal;\n const rect = svg.getBoundingClientRect();\n const mouseX = e.clientX - rect.left;\n const mouseY = e.clientY - rect.top;\n const svgX = viewBox.x + (mouseX / rect.width) * viewBox.width;\n const svgY = viewBox.y + (mouseY / rect.height) * viewBox.height;\n return { x: svgX, y: svgY };\n}\n\nconst handleMouseMoveIcon = (e) => {\n if (!isDraggingIcon || !iconToPlace || !isIconToolActive) return;\n\n const { x, y } = getSVGCoordsFromMouse(e);\n iconX = x;\n iconY = y;\n\n drawMiniatureIcon();\n\n if (typeof shapes !== 'undefined' && Array.isArray(shapes)) {\n shapes.forEach(frame => {\n if (frame.shapeName === 'frame') {\n const tempIconBounds = {\n x: iconX - 50,\n y: iconY - 50,\n width: 100,\n height: 100\n };\n\n if (frame.isShapeInFrame(tempIconBounds)) {\n frame.highlightFrame();\n hoveredFrameIcon = frame;\n if (window.__iconShapeState) window.__iconShapeState.hoveredFrameIcon = frame;\n } else if (hoveredFrameIcon === frame) {\n frame.removeHighlight();\n hoveredFrameIcon = null;\n if (window.__iconShapeState) window.__iconShapeState.hoveredFrameIcon = null;\n }\n }\n });\n }\n};\n\nconst drawMiniatureIcon = () => {\n if (!isDraggingIcon || !iconToPlace || !isIconToolActive) return;\n\n const svg = getSVGElement();\n if (!svg) {\n console.error('SVG element not found for miniature icon');\n return;\n }\n\n if (currentIconElement) {\n svg.removeChild(currentIconElement);\n currentIconElement = null;\n }\n\n const tempDiv = document.createElement('div');\n tempDiv.innerHTML = iconToPlace;\n const svgElement = tempDiv.querySelector('svg');\n\n if (svgElement) {\n const iconGroup = document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\n\n const viewBox = svgElement.getAttribute('viewBox');\n let vbWidth = 24, vbHeight = 24;\n\n if (viewBox) {\n const [, , widthStr, heightStr] = viewBox.split(/\\s+/);\n vbWidth = parseFloat(widthStr) || 24;\n vbHeight = parseFloat(heightStr) || 24;\n } else {\n const width = svgElement.getAttribute('width');\n const height = svgElement.getAttribute('height');\n if (width && height) {\n vbWidth = parseFloat(width) || 24;\n vbHeight = parseFloat(height) || 24;\n }\n }\n\n const scale = miniatureSize / Math.max(vbWidth, vbHeight);\n iconGroup.setAttribute(\"transform\", `translate(${iconX - miniatureSize / 2}, ${iconY - miniatureSize / 2}) scale(${scale})`);\n\n const allChildren = svgElement.children;\n for (let i = 0; i < allChildren.length; i++) {\n const clonedChild = allChildren[i].cloneNode(true);\n \n const applyGrayStyle = (element) => {\n if (element.nodeType === 1) {\n element.setAttribute('fill', '#666');\n element.setAttribute('stroke', '#666');\n \n for (let j = 0; j < element.children.length; j++) {\n applyGrayStyle(element.children[j]);\n }\n }\n };\n \n applyGrayStyle(clonedChild);\n iconGroup.appendChild(clonedChild);\n }\n\n iconGroup.setAttribute(\"style\", \"pointer-events: none; opacity: 0.7;\");\n iconGroup.setAttribute(\"class\", \"miniature-icon\");\n\n currentIconElement = iconGroup;\n svg.appendChild(currentIconElement);\n }\n};\n\nconst handleMouseDownIcon = async (e) => {\n if (!e.target) return;\n if (isSelectionToolActive) {\n const clickedIcon = e.target.closest('[type=\"icon\"]');\n if (clickedIcon) {\n e.preventDefault();\n e.stopPropagation();\n\n if (selectedIcon === clickedIcon) {\n originalX = parseFloat(selectedIcon.getAttribute('x')) || 0;\n originalY = parseFloat(selectedIcon.getAttribute('y')) || 0;\n originalWidth = parseFloat(selectedIcon.getAttribute('width')) || placedIconSize;\n originalHeight = parseFloat(selectedIcon.getAttribute('height')) || placedIconSize;\n\n const { x, y } = getSVGCoordsFromMouse(e);\n dragOffsetX = x - originalX;\n dragOffsetY = y - originalY;\n\n const initialMouseX = x;\n const initialMouseY = y;\n\n // Threshold in screen pixels converted to SVG units, so zoom doesn't affect sensitivity\n const svgEl = getSVGElement();\n const svgRect2 = svgEl ? svgEl.getBoundingClientRect() : { width: 1536 };\n const svgViewW = svgEl ? svgEl.viewBox.baseVal.width : 1536;\n const dragThreshold = 12 * (svgViewW / svgRect2.width); // ~12 screen pixels\n\n function checkDragStartWithThreshold(moveEvent) {\n const { x: currentX, y: currentY } = getSVGCoordsFromMouse(moveEvent);\n const deltaX = Math.abs(currentX - initialMouseX);\n const deltaY = Math.abs(currentY - initialMouseY);\n\n if (deltaX > dragThreshold || deltaY > dragThreshold) {\n document.removeEventListener('pointermove', checkDragStartWithThreshold);\n document.removeEventListener('pointerup', cancelDragPrep);\n window.removeEventListener('pointerup', cancelDragPrep);\n\n const svg = getSVGElement();\n if (svg) svg.removeEventListener('pointerup', cancelDragPrep);\n\n startDrag(moveEvent);\n }\n }\n\n _pendingDragChecker = checkDragStartWithThreshold;\n document.addEventListener('pointermove', checkDragStartWithThreshold);\n document.addEventListener('pointerup', cancelDragPrep);\n window.addEventListener('pointerup', cancelDragPrep);\n\n const svg = getSVGElement();\n if (svg) svg.addEventListener('pointerup', cancelDragPrep);\n\n return;\n } else {\n selectIcon(e);\n return;\n }\n }\n\n // Clicked on empty canvas while an icon is selected \u2014 deselect it\n if (selectedIcon) {\n removeSelection();\n selectedIcon = null;\n if (currentShape && currentShape.shapeName === 'icon') {\n currentShape = null;\n }\n }\n return;\n }\n\n if (!isDraggingIcon || !iconToPlace || !isIconToolActive) {\n return;\n }\n\n let placedIconShape = null;\n\n try {\n const svg = getSVGElement();\n if (!svg) {\n throw new Error('SVG element not found');\n }\n\n if (currentIconElement) {\n svg.removeChild(currentIconElement);\n currentIconElement = null;\n }\n\n const { x: placedX, y: placedY } = getSVGCoordsFromMouse(e);\n\n const tempDiv = document.createElement('div');\n tempDiv.innerHTML = iconToPlace;\n const originalSvgElement = tempDiv.querySelector('svg');\n\n if (!originalSvgElement) {\n throw new Error('Invalid SVG content');\n }\n\n const finalIconGroup = document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\n const finalX = placedX - placedIconSize / 2;\n const finalY = placedY - placedIconSize / 2;\n\n const viewBox = originalSvgElement.getAttribute('viewBox');\n let vbWidth = 24, vbHeight = 24;\n\n if (viewBox) {\n const [, , widthStr, heightStr] = viewBox.split(/\\s+/);\n vbWidth = parseFloat(widthStr) || 24;\n vbHeight = parseFloat(heightStr) || 24;\n } else {\n const width = originalSvgElement.getAttribute('width');\n const height = originalSvgElement.getAttribute('height');\n if (width && height) {\n vbWidth = parseFloat(width) || 24;\n vbHeight = parseFloat(height) || 24;\n }\n }\n\n const scale = placedIconSize / Math.max(vbWidth, vbHeight);\n const localCenterX = placedIconSize / 2 / scale;\n const localCenterY = placedIconSize / 2 / scale;\n finalIconGroup.setAttribute('transform', `translate(${finalX}, ${finalY}) scale(${scale}) rotate(0, ${localCenterX}, ${localCenterY})`);\n finalIconGroup.setAttribute('data-viewbox-width', vbWidth);\n finalIconGroup.setAttribute('data-viewbox-height', vbHeight);\n\n const backgroundRect = document.createElementNS(\"http://www.w3.org/2000/svg\", \"rect\");\n backgroundRect.setAttribute('x', 0);\n backgroundRect.setAttribute('y', 0);\n backgroundRect.setAttribute('width', vbWidth);\n backgroundRect.setAttribute('height', vbHeight);\n backgroundRect.setAttribute('fill', 'transparent');\n backgroundRect.setAttribute('stroke', 'none');\n backgroundRect.setAttribute('style', 'pointer-events: all; cursor: pointer;');\n finalIconGroup.appendChild(backgroundRect);\n\n const allChildren = originalSvgElement.children;\n for (let i = 0; i < allChildren.length; i++) {\n const clonedChild = allChildren[i].cloneNode(true);\n\n // Apply white fill/stroke so icons are visible on dark canvas\n const applyWhiteStyle = (element) => {\n if (element.nodeType === 1) {\n const fill = element.getAttribute('fill');\n const stroke = element.getAttribute('stroke');\n // Replace black/dark fills with white; leave 'none'/'transparent' alone\n if (!fill || fill === '#000' || fill === '#000000' || fill === 'black' || fill === 'currentColor') {\n element.setAttribute('fill', '#ffffff');\n }\n if (stroke === '#000' || stroke === '#000000' || stroke === 'black' || stroke === 'currentColor') {\n element.setAttribute('stroke', '#ffffff');\n }\n for (let j = 0; j < element.children.length; j++) {\n applyWhiteStyle(element.children[j]);\n }\n }\n };\n applyWhiteStyle(clonedChild);\n\n finalIconGroup.appendChild(clonedChild);\n }\n\n finalIconGroup.setAttribute('x', finalX);\n finalIconGroup.setAttribute('y', finalY);\n finalIconGroup.setAttribute('width', placedIconSize);\n finalIconGroup.setAttribute('height', placedIconSize);\n finalIconGroup.setAttribute('type', 'icon');\n finalIconGroup.setAttribute('data-shape-x', finalX);\n finalIconGroup.setAttribute('data-shape-y', finalY);\n finalIconGroup.setAttribute('data-shape-width', placedIconSize);\n finalIconGroup.setAttribute('data-shape-height', placedIconSize);\n finalIconGroup.setAttribute('data-shape-rotation', 0);\n finalIconGroup.shapeID = `icon-${String(Date.now()).slice(0, 8)}-${Math.floor(Math.random() * 10000)}`;\n finalIconGroup.setAttribute('id', finalIconGroup.shapeID);\n finalIconGroup.setAttribute('style', 'cursor: pointer; pointer-events: all;');\n\n svg.appendChild(finalIconGroup);\n\n const iconShape = wrapIconElement(finalIconGroup);\n placedIconShape = iconShape;\n\n if (typeof shapes !== 'undefined' && Array.isArray(shapes)) {\n // Prevent duplicates \u2014 check if this element is already tracked\n const alreadyExists = shapes.some(s => s.shapeName === 'icon' && s.element === finalIconGroup);\n if (!alreadyExists) {\n shapes.push(iconShape);\n }\n }\n\n const finalFrame = hoveredFrameIcon;\n if (finalFrame) {\n finalFrame.addShapeToFrame(iconShape);\n pushFrameAttachmentAction(finalFrame, iconShape, 'attach', null);\n }\n\n pushCreateAction(iconShape);\n\n // mousedown handles selection; click listener removed to avoid double-selection conflicts\n\n if (hoveredFrameIcon) {\n hoveredFrameIcon.removeHighlight();\n hoveredFrameIcon = null;\n if (window.__iconShapeState) window.__iconShapeState.hoveredFrameIcon = null;\n }\n\n console.log('Icon placed successfully:', finalIconGroup);\n\n } catch (error) {\n console.error(\"Error placing icon:\", error);\n isDraggingIcon = false;\n iconToPlace = null;\n } finally {\n isDraggingIcon = false;\n iconToPlace = null;\n document.body.style.cursor = 'default';\n }\n\n // Select the placed icon but stay in icon tool so the sidebar remains open\n if (placedIconShape) {\n currentShape = placedIconShape;\n currentShape.isSelected = true;\n requestAnimationFrame(() => {\n placedIconShape.selectShape();\n });\n }\n};\n\nconst handleMouseUpIcon = (e) => {\n if (!e.target) return;\n // Deselection on empty-canvas click is handled by handleMouseDownIcon.\n // We intentionally do NOT deselect on mouseup \u2014 after a drag the cursor\n // often ends up on the background, and that shouldn't kill the selection.\n\n if (hoveredFrameIcon) {\n hoveredFrameIcon.removeHighlight();\n hoveredFrameIcon = null;\n }\n};\n\nfunction addSelectionOutline() {\n if (!selectedIcon) return;\n\n const svg = getSVGElement();\n if (!svg) return;\n\n // Use stored SVG-space data attributes \u2014 reliable even immediately after DOM insertion\n const x = parseFloat(selectedIcon.getAttribute('data-shape-x')) || 0;\n const y = parseFloat(selectedIcon.getAttribute('data-shape-y')) || 0;\n const width = parseFloat(selectedIcon.getAttribute('data-shape-width')) || 40;\n const height = parseFloat(selectedIcon.getAttribute('data-shape-height')) || 40;\n const rotation = parseFloat(selectedIcon.getAttribute('data-shape-rotation')) || 0;\n\n const centerX = x + width / 2;\n const centerY = y + height / 2;\n\n const zoom = window.currentZoom || 1;\n const selectionPadding = 8 / zoom;\n const expandedX = x - selectionPadding;\n const expandedY = y - selectionPadding;\n const expandedWidth = width + 2 * selectionPadding;\n const expandedHeight = height + 2 * selectionPadding;\n\n removeSelection();\n\n const outline = document.createElementNS(\"http://www.w3.org/2000/svg\", \"rect\");\n outline.setAttribute(\"x\", expandedX);\n outline.setAttribute(\"y\", expandedY);\n outline.setAttribute(\"width\", expandedWidth);\n outline.setAttribute(\"height\", expandedHeight);\n outline.setAttribute(\"fill\", \"none\");\n outline.setAttribute(\"stroke\", \"#5B57D1\");\n outline.setAttribute(\"stroke-width\", 1.5);\n outline.setAttribute(\"stroke-dasharray\", \"4 3\");\n outline.setAttribute(\"style\", \"pointer-events: none;\");\n outline.setAttribute(\"class\", \"selection-outline\");\n if (rotation !== 0) {\n outline.setAttribute(\"transform\", `rotate(${rotation}, ${centerX}, ${centerY})`);\n }\n\n svg.appendChild(outline);\n\n addResizeAnchors(expandedX, expandedY, expandedWidth, expandedHeight, centerX, centerY, width, rotation);\n addRotationAnchor(expandedX, expandedY, expandedWidth, expandedHeight, centerX, centerY, width, rotation);\n}\n\nfunction checkDragStart(event) {\n document.removeEventListener('pointermove', checkDragStart);\n document.removeEventListener('pointerup', cancelDragPrep);\n startDrag(event);\n}\nfunction cancelDragPrep(event) {\n if (_pendingDragChecker) {\n document.removeEventListener('pointermove', _pendingDragChecker);\n _pendingDragChecker = null;\n }\n document.removeEventListener('pointerup', cancelDragPrep);\n window.removeEventListener('pointerup', cancelDragPrep);\n\n const svg = getSVGElement();\n if (svg) {\n svg.removeEventListener('pointerup', cancelDragPrep);\n }\n}\n\nfunction startDrag(event) {\n console.log(\"start dragging icon\");\n if (!isSelectionToolActive || !selectedIcon) return;\n \n isDragging = true;\n if (window.__iconShapeState) window.__iconShapeState.isDragging = true;\n\n let iconShape = null;\n if (typeof shapes !== 'undefined' && Array.isArray(shapes)) {\n iconShape = shapes.find(shape => shape.shapeName === 'icon' && shape.element === selectedIcon);\n }\n\n if (iconShape) {\n draggedShapeInitialFrameIcon = iconShape.parentFrame || null;\n\n if (iconShape.parentFrame) {\n iconShape.parentFrame.temporarilyRemoveFromFrame(iconShape);\n }\n }\n\n document.addEventListener('pointermove', dragIcon);\n document.addEventListener('pointerup', stopDrag);\n \n window.addEventListener('pointerup', stopDrag);\n \n const svg = getSVGElement();\n if (svg) {\n svg.addEventListener('pointerup', stopDrag);\n }\n \n document.addEventListener('dragstart', preventDefaultDrag);\n document.addEventListener('selectstart', preventDefaultDrag);\n}\n\nfunction preventDefaultDrag(e) {\n e.preventDefault();\n return false;\n}\n\nfunction selectIcon(event) {\n if (!isSelectionToolActive) return;\n\n event.stopPropagation();\n\n let targetIcon = event.target.closest ? event.target.closest('[type=\"icon\"]') : null;\n if (!targetIcon) {\n let current = event.target;\n while (current && current !== document) {\n if (current.getAttribute && current.getAttribute('type') === 'icon') {\n targetIcon = current;\n break;\n }\n current = current.parentElement;\n }\n }\n\n // Always clean up previous selection before applying new one\n if (selectedIcon) {\n removeSelection();\n }\n\n selectedIcon = targetIcon;\n\n if (!selectedIcon) {\n console.warn('Could not find icon to select');\n return;\n }\n\n const transform = selectedIcon.getAttribute('transform');\n if (transform) {\n const rotateMatch = transform.match(/rotate\\(([^,\\s]+)/);\n if (rotateMatch) {\n iconRotation = parseFloat(rotateMatch[1]);\n }\n } else {\n iconRotation = 0;\n }\n\n addSelectionOutline();\n\n originalX = parseFloat(selectedIcon.getAttribute('x')) || 0;\n originalY = parseFloat(selectedIcon.getAttribute('y')) || 0;\n originalWidth = parseFloat(selectedIcon.getAttribute('width')) || placedIconSize;\n originalHeight = parseFloat(selectedIcon.getAttribute('height')) || placedIconSize;\n\n // Set currentShape so EventDispatcher routes subsequent events to icon handler\n const iconShape = (typeof shapes !== 'undefined' && Array.isArray(shapes))\n ? shapes.find(s => s.shapeName === 'icon' && s.element === selectedIcon)\n : null;\n if (iconShape) {\n currentShape = iconShape;\n currentShape.isSelected = true;\n if (window.__showSidebarForShape) window.__showSidebarForShape('icon');\n }\n}\n\nfunction addResizeAnchors(x, y, width, height, centerX, centerY, iconWidth, rotation) {\n const svg = getSVGElement();\n if (!svg) return;\n\n const zoom = window.currentZoom || 1;\n const anchorSize = 10 / zoom;\n const anchorStrokeWidth = 2 / zoom;\n\n const positions = [\n { x: x, y: y, cursor: \"nw-resize\" },\n { x: x + width, y: y, cursor: \"ne-resize\" },\n { x: x, y: y + height, cursor: \"sw-resize\" },\n { x: x + width, y: y + height, cursor: \"se-resize\" }\n ];\n\n positions.forEach((pos) => {\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(\"fill\", \"#121212\");\n anchor.setAttribute(\"stroke\", \"#5B57D1\");\n anchor.setAttribute(\"stroke-width\", anchorStrokeWidth);\n anchor.setAttribute(\"vector-effect\", \"non-scaling-stroke\");\n anchor.setAttribute(\"class\", \"resize-anchor\");\n anchor.setAttribute(\"transform\", `rotate(${rotation}, ${centerX}, ${centerY})`);\n anchor.style.cursor = pos.cursor;\n\n svg.appendChild(anchor);\n\n anchor.addEventListener('pointerdown', startResize);\n anchor.addEventListener('pointerup', stopResize);\n });\n}\n\nfunction addRotationAnchor(x, y, width, height, centerX, centerY, iconWidth, rotation) {\n const svg = getSVGElement();\n if (!svg) return;\n\n const zoom = window.currentZoom || 1;\n const anchorRadius = 5 / zoom;\n const anchorStrokeWidth = 2 / zoom;\n const rotationDistance = 30 / zoom;\n\n const rotationAnchorX = x + width / 2;\n const rotationAnchorY = y - rotationDistance;\n\n const rotationAnchor = document.createElementNS('http://www.w3.org/2000/svg', 'circle');\n rotationAnchor.setAttribute('cx', rotationAnchorX);\n rotationAnchor.setAttribute('cy', rotationAnchorY);\n rotationAnchor.setAttribute('r', anchorRadius);\n rotationAnchor.setAttribute('class', 'rotation-anchor');\n rotationAnchor.setAttribute('fill', '#121212');\n rotationAnchor.setAttribute('stroke', '#5B57D1');\n rotationAnchor.setAttribute('stroke-width', anchorStrokeWidth);\n rotationAnchor.setAttribute('vector-effect', 'non-scaling-stroke');\n rotationAnchor.setAttribute('style', 'pointer-events: all; cursor: grab;');\n rotationAnchor.setAttribute('transform', `rotate(${rotation}, ${centerX}, ${centerY})`);\n\n svg.appendChild(rotationAnchor);\n\n rotationAnchor.addEventListener('pointerdown', startRotation);\n rotationAnchor.addEventListener('pointerup', stopRotation);\n\n rotationAnchor.addEventListener('mouseover', function() {\n if (!isRotatingIcon && !isDragging) {\n rotationAnchor.style.cursor = 'grab';\n }\n });\n\n rotationAnchor.addEventListener('mouseout', function() {\n if (!isRotatingIcon && !isDragging) {\n rotationAnchor.style.cursor = 'default';\n }\n });\n}\n\nfunction removeRotationAnchor() {\n const svg = getSVGElement();\n if (!svg) return;\n\n svg.querySelectorAll(\".rotation-anchor\").forEach(el => el.remove());\n}\n\nfunction removeResizeAnchors() {\n const svg = getSVGElement();\n if (!svg) return;\n\n const anchors = svg.querySelectorAll(\".resize-anchor\");\n anchors.forEach(anchor => svg.removeChild(anchor));\n}\n\nfunction startResize(event) {\n event.preventDefault();\n event.stopPropagation();\n\n currentAnchor = event.target;\n\n originalX = parseFloat(selectedIcon.getAttribute('x')) || 0;\n originalY = parseFloat(selectedIcon.getAttribute('y')) || 0;\n originalWidth = parseFloat(selectedIcon.getAttribute('width')) || 100;\n originalHeight = parseFloat(selectedIcon.getAttribute('height')) || 100;\n\n const { x: mouseX, y: mouseY } = getSVGCoordsFromMouse(event);\n currentAnchor.startMouseX = mouseX;\n currentAnchor.startMouseY = mouseY;\n\n currentAnchor.iconRotation = iconRotation;\n\n const svg = getSVGElement();\n if (svg) {\n svg.addEventListener('pointermove', resizeIcon);\n }\n document.addEventListener('pointerup', stopResize);\n}\n\nfunction stopResize(event) {\n stopInteracting();\n document.removeEventListener('pointerup', stopResize);\n}\n\nfunction resizeIcon(event) {\n if (!selectedIcon || !currentAnchor) return;\n\n const { x: currentMouseX, y: currentMouseY } = getSVGCoordsFromMouse(event);\n\n const rotation = currentAnchor.iconRotation || 0;\n const rotationRad = (rotation * Math.PI) / 180;\n\n const rawDeltaX = currentMouseX - currentAnchor.startMouseX;\n const rawDeltaY = currentMouseY - currentAnchor.startMouseY;\n\n // Rotate delta to local (unrotated) space\n const deltaX = rawDeltaX * Math.cos(-rotationRad) - rawDeltaY * Math.sin(-rotationRad);\n const deltaY = rawDeltaX * Math.sin(-rotationRad) + rawDeltaY * Math.cos(-rotationRad);\n\n let newWidth = originalWidth;\n let newHeight = originalHeight;\n let newX = originalX;\n let newY = originalY;\n\n // Track which corner is fixed (relative to original rect)\n let fixedRelX, fixedRelY;\n\n switch (currentAnchor.style.cursor) {\n case \"nw-resize\":\n newWidth = Math.max(minIconSize, originalWidth - deltaX);\n newHeight = Math.max(minIconSize, originalHeight - deltaY);\n if (aspect_ratio_lock) {\n const scale = Math.min(newWidth / originalWidth, newHeight / originalHeight);\n newWidth = originalWidth * scale;\n newHeight = originalHeight * scale;\n }\n newX = originalX + (originalWidth - newWidth);\n newY = originalY + (originalHeight - newHeight);\n fixedRelX = originalWidth; fixedRelY = originalHeight;\n break;\n case \"ne-resize\":\n newWidth = Math.max(minIconSize, originalWidth + deltaX);\n newHeight = Math.max(minIconSize, originalHeight - deltaY);\n if (aspect_ratio_lock) {\n const scale = Math.max(newWidth / originalWidth, newHeight / originalHeight);\n newWidth = originalWidth * scale;\n newHeight = originalHeight * scale;\n }\n newX = originalX;\n newY = originalY + (originalHeight - newHeight);\n fixedRelX = 0; fixedRelY = originalHeight;\n break;\n case \"sw-resize\":\n newWidth = Math.max(minIconSize, originalWidth - deltaX);\n newHeight = Math.max(minIconSize, originalHeight + deltaY);\n if (aspect_ratio_lock) {\n const scale = Math.max(newWidth / originalWidth, newHeight / originalHeight);\n newWidth = originalWidth * scale;\n newHeight = originalHeight * scale;\n }\n newX = originalX + (originalWidth - newWidth);\n newY = originalY;\n fixedRelX = originalWidth; fixedRelY = 0;\n break;\n case \"se-resize\":\n newWidth = Math.max(minIconSize, originalWidth + deltaX);\n newHeight = Math.max(minIconSize, originalHeight + deltaY);\n if (aspect_ratio_lock) {\n const scale = Math.max(newWidth / originalWidth, newHeight / originalHeight);\n newWidth = originalWidth * scale;\n newHeight = originalHeight * scale;\n }\n newX = originalX;\n newY = originalY;\n fixedRelX = 0; fixedRelY = 0;\n break;\n }\n\n // Compensate for rotation center shift when rotated\n if (rotation !== 0) {\n const cosR = Math.cos(rotationRad);\n const sinR = Math.sin(rotationRad);\n\n // Compute rotated world position of the fixed corner in the original rect\n const oldCX = originalX + originalWidth / 2;\n const oldCY = originalY + originalHeight / 2;\n const odx = (originalX + fixedRelX) - oldCX;\n const ody = (originalY + fixedRelY) - oldCY;\n const fixedWorldX = oldCX + odx * cosR - ody * sinR;\n const fixedWorldY = oldCY + odx * sinR + ody * cosR;\n\n // Determine where the fixed corner sits in the new rect\n const fixedNewRelX = fixedRelX === 0 ? 0 : newWidth;\n const fixedNewRelY = fixedRelY === 0 ? 0 : newHeight;\n\n // Solve for new origin so the fixed corner stays in place\n const ncx = newWidth / 2;\n const ncy = newHeight / 2;\n const ndx = fixedNewRelX - ncx;\n const ndy = fixedNewRelY - ncy;\n const rotX = ncx + ndx * cosR - ndy * sinR;\n const rotY = ncy + ndx * sinR + ndy * cosR;\n\n newX = fixedWorldX - rotX;\n newY = fixedWorldY - rotY;\n }\n\n selectedIcon.setAttribute('width', newWidth);\n selectedIcon.setAttribute('height', newHeight);\n selectedIcon.setAttribute('x', newX);\n selectedIcon.setAttribute('y', newY);\n\n selectedIcon.setAttribute('data-shape-x', newX);\n selectedIcon.setAttribute('data-shape-y', newY);\n selectedIcon.setAttribute('data-shape-width', newWidth);\n selectedIcon.setAttribute('data-shape-height', newHeight);\n\n const vbWidth = parseFloat(selectedIcon.getAttribute('data-viewbox-width')) || 24;\n const vbHeight = parseFloat(selectedIcon.getAttribute('data-viewbox-height')) || 24;\n const iconScale = newWidth / Math.max(vbWidth, vbHeight);\n const localCenterX = newWidth / 2 / iconScale;\n const localCenterY = newHeight / 2 / iconScale;\n selectedIcon.setAttribute('transform', `translate(${newX}, ${newY}) scale(${iconScale}) rotate(${iconRotation}, ${localCenterX}, ${localCenterY})`);\n\n updateArrowsForShape(selectedIcon);\n\n addSelectionOutline();\n}\n\nfunction dragIcon(event) {\n if (!isDragging || !selectedIcon) return;\n\n const { x, y } = getSVGCoordsFromMouse(event);\n let newX = x - dragOffsetX;\n let newY = y - dragOffsetY;\n\n selectedIcon.setAttribute('x', newX);\n selectedIcon.setAttribute('y', newY);\n\n selectedIcon.setAttribute('data-shape-x', newX);\n selectedIcon.setAttribute('data-shape-y', newY);\n\n const width = parseFloat(selectedIcon.getAttribute('width')) || 100;\n const height = parseFloat(selectedIcon.getAttribute('height')) || 100;\n const vbWidth = parseFloat(selectedIcon.getAttribute('data-viewbox-width')) || 24;\n const vbHeight = parseFloat(selectedIcon.getAttribute('data-viewbox-height')) || 24;\n const scale = width / Math.max(vbWidth, vbHeight);\n const localCenterX = width / 2 / scale;\n const localCenterY = height / 2 / scale;\n \n selectedIcon.setAttribute('transform', `translate(${newX}, ${newY}) scale(${scale}) rotate(${iconRotation}, ${localCenterX}, ${localCenterY})`);\n\n if (typeof shapes !== 'undefined' && Array.isArray(shapes)) {\n const iconShape = shapes.find(shape => shape.shapeName === 'icon' && shape.element === selectedIcon);\n if (iconShape) {\n iconShape.x = newX;\n iconShape.y = newY;\n iconShape.updateFrameContainment();\n }\n }\n\n updateArrowsForShape(selectedIcon);\n\n removeSelection();\n addSelectionOutline();\n}\n\nfunction stopDrag(event) {\n if (!isDragging) return;\n \n console.log(\"stop dragging icon\");\n isDragging = false;\n if (window.__iconShapeState) window.__iconShapeState.isDragging = false;\n\n document.removeEventListener('pointermove', dragIcon);\n document.removeEventListener('pointerup', stopDrag);\n window.removeEventListener('pointerup', stopDrag);\n \n const svg = getSVGElement();\n if (svg) {\n svg.removeEventListener('pointerup', stopDrag);\n }\n \n document.removeEventListener('dragstart', preventDefaultDrag);\n document.removeEventListener('selectstart', preventDefaultDrag);\n \n stopInteracting();\n}\n\nfunction startRotation(event) {\n event.preventDefault();\n event.stopPropagation();\n\n if (!selectedIcon) return;\n\n isRotatingIcon = true;\n console.log(selectedIcon)\n const iconX = parseFloat(selectedIcon.getAttribute('x'));\n const iconY = parseFloat(selectedIcon.getAttribute('y'));\n const iconWidth = parseFloat(selectedIcon.getAttribute('width'));\n const iconHeight = parseFloat(selectedIcon.getAttribute('height'));\n\n const centerX = iconX + iconWidth / 2;\n const centerY = iconY + iconHeight / 2;\n\n const { x: mouseX, y: mouseY } = getSVGCoordsFromMouse(event);\n\n startRotationMouseAngle = Math.atan2(mouseY - centerY, mouseX - centerX) * 180 / Math.PI;\n console.log('Start rotation mouse angle:', startRotationMouseAngle);\n startIconRotation = iconRotation;\n\n const svg = getSVGElement();\n if (svg) {\n svg.addEventListener('pointermove', rotateIcon);\n svg.style.cursor = 'grabbing';\n }\n document.addEventListener('pointerup', stopRotation);\n}\n\nfunction rotateIcon(event) {\n if (!isRotatingIcon || !selectedIcon) return;\n\n const iconX = parseFloat(selectedIcon.getAttribute('x')) || 0;\n const iconY = parseFloat(selectedIcon.getAttribute('y')) || 0;\n const iconWidth = parseFloat(selectedIcon.getAttribute('width')) || 100;\n const iconHeight = parseFloat(selectedIcon.getAttribute('height')) || 100;\n\n const centerX = iconX + iconWidth / 2;\n const centerY = iconY + iconHeight / 2;\n\n const { x: mouseX, y: mouseY } = getSVGCoordsFromMouse(event);\n\n const currentMouseAngle = Math.atan2(mouseY - centerY, mouseX - centerX) * 180 / Math.PI;\n const angleDiff = currentMouseAngle - startRotationMouseAngle;\n\n iconRotation = startIconRotation + angleDiff;\n iconRotation = iconRotation % 360;\n if (iconRotation < 0) iconRotation += 360;\n\n const vbWidth = parseFloat(selectedIcon.getAttribute('data-viewbox-width')) || 24;\n const vbHeight = parseFloat(selectedIcon.getAttribute('data-viewbox-height')) || 24;\n const scale = iconWidth / Math.max(vbWidth, vbHeight);\n const localCenterX = iconWidth / 2 / scale;\n const localCenterY = iconHeight / 2 / scale;\n\n selectedIcon.setAttribute('transform', `translate(${iconX}, ${iconY}) scale(${scale}) rotate(${iconRotation}, ${localCenterX}, ${localCenterY})`);\n\n selectedIcon.setAttribute('data-shape-rotation', iconRotation);\n\n updateArrowsForShape(selectedIcon);\n\n removeSelection();\n addSelectionOutline();\n}\n\nfunction stopRotation(event) {\n if (!isRotatingIcon) return;\n stopInteracting();\n isRotatingIcon = false;\n startRotationMouseAngle = null;\n startIconRotation = null;\n\n const svg = getSVGElement();\n if (svg) {\n svg.removeEventListener('pointermove', rotateIcon);\n svg.style.cursor = 'default';\n }\n document.removeEventListener('pointerup', stopRotation);\n}\n\nfunction stopInteracting() {\n if (selectedIcon && (isDragging || isRotatingIcon || currentAnchor)) {\n const newPos = {\n x: parseFloat(selectedIcon.getAttribute('x')) || 0,\n y: parseFloat(selectedIcon.getAttribute('y')) || 0,\n width: parseFloat(selectedIcon.getAttribute('width')) || 100,\n height: parseFloat(selectedIcon.getAttribute('height')) || 100,\n rotation: iconRotation\n };\n\n let originalRotation = iconRotation;\n if (isRotatingIcon && startIconRotation !== null) {\n originalRotation = startIconRotation;\n }\n\n const oldPos = {\n x: originalX,\n y: originalY,\n width: originalWidth,\n height: originalHeight,\n rotation: originalRotation\n };\n\n let iconShape = null;\n if (typeof shapes !== 'undefined' && Array.isArray(shapes)) {\n iconShape = shapes.find(shape => shape.shapeName === 'icon' && shape.element === selectedIcon);\n if (iconShape) {\n iconShape.x = newPos.x;\n iconShape.y = newPos.y;\n iconShape.width = newPos.width;\n iconShape.height = newPos.height;\n iconShape.rotation = newPos.rotation;\n }\n }\n\n const oldPosWithFrame = {\n ...oldPos,\n parentFrame: draggedShapeInitialFrameIcon\n };\n // Issue #34 bug #2: for drag, hoveredFrameIcon tracks the actual\n // destination \u2014 currentShape.parentFrame is still the OLD frame.\n // Resize / rotate don't track hover, so fall back to whatever the\n // shape itself reports (parent doesn't change for those gestures).\n const newPosWithFrame = {\n ...newPos,\n parentFrame: isDragging\n ? (hoveredFrameIcon || null)\n : (iconShape ? iconShape.parentFrame : null),\n };\n\n const stateChanged = newPos.x !== oldPos.x || newPos.y !== oldPos.y ||\n newPos.width !== oldPos.width || newPos.height !== oldPos.height ||\n newPos.rotation !== oldPos.rotation;\n const frameChanged = oldPosWithFrame.parentFrame !== newPosWithFrame.parentFrame;\n\n if ((stateChanged || frameChanged) && iconShape) {\n pushTransformAction(iconShape, oldPosWithFrame, newPosWithFrame);\n }\n\n if (isDragging && iconShape) {\n const finalFrame = hoveredFrameIcon;\n\n if (draggedShapeInitialFrameIcon !== finalFrame) {\n if (draggedShapeInitialFrameIcon) {\n draggedShapeInitialFrameIcon.removeShapeFromFrame(iconShape);\n }\n\n if (finalFrame) {\n finalFrame.addShapeToFrame(iconShape);\n }\n\n if (frameChanged) {\n pushFrameAttachmentAction(finalFrame || draggedShapeInitialFrameIcon, iconShape,\n finalFrame ? 'attach' : 'detach', draggedShapeInitialFrameIcon);\n }\n } else if (draggedShapeInitialFrameIcon) {\n draggedShapeInitialFrameIcon.restoreToFrame(iconShape);\n }\n }\n\n draggedShapeInitialFrameIcon = null;\n }\n\n if (hoveredFrameIcon) {\n hoveredFrameIcon.removeHighlight();\n hoveredFrameIcon = null;\n if (window.__iconShapeState) window.__iconShapeState.hoveredFrameIcon = null;\n }\n\n isDragging = false;\n if (window.__iconShapeState) window.__iconShapeState.isDragging = false;\n isRotatingIcon = false;\n\n const svg = getSVGElement();\n if (svg) {\n svg.removeEventListener('pointermove', dragIcon);\n svg.removeEventListener('pointermove', resizeIcon);\n svg.removeEventListener('pointermove', rotateIcon);\n }\n \n document.removeEventListener('pointermove', dragIcon);\n document.removeEventListener('pointermove', resizeIcon);\n document.removeEventListener('pointermove', rotateIcon);\n \n currentAnchor = null;\n startRotationMouseAngle = null;\n startIconRotation = null;\n\n if (selectedIcon) {\n originalX = parseFloat(selectedIcon.getAttribute('x')) || 0;\n originalY = parseFloat(selectedIcon.getAttribute('y')) || 0;\n originalWidth = parseFloat(selectedIcon.getAttribute('width')) || 100;\n originalHeight = parseFloat(selectedIcon.getAttribute('height')) || 100;\n\n selectedIcon.setAttribute('data-shape-x', originalX);\n selectedIcon.setAttribute('data-shape-y', originalY);\n selectedIcon.setAttribute('data-shape-width', originalWidth);\n selectedIcon.setAttribute('data-shape-height', originalHeight);\n selectedIcon.setAttribute('data-shape-rotation', iconRotation);\n\n updateArrowsForShape(selectedIcon);\n }\n}\n\nfunction deleteCurrentIcon() {\n if (selectedIcon) {\n let iconShape = null;\n if (typeof shapes !== 'undefined' && Array.isArray(shapes)) {\n iconShape = shapes.find(shape => shape.shapeName === 'icon' && shape.element === selectedIcon);\n if (iconShape) {\n const idx = shapes.indexOf(iconShape);\n if (idx !== -1) shapes.splice(idx, 1);\n\n if (iconShape.group && iconShape.group.parentNode) {\n iconShape.group.parentNode.removeChild(iconShape.group);\n }\n }\n }\n\n if (!iconShape && selectedIcon.parentNode) {\n selectedIcon.parentNode.removeChild(selectedIcon);\n }\n\n if (typeof cleanupAttachments === 'function') {\n cleanupAttachments(selectedIcon);\n }\n\n if (iconShape) {\n pushDeleteAction(iconShape);\n }\n\n removeSelection();\n selectedIcon = null;\n }\n}\n\ndocument.addEventListener('keydown', (e) => {\n if (e.key === 'Delete' && selectedIcon) {\n deleteCurrentIcon();\n }\n});\n\nasync function fetchIconsFromServer() {\n try {\n const apiUrl = \"/api/icons/feed?offset=0&limit=20\";\n \n const response = await fetch(apiUrl);\n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`);\n }\n const data = await response.json();\n return data.results;\n } catch (error) {\n console.error('Failed to fetch icons from server:', error);\n return null;\n }\n}\n\nasync function renderIconsFromServer() {\n const icons = await fetchIconsFromServer();\n if (icons) {\n document.getElementById(\"iconsContainer\").innerHTML = '';\n\n for (const icon of icons) {\n try {\n const response = await fetch(`/api/icons/serve?name=${encodeURIComponent(icon.filename)}`);\n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`);\n }\n const svgContent = await response.text();\n\n const normalizedSVG = normalizeSVGSize(svgContent);\n\n // Use normalizedSVG for display, not original svgContent\n let svgIcon = `<div class=\"icons\" data-url=\"${icon.filename}\" data-svg=\"${encodeURIComponent(normalizedSVG)}\">\n ${normalizedSVG}\n </div>`;\n document.getElementById(\"iconsContainer\").innerHTML += svgIcon;\n } catch (error) {\n console.error('Failed to render icon:', icon.filename, error);\n }\n }\n\n addIconClickListeners();\n }\n}\n\nasync function searchAndRenderIcons(query) {\n try {\n const apiUrl = `/api/icons/search?q=${encodeURIComponent(query)}`;\n \n const response = await fetch(apiUrl);\n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`);\n }\n const searchResults = await response.json();\n\n document.getElementById(\"iconsContainer\").innerHTML = '';\n\n for (const icon of searchResults) {\n try {\n const svgResponse = await fetch(`/api/icons/serve?name=${encodeURIComponent(icon.filename)}`);\n if (!svgResponse.ok) {\n throw new Error(`HTTP error! status: ${svgResponse.status}`);\n }\n const svgContent = await svgResponse.text();\n\n const normalizedSVG = normalizeSVGSize(svgContent);\n\n // Use normalizedSVG for display, not original svgContent\n let svgIcon = `<div class=\"icons\" data-url=\"${icon.filename}\">\n ${normalizedSVG}\n </div>`;\n document.getElementById(\"iconsContainer\").innerHTML += svgIcon;\n } catch (error) {\n console.error('Failed to render search result:', icon.filename, error);\n }\n }\n\n addIconClickListeners();\n\n } catch (error) {\n console.error('Failed to search icons:', error);\n }\n}\n\nfunction normalizeSVGSize(svgContent, fillColor = '#fff', strokeColor = null) {\n const tempDiv = document.createElement('div');\n tempDiv.innerHTML = svgContent;\n const svgElement = tempDiv.querySelector('svg');\n \n if (svgElement) {\n const originalViewBox = svgElement.getAttribute('viewBox');\n \n svgElement.setAttribute('width', '35');\n svgElement.setAttribute('height', '35');\n \n if (!originalViewBox) {\n const width = svgElement.getAttribute('width') || '24';\n const height = svgElement.getAttribute('height') || '24';\n const numWidth = parseFloat(width);\n const numHeight = parseFloat(height);\n \n if (!isNaN(numWidth) && !isNaN(numHeight)) {\n svgElement.setAttribute('viewBox', `0 0 ${numWidth} ${numHeight}`);\n }\n }\n \n // Apply custom styling with more selective logic\n const applyCustomStyling = (element) => {\n if (element.nodeType === 1) {\n const tagName = element.tagName.toLowerCase();\n \n // Only apply to shape elements, not container elements like 'g'\n if (['path', 'circle', 'rect', 'polygon', 'ellipse', 'polyline', 'line'].includes(tagName)) {\n const currentFill = element.getAttribute('fill');\n const currentStroke = element.getAttribute('stroke');\n \n // Check if parent <g> has explicit colors - if so, don't override\n let parentG = element.parentElement;\n let hasParentColor = false;\n \n while (parentG && parentG.tagName.toLowerCase() === 'g') {\n if (parentG.getAttribute('fill') || parentG.getAttribute('stroke')) {\n hasParentColor = true;\n break;\n }\n parentG = parentG.parentElement;\n }\n \n // Only apply white fill if:\n // 1. Element doesn't have explicit 'none' fill\n // 2. Element doesn't already have a specific color (other than black/default)\n // 3. Parent <g> doesn't have explicit colors\n if (!hasParentColor && currentFill !== 'none') {\n // Only override if it's black, default, or unset\n if (!currentFill || currentFill === '#000' || currentFill === '#000000' || currentFill === 'black' || currentFill === 'currentColor') {\n element.setAttribute('fill', fillColor);\n }\n }\n \n // Handle stroke similarly\n if (strokeColor && !hasParentColor) {\n if (currentStroke && currentStroke !== 'none') {\n if (!currentStroke || currentStroke === '#000' || currentStroke === '#000000' || currentStroke === 'black' || currentStroke === 'currentColor') {\n element.setAttribute('stroke', strokeColor);\n }\n }\n }\n }\n \n // Recursively process children\n for (let i = 0; i < element.children.length; i++) {\n applyCustomStyling(element.children[i]);\n }\n }\n };\n \n applyCustomStyling(svgElement);\n \n return svgElement.outerHTML;\n }\n\n return svgContent;\n}\n\nfunction addIconClickListeners() {\n const iconElements = document.querySelectorAll('#iconsContainer .icons');\n iconElements.forEach(iconElement => {\n iconElement.addEventListener('click', (e) => {\n const filename = iconElement.getAttribute('data-url') || 'unknown';\n handleIconClick(e, filename);\n });\n });\n}\n\n// Legacy category/search listeners disabled \u2014 React IconSidebar handles all icon UI\n\nfunction handleIconClick(event, filename) {\n event.stopPropagation();\n\n const iconElement = event.currentTarget;\n const svgElement = iconElement.querySelector('svg');\n\n if (svgElement) {\n iconToPlace = svgElement.outerHTML;\n isDraggingIcon = true;\n isIconToolActive = true;\n\n console.log('Icon selected and ready to place:', filename);\n\n const iconContainer = document.getElementById('iconsToolBar');\n if (iconContainer) {\n iconContainer.classList.add('hidden');\n }\n\n document.body.style.cursor = 'crosshair';\n }\n}\n\n\n\n// Clean up any lingering miniature icon or drag state (called on tool switch)\nfunction cleanupIconTool() {\n if (currentIconElement) {\n const svg = getSVGElement();\n if (svg && currentIconElement.parentNode === svg) {\n svg.removeChild(currentIconElement);\n }\n currentIconElement = null;\n }\n isDraggingIcon = false;\n iconToPlace = null;\n document.body.style.cursor = 'default';\n}\nwindow.__cleanupIconTool = cleanupIconTool;\n\n// Bridge for React sidebar to trigger icon placement\nwindow.prepareIconPlacement = function(svgContent) {\n iconToPlace = svgContent;\n isDraggingIcon = true;\n window.isIconToolActive = true;\n document.body.style.cursor = 'crosshair';\n};\n\n// Bridge for IconShape to call selectIcon and removeSelection\nwindow.__iconToolSelectIcon = selectIcon;\nwindow.__iconToolRemoveSelection = removeSelection;\n\n// Legacy icon rendering disabled \u2014 React IconSidebar handles icon UI\n\nexport { handleMouseDownIcon, handleMouseMoveIcon, handleMouseUpIcon, startDrag, stopDrag}"],
5
+ "mappings": ";;;;;;;;;;;;;AAMA,IAAI,iBAAiB;AACrB,IAAI,c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,KAAK,MAAM,SAAS;AACjC;AACA,OAAO,oBAAoB;AAG3B,OAAO,uBAAuB,SAAS,YAAY;AAC/C,gBAAc;AACd,mBAAiB;AACjB,SAAO,mBAAmB;AAC1B,WAAS,KAAK,MAAM,SAAS;AACjC;AAGA,OAAO,uBAAuB;AAC9B,OAAO,4BAA4B;",
6
+ "names": ["svg", "iconX", "iconY"]
7
+ }
@@ -485,7 +485,8 @@ var Rectangle = class {
485
485
  }
486
486
  updateSelectionControls() {
487
487
  if (!this.selectionOutline || this.anchors.length === 0) return;
488
- const anchorSize = 10;
488
+ const zoom = window.currentZoom || 1;
489
+ const anchorSize = 10 / zoom;
489
490
  const expandedX = -this.selectionPadding;
490
491
  const expandedY = -this.selectionPadding;
491
492
  const expandedWidth = this.width + 2 * this.selectionPadding;
@@ -516,7 +517,7 @@ var Rectangle = class {
516
517
  this.selectionOutline.setAttribute("points", outlinePoints.map((p) => p.join(",")).join(" "));
517
518
  if (this.rotationAnchor) {
518
519
  this.rotationAnchor.setAttribute("cx", expandedX + expandedWidth / 2);
519
- this.rotationAnchor.setAttribute("cy", expandedY - 30);
520
+ this.rotationAnchor.setAttribute("cy", expandedY - 30 / zoom);
520
521
  }
521
522
  }
522
523
  removeSelection() {
@@ -723,4 +724,4 @@ var Rectangle = class {
723
724
  export {
724
725
  Rectangle
725
726
  };
726
- //# sourceMappingURL=chunk-24TW3M7X.js.map
727
+ //# sourceMappingURL=chunk-XCJOF6BM.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/shapes/Rectangle.js"],
4
- "sourcesContent": ["/* eslint-disable */\n// Rectangle shape class - extracted from drawSquare.js\n// Depends on globals: svg, shapes, rough, currentShape, currentZoom, rc\n\n// Create local rc from globals; tool-state vars default to false\nconst rc = rough.svg(svg);\nlet isDraggingShapeSquare = false;\nlet isResizingShapeSquare = false;\nlet isRotatingShapeSquare = false;\nlet hoveredFrame = null;\nconst SquarecolorOptions = document.querySelectorAll(\".squareStrokeSpan\");\nconst backgroundColorOptionsSquare = document.querySelectorAll(\".squareBackgroundSpan\");\nconst fillStyleOptions = document.querySelectorAll(\".squareFillStyleSpan\");\nconst squareStrokeThicknessValue = document.querySelectorAll(\".squareStrokeThickSpan\");\nconst squareOutlineStyleValue = document.querySelectorAll(\".squareOutlineStyle\");\n// Depends on globals: squareStrokecolor, squareBackgroundColor, squareFillStyleValue, squareStrokeThicknes, squareOutlineStyle\n// Depends on globals: isDraggingShapeSquare, isResizingShapeSquare, isRotatingShapeSquare\n// Depends on globals: squareSideBar, disableAllSideBars\n// Depends on DOM query: SquarecolorOptions, backgroundColorOptionsSquare, fillStyleOptions, squareStrokeThicknessValue, squareOutlineStyleValue\n\nclass Rectangle {\n constructor(x, y, width, height, options = {}) {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n this.options = {\n roughness: 1.5,\n stroke: \"#fff\",\n strokeWidth: 2,\n fill: \"transparent\",\n fillStyle: \"none\",\n strokeDasharray: \"\",\n ...options\n };\n this.element = null;\n this.isSelected = false;\n this.rotation = 0;\n this.group = document.createElementNS('http://www.w3.org/2000/svg', 'g');\n this.anchors = [];\n this.rotationAnchor = null;\n this.selectionPadding = 8;\n this.selectionOutline = null;\n this.shapeName = 'rectangle';\n this.shapeID = `rectangle-${String(Date.now()).slice(0, 8)}-${Math.floor(Math.random() * 10000)}`;\n this.group.setAttribute('id', this.shapeID);\n\n // Embedded label support\n this.label = options.label || '';\n this.labelElement = null;\n this.labelColor = options.labelColor || '#e0e0e0';\n this.labelFontSize = options.labelFontSize || 14;\n this.labelBg = options.labelBg !== false; // set labelBg:false to render plain text with no pill backdrop\n this._isEditingLabel = false;\n this._hitArea = null;\n this._labelBg = null;\n\n // Shading / gradient support for research paper style diagrams\n this.shadeColor = options.shadeColor || null;\n this.shadeOpacity = options.shadeOpacity !== undefined ? options.shadeOpacity : 0.15;\n this.shadeDirection = options.shadeDirection || 'bottom'; // 'top' | 'bottom' | 'left' | 'right'\n this._shadeRect = null;\n this._shadeGradient = null;\n\n if (!this.group.parentNode) {\n svg.appendChild(this.group);\n }\n this._lastDrawn = {\n width: null,\n height: null,\n options: null\n };\n this.isBeingDrawn = false;\n this._setupLabelDblClick();\n this.draw();\n }\n draw() {\n const childrenToRemove = [];\n const preserveSet = this._skipAnchors ? new Set([...this.anchors, this.selectionOutline, this.rotationAnchor].filter(Boolean)) : null;\n for (let i = 0; i < this.group.children.length; i++) {\n const child = this.group.children[i];\n if (child !== this.element && child !== this.labelElement && child !== this._hitArea && child !== this._labelBg && child !== this._shadeRect) {\n if (preserveSet && preserveSet.has(child)) continue;\n childrenToRemove.push(child);\n }\n }\n childrenToRemove.forEach(child => this.group.removeChild(child));\n\n const optionsString = JSON.stringify(this.options);\n const isInitialDraw = this.element === null;\n const optionsChanged = optionsString !== this._lastDrawn.options;\n const sizeChanged = this.width !== this._lastDrawn.width || this.height !== this._lastDrawn.height;\n\n // Only regenerate rough element if it's not being actively drawn OR if options changed OR initial draw\n if (isInitialDraw || optionsChanged || (!this.isBeingDrawn && sizeChanged)) {\n if (this.element && this.element.parentNode === this.group) {\n this.group.removeChild(this.element);\n }\n const roughRect = rc.rectangle(0, 0, this.width, this.height, this.options);\n this.element = roughRect;\n this.group.appendChild(roughRect);\n\n // Cache the values\n this._lastDrawn.width = this.width;\n this._lastDrawn.height = this.height;\n this._lastDrawn.options = optionsString;\n }\n\n // Hit area for dblclick detection (transparent rect that captures pointer events)\n if (!this._hitArea) {\n this._hitArea = document.createElementNS('http://www.w3.org/2000/svg', 'rect');\n this._hitArea.setAttribute('fill', 'transparent');\n this._hitArea.setAttribute('stroke', 'none');\n this._hitArea.setAttribute('style', 'pointer-events: all;');\n this.group.insertBefore(this._hitArea, this.group.firstChild);\n }\n this._hitArea.setAttribute('x', 0);\n this._hitArea.setAttribute('y', 0);\n this._hitArea.setAttribute('width', this.width);\n this._hitArea.setAttribute('height', this.height);\n\n // Shading / gradient overlay\n this._updateShade();\n\n // Update embedded label\n this._updateLabelElement();\n\n const rotateCenterX = this.width / 2;\n const rotateCenterY = this.height / 2;\n this.group.setAttribute('transform', `translate(${this.x}, ${this.y}) rotate(${this.rotation}, ${rotateCenterX}, ${rotateCenterY})`);\n\n if (this.isSelected) {\n if (this._skipAnchors) {\n this.updateSelectionControls();\n } else {\n this.addAnchors();\n }\n }\n if (!this.group.parentNode) {\n this.updateAttachedArrows();\n svg.appendChild(this.group);\n }\n }\n\n _updateShade() {\n if (!this.shadeColor) {\n if (this._shadeRect && this._shadeRect.parentNode === this.group) {\n this.group.removeChild(this._shadeRect);\n this._shadeRect = null;\n }\n if (this._shadeGradient && this._shadeGradient.parentNode) {\n this._shadeGradient.parentNode.removeChild(this._shadeGradient);\n this._shadeGradient = null;\n }\n return;\n }\n\n // Create or update gradient in SVG defs\n let defs = svg.querySelector('defs');\n if (!defs) {\n defs = document.createElementNS('http://www.w3.org/2000/svg', 'defs');\n svg.appendChild(defs);\n }\n\n const gradId = `shade-${this.shapeID}`;\n if (!this._shadeGradient) {\n this._shadeGradient = document.createElementNS('http://www.w3.org/2000/svg', 'linearGradient');\n this._shadeGradient.setAttribute('id', gradId);\n defs.appendChild(this._shadeGradient);\n }\n\n // Direction mapping\n const dirs = {\n top: { x1: '0%', y1: '0%', x2: '0%', y2: '100%' },\n bottom: { x1: '0%', y1: '100%', x2: '0%', y2: '0%' },\n left: { x1: '0%', y1: '0%', x2: '100%', y2: '0%' },\n right: { x1: '100%', y1: '0%', x2: '0%', y2: '0%' },\n };\n const d = dirs[this.shadeDirection] || dirs.bottom;\n this._shadeGradient.setAttribute('x1', d.x1);\n this._shadeGradient.setAttribute('y1', d.y1);\n this._shadeGradient.setAttribute('x2', d.x2);\n this._shadeGradient.setAttribute('y2', d.y2);\n\n // Rebuild stops\n while (this._shadeGradient.firstChild) this._shadeGradient.removeChild(this._shadeGradient.firstChild);\n const stop1 = document.createElementNS('http://www.w3.org/2000/svg', 'stop');\n stop1.setAttribute('offset', '0%');\n stop1.setAttribute('stop-color', this.shadeColor);\n stop1.setAttribute('stop-opacity', this.shadeOpacity);\n const stop2 = document.createElementNS('http://www.w3.org/2000/svg', 'stop');\n stop2.setAttribute('offset', '100%');\n stop2.setAttribute('stop-color', this.shadeColor);\n stop2.setAttribute('stop-opacity', '0');\n this._shadeGradient.appendChild(stop1);\n this._shadeGradient.appendChild(stop2);\n\n // Create or update shade rect\n if (!this._shadeRect) {\n this._shadeRect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');\n this._shadeRect.setAttribute('pointer-events', 'none');\n }\n this._shadeRect.setAttribute('x', 0);\n this._shadeRect.setAttribute('y', 0);\n this._shadeRect.setAttribute('width', this.width);\n this._shadeRect.setAttribute('height', this.height);\n this._shadeRect.setAttribute('fill', `url(#${gradId})`);\n this._shadeRect.setAttribute('rx', 2);\n\n // Insert after rough element\n if (this._shadeRect.parentNode === this.group) this.group.removeChild(this._shadeRect);\n if (this.element && this.element.nextSibling) {\n this.group.insertBefore(this._shadeRect, this.element.nextSibling);\n } else {\n this.group.appendChild(this._shadeRect);\n }\n }\n\n _updateLabelElement() {\n if (!this.label) {\n // Remove label element if label is empty\n if (this.labelElement && this.labelElement.parentNode === this.group) {\n this.group.removeChild(this.labelElement);\n this.labelElement = null;\n }\n if (this._labelBg && this._labelBg.parentNode === this.group) {\n this.group.removeChild(this._labelBg);\n this._labelBg = null;\n }\n return;\n }\n\n if (!this.labelElement) {\n this.labelElement = document.createElementNS('http://www.w3.org/2000/svg', 'text');\n this.labelElement.setAttribute('class', 'shape-label');\n this.labelElement.setAttribute('pointer-events', 'none');\n }\n\n // Position at center of rectangle\n this.labelElement.setAttribute('x', this.width / 2);\n this.labelElement.setAttribute('y', this.height / 2);\n this.labelElement.setAttribute('text-anchor', 'middle');\n this.labelElement.setAttribute('dominant-baseline', 'central');\n this.labelElement.setAttribute('fill', this.labelColor);\n this.labelElement.setAttribute('font-size', this.labelFontSize);\n this.labelElement.setAttribute('font-family', 'lixFont, sans-serif');\n this.labelElement.textContent = this.label;\n\n // Background padding rect behind text (like arrows have) \u2014 skippable\n // via labelBg:false for dense multi-row content (e.g. mermaid ER\n // attribute rows) where a pill backdrop looks out of place and\n // doesn't match the SVG preview.\n if (!this.labelBg) {\n if (this._labelBg && this._labelBg.parentNode === this.group) {\n this.group.removeChild(this._labelBg);\n this._labelBg = null;\n }\n if (this.labelElement.parentNode === this.group) this.group.removeChild(this.labelElement);\n this.group.appendChild(this.labelElement);\n return;\n }\n const canvasBg = window.getComputedStyle(svg).backgroundColor || '#000';\n if (!this._labelBg) {\n this._labelBg = document.createElementNS('http://www.w3.org/2000/svg', 'rect');\n this._labelBg.setAttribute('pointer-events', 'none');\n }\n this._labelBg.setAttribute('fill', canvasBg);\n const hPadding = 6;\n const vPadding = 2;\n const charWidth = this.labelFontSize * 0.6;\n const bgW = this.label.length * charWidth + hPadding * 2;\n const bgH = this.labelFontSize + vPadding * 2;\n this._labelBg.setAttribute('x', this.width / 2 - bgW / 2);\n this._labelBg.setAttribute('y', this.height / 2 - bgH / 2);\n this._labelBg.setAttribute('width', bgW);\n this._labelBg.setAttribute('height', bgH);\n this._labelBg.setAttribute('rx', 3);\n\n // Re-append bg then text on top\n if (this._labelBg.parentNode === this.group) this.group.removeChild(this._labelBg);\n if (this.labelElement.parentNode === this.group) this.group.removeChild(this.labelElement);\n this.group.appendChild(this._labelBg);\n this.group.appendChild(this.labelElement);\n }\n\n _setupLabelDblClick() {\n this.group.addEventListener('dblclick', (e) => {\n e.stopPropagation();\n e.preventDefault();\n this.startLabelEdit();\n });\n }\n\n startLabelEdit() {\n if (this._isEditingLabel) return;\n this._isEditingLabel = true;\n\n // Hide label element during editing\n if (this.labelElement) {\n this.labelElement.setAttribute('visibility', 'hidden');\n }\n\n // Get shape's screen position via CTM\n const ctm = this.group.getScreenCTM();\n if (!ctm) { this._isEditingLabel = false; return; }\n\n // Map the shape corners to screen coords\n const pt1 = svg.createSVGPoint();\n pt1.x = 0; pt1.y = 0;\n const screenTL = pt1.matrixTransform(ctm);\n const pt2 = svg.createSVGPoint();\n pt2.x = this.width; pt2.y = this.height;\n const screenBR = pt2.matrixTransform(ctm);\n\n const screenW = Math.abs(screenBR.x - screenTL.x);\n const screenH = Math.abs(screenBR.y - screenTL.y);\n const screenX = Math.min(screenTL.x, screenBR.x);\n const screenY = Math.min(screenTL.y, screenBR.y);\n\n // Create HTML overlay\n const overlay = document.createElement('div');\n overlay.className = 'shape-label-editor';\n overlay.style.cssText = `\n position: fixed; z-index: 10000;\n left: ${screenX}px; top: ${screenY}px;\n width: ${screenW}px; height: ${screenH}px;\n display: flex; align-items: center; justify-content: center;\n pointer-events: auto;\n `;\n\n const canvasBg = window.getComputedStyle(svg).backgroundColor || '#000';\n const input = document.createElement('div');\n input.setAttribute('contenteditable', 'true');\n input.style.cssText = `\n max-width: ${screenW - 8}px; min-width: 30px; min-height: 20px;\n background: ${canvasBg}; border: none;\n outline: none; padding: 2px 6px;\n color: ${this.labelColor}; font-size: ${Math.max(12, this.labelFontSize * (screenW / Math.max(this.width, 1)))}px;\n font-family: lixFont, sans-serif; text-align: center;\n white-space: pre-wrap; word-break: break-word;\n cursor: text;\n `;\n if (this.label) {\n input.textContent = this.label;\n } else {\n input.innerHTML = '&nbsp;';\n }\n\n overlay.appendChild(input);\n document.body.appendChild(overlay);\n\n // Focus and select all text\n setTimeout(() => {\n input.focus();\n const sel = window.getSelection();\n const range = document.createRange();\n range.selectNodeContents(input);\n sel.removeAllRanges();\n sel.addRange(range);\n }, 10);\n\n const finishEdit = () => {\n const newText = input.textContent.trim().replace(/\\u00A0/g, '');\n this.label = newText;\n this._isEditingLabel = false;\n\n if (overlay.parentNode) overlay.parentNode.removeChild(overlay);\n if (this.labelElement) this.labelElement.setAttribute('visibility', 'visible');\n this.draw();\n };\n\n input.addEventListener('blur', finishEdit);\n input.addEventListener('keydown', (e) => {\n e.stopPropagation();\n if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); input.blur(); }\n if (e.key === 'Escape') { input.textContent = this.label; input.blur(); }\n });\n input.addEventListener('pointerdown', (e) => e.stopPropagation());\n input.addEventListener('pointermove', (e) => e.stopPropagation());\n input.addEventListener('pointerup', (e) => e.stopPropagation());\n }\n\n setLabel(text, color, fontSize) {\n this.label = text || '';\n if (color) this.labelColor = color;\n if (fontSize) this.labelFontSize = fontSize;\n this.draw();\n }\n\n setDrawingState(isDrawing) {\n this.isBeingDrawn = isDrawing;\n }\n\n getRotatedCursor(direction, angle) {\n const directions = ['ns', 'nesw', 'ew', 'nwse'];\n angle = angle % 360;\n if (angle < 0) angle += 360;\n\n const baseDirectionMap = {\n '0': 'nwse', '1': 'nesw', \n '2': 'nesw', '3': 'nwse', \n '4': 'ns', '5': 'ns', \n '6': 'ew', '7': 'ew' \n };\n const baseDirection = baseDirectionMap[direction];\n let effectiveAngle = angle; \n if (baseDirection === 'nesw') {\n effectiveAngle += 45;\n } else if (baseDirection === 'ew') {\n effectiveAngle += 90;\n } else if (baseDirection === 'nwse') {\n effectiveAngle += 135;\n }\n effectiveAngle = effectiveAngle % 360;\n if (effectiveAngle < 0) effectiveAngle += 360;\n const index = Math.round(effectiveAngle / 45) % 4; \n let finalIndex;\n if (effectiveAngle >= 337.5 || effectiveAngle < 22.5) finalIndex = 0; \n else if (effectiveAngle >= 22.5 && effectiveAngle < 67.5) finalIndex = 1; \n else if (effectiveAngle >= 67.5 && effectiveAngle < 112.5) finalIndex = 2; \n else if (effectiveAngle >= 112.5 && effectiveAngle < 157.5) finalIndex = 3;\n else if (effectiveAngle >= 157.5 && effectiveAngle < 202.5) finalIndex = 0; \n else if (effectiveAngle >= 202.5 && effectiveAngle < 247.5) finalIndex = 1; \n else if (effectiveAngle >= 247.5 && effectiveAngle < 292.5) finalIndex = 2; \n else if (effectiveAngle >= 292.5 && effectiveAngle < 337.5) finalIndex = 3; \n else finalIndex = 0; \n return directions[finalIndex];\n }\n addAnchors() {\n const zoom = window.currentZoom || 1;\n const anchorSize = 10 / zoom;\n const anchorStrokeWidth = 2;\n const self = this;\n const expandedX = -this.selectionPadding; \n const expandedY = -this.selectionPadding; \n const expandedWidth = this.width + 2 * this.selectionPadding;\n const expandedHeight = this.height + 2 * this.selectionPadding;\n\n const positions = [\n { x: expandedX, y: expandedY }, \n { x: expandedX + expandedWidth, y: expandedY }, \n { x: expandedX, y: expandedY + expandedHeight }, \n { x: expandedX + expandedWidth, y: expandedY + expandedHeight }, \n { x: expandedX + expandedWidth / 2, y: expandedY }, \n { x: expandedX + expandedWidth / 2, y: expandedY + expandedHeight }, \n { x: expandedX, y: expandedHeight / 2 + expandedY }, \n { x: expandedX + expandedWidth, y: expandedHeight / 2 + expandedY } \n ];\n\n const outlinePoints = [\n [positions[0].x, positions[0].y],\n [positions[1].x, positions[1].y],\n [positions[3].x, positions[3].y],\n [positions[2].x, positions[2].y],\n [positions[0].x, positions[0].y]\n ];\n\n this.anchors.forEach(anchor => {\n if (anchor.parentNode === this.group) {\n this.group.removeChild(anchor);\n }\n });\n if (this.rotationAnchor && this.rotationAnchor.parentNode === this.group) {\n this.group.removeChild(this.rotationAnchor);\n }\n if (this.selectionOutline && this.selectionOutline.parentNode === this.group) {\n this.group.removeChild(this.selectionOutline);\n }\n\n this.anchors = [];\n const anchorDirections = {\n 0: 'nwse', \n 1: 'nesw', \n 2: 'nesw', \n 3: 'nwse', \n 4: 'ns', \n 5: 'ns', \n 6: 'ew', \n 7: 'ew' \n };\n\n positions.forEach((pos, i) => {\n const anchor = document.createElementNS('http://www.w3.org/2000/svg', 'rect');\n anchor.setAttribute('x', pos.x - anchorSize / 2);\n anchor.setAttribute('y', pos.y - anchorSize / 2);\n anchor.setAttribute('width', anchorSize);\n anchor.setAttribute('height', anchorSize);\n anchor.setAttribute('class', 'anchor');\n anchor.setAttribute('data-index', i);\n anchor.setAttribute('fill', '#121212');\n anchor.setAttribute('stroke', '#5B57D1');\n anchor.setAttribute('stroke-width', anchorStrokeWidth);\n anchor.setAttribute('vector-effect', 'non-scaling-stroke');\n anchor.setAttribute('style', 'pointer-events: all;');\n\n anchor.addEventListener('mouseover', function () {\n const index = this.getAttribute('data-index');\n const baseDirection = anchorDirections[index];\n const rotatedCursor = self.getRotatedCursor(index, self.rotation); \n svg.style.cursor = rotatedCursor + '-resize';\n });\n\n anchor.addEventListener('mouseout', function () {\n if (!isResizingShapeSquare && !isDraggingShapeSquare && !isRotatingShapeSquare) {\n svg.style.cursor = 'default';\n }\n });\n\n this.group.appendChild(anchor);\n this.anchors[i] = anchor;\n });\n const rotationAnchorPos = { x: expandedX + expandedWidth / 2, y: expandedY - 30 / zoom };\n this.rotationAnchor = document.createElementNS('http://www.w3.org/2000/svg', 'circle');\n this.rotationAnchor.setAttribute('cx', rotationAnchorPos.x);\n this.rotationAnchor.setAttribute('cy', rotationAnchorPos.y);\n this.rotationAnchor.setAttribute('r', 8 / zoom);\n this.rotationAnchor.setAttribute('class', 'rotate-anchor');\n this.rotationAnchor.setAttribute('fill', '#121212');\n this.rotationAnchor.setAttribute('stroke', '#5B57D1');\n this.rotationAnchor.setAttribute('stroke-width', anchorStrokeWidth);\n this.rotationAnchor.setAttribute('vector-effect', 'non-scaling-stroke');\n this.rotationAnchor.setAttribute('style', 'pointer-events: all;');\n this.group.appendChild(this.rotationAnchor);\n\n this.rotationAnchor.addEventListener('mouseover', function () {\n if (!isResizingShapeSquare && !isDraggingShapeSquare && !isRotatingShapeSquare) {\n svg.style.cursor = 'grab';\n }\n });\n this.rotationAnchor.addEventListener('mouseout', function () {\n if (!isResizingShapeSquare && !isDraggingShapeSquare && !isRotatingShapeSquare) {\n svg.style.cursor = 'default';\n }\n });\n\n const pointsAttr = outlinePoints.map(p => p.join(',')).join(' ');\n const outline = document.createElementNS('http://www.w3.org/2000/svg', 'polyline');\n outline.setAttribute('points', pointsAttr);\n outline.setAttribute('fill', 'none');\n outline.setAttribute('stroke', '#5B57D1');\n outline.setAttribute('stroke-width', 1.5);\n outline.setAttribute('stroke-dasharray', '4 2');\n outline.setAttribute('vector-effect', 'non-scaling-stroke');\n outline.setAttribute('style', 'pointer-events: none;');\n this.group.appendChild(outline);\n this.selectionOutline = outline;\n\n // Show relevant sidebar\n disableAllSideBars();\n squareSideBar.classList.remove(\"hidden\");\n if (window.__showSidebarForShape) window.__showSidebarForShape('rectangle');\n this.updateSidebar();\n }\n\n updateSelectionControls() {\n if (!this.selectionOutline || this.anchors.length === 0) return;\n\n const anchorSize = 10;\n const expandedX = -this.selectionPadding;\n const expandedY = -this.selectionPadding;\n const expandedWidth = this.width + 2 * this.selectionPadding;\n const expandedHeight = this.height + 2 * this.selectionPadding;\n\n const positions = [\n { x: expandedX, y: expandedY },\n { x: expandedX + expandedWidth, y: expandedY },\n { x: expandedX, y: expandedY + expandedHeight },\n { x: expandedX + expandedWidth, y: expandedY + expandedHeight },\n { x: expandedX + expandedWidth / 2, y: expandedY },\n { x: expandedX + expandedWidth / 2, y: expandedY + expandedHeight },\n { x: expandedX, y: expandedHeight / 2 + expandedY },\n { x: expandedX + expandedWidth, y: expandedHeight / 2 + expandedY }\n ];\n\n // Update anchor positions\n positions.forEach((pos, i) => {\n if (this.anchors[i]) {\n this.anchors[i].setAttribute('x', pos.x - anchorSize / 2);\n this.anchors[i].setAttribute('y', pos.y - anchorSize / 2);\n }\n });\n\n // Update outline\n const outlinePoints = [\n [positions[0].x, positions[0].y],\n [positions[1].x, positions[1].y],\n [positions[3].x, positions[3].y],\n [positions[2].x, positions[2].y],\n [positions[0].x, positions[0].y]\n ];\n this.selectionOutline.setAttribute('points', outlinePoints.map(p => p.join(',')).join(' '));\n\n // Update rotation anchor\n if (this.rotationAnchor) {\n this.rotationAnchor.setAttribute('cx', expandedX + expandedWidth / 2);\n this.rotationAnchor.setAttribute('cy', expandedY - 30);\n }\n }\n\n removeSelection() {\n // Remove selection elements (anchors, outline, rotation anchor) from the group\n this.anchors.forEach(anchor => {\n if (anchor.parentNode === this.group) {\n this.group.removeChild(anchor);\n }\n });\n if (this.rotationAnchor && this.rotationAnchor.parentNode === this.group) {\n this.group.removeChild(this.rotationAnchor);\n }\n if (this.selectionOutline && this.selectionOutline.parentNode === this.group) {\n this.group.removeChild(this.selectionOutline);\n }\n this.anchors = [];\n this.rotationAnchor = null;\n this.selectionOutline = null;\n this.isSelected = false;\n }\n\n contains(x, y) {\n if (!this.element) return false;\n // x/y are already canvas (viewBox) coordinates. getCTM() operates in\n // viewport coordinates and made hit testing drift after pan/zoom.\n const centerX = this.width / 2;\n const centerY = this.height / 2;\n const angle = -(this.rotation || 0) * Math.PI / 180;\n const translatedX = x - this.x;\n const translatedY = y - this.y;\n const dx = translatedX - centerX;\n const dy = translatedY - centerY;\n const localX = dx * Math.cos(angle) - dy * Math.sin(angle) + centerX;\n const localY = dx * Math.sin(angle) + dy * Math.cos(angle) + centerY;\n const tolerance = 5;\n return localX >= -tolerance && localX <= this.width + tolerance &&\n localY >= -tolerance && localY <= this.height + tolerance;\n }\n\n // Helper to check if a point is near an anchor\n isNearAnchor(x, y) {\n if (!this.isSelected) return null;\n const buffer = 10; \n const anchorSize = 10; \n\n // Iterate through anchors\n for (let i = 0; i < this.anchors.length; i++) {\n const anchor = this.anchors[i];\n const anchorLocalX = parseFloat(anchor.getAttribute('x')) + anchorSize / 2;\n const anchorLocalY = parseFloat(anchor.getAttribute('y')) + anchorSize / 2;\n const svgPoint = svg.createSVGPoint();\n svgPoint.x = anchorLocalX;\n svgPoint.y = anchorLocalY;\n const transformedPoint = svgPoint.matrixTransform(this.group.getCTM());\n const anchorLeft = transformedPoint.x - anchorSize/2 - buffer;\n const anchorRight = transformedPoint.x + anchorSize/2 + buffer;\n const anchorTop = transformedPoint.y - anchorSize/2 - buffer;\n const anchorBottom = transformedPoint.y + anchorSize/2 + buffer;\n if (x >= anchorLeft && x <= anchorRight && y >= anchorTop && y <= anchorBottom) {\n return { type: 'resize', index: i };\n }\n }\n\n // Check rotation anchor\n if (this.rotationAnchor) {\n const rotateAnchorLocalX = parseFloat(this.rotationAnchor.getAttribute('cx'));\n const rotateAnchorLocalY = parseFloat(this.rotationAnchor.getAttribute('cy'));\n const svgPoint = svg.createSVGPoint();\n svgPoint.x = rotateAnchorLocalX;\n svgPoint.y = rotateAnchorLocalY;\n const transformedPoint = svgPoint.matrixTransform(this.group.getCTM());\n const rotateAnchorRadius = parseFloat(this.rotationAnchor.getAttribute('r'));\n const distSq = (x - transformedPoint.x)**2 + (y - transformedPoint.y)**2;\n if (distSq <= (rotateAnchorRadius + buffer)**2) {\n return { type: 'rotate' };\n }\n }\n\n return null;\n }\n\n\nmove(dx, dy) {\n this.x += dx;\n this.y += dy;\n\n // Fast path: just update the transform \u2014 no need to rebuild RoughJS element\n const rotateCenterX = this.width / 2;\n const rotateCenterY = this.height / 2;\n this.group.setAttribute('transform', `translate(${this.x}, ${this.y}) rotate(${this.rotation}, ${rotateCenterX}, ${rotateCenterY})`);\n\n this.updateAttachedArrows();\n\n // Only update frame containment if we're actively dragging the shape itself\n // and not being moved by a parent frame\n if (isDraggingShapeSquare && !this.isBeingMovedByFrame) {\n this.updateFrameContainment();\n }\n}\n\nupdateFrameContainment() {\n // Don't update if we're being moved by a frame\n if (this.isBeingMovedByFrame) return;\n \n let targetFrame = null;\n \n // Find which frame this shape is over\n shapes.forEach(shape => {\n if (shape.shapeName === 'frame' && shape.isShapeInFrame(this)) {\n targetFrame = shape;\n }\n });\n \n // If we have a parent frame and we're being dragged, temporarily remove clipping\n if (this.parentFrame && isDraggingShapeSquare) {\n this.parentFrame.temporarilyRemoveFromFrame(this);\n }\n \n // Update frame highlighting\n if (hoveredFrame && hoveredFrame !== targetFrame) {\n hoveredFrame.removeHighlight();\n }\n \n if (targetFrame && targetFrame !== hoveredFrame) {\n targetFrame.highlightFrame();\n }\n \n hoveredFrame = targetFrame;\n}\n\n updatePosition(anchorIndex, newMouseX, newMouseY) {\n const CTM = this.group.getCTM();\n if (!CTM) return;\n const inverseCTM = CTM.inverse();\n const svgPoint = svg.createSVGPoint();\n svgPoint.x = newMouseX;\n svgPoint.y = newMouseY;\n const localMouse = svgPoint.matrixTransform(inverseCTM);\n\n const oldW = this.width;\n const oldH = this.height;\n\n // Determine fixed point in old local coords and compute raw new dimensions\n let fixedOldX, fixedOldY, rawW, rawH;\n switch (anchorIndex) {\n case 0: fixedOldX = oldW; fixedOldY = oldH; rawW = oldW - localMouse.x; rawH = oldH - localMouse.y; break;\n case 1: fixedOldX = 0; fixedOldY = oldH; rawW = localMouse.x; rawH = oldH - localMouse.y; break;\n case 2: fixedOldX = oldW; fixedOldY = 0; rawW = oldW - localMouse.x; rawH = localMouse.y; break;\n case 3: fixedOldX = 0; fixedOldY = 0; rawW = localMouse.x; rawH = localMouse.y; break;\n case 4: fixedOldX = 0; fixedOldY = oldH; rawW = oldW; rawH = oldH - localMouse.y; break;\n case 5: fixedOldX = 0; fixedOldY = 0; rawW = oldW; rawH = localMouse.y; break;\n case 6: fixedOldX = oldW; fixedOldY = 0; rawW = oldW - localMouse.x; rawH = oldH; break;\n case 7: fixedOldX = 0; fixedOldY = 0; rawW = localMouse.x; rawH = oldH; break;\n }\n\n // Get world position of the fixed point using current CTM\n const fp = svg.createSVGPoint();\n fp.x = fixedOldX;\n fp.y = fixedOldY;\n const fixedWorld = fp.matrixTransform(CTM);\n\n // Handle negative dimensions (dragged past opposite edge)\n const newW = Math.abs(rawW);\n const newH = Math.abs(rawH);\n\n // Fixed point in new local coords (flips if dimension went negative)\n const fixedNewX = fixedOldX === 0 ? (rawW >= 0 ? 0 : newW) : (rawW >= 0 ? newW : 0);\n const fixedNewY = fixedOldY === 0 ? (rawH >= 0 ? 0 : newH) : (rawH >= 0 ? newH : 0);\n\n // Solve for new x, y so the fixed corner stays in place\n // Transform: translate(x, y) rotate(\u03B8, newW/2, newH/2)\n const rad = this.rotation * Math.PI / 180;\n const cosR = Math.cos(rad);\n const sinR = Math.sin(rad);\n const ncx = newW / 2;\n const ncy = newH / 2;\n const dx = fixedNewX - ncx;\n const dy = fixedNewY - ncy;\n const rotX = ncx + dx * cosR - dy * sinR;\n const rotY = ncy + dx * sinR + dy * cosR;\n\n this.x = fixedWorld.x - rotX;\n this.y = fixedWorld.y - rotY;\n this.width = newW;\n this.height = newH;\n\n this.updateAttachedArrows();\n }\n\n updateAttachedArrows() {\n shapes.forEach(shape => {\n if (shape && shape.shapeName === 'arrow' && typeof shape.updateAttachments === 'function') {\n \n if ((shape.attachedToStart && shape.attachedToStart.shape === this) ||\n (shape.attachedToEnd && shape.attachedToEnd.shape === this)) {\n shape.updateAttachments();\n }\n }\n });\n } \n\n rotate(angle) {\n angle = angle % 360;\n if (angle < 0) angle += 360;\n this.rotation = angle;\n }\n\n // Method to update the sidebar based on the shape's current options\n // No-op: React sidebar handles UI updates via Zustand store\n updateSidebar() {}\n}\n\nexport { Rectangle };\n"],
5
- "mappings": ";;;AAKA,IAAM,KAAK,MAAM,IAAI,GAAG;AACxB,IAAI,wBAAwB;AAC5B,IAAI,wBAAwB;AAC5B,IAAI,wBAAwB;AAC5B,IAAI,eAAe;AACnB,IAAM,qBAAqB,SAAS,iBAAiB,mBAAmB;AACxE,IAAM,+BAA+B,SAAS,iBAAiB,uBAAuB;AACtF,IAAM,mBAAmB,SAAS,iBAAiB,sBAAsB;AACzE,IAAM,6BAA6B,SAAS,iBAAiB,wBAAwB;AACrF,IAAM,0BAA0B,SAAS,iBAAiB,qBAAqB;AAM/E,IAAM,YAAN,MAAgB;AAAA,EACZ,YAAY,GAAG,GAAG,OAAO,QAAQ,UAAU,CAAC,GAAG;AAC3C,SAAK,IAAI;AACT,SAAK,IAAI;AACT,SAAK,QAAQ;AACb,SAAK,SAAS;AACd,SAAK,UAAU;AAAA,MACX,WAAW;AAAA,MACX,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,MAAM;AAAA,MACN,WAAW;AAAA,MACX,iBAAiB;AAAA,MACjB,GAAG;AAAA,IACP;AACA,SAAK,UAAU;AACf,SAAK,aAAa;AAClB,SAAK,WAAW;AAChB,SAAK,QAAQ,SAAS,gBAAgB,8BAA8B,GAAG;AACvE,SAAK,UAA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,OAAO,KAAK;AAEpC,SAAK,IAAI,WAAW,IAAI;AACxB,SAAK,IAAI,WAAW,IAAI;AACxB,SAAK,QAAQ;AACb,SAAK,SAAS;AAEd,SAAK,qBAAqB;AAAA,EAC9B;AAAA,EAEI,uBAAuB;AACvB,WAAO,QAAQ,WAAS;AACpB,UAAI,SAAS,MAAM,cAAc,WAAW,OAAO,MAAM,sBAAsB,YAAY;AAEvF,YAAK,MAAM,mBAAmB,MAAM,gBAAgB,UAAU,QACzD,MAAM,iBAAiB,MAAM,cAAc,UAAU,MAAO;AAC7D,gBAAM,kBAAkB;AAAA,QAC5B;AAAA,MACJ;AAAA,IACJ,CAAC;AAAA,EACL;AAAA,EAEA,OAAO,OAAO;AACV,YAAQ,QAAQ;AAChB,QAAI,QAAQ,EAAG,UAAS;AACxB,SAAK,WAAW;AAAA,EACpB;AAAA;AAAA;AAAA,EAIA,gBAAgB;AAAA,EAAC;AACrB;",
4
+ "sourcesContent": ["/* eslint-disable */\n// Rectangle shape class - extracted from drawSquare.js\n// Depends on globals: svg, shapes, rough, currentShape, currentZoom, rc\n\n// Create local rc from globals; tool-state vars default to false\nconst rc = rough.svg(svg);\nlet isDraggingShapeSquare = false;\nlet isResizingShapeSquare = false;\nlet isRotatingShapeSquare = false;\nlet hoveredFrame = null;\nconst SquarecolorOptions = document.querySelectorAll(\".squareStrokeSpan\");\nconst backgroundColorOptionsSquare = document.querySelectorAll(\".squareBackgroundSpan\");\nconst fillStyleOptions = document.querySelectorAll(\".squareFillStyleSpan\");\nconst squareStrokeThicknessValue = document.querySelectorAll(\".squareStrokeThickSpan\");\nconst squareOutlineStyleValue = document.querySelectorAll(\".squareOutlineStyle\");\n// Depends on globals: squareStrokecolor, squareBackgroundColor, squareFillStyleValue, squareStrokeThicknes, squareOutlineStyle\n// Depends on globals: isDraggingShapeSquare, isResizingShapeSquare, isRotatingShapeSquare\n// Depends on globals: squareSideBar, disableAllSideBars\n// Depends on DOM query: SquarecolorOptions, backgroundColorOptionsSquare, fillStyleOptions, squareStrokeThicknessValue, squareOutlineStyleValue\n\nclass Rectangle {\n constructor(x, y, width, height, options = {}) {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n this.options = {\n roughness: 1.5,\n stroke: \"#fff\",\n strokeWidth: 2,\n fill: \"transparent\",\n fillStyle: \"none\",\n strokeDasharray: \"\",\n ...options\n };\n this.element = null;\n this.isSelected = false;\n this.rotation = 0;\n this.group = document.createElementNS('http://www.w3.org/2000/svg', 'g');\n this.anchors = [];\n this.rotationAnchor = null;\n this.selectionPadding = 8;\n this.selectionOutline = null;\n this.shapeName = 'rectangle';\n this.shapeID = `rectangle-${String(Date.now()).slice(0, 8)}-${Math.floor(Math.random() * 10000)}`;\n this.group.setAttribute('id', this.shapeID);\n\n // Embedded label support\n this.label = options.label || '';\n this.labelElement = null;\n this.labelColor = options.labelColor || '#e0e0e0';\n this.labelFontSize = options.labelFontSize || 14;\n this.labelBg = options.labelBg !== false; // set labelBg:false to render plain text with no pill backdrop\n this._isEditingLabel = false;\n this._hitArea = null;\n this._labelBg = null;\n\n // Shading / gradient support for research paper style diagrams\n this.shadeColor = options.shadeColor || null;\n this.shadeOpacity = options.shadeOpacity !== undefined ? options.shadeOpacity : 0.15;\n this.shadeDirection = options.shadeDirection || 'bottom'; // 'top' | 'bottom' | 'left' | 'right'\n this._shadeRect = null;\n this._shadeGradient = null;\n\n if (!this.group.parentNode) {\n svg.appendChild(this.group);\n }\n this._lastDrawn = {\n width: null,\n height: null,\n options: null\n };\n this.isBeingDrawn = false;\n this._setupLabelDblClick();\n this.draw();\n }\n draw() {\n const childrenToRemove = [];\n const preserveSet = this._skipAnchors ? new Set([...this.anchors, this.selectionOutline, this.rotationAnchor].filter(Boolean)) : null;\n for (let i = 0; i < this.group.children.length; i++) {\n const child = this.group.children[i];\n if (child !== this.element && child !== this.labelElement && child !== this._hitArea && child !== this._labelBg && child !== this._shadeRect) {\n if (preserveSet && preserveSet.has(child)) continue;\n childrenToRemove.push(child);\n }\n }\n childrenToRemove.forEach(child => this.group.removeChild(child));\n\n const optionsString = JSON.stringify(this.options);\n const isInitialDraw = this.element === null;\n const optionsChanged = optionsString !== this._lastDrawn.options;\n const sizeChanged = this.width !== this._lastDrawn.width || this.height !== this._lastDrawn.height;\n\n // Only regenerate rough element if it's not being actively drawn OR if options changed OR initial draw\n if (isInitialDraw || optionsChanged || (!this.isBeingDrawn && sizeChanged)) {\n if (this.element && this.element.parentNode === this.group) {\n this.group.removeChild(this.element);\n }\n const roughRect = rc.rectangle(0, 0, this.width, this.height, this.options);\n this.element = roughRect;\n this.group.appendChild(roughRect);\n\n // Cache the values\n this._lastDrawn.width = this.width;\n this._lastDrawn.height = this.height;\n this._lastDrawn.options = optionsString;\n }\n\n // Hit area for dblclick detection (transparent rect that captures pointer events)\n if (!this._hitArea) {\n this._hitArea = document.createElementNS('http://www.w3.org/2000/svg', 'rect');\n this._hitArea.setAttribute('fill', 'transparent');\n this._hitArea.setAttribute('stroke', 'none');\n this._hitArea.setAttribute('style', 'pointer-events: all;');\n this.group.insertBefore(this._hitArea, this.group.firstChild);\n }\n this._hitArea.setAttribute('x', 0);\n this._hitArea.setAttribute('y', 0);\n this._hitArea.setAttribute('width', this.width);\n this._hitArea.setAttribute('height', this.height);\n\n // Shading / gradient overlay\n this._updateShade();\n\n // Update embedded label\n this._updateLabelElement();\n\n const rotateCenterX = this.width / 2;\n const rotateCenterY = this.height / 2;\n this.group.setAttribute('transform', `translate(${this.x}, ${this.y}) rotate(${this.rotation}, ${rotateCenterX}, ${rotateCenterY})`);\n\n if (this.isSelected) {\n if (this._skipAnchors) {\n this.updateSelectionControls();\n } else {\n this.addAnchors();\n }\n }\n if (!this.group.parentNode) {\n this.updateAttachedArrows();\n svg.appendChild(this.group);\n }\n }\n\n _updateShade() {\n if (!this.shadeColor) {\n if (this._shadeRect && this._shadeRect.parentNode === this.group) {\n this.group.removeChild(this._shadeRect);\n this._shadeRect = null;\n }\n if (this._shadeGradient && this._shadeGradient.parentNode) {\n this._shadeGradient.parentNode.removeChild(this._shadeGradient);\n this._shadeGradient = null;\n }\n return;\n }\n\n // Create or update gradient in SVG defs\n let defs = svg.querySelector('defs');\n if (!defs) {\n defs = document.createElementNS('http://www.w3.org/2000/svg', 'defs');\n svg.appendChild(defs);\n }\n\n const gradId = `shade-${this.shapeID}`;\n if (!this._shadeGradient) {\n this._shadeGradient = document.createElementNS('http://www.w3.org/2000/svg', 'linearGradient');\n this._shadeGradient.setAttribute('id', gradId);\n defs.appendChild(this._shadeGradient);\n }\n\n // Direction mapping\n const dirs = {\n top: { x1: '0%', y1: '0%', x2: '0%', y2: '100%' },\n bottom: { x1: '0%', y1: '100%', x2: '0%', y2: '0%' },\n left: { x1: '0%', y1: '0%', x2: '100%', y2: '0%' },\n right: { x1: '100%', y1: '0%', x2: '0%', y2: '0%' },\n };\n const d = dirs[this.shadeDirection] || dirs.bottom;\n this._shadeGradient.setAttribute('x1', d.x1);\n this._shadeGradient.setAttribute('y1', d.y1);\n this._shadeGradient.setAttribute('x2', d.x2);\n this._shadeGradient.setAttribute('y2', d.y2);\n\n // Rebuild stops\n while (this._shadeGradient.firstChild) this._shadeGradient.removeChild(this._shadeGradient.firstChild);\n const stop1 = document.createElementNS('http://www.w3.org/2000/svg', 'stop');\n stop1.setAttribute('offset', '0%');\n stop1.setAttribute('stop-color', this.shadeColor);\n stop1.setAttribute('stop-opacity', this.shadeOpacity);\n const stop2 = document.createElementNS('http://www.w3.org/2000/svg', 'stop');\n stop2.setAttribute('offset', '100%');\n stop2.setAttribute('stop-color', this.shadeColor);\n stop2.setAttribute('stop-opacity', '0');\n this._shadeGradient.appendChild(stop1);\n this._shadeGradient.appendChild(stop2);\n\n // Create or update shade rect\n if (!this._shadeRect) {\n this._shadeRect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');\n this._shadeRect.setAttribute('pointer-events', 'none');\n }\n this._shadeRect.setAttribute('x', 0);\n this._shadeRect.setAttribute('y', 0);\n this._shadeRect.setAttribute('width', this.width);\n this._shadeRect.setAttribute('height', this.height);\n this._shadeRect.setAttribute('fill', `url(#${gradId})`);\n this._shadeRect.setAttribute('rx', 2);\n\n // Insert after rough element\n if (this._shadeRect.parentNode === this.group) this.group.removeChild(this._shadeRect);\n if (this.element && this.element.nextSibling) {\n this.group.insertBefore(this._shadeRect, this.element.nextSibling);\n } else {\n this.group.appendChild(this._shadeRect);\n }\n }\n\n _updateLabelElement() {\n if (!this.label) {\n // Remove label element if label is empty\n if (this.labelElement && this.labelElement.parentNode === this.group) {\n this.group.removeChild(this.labelElement);\n this.labelElement = null;\n }\n if (this._labelBg && this._labelBg.parentNode === this.group) {\n this.group.removeChild(this._labelBg);\n this._labelBg = null;\n }\n return;\n }\n\n if (!this.labelElement) {\n this.labelElement = document.createElementNS('http://www.w3.org/2000/svg', 'text');\n this.labelElement.setAttribute('class', 'shape-label');\n this.labelElement.setAttribute('pointer-events', 'none');\n }\n\n // Position at center of rectangle\n this.labelElement.setAttribute('x', this.width / 2);\n this.labelElement.setAttribute('y', this.height / 2);\n this.labelElement.setAttribute('text-anchor', 'middle');\n this.labelElement.setAttribute('dominant-baseline', 'central');\n this.labelElement.setAttribute('fill', this.labelColor);\n this.labelElement.setAttribute('font-size', this.labelFontSize);\n this.labelElement.setAttribute('font-family', 'lixFont, sans-serif');\n this.labelElement.textContent = this.label;\n\n // Background padding rect behind text (like arrows have) \u2014 skippable\n // via labelBg:false for dense multi-row content (e.g. mermaid ER\n // attribute rows) where a pill backdrop looks out of place and\n // doesn't match the SVG preview.\n if (!this.labelBg) {\n if (this._labelBg && this._labelBg.parentNode === this.group) {\n this.group.removeChild(this._labelBg);\n this._labelBg = null;\n }\n if (this.labelElement.parentNode === this.group) this.group.removeChild(this.labelElement);\n this.group.appendChild(this.labelElement);\n return;\n }\n const canvasBg = window.getComputedStyle(svg).backgroundColor || '#000';\n if (!this._labelBg) {\n this._labelBg = document.createElementNS('http://www.w3.org/2000/svg', 'rect');\n this._labelBg.setAttribute('pointer-events', 'none');\n }\n this._labelBg.setAttribute('fill', canvasBg);\n const hPadding = 6;\n const vPadding = 2;\n const charWidth = this.labelFontSize * 0.6;\n const bgW = this.label.length * charWidth + hPadding * 2;\n const bgH = this.labelFontSize + vPadding * 2;\n this._labelBg.setAttribute('x', this.width / 2 - bgW / 2);\n this._labelBg.setAttribute('y', this.height / 2 - bgH / 2);\n this._labelBg.setAttribute('width', bgW);\n this._labelBg.setAttribute('height', bgH);\n this._labelBg.setAttribute('rx', 3);\n\n // Re-append bg then text on top\n if (this._labelBg.parentNode === this.group) this.group.removeChild(this._labelBg);\n if (this.labelElement.parentNode === this.group) this.group.removeChild(this.labelElement);\n this.group.appendChild(this._labelBg);\n this.group.appendChild(this.labelElement);\n }\n\n _setupLabelDblClick() {\n this.group.addEventListener('dblclick', (e) => {\n e.stopPropagation();\n e.preventDefault();\n this.startLabelEdit();\n });\n }\n\n startLabelEdit() {\n if (this._isEditingLabel) return;\n this._isEditingLabel = true;\n\n // Hide label element during editing\n if (this.labelElement) {\n this.labelElement.setAttribute('visibility', 'hidden');\n }\n\n // Get shape's screen position via CTM\n const ctm = this.group.getScreenCTM();\n if (!ctm) { this._isEditingLabel = false; return; }\n\n // Map the shape corners to screen coords\n const pt1 = svg.createSVGPoint();\n pt1.x = 0; pt1.y = 0;\n const screenTL = pt1.matrixTransform(ctm);\n const pt2 = svg.createSVGPoint();\n pt2.x = this.width; pt2.y = this.height;\n const screenBR = pt2.matrixTransform(ctm);\n\n const screenW = Math.abs(screenBR.x - screenTL.x);\n const screenH = Math.abs(screenBR.y - screenTL.y);\n const screenX = Math.min(screenTL.x, screenBR.x);\n const screenY = Math.min(screenTL.y, screenBR.y);\n\n // Create HTML overlay\n const overlay = document.createElement('div');\n overlay.className = 'shape-label-editor';\n overlay.style.cssText = `\n position: fixed; z-index: 10000;\n left: ${screenX}px; top: ${screenY}px;\n width: ${screenW}px; height: ${screenH}px;\n display: flex; align-items: center; justify-content: center;\n pointer-events: auto;\n `;\n\n const canvasBg = window.getComputedStyle(svg).backgroundColor || '#000';\n const input = document.createElement('div');\n input.setAttribute('contenteditable', 'true');\n input.style.cssText = `\n max-width: ${screenW - 8}px; min-width: 30px; min-height: 20px;\n background: ${canvasBg}; border: none;\n outline: none; padding: 2px 6px;\n color: ${this.labelColor}; font-size: ${Math.max(12, this.labelFontSize * (screenW / Math.max(this.width, 1)))}px;\n font-family: lixFont, sans-serif; text-align: center;\n white-space: pre-wrap; word-break: break-word;\n cursor: text;\n `;\n if (this.label) {\n input.textContent = this.label;\n } else {\n input.innerHTML = '&nbsp;';\n }\n\n overlay.appendChild(input);\n document.body.appendChild(overlay);\n\n // Focus and select all text\n setTimeout(() => {\n input.focus();\n const sel = window.getSelection();\n const range = document.createRange();\n range.selectNodeContents(input);\n sel.removeAllRanges();\n sel.addRange(range);\n }, 10);\n\n const finishEdit = () => {\n const newText = input.textContent.trim().replace(/\\u00A0/g, '');\n this.label = newText;\n this._isEditingLabel = false;\n\n if (overlay.parentNode) overlay.parentNode.removeChild(overlay);\n if (this.labelElement) this.labelElement.setAttribute('visibility', 'visible');\n this.draw();\n };\n\n input.addEventListener('blur', finishEdit);\n input.addEventListener('keydown', (e) => {\n e.stopPropagation();\n if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); input.blur(); }\n if (e.key === 'Escape') { input.textContent = this.label; input.blur(); }\n });\n input.addEventListener('pointerdown', (e) => e.stopPropagation());\n input.addEventListener('pointermove', (e) => e.stopPropagation());\n input.addEventListener('pointerup', (e) => e.stopPropagation());\n }\n\n setLabel(text, color, fontSize) {\n this.label = text || '';\n if (color) this.labelColor = color;\n if (fontSize) this.labelFontSize = fontSize;\n this.draw();\n }\n\n setDrawingState(isDrawing) {\n this.isBeingDrawn = isDrawing;\n }\n\n getRotatedCursor(direction, angle) {\n const directions = ['ns', 'nesw', 'ew', 'nwse'];\n angle = angle % 360;\n if (angle < 0) angle += 360;\n\n const baseDirectionMap = {\n '0': 'nwse', '1': 'nesw', \n '2': 'nesw', '3': 'nwse', \n '4': 'ns', '5': 'ns', \n '6': 'ew', '7': 'ew' \n };\n const baseDirection = baseDirectionMap[direction];\n let effectiveAngle = angle; \n if (baseDirection === 'nesw') {\n effectiveAngle += 45;\n } else if (baseDirection === 'ew') {\n effectiveAngle += 90;\n } else if (baseDirection === 'nwse') {\n effectiveAngle += 135;\n }\n effectiveAngle = effectiveAngle % 360;\n if (effectiveAngle < 0) effectiveAngle += 360;\n const index = Math.round(effectiveAngle / 45) % 4; \n let finalIndex;\n if (effectiveAngle >= 337.5 || effectiveAngle < 22.5) finalIndex = 0; \n else if (effectiveAngle >= 22.5 && effectiveAngle < 67.5) finalIndex = 1; \n else if (effectiveAngle >= 67.5 && effectiveAngle < 112.5) finalIndex = 2; \n else if (effectiveAngle >= 112.5 && effectiveAngle < 157.5) finalIndex = 3;\n else if (effectiveAngle >= 157.5 && effectiveAngle < 202.5) finalIndex = 0; \n else if (effectiveAngle >= 202.5 && effectiveAngle < 247.5) finalIndex = 1; \n else if (effectiveAngle >= 247.5 && effectiveAngle < 292.5) finalIndex = 2; \n else if (effectiveAngle >= 292.5 && effectiveAngle < 337.5) finalIndex = 3; \n else finalIndex = 0; \n return directions[finalIndex];\n }\n addAnchors() {\n const zoom = window.currentZoom || 1;\n const anchorSize = 10 / zoom;\n const anchorStrokeWidth = 2;\n const self = this;\n const expandedX = -this.selectionPadding; \n const expandedY = -this.selectionPadding; \n const expandedWidth = this.width + 2 * this.selectionPadding;\n const expandedHeight = this.height + 2 * this.selectionPadding;\n\n const positions = [\n { x: expandedX, y: expandedY }, \n { x: expandedX + expandedWidth, y: expandedY }, \n { x: expandedX, y: expandedY + expandedHeight }, \n { x: expandedX + expandedWidth, y: expandedY + expandedHeight }, \n { x: expandedX + expandedWidth / 2, y: expandedY }, \n { x: expandedX + expandedWidth / 2, y: expandedY + expandedHeight }, \n { x: expandedX, y: expandedHeight / 2 + expandedY }, \n { x: expandedX + expandedWidth, y: expandedHeight / 2 + expandedY } \n ];\n\n const outlinePoints = [\n [positions[0].x, positions[0].y],\n [positions[1].x, positions[1].y],\n [positions[3].x, positions[3].y],\n [positions[2].x, positions[2].y],\n [positions[0].x, positions[0].y]\n ];\n\n this.anchors.forEach(anchor => {\n if (anchor.parentNode === this.group) {\n this.group.removeChild(anchor);\n }\n });\n if (this.rotationAnchor && this.rotationAnchor.parentNode === this.group) {\n this.group.removeChild(this.rotationAnchor);\n }\n if (this.selectionOutline && this.selectionOutline.parentNode === this.group) {\n this.group.removeChild(this.selectionOutline);\n }\n\n this.anchors = [];\n const anchorDirections = {\n 0: 'nwse', \n 1: 'nesw', \n 2: 'nesw', \n 3: 'nwse', \n 4: 'ns', \n 5: 'ns', \n 6: 'ew', \n 7: 'ew' \n };\n\n positions.forEach((pos, i) => {\n const anchor = document.createElementNS('http://www.w3.org/2000/svg', 'rect');\n anchor.setAttribute('x', pos.x - anchorSize / 2);\n anchor.setAttribute('y', pos.y - anchorSize / 2);\n anchor.setAttribute('width', anchorSize);\n anchor.setAttribute('height', anchorSize);\n anchor.setAttribute('class', 'anchor');\n anchor.setAttribute('data-index', i);\n anchor.setAttribute('fill', '#121212');\n anchor.setAttribute('stroke', '#5B57D1');\n anchor.setAttribute('stroke-width', anchorStrokeWidth);\n anchor.setAttribute('vector-effect', 'non-scaling-stroke');\n anchor.setAttribute('style', 'pointer-events: all;');\n\n anchor.addEventListener('mouseover', function () {\n const index = this.getAttribute('data-index');\n const baseDirection = anchorDirections[index];\n const rotatedCursor = self.getRotatedCursor(index, self.rotation); \n svg.style.cursor = rotatedCursor + '-resize';\n });\n\n anchor.addEventListener('mouseout', function () {\n if (!isResizingShapeSquare && !isDraggingShapeSquare && !isRotatingShapeSquare) {\n svg.style.cursor = 'default';\n }\n });\n\n this.group.appendChild(anchor);\n this.anchors[i] = anchor;\n });\n const rotationAnchorPos = { x: expandedX + expandedWidth / 2, y: expandedY - 30 / zoom };\n this.rotationAnchor = document.createElementNS('http://www.w3.org/2000/svg', 'circle');\n this.rotationAnchor.setAttribute('cx', rotationAnchorPos.x);\n this.rotationAnchor.setAttribute('cy', rotationAnchorPos.y);\n this.rotationAnchor.setAttribute('r', 8 / zoom);\n this.rotationAnchor.setAttribute('class', 'rotate-anchor');\n this.rotationAnchor.setAttribute('fill', '#121212');\n this.rotationAnchor.setAttribute('stroke', '#5B57D1');\n this.rotationAnchor.setAttribute('stroke-width', anchorStrokeWidth);\n this.rotationAnchor.setAttribute('vector-effect', 'non-scaling-stroke');\n this.rotationAnchor.setAttribute('style', 'pointer-events: all;');\n this.group.appendChild(this.rotationAnchor);\n\n this.rotationAnchor.addEventListener('mouseover', function () {\n if (!isResizingShapeSquare && !isDraggingShapeSquare && !isRotatingShapeSquare) {\n svg.style.cursor = 'grab';\n }\n });\n this.rotationAnchor.addEventListener('mouseout', function () {\n if (!isResizingShapeSquare && !isDraggingShapeSquare && !isRotatingShapeSquare) {\n svg.style.cursor = 'default';\n }\n });\n\n const pointsAttr = outlinePoints.map(p => p.join(',')).join(' ');\n const outline = document.createElementNS('http://www.w3.org/2000/svg', 'polyline');\n outline.setAttribute('points', pointsAttr);\n outline.setAttribute('fill', 'none');\n outline.setAttribute('stroke', '#5B57D1');\n outline.setAttribute('stroke-width', 1.5);\n outline.setAttribute('stroke-dasharray', '4 2');\n outline.setAttribute('vector-effect', 'non-scaling-stroke');\n outline.setAttribute('style', 'pointer-events: none;');\n this.group.appendChild(outline);\n this.selectionOutline = outline;\n\n // Show relevant sidebar\n disableAllSideBars();\n squareSideBar.classList.remove(\"hidden\");\n if (window.__showSidebarForShape) window.__showSidebarForShape('rectangle');\n this.updateSidebar();\n }\n\n updateSelectionControls() {\n if (!this.selectionOutline || this.anchors.length === 0) return;\n\n const zoom = window.currentZoom || 1;\n const anchorSize = 10 / zoom;\n const expandedX = -this.selectionPadding;\n const expandedY = -this.selectionPadding;\n const expandedWidth = this.width + 2 * this.selectionPadding;\n const expandedHeight = this.height + 2 * this.selectionPadding;\n\n const positions = [\n { x: expandedX, y: expandedY },\n { x: expandedX + expandedWidth, y: expandedY },\n { x: expandedX, y: expandedY + expandedHeight },\n { x: expandedX + expandedWidth, y: expandedY + expandedHeight },\n { x: expandedX + expandedWidth / 2, y: expandedY },\n { x: expandedX + expandedWidth / 2, y: expandedY + expandedHeight },\n { x: expandedX, y: expandedHeight / 2 + expandedY },\n { x: expandedX + expandedWidth, y: expandedHeight / 2 + expandedY }\n ];\n\n // Update anchor positions\n positions.forEach((pos, i) => {\n if (this.anchors[i]) {\n this.anchors[i].setAttribute('x', pos.x - anchorSize / 2);\n this.anchors[i].setAttribute('y', pos.y - anchorSize / 2);\n }\n });\n\n // Update outline\n const outlinePoints = [\n [positions[0].x, positions[0].y],\n [positions[1].x, positions[1].y],\n [positions[3].x, positions[3].y],\n [positions[2].x, positions[2].y],\n [positions[0].x, positions[0].y]\n ];\n this.selectionOutline.setAttribute('points', outlinePoints.map(p => p.join(',')).join(' '));\n\n // Update rotation anchor\n if (this.rotationAnchor) {\n this.rotationAnchor.setAttribute('cx', expandedX + expandedWidth / 2);\n this.rotationAnchor.setAttribute('cy', expandedY - 30 / zoom);\n }\n }\n\n removeSelection() {\n // Remove selection elements (anchors, outline, rotation anchor) from the group\n this.anchors.forEach(anchor => {\n if (anchor.parentNode === this.group) {\n this.group.removeChild(anchor);\n }\n });\n if (this.rotationAnchor && this.rotationAnchor.parentNode === this.group) {\n this.group.removeChild(this.rotationAnchor);\n }\n if (this.selectionOutline && this.selectionOutline.parentNode === this.group) {\n this.group.removeChild(this.selectionOutline);\n }\n this.anchors = [];\n this.rotationAnchor = null;\n this.selectionOutline = null;\n this.isSelected = false;\n }\n\n contains(x, y) {\n if (!this.element) return false;\n // x/y are already canvas (viewBox) coordinates. getCTM() operates in\n // viewport coordinates and made hit testing drift after pan/zoom.\n const centerX = this.width / 2;\n const centerY = this.height / 2;\n const angle = -(this.rotation || 0) * Math.PI / 180;\n const translatedX = x - this.x;\n const translatedY = y - this.y;\n const dx = translatedX - centerX;\n const dy = translatedY - centerY;\n const localX = dx * Math.cos(angle) - dy * Math.sin(angle) + centerX;\n const localY = dx * Math.sin(angle) + dy * Math.cos(angle) + centerY;\n const tolerance = 5;\n return localX >= -tolerance && localX <= this.width + tolerance &&\n localY >= -tolerance && localY <= this.height + tolerance;\n }\n\n // Helper to check if a point is near an anchor\n isNearAnchor(x, y) {\n if (!this.isSelected) return null;\n const buffer = 10; \n const anchorSize = 10; \n\n // Iterate through anchors\n for (let i = 0; i < this.anchors.length; i++) {\n const anchor = this.anchors[i];\n const anchorLocalX = parseFloat(anchor.getAttribute('x')) + anchorSize / 2;\n const anchorLocalY = parseFloat(anchor.getAttribute('y')) + anchorSize / 2;\n const svgPoint = svg.createSVGPoint();\n svgPoint.x = anchorLocalX;\n svgPoint.y = anchorLocalY;\n const transformedPoint = svgPoint.matrixTransform(this.group.getCTM());\n const anchorLeft = transformedPoint.x - anchorSize/2 - buffer;\n const anchorRight = transformedPoint.x + anchorSize/2 + buffer;\n const anchorTop = transformedPoint.y - anchorSize/2 - buffer;\n const anchorBottom = transformedPoint.y + anchorSize/2 + buffer;\n if (x >= anchorLeft && x <= anchorRight && y >= anchorTop && y <= anchorBottom) {\n return { type: 'resize', index: i };\n }\n }\n\n // Check rotation anchor\n if (this.rotationAnchor) {\n const rotateAnchorLocalX = parseFloat(this.rotationAnchor.getAttribute('cx'));\n const rotateAnchorLocalY = parseFloat(this.rotationAnchor.getAttribute('cy'));\n const svgPoint = svg.createSVGPoint();\n svgPoint.x = rotateAnchorLocalX;\n svgPoint.y = rotateAnchorLocalY;\n const transformedPoint = svgPoint.matrixTransform(this.group.getCTM());\n const rotateAnchorRadius = parseFloat(this.rotationAnchor.getAttribute('r'));\n const distSq = (x - transformedPoint.x)**2 + (y - transformedPoint.y)**2;\n if (distSq <= (rotateAnchorRadius + buffer)**2) {\n return { type: 'rotate' };\n }\n }\n\n return null;\n }\n\n\nmove(dx, dy) {\n this.x += dx;\n this.y += dy;\n\n // Fast path: just update the transform \u2014 no need to rebuild RoughJS element\n const rotateCenterX = this.width / 2;\n const rotateCenterY = this.height / 2;\n this.group.setAttribute('transform', `translate(${this.x}, ${this.y}) rotate(${this.rotation}, ${rotateCenterX}, ${rotateCenterY})`);\n\n this.updateAttachedArrows();\n\n // Only update frame containment if we're actively dragging the shape itself\n // and not being moved by a parent frame\n if (isDraggingShapeSquare && !this.isBeingMovedByFrame) {\n this.updateFrameContainment();\n }\n}\n\nupdateFrameContainment() {\n // Don't update if we're being moved by a frame\n if (this.isBeingMovedByFrame) return;\n \n let targetFrame = null;\n \n // Find which frame this shape is over\n shapes.forEach(shape => {\n if (shape.shapeName === 'frame' && shape.isShapeInFrame(this)) {\n targetFrame = shape;\n }\n });\n \n // If we have a parent frame and we're being dragged, temporarily remove clipping\n if (this.parentFrame && isDraggingShapeSquare) {\n this.parentFrame.temporarilyRemoveFromFrame(this);\n }\n \n // Update frame highlighting\n if (hoveredFrame && hoveredFrame !== targetFrame) {\n hoveredFrame.removeHighlight();\n }\n \n if (targetFrame && targetFrame !== hoveredFrame) {\n targetFrame.highlightFrame();\n }\n \n hoveredFrame = targetFrame;\n}\n\n updatePosition(anchorIndex, newMouseX, newMouseY) {\n const CTM = this.group.getCTM();\n if (!CTM) return;\n const inverseCTM = CTM.inverse();\n const svgPoint = svg.createSVGPoint();\n svgPoint.x = newMouseX;\n svgPoint.y = newMouseY;\n const localMouse = svgPoint.matrixTransform(inverseCTM);\n\n const oldW = this.width;\n const oldH = this.height;\n\n // Determine fixed point in old local coords and compute raw new dimensions\n let fixedOldX, fixedOldY, rawW, rawH;\n switch (anchorIndex) {\n case 0: fixedOldX = oldW; fixedOldY = oldH; rawW = oldW - localMouse.x; rawH = oldH - localMouse.y; break;\n case 1: fixedOldX = 0; fixedOldY = oldH; rawW = localMouse.x; rawH = oldH - localMouse.y; break;\n case 2: fixedOldX = oldW; fixedOldY = 0; rawW = oldW - localMouse.x; rawH = localMouse.y; break;\n case 3: fixedOldX = 0; fixedOldY = 0; rawW = localMouse.x; rawH = localMouse.y; break;\n case 4: fixedOldX = 0; fixedOldY = oldH; rawW = oldW; rawH = oldH - localMouse.y; break;\n case 5: fixedOldX = 0; fixedOldY = 0; rawW = oldW; rawH = localMouse.y; break;\n case 6: fixedOldX = oldW; fixedOldY = 0; rawW = oldW - localMouse.x; rawH = oldH; break;\n case 7: fixedOldX = 0; fixedOldY = 0; rawW = localMouse.x; rawH = oldH; break;\n }\n\n // Get world position of the fixed point using current CTM\n const fp = svg.createSVGPoint();\n fp.x = fixedOldX;\n fp.y = fixedOldY;\n const fixedWorld = fp.matrixTransform(CTM);\n\n // Handle negative dimensions (dragged past opposite edge)\n const newW = Math.abs(rawW);\n const newH = Math.abs(rawH);\n\n // Fixed point in new local coords (flips if dimension went negative)\n const fixedNewX = fixedOldX === 0 ? (rawW >= 0 ? 0 : newW) : (rawW >= 0 ? newW : 0);\n const fixedNewY = fixedOldY === 0 ? (rawH >= 0 ? 0 : newH) : (rawH >= 0 ? newH : 0);\n\n // Solve for new x, y so the fixed corner stays in place\n // Transform: translate(x, y) rotate(\u03B8, newW/2, newH/2)\n const rad = this.rotation * Math.PI / 180;\n const cosR = Math.cos(rad);\n const sinR = Math.sin(rad);\n const ncx = newW / 2;\n const ncy = newH / 2;\n const dx = fixedNewX - ncx;\n const dy = fixedNewY - ncy;\n const rotX = ncx + dx * cosR - dy * sinR;\n const rotY = ncy + dx * sinR + dy * cosR;\n\n this.x = fixedWorld.x - rotX;\n this.y = fixedWorld.y - rotY;\n this.width = newW;\n this.height = newH;\n\n this.updateAttachedArrows();\n }\n\n updateAttachedArrows() {\n shapes.forEach(shape => {\n if (shape && shape.shapeName === 'arrow' && typeof shape.updateAttachments === 'function') {\n \n if ((shape.attachedToStart && shape.attachedToStart.shape === this) ||\n (shape.attachedToEnd && shape.attachedToEnd.shape === this)) {\n shape.updateAttachments();\n }\n }\n });\n } \n\n rotate(angle) {\n angle = angle % 360;\n if (angle < 0) angle += 360;\n this.rotation = angle;\n }\n\n // Method to update the sidebar based on the shape's current options\n // No-op: React sidebar handles UI updates via Zustand store\n updateSidebar() {}\n}\n\nexport { Rectangle };\n"],
5
+ "mappings": ";;;AAKA,IAAM,KAAK,MAAM,IAAI,GAAG;AACxB,IAAI,wBAAwB;AAC5B,IAAI,wBAAwB;AAC5B,IAAI,wBAAwB;AAC5B,IAAI,eAAe;AACnB,IAAM,qBAAqB,SAAS,iBAAiB,mBAAmB;AACxE,IAAM,+BAA+B,SAAS,iBAAiB,uBAAuB;AACtF,IAAM,mBAAmB,SAAS,iBAAiB,sBAAsB;AACzE,IAAM,6BAA6B,SAAS,iBAAiB,wBAAwB;AACrF,IAAM,0BAA0B,SAAS,iBAAiB,qBAAqB;AAM/E,IAAM,YAAN,MAAgB;AAAA,EACZ,YAAY,GAAG,GAAG,OAAO,QAAQ,UAAU,CAAC,GAAG;AAC3C,SAAK,IAAI;AACT,SAAK,IAAI;AACT,SAAK,QAAQ;AACb,SAAK,SAAS;AACd,SAAK,UAAU;AAAA,MACX,WAAW;AAAA,MACX,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,MAAM;AAAA,MACN,WAAW;AAAA,MACX,iBAAiB;AAAA,MACjB,GAAG;AAAA,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,aAAa,OAAO,KAAK,IAAI,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,KAAK,MAAM,KAAK,OAAO,IAAI,GAAK,CAAC;AAC/F,SAAK,MAAM,aAAa,MAAM,KAAK,OAAO;AAG1C,SAAK,QAAQ,QAAQ,SAAS;AAC9B,SAAK,eAAe;AACpB,SAAK,aAAa,QAAQ,cAAc;AACxC,SAAK,gBAAgB,QAAQ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,cAAc,UAAU,MAAO;AAC7D,gBAAM,kBAAkB;AAAA,QAC5B;AAAA,MACJ;AAAA,IACJ,CAAC;AAAA,EACL;AAAA,EAEA,OAAO,OAAO;AACV,YAAQ,QAAQ;AAChB,QAAI,QAAQ,EAAG,UAAS;AACxB,SAAK,WAAW;AAAA,EACpB;AAAA;AAAA;AAAA,EAIA,gBAAgB;AAAA,EAAC;AACrB;",
6
6
  "names": []
7
7
  }
@@ -5,7 +5,7 @@ import {
5
5
  handleMouseUpIcon,
6
6
  startDrag,
7
7
  stopDrag
8
- } from "./chunk-VN62KLOC.js";
8
+ } from "./chunk-X6AHYG5J.js";
9
9
  import "./chunk-BZE4CEBG.js";
10
10
  import "./chunk-L5OARZJ7.js";
11
11
  export {
@@ -15,4 +15,4 @@ export {
15
15
  startDrag,
16
16
  stopDrag
17
17
  };
18
- //# sourceMappingURL=iconTool-GPZ7O7NH.js.map
18
+ //# sourceMappingURL=iconTool-YD4GRXAP.js.map
@@ -3,7 +3,7 @@ import {
3
3
  handleMouseDownImage,
4
4
  handleMouseMoveImage,
5
5
  handleMouseUpImage
6
- } from "./chunk-URB6MY46.js";
6
+ } from "./chunk-7DC26DDU.js";
7
7
  import "./chunk-DNAG7ML6.js";
8
8
  import "./chunk-BZE4CEBG.js";
9
9
  import "./chunk-L5OARZJ7.js";
@@ -12,4 +12,4 @@ export {
12
12
  handleMouseMoveImage,
13
13
  handleMouseUpImage
14
14
  };
15
- //# sourceMappingURL=imageTool-D5R4XGEU.js.map
15
+ //# sourceMappingURL=imageTool-WJVV4WI3.js.map
@@ -431,7 +431,7 @@ function useSketchEngine(svgRef, ready = true) {
431
431
  setZoom: (zoom) => useSketchStore_default.setState({ zoom }),
432
432
  getState: () => useSketchStore_default.getState()
433
433
  };
434
- const { SketchEngine } = await import("./SketchEngine-B7XCB3BS.js");
434
+ const { SketchEngine } = await import("./SketchEngine-RFEF27MN.js");
435
435
  if (cancelled) return;
436
436
  const engine = new SketchEngine(svgRef.current);
437
437
  await engine.init();
@@ -4542,7 +4542,7 @@ function LixScriptModal() {
4542
4542
  }
4543
4543
  ),
4544
4544
  /* @__PURE__ */ jsx24("div", { className: "mx-auto mb-5 w-12 h-12 rounded-xl bg-accent-blue/10 border border-accent-blue/25 flex items-center justify-center", children: /* @__PURE__ */ jsx24("i", { className: "bx bx-plug text-2xl text-accent-blue" }) }),
4545
- /* @__PURE__ */ jsx24("span", { className: "inline-flex px-2.5 py-1 rounded-full bg-[#a97852]/15 text-[#8f6244] text-[10px] font-semibold uppercase tracking-wider", children: "Coming soon" }),
4545
+ /* @__PURE__ */ jsx24("span", { className: "inline-flex px-2.5 py-1 rounded-full bg-accent-blue/10 text-accent-blue text-[10px] font-semibold uppercase tracking-wider", children: "Coming soon" }),
4546
4546
  /* @__PURE__ */ jsx24("h2", { id: "lixscript-coming-soon-title", className: "mt-4 text-text-primary text-xl font-medium", children: "LixScript MCP" }),
4547
4547
  /* @__PURE__ */ jsx24("p", { className: "mt-2 text-text-muted text-sm leading-relaxed", children: "LixScript is being prepared as the programmable MCP interface for LixSketch. This workspace panel will become available with the supported platform integration." })
4548
4548
  ]
@@ -4741,7 +4741,7 @@ var _saveScene = null;
4741
4741
  var _loadScene = null;
4742
4742
  async function ensureSceneSerializer() {
4743
4743
  if (_saveScene && _loadScene) return;
4744
- const m = await import("./SceneSerializer-YK44QZ6B.js");
4744
+ const m = await import("./SceneSerializer-IQGUAK45.js");
4745
4745
  _saveScene = m.saveScene;
4746
4746
  _loadScene = m.loadScene;
4747
4747
  }