@elixpo/lixsketch 5.6.4 → 5.6.6

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 (160) hide show
  1. package/dist/mcp/index.js +5 -1
  2. package/dist/mcp/index.js.map +2 -2
  3. package/dist/mcp/stdio.js +5 -1
  4. package/dist/mcp/stdio.js.map +2 -2
  5. package/dist/react/{AIRenderer-SRF7LU5K.js → AIRenderer-R5M2CIDO.js} +13 -6
  6. package/dist/react/AIRenderer-R5M2CIDO.js.map +7 -0
  7. package/dist/react/Circle-HMM5PKJ2.js +10 -0
  8. package/dist/react/{CopyPaste-YUDZ6DHY.js → CopyPaste-P6G35CXO.js} +11 -10
  9. package/dist/react/{CopyPaste-YUDZ6DHY.js.map → CopyPaste-P6G35CXO.js.map} +1 -1
  10. package/dist/react/{EventDispatcher-7LAK7GQ7.js → EventDispatcher-M5B4EWHJ.js} +216 -63
  11. package/dist/react/EventDispatcher-M5B4EWHJ.js.map +7 -0
  12. package/dist/react/Frame-QEUEYITT.js +11 -0
  13. package/dist/react/{FreehandStroke-U6GYZOM4.js → FreehandStroke-WXIJKD5I.js} +2 -2
  14. package/dist/react/{GraphEngine-MM6ALA2N.js → GraphEngine-XH3RPYO4.js} +9 -2
  15. package/dist/react/GraphEngine-XH3RPYO4.js.map +7 -0
  16. package/dist/react/IconShape-NHJE4YBY.js +10 -0
  17. package/dist/react/ImageShape-33VCMSDP.js +10 -0
  18. package/dist/react/Line-A6FE232Q.js +10 -0
  19. package/dist/react/{LixScriptParser-JYWJX375.js → LixScriptParser-YS3ZOTGS.js} +6 -2
  20. package/dist/react/LixScriptParser-YS3ZOTGS.js.map +7 -0
  21. package/dist/react/{MermaidFlowchartRenderer-PQEC4TMI.js → MermaidFlowchartRenderer-EL3Q2MNW.js} +6 -2
  22. package/dist/react/MermaidFlowchartRenderer-EL3Q2MNW.js.map +7 -0
  23. package/dist/react/MermaidSequenceParser-DBYXW23P.js +8 -0
  24. package/dist/react/{MermaidSequenceRenderer-KCUHO7UI.js → MermaidSequenceRenderer-K4KHHEVC.js} +10 -3
  25. package/dist/react/MermaidSequenceRenderer-K4KHHEVC.js.map +7 -0
  26. package/dist/react/{MermaidStructuredRenderer-W7UKN7BM.js → MermaidStructuredRenderer-6LN3WISP.js} +7 -2
  27. package/dist/react/MermaidStructuredRenderer-6LN3WISP.js.map +7 -0
  28. package/dist/react/Rectangle-4U4CD2ER.js +10 -0
  29. package/dist/react/{SceneSerializer-SG6SJN5X.js → SceneSerializer-JEYTYXZQ.js} +120 -46
  30. package/dist/react/SceneSerializer-JEYTYXZQ.js.map +7 -0
  31. package/dist/react/{Selection-2TSH3J6P.js → Selection-23MOLHEI.js} +4 -4
  32. package/dist/react/{SketchEngine-UD2XV2KT.js → SketchEngine-OPJON7TD.js} +26 -26
  33. package/dist/react/{UndoRedo-IN4SXDG6.js → UndoRedo-QVNRI5OB.js} +8 -2
  34. package/dist/react/{arrowTool-OYDWJGQK.js → arrowTool-VH3PJPDM.js} +3 -3
  35. package/dist/react/{chunk-LSHZYN77.js → chunk-2DZHO67H.js} +2 -2
  36. package/dist/react/{chunk-XOWNCYE4.js → chunk-5NHJJJBZ.js} +3 -3
  37. package/dist/react/chunk-6AIFXYV6.js +31 -0
  38. package/dist/react/chunk-6AIFXYV6.js.map +7 -0
  39. package/dist/react/{chunk-K5RY4EV7.js → chunk-6GPWSPJF.js} +9 -5
  40. package/dist/react/{chunk-K5RY4EV7.js.map → chunk-6GPWSPJF.js.map} +2 -2
  41. package/dist/react/{chunk-ASBC5G35.js → chunk-B6CYUZC4.js} +2 -2
  42. package/dist/react/{chunk-OP56XPWF.js → chunk-DNFPTVIP.js} +2 -2
  43. package/dist/react/{chunk-XYUFEIZR.js → chunk-DWEFPKDO.js} +2 -2
  44. package/dist/react/{chunk-GQUZPON4.js → chunk-F56XUE5S.js} +4 -4
  45. package/dist/react/{chunk-7CM5XQDN.js → chunk-G3DJQY65.js} +20 -36
  46. package/dist/react/chunk-G3DJQY65.js.map +7 -0
  47. package/dist/react/{chunk-LJR7EVW2.js → chunk-JEGLUNBC.js} +3 -3
  48. package/dist/react/{chunk-6GPEWDRB.js → chunk-M7GAB24F.js} +52 -6
  49. package/dist/react/chunk-M7GAB24F.js.map +7 -0
  50. package/dist/react/{chunk-VQVEPJSA.js → chunk-MHV5P6TS.js} +2 -1
  51. package/dist/react/chunk-MHV5P6TS.js.map +7 -0
  52. package/dist/react/{chunk-PXFPPO3R.js → chunk-NH3NVSWT.js} +18 -2
  53. package/dist/react/chunk-NH3NVSWT.js.map +7 -0
  54. package/dist/react/{chunk-XFL4R5ZF.js → chunk-OK4ROGMM.js} +16 -35
  55. package/dist/react/chunk-OK4ROGMM.js.map +7 -0
  56. package/dist/react/{chunk-APTOPAOY.js → chunk-SSFEN5CY.js} +3 -3
  57. package/dist/react/{chunk-RGMDWLRJ.js → chunk-UEL2G6D2.js} +3 -3
  58. package/dist/react/{chunk-M6TMN76K.js → chunk-ULPIHUVC.js} +3 -3
  59. package/dist/react/{chunk-FETTJLCV.js → chunk-VZPH7OAM.js} +14 -22
  60. package/dist/react/chunk-VZPH7OAM.js.map +7 -0
  61. package/dist/react/{chunk-TKXKJNTX.js → chunk-W7XUY4GR.js} +16 -19
  62. package/dist/react/chunk-W7XUY4GR.js.map +7 -0
  63. package/dist/react/{chunk-EOURRJ55.js → chunk-XSE4HQ2D.js} +2 -2
  64. package/dist/react/{chunk-K5BG5MHY.js → chunk-ZNZAICWY.js} +36 -60
  65. package/dist/react/chunk-ZNZAICWY.js.map +7 -0
  66. package/dist/react/{circleTool-LDKGZALF.js → circleTool-2UODOBCV.js} +4 -4
  67. package/dist/react/{codeTool-4YZO5W7J.js → codeTool-F4RV7SAI.js} +4 -4
  68. package/dist/react/{frameTool-MXNJEXQQ.js → frameTool-NTGA5BI6.js} +4 -4
  69. package/dist/react/{freehandTool-26D3FOOX.js → freehandTool-L55EUB5C.js} +4 -4
  70. package/dist/react/{iconTool-46O5VEUX.js → iconTool-KQQBLGR3.js} +4 -4
  71. package/dist/react/{imageTool-P2RWZRHO.js → imageTool-LDJ45AD7.js} +4 -4
  72. package/dist/react/index.js +148 -37
  73. package/dist/react/index.js.map +4 -4
  74. package/dist/react/{lineTool-ZMR27U5L.js → lineTool-CSAFD7PW.js} +4 -4
  75. package/dist/react/{rectangleTool-EJKK6UTX.js → rectangleTool-YPD2SIIZ.js} +4 -4
  76. package/dist/react/{textTool-S4XXZHZH.js → textTool-VQHMWEFJ.js} +5 -5
  77. package/package.json +5 -2
  78. package/src/core/AIRenderer.js +8 -2
  79. package/src/core/CanvasSpace.js +28 -0
  80. package/src/core/GraphRenderer.js +8 -3
  81. package/src/core/LixScriptParser.js +7 -1
  82. package/src/core/MermaidFlowchartRenderer.js +5 -1
  83. package/src/core/MermaidSequenceParser.js +1 -0
  84. package/src/core/MermaidSequenceRenderer.js +8 -3
  85. package/src/core/MermaidStructuredRenderer.js +6 -1
  86. package/src/core/SceneSerializer.js +121 -38
  87. package/src/core/Selection.js +12 -2
  88. package/src/core/UndoRedo.js +59 -5
  89. package/src/react/components/AppMenu.jsx +20 -19
  90. package/src/react/components/canvas/CanvasRulers.jsx +8 -13
  91. package/src/react/components/canvas/SVGCanvas.jsx +2 -1
  92. package/src/react/components/canvas/rulerUnits.js +28 -0
  93. package/src/react/components/sidebars/PaintBucketSidebar.jsx +1 -1
  94. package/src/react/store/useSketchStore.js +24 -3
  95. package/src/react/store/useUIStore.js +24 -1
  96. package/src/react/utils/canvasBackgrounds.js +29 -0
  97. package/src/shapes/Circle.js +12 -19
  98. package/src/shapes/Frame.js +38 -69
  99. package/src/shapes/FreehandStroke.js +24 -1
  100. package/src/shapes/Rectangle.js +10 -22
  101. package/src/tools/circleTool.js +3 -27
  102. package/src/tools/paintBucketTool.js +72 -15
  103. package/src/tools/rectangleTool.js +7 -23
  104. package/src/tools/shapeRecognition.js +270 -0
  105. package/src/tools/shapeRecognitionTool.js +36 -183
  106. package/dist/react/AIRenderer-SRF7LU5K.js.map +0 -7
  107. package/dist/react/Circle-6POZCUZD.js +0 -9
  108. package/dist/react/EventDispatcher-7LAK7GQ7.js.map +0 -7
  109. package/dist/react/Frame-7D2MXCFF.js +0 -11
  110. package/dist/react/GraphEngine-MM6ALA2N.js.map +0 -7
  111. package/dist/react/IconShape-ZADX7Y33.js +0 -10
  112. package/dist/react/ImageShape-UJQN2HI7.js +0 -10
  113. package/dist/react/Line-APEULMHE.js +0 -10
  114. package/dist/react/LixScriptParser-JYWJX375.js.map +0 -7
  115. package/dist/react/MermaidFlowchartRenderer-PQEC4TMI.js.map +0 -7
  116. package/dist/react/MermaidSequenceParser-UKG2NSZY.js +0 -8
  117. package/dist/react/MermaidSequenceRenderer-KCUHO7UI.js.map +0 -7
  118. package/dist/react/MermaidStructuredRenderer-W7UKN7BM.js.map +0 -7
  119. package/dist/react/Rectangle-S7XUKWYD.js +0 -9
  120. package/dist/react/SceneSerializer-SG6SJN5X.js.map +0 -7
  121. package/dist/react/chunk-6GPEWDRB.js.map +0 -7
  122. package/dist/react/chunk-7CM5XQDN.js.map +0 -7
  123. package/dist/react/chunk-FETTJLCV.js.map +0 -7
  124. package/dist/react/chunk-K5BG5MHY.js.map +0 -7
  125. package/dist/react/chunk-PXFPPO3R.js.map +0 -7
  126. package/dist/react/chunk-TKXKJNTX.js.map +0 -7
  127. package/dist/react/chunk-VQVEPJSA.js.map +0 -7
  128. package/dist/react/chunk-XFL4R5ZF.js.map +0 -7
  129. /package/dist/react/{Circle-6POZCUZD.js.map → Circle-HMM5PKJ2.js.map} +0 -0
  130. /package/dist/react/{Frame-7D2MXCFF.js.map → Frame-QEUEYITT.js.map} +0 -0
  131. /package/dist/react/{FreehandStroke-U6GYZOM4.js.map → FreehandStroke-WXIJKD5I.js.map} +0 -0
  132. /package/dist/react/{IconShape-ZADX7Y33.js.map → IconShape-NHJE4YBY.js.map} +0 -0
  133. /package/dist/react/{ImageShape-UJQN2HI7.js.map → ImageShape-33VCMSDP.js.map} +0 -0
  134. /package/dist/react/{Line-APEULMHE.js.map → Line-A6FE232Q.js.map} +0 -0
  135. /package/dist/react/{MermaidSequenceParser-UKG2NSZY.js.map → MermaidSequenceParser-DBYXW23P.js.map} +0 -0
  136. /package/dist/react/{Rectangle-S7XUKWYD.js.map → Rectangle-4U4CD2ER.js.map} +0 -0
  137. /package/dist/react/{Selection-2TSH3J6P.js.map → Selection-23MOLHEI.js.map} +0 -0
  138. /package/dist/react/{SketchEngine-UD2XV2KT.js.map → SketchEngine-OPJON7TD.js.map} +0 -0
  139. /package/dist/react/{UndoRedo-IN4SXDG6.js.map → UndoRedo-QVNRI5OB.js.map} +0 -0
  140. /package/dist/react/{arrowTool-OYDWJGQK.js.map → arrowTool-VH3PJPDM.js.map} +0 -0
  141. /package/dist/react/{chunk-LSHZYN77.js.map → chunk-2DZHO67H.js.map} +0 -0
  142. /package/dist/react/{chunk-XOWNCYE4.js.map → chunk-5NHJJJBZ.js.map} +0 -0
  143. /package/dist/react/{chunk-ASBC5G35.js.map → chunk-B6CYUZC4.js.map} +0 -0
  144. /package/dist/react/{chunk-OP56XPWF.js.map → chunk-DNFPTVIP.js.map} +0 -0
  145. /package/dist/react/{chunk-XYUFEIZR.js.map → chunk-DWEFPKDO.js.map} +0 -0
  146. /package/dist/react/{chunk-GQUZPON4.js.map → chunk-F56XUE5S.js.map} +0 -0
  147. /package/dist/react/{chunk-LJR7EVW2.js.map → chunk-JEGLUNBC.js.map} +0 -0
  148. /package/dist/react/{chunk-APTOPAOY.js.map → chunk-SSFEN5CY.js.map} +0 -0
  149. /package/dist/react/{chunk-RGMDWLRJ.js.map → chunk-UEL2G6D2.js.map} +0 -0
  150. /package/dist/react/{chunk-M6TMN76K.js.map → chunk-ULPIHUVC.js.map} +0 -0
  151. /package/dist/react/{chunk-EOURRJ55.js.map → chunk-XSE4HQ2D.js.map} +0 -0
  152. /package/dist/react/{circleTool-LDKGZALF.js.map → circleTool-2UODOBCV.js.map} +0 -0
  153. /package/dist/react/{codeTool-4YZO5W7J.js.map → codeTool-F4RV7SAI.js.map} +0 -0
  154. /package/dist/react/{frameTool-MXNJEXQQ.js.map → frameTool-NTGA5BI6.js.map} +0 -0
  155. /package/dist/react/{freehandTool-26D3FOOX.js.map → freehandTool-L55EUB5C.js.map} +0 -0
  156. /package/dist/react/{iconTool-46O5VEUX.js.map → iconTool-KQQBLGR3.js.map} +0 -0
  157. /package/dist/react/{imageTool-P2RWZRHO.js.map → imageTool-LDJ45AD7.js.map} +0 -0
  158. /package/dist/react/{lineTool-ZMR27U5L.js.map → lineTool-CSAFD7PW.js.map} +0 -0
  159. /package/dist/react/{rectangleTool-EJKK6UTX.js.map → rectangleTool-YPD2SIIZ.js.map} +0 -0
  160. /package/dist/react/{textTool-S4XXZHZH.js.map → textTool-VQHMWEFJ.js.map} +0 -0
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/core/UndoRedo.js"],
4
- "sourcesContent": ["/* eslint-disable */\n// Undo/Redo system - copied from undoAndRedo.js\n\n// Stacks for undo/redo\nconst undoStack = [];\nconst redoStack = [];\n\n// Import references to text-related variables and functions\nlet selectedElement = null;\nlet updateSelectionFeedback = null;\nlet svg = null;\n\nfunction notifyCollaboration() {\n if (typeof window !== 'undefined' && typeof window.__collabSceneChanged === 'function') {\n window.__collabSceneChanged();\n }\n}\n\n// Function to set references from other modules\nexport function setTextReferences(element, updateFn, svgElement) {\n selectedElement = element;\n updateSelectionFeedback = updateFn;\n svg = svgElement;\n}\n\n// Function to get current selectedElement (called from other modules)\nexport function getCurrentSelectedElement() {\n return selectedElement;\n}\n\n// Function to update selectedElement reference (called from other modules)\nexport function updateSelectedElement(element) {\n selectedElement = element;\n}\n\n// Call this after creating a new shape (e.g., Rectangle)\nexport function pushCreateAction(shape, meta = null) {\n const action = {\n type: 'create',\n shape: shape\n };\n if (meta?.frameCreation && shape?.shapeName === 'frame') {\n action.frameCreation = true;\n action.containedShapes = [...(meta.containedShapes || shape.containedShapes || [])];\n action.shapeIndex = Array.isArray(shapes) ? shapes.indexOf(shape) : -1;\n }\n undoStack.push(action);\n \n // Clear redo stack when new action is performed\n redoStack.length = 0;\n notifyCollaboration();\n}\n\nexport function pushDeleteAction(shape, meta = null) {\n // Issue #24 bug #7: when the deleted shape is a frame, the caller may\n // pass `meta.childSnapshot` \u2014 the contained shape REFERENCES at the\n // time of delete. The undo branch uses this to re-attach the children\n // when the frame is restored, instead of leaving an empty box.\n const action = { type: 'delete', shape };\n if (meta && meta.childSnapshot) action.childSnapshot = meta.childSnapshot;\n undoStack.push(action);\n\n // Clear redo stack when new action is performed\n redoStack.length = 0;\n notifyCollaboration();\n}\n\n// Enhanced delete action to clean up attached arrows\nexport function pushDeleteActionWithAttachments(shape) {\n let affectedArrows = [];\n \n // If deleting a text element, find all attached arrows\n if (shape.type === 'text' || shape.shapeName === 'text') {\n affectedArrows = shapes.filter(s => s.shapeName === 'arrow' && \n (s.attachedToStart?.shape === shape || s.attachedToEnd?.shape === shape))\n .map(arrow => ({\n arrow: arrow,\n oldAttachments: arrow.getAttachmentState(),\n oldPoints: {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n }\n }));\n }\n \n undoStack.push({\n type: 'delete',\n shape: shape,\n affectedArrows: affectedArrows\n });\n \n // Clear redo stack when new action is performed\n redoStack.length = 0;\n notifyCollaboration();\n}\n\nexport function pushFrameAttachmentAction(frame, shape, action, oldFrame = null) {\n undoStack.push({\n type: 'frameAttachment',\n frame: frame,\n shape: shape,\n action: action, // 'attach' or 'detach'\n oldFrame: oldFrame, // Previous frame if shape was moved between frames\n // Store shape position for potential restoration\n shapeState: {\n x: shape.x,\n y: shape.y,\n width: shape.width || 0,\n height: shape.height || 0,\n rotation: shape.rotation || 0\n }\n });\n \n // Clear redo stack when new action is performed\n redoStack.length = 0;\n notifyCollaboration();\n}\n\nexport function pushCreateActionWithAttachments(shape) {\n undoStack.push({\n type: 'create',\n shape: shape,\n // Store any arrows that might need to reattach when this is undone\n potentialAttachments: []\n });\n \n // Clear redo stack when new action is performed\n redoStack.length = 0;\n notifyCollaboration();\n}\n\nexport function pushTransformAction(shape, oldPos, newPos) {\n if (shape.shapeName === 'frame') {\n // Handle frame transformation with contained shapes\n const containedShapesStates = shape.containedShapes.map(containedShape => ({\n shape: containedShape,\n oldState: {\n x: containedShape.x - (newPos.x - oldPos.x),\n y: containedShape.y - (newPos.y - oldPos.y),\n width: containedShape.width || 0,\n height: containedShape.height || 0,\n rotation: containedShape.rotation || 0\n },\n newState: {\n x: containedShape.x,\n y: containedShape.y,\n width: containedShape.width || 0,\n height: containedShape.height || 0,\n rotation: containedShape.rotation || 0\n }\n }));\n\n undoStack.push({\n type: 'frameTransform',\n shape: shape,\n oldPos: {\n x: oldPos.x,\n y: oldPos.y,\n width: oldPos.width,\n height: oldPos.height,\n rotation: oldPos.rotation,\n frameName: oldPos.frameName || shape.frameName\n },\n newPos: {\n x: newPos.x,\n y: newPos.y,\n width: newPos.width,\n height: newPos.height,\n rotation: newPos.rotation,\n frameName: newPos.frameName || shape.frameName\n },\n containedShapes: containedShapesStates\n });\n } else if (shape.type === 'text') {\n // Enhanced text handling - also track frame attachment changes\n const currentFrame = shape.parentFrame || null;\n \n undoStack.push({\n type: 'transform',\n shape: shape,\n oldPos: {\n x: oldPos.x,\n y: oldPos.y,\n rotation: oldPos.rotation,\n fontSize: oldPos.fontSize\n },\n newPos: {\n x: newPos.x,\n y: newPos.y,\n rotation: newPos.rotation,\n fontSize: newPos.fontSize\n },\n // Track frame attachment state\n frameAttachment: {\n oldFrame: oldPos.parentFrame || null,\n newFrame: currentFrame\n },\n // Store affected arrows with their attachment states\n affectedArrows: shapes.filter(s => s.shapeName === 'arrow' && \n (s.attachedToStart?.shape === shape || s.attachedToEnd?.shape === shape))\n .map(arrow => ({\n arrow: arrow,\n oldAttachments: arrow.getAttachmentState(),\n oldPoints: {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n }\n }))\n });\n } else if (shape.type === 'image') {\n // Enhanced image handling - also track frame attachment changes\n const currentFrame = shape.parentFrame || null;\n \n undoStack.push({\n type: 'transform',\n shape: shape,\n oldPos: {\n x: oldPos.x,\n y: oldPos.y,\n width: oldPos.width,\n height: oldPos.height,\n rotation: oldPos.rotation\n },\n newPos: {\n x: newPos.x,\n y: newPos.y,\n width: newPos.width,\n height: newPos.height,\n rotation: newPos.rotation\n },\n // Track frame attachment state\n frameAttachment: {\n oldFrame: oldPos.parentFrame || null,\n newFrame: currentFrame\n },\n // Store affected arrows with their attachment states\n affectedArrows: shapes.filter(s => s.shapeName === 'arrow' && \n (s.attachedToStart?.shape === shape || s.attachedToEnd?.shape === shape))\n .map(arrow => ({\n arrow: arrow,\n oldAttachments: arrow.getAttachmentState(),\n oldPoints: {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n }\n }))\n });\n } else if (shape.shapeName === 'circle') {\n // Enhanced circle handling - also track frame attachment changes\n const currentFrame = shape.parentFrame || null;\n \n undoStack.push({\n type: 'transform',\n shape: shape,\n oldPos: {\n x: oldPos.x,\n y: oldPos.y,\n rx: oldPos.rx,\n ry: oldPos.ry,\n rotation: oldPos.rotation\n },\n newPos: {\n x: newPos.x,\n y: newPos.y,\n rx: newPos.rx,\n ry: newPos.ry,\n rotation: newPos.rotation\n },\n // Track frame attachment state\n frameAttachment: {\n oldFrame: oldPos.parentFrame || null,\n newFrame: currentFrame\n },\n // Store affected arrows with their attachment states\n affectedArrows: shapes.filter(s => s.shapeName === 'arrow' && \n (s.attachedToStart?.shape === shape || s.attachedToEnd?.shape === shape))\n .map(arrow => ({\n arrow: arrow,\n oldAttachments: arrow.getAttachmentState(),\n oldPoints: {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n }\n }))\n });\n } else if (shape.shapeName === \"rectangle\") {\n // Enhanced rectangle handling - also track frame attachment changes\n const currentFrame = shape.parentFrame || null;\n \n undoStack.push({\n type: 'transform',\n shape: shape,\n oldPos: { \n x: oldPos.x, \n y: oldPos.y, \n width: oldPos.width, \n height: oldPos.height, \n rotation: oldPos.rotation\n },\n newPos: { \n x: newPos.x, \n y: newPos.y, \n width: newPos.width, \n height: newPos.height, \n rotation: newPos.rotation\n },\n // Track frame attachment state\n frameAttachment: {\n oldFrame: oldPos.parentFrame || null,\n newFrame: currentFrame\n },\n // Store affected arrows with their attachment states\n affectedArrows: shapes.filter(s => s.shapeName === 'arrow' && \n (s.attachedToStart?.shape === shape || s.attachedToEnd?.shape === shape))\n .map(arrow => ({\n arrow: arrow,\n oldAttachments: arrow.getAttachmentState(),\n oldPoints: {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n }\n }))\n });\n } \n else if (shape.shapeName === 'line') {\n // Enhanced line handling with curve support\n const currentFrame = shape.parentFrame || null;\n \n undoStack.push({\n type: 'transform',\n shape: shape,\n oldPos: {\n startPoint: { x: oldPos.startPoint.x, y: oldPos.startPoint.y },\n endPoint: { x: oldPos.endPoint.x, y: oldPos.endPoint.y },\n controlPoint: oldPos.controlPoint ? { x: oldPos.controlPoint.x, y: oldPos.controlPoint.y } : null,\n isCurved: oldPos.isCurved || false\n },\n newPos: {\n startPoint: { x: newPos.startPoint.x, y: newPos.startPoint.y },\n endPoint: { x: newPos.endPoint.x, y: newPos.endPoint.y },\n controlPoint: newPos.controlPoint ? { x: newPos.controlPoint.x, y: newPos.controlPoint.y } : null,\n isCurved: newPos.isCurved || false\n },\n // Track frame attachment state\n frameAttachment: {\n oldFrame: oldPos.parentFrame || null,\n newFrame: currentFrame\n }\n });\n }\n else if (shape.shapeName === 'arrow') {\n // Handle arrow transform with attachment state\n undoStack.push({\n type: 'transform',\n shape: shape,\n oldPos: {\n startPoint: { x: oldPos.startPoint.x, y: oldPos.startPoint.y },\n endPoint: { x: oldPos.endPoint.x, y: oldPos.endPoint.y },\n controlPoint1: oldPos.controlPoint1 ? { x: oldPos.controlPoint1.x, y: oldPos.controlPoint1.y } : null,\n controlPoint2: oldPos.controlPoint2 ? { x: oldPos.controlPoint2.x, y: oldPos.controlPoint2.y } : null,\n attachments: oldPos.attachments || shape.getAttachmentState()\n },\n newPos: {\n startPoint: { x: newPos.startPoint.x, y: newPos.startPoint.y },\n endPoint: { x: newPos.endPoint.x, y: newPos.endPoint.y },\n controlPoint1: newPos.controlPoint1 ? { x: newPos.controlPoint1.x, y: newPos.controlPoint1.y } : null,\n controlPoint2: newPos.controlPoint2 ? { x: newPos.controlPoint2.x, y: newPos.controlPoint2.y } : null,\n attachments: newPos.attachments || shape.getAttachmentState()\n }\n });\n } \n else if (shape.type === 'icon') {\n // Enhanced icon handling - also track frame attachment changes\n const currentFrame = shape.parentFrame || null;\n \n undoStack.push({\n type: 'transform',\n shape: shape,\n oldPos: {\n x: oldPos.x,\n y: oldPos.y,\n width: oldPos.width,\n height: oldPos.height,\n rotation: oldPos.rotation\n },\n newPos: {\n x: newPos.x,\n y: newPos.y,\n width: newPos.width,\n height: newPos.height,\n rotation: newPos.rotation\n },\n // Track frame attachment state\n frameAttachment: {\n oldFrame: oldPos.parentFrame || null,\n newFrame: currentFrame\n },\n // Store affected arrows with their attachment states\n affectedArrows: shapes.filter(s => s.shapeName === 'arrow' && \n (s.attachedToStart?.shape === shape || s.attachedToEnd?.shape === shape))\n .map(arrow => ({\n arrow: arrow,\n oldAttachments: arrow.getAttachmentState(),\n oldPoints: {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n }\n }))\n });\n}\n else if (shape.shapeName === 'freehandStroke') {\n // Handle freehand stroke transform\n undoStack.push({\n type: 'transform',\n shape: shape,\n oldPos: {\n points: JSON.parse(JSON.stringify(oldPos.points)),\n rotation: oldPos.rotation\n },\n newPos: {\n points: JSON.parse(JSON.stringify(newPos.points)),\n rotation: newPos.rotation\n }\n });\n }\n \n // Clear redo stack when new action is performed\n redoStack.length = 0;\n notifyCollaboration();\n}\n\nexport function pushOptionsChangeAction(shape, oldOptions, newOptions = null) {\n undoStack.push({\n type: 'optionsChange',\n shape: shape,\n oldOptions: oldOptions,\n newOptions: newOptions\n });\n \n // Clear redo stack when new action is performed\n redoStack.length = 0;\n notifyCollaboration();\n}\n\n// Issue #34 bug #4: refresh the multi-selection outline + handles so it\n// follows the reverted geometry. Without this the selection rect stays\n// pinned to the pre-undo coordinates and the user sees a ghost rect\n// floating away from the shapes it claims to wrap.\nfunction refreshSelectionAfterAction() {\n const ms = (typeof window !== 'undefined') ? window.multiSelection : null;\n if (!ms) return;\n if (typeof ms.updateControls !== 'function') return;\n if (!ms.selectedShapes || ms.selectedShapes.size === 0) return;\n try { ms.updateControls(); } catch (err) { console.warn('[UndoRedo] selection refresh failed:', err); }\n}\n\nexport function undo() {\n if (undoStack.length === 0) return;\n const action = undoStack.pop();\n try {\n if (action.type === 'frameTransform') {\n // Handle frame transformation undo\n action.shape.x = action.oldPos.x;\n action.shape.y = action.oldPos.y;\n action.shape.width = action.oldPos.width;\n action.shape.height = action.oldPos.height;\n action.shape.rotation = action.oldPos.rotation;\n action.shape.frameName = action.oldPos.frameName;\n \n // Restore contained shapes to their old positions\n action.containedShapes.forEach(shapeData => {\n const shape = shapeData.shape;\n shape.x = shapeData.oldState.x;\n shape.y = shapeData.oldState.y;\n shape.width = shapeData.oldState.width;\n shape.height = shapeData.oldState.height;\n shape.rotation = shapeData.oldState.rotation;\n \n if (typeof shape.draw === 'function') {\n shape.draw();\n }\n });\n \n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n action.shape.updateClipPath();\n \n redoStack.push(action);\n return;\n }\n \n if (action.type === 'frameAttachment') {\n // Handle frame attachment/detachment undo WITHOUT calling the methods that track undo\n if (action.action === 'attach') {\n // Undo attach: manually remove shape from frame\n const frameIndex = action.frame.containedShapes.indexOf(action.shape);\n if (frameIndex > -1) {\n action.frame.containedShapes.splice(frameIndex, 1);\n action.shape.parentFrame = null;\n \n // Move shape back to main SVG\n if (action.shape.group && action.shape.group.parentNode === action.frame.clipGroup) {\n action.frame.clipGroup.removeChild(action.shape.group);\n svg.appendChild(action.shape.group);\n }\n }\n \n // If shape was moved from another frame, restore it there\n if (action.oldFrame) {\n action.oldFrame.containedShapes.push(action.shape);\n action.shape.parentFrame = action.oldFrame;\n \n // Move to old frame's clipped group\n if (action.shape.group && action.shape.group.parentNode === svg) {\n svg.removeChild(action.shape.group);\n action.oldFrame.clipGroup.appendChild(action.shape.group);\n }\n }\n } else if (action.action === 'detach') {\n // Undo detach: manually add shape back to frame\n if (!action.frame.containedShapes.includes(action.shape)) {\n action.frame.containedShapes.push(action.shape);\n action.shape.parentFrame = action.frame;\n \n // Move to frame's clipped group\n if (action.shape.group && action.shape.group.parentNode === svg) {\n svg.removeChild(action.shape.group);\n action.frame.clipGroup.appendChild(action.shape.group);\n }\n }\n }\n \n // Restore shape state\n action.shape.x = action.shapeState.x;\n action.shape.y = action.shapeState.y;\n action.shape.width = action.shapeState.width;\n action.shape.height = action.shapeState.height;\n action.shape.rotation = action.shapeState.rotation;\n \n if (typeof action.shape.draw === 'function') {\n action.shape.draw();\n }\n \n redoStack.push(action);\n return;\n }\n\n // Handle mode conversion undo (code \u2194 text)\n if (action.type === 'create' && action.shape.type === 'modeConvert') {\n // Undo: remove the new shape, restore the old shape\n const newShape = action.shape.newShape;\n const newElement = action.shape.newElement;\n const oldShape = action.shape.oldShape;\n const oldElement = action.shape.oldElement;\n\n // Remove new shape from DOM and shapes array\n if (newElement && newElement.parentNode) {\n newElement.parentNode.removeChild(newElement);\n }\n const newIdx = shapes.indexOf(newShape);\n if (newIdx !== -1) shapes.splice(newIdx, 1);\n\n // Restore old shape to DOM and shapes array\n if (svg && oldElement) {\n svg.appendChild(oldElement);\n }\n if (oldShape) {\n shapes.push(oldShape);\n }\n\n redoStack.push(action);\n return;\n }\n\n if (action.type === 'create') {\n if (action.frameCreation && action.shape.shapeName === 'frame') {\n // Treat a manually-created frame and its initial membership as one\n // atomic action. Children remain on the canvas when the frame is\n // undone and are clipped back into it on redo.\n for (const child of action.containedShapes || []) {\n if (child?.parentFrame === action.shape) action.shape.removeShapeFromFrame(child);\n }\n if (currentShape === action.shape) {\n action.shape.removeSelection?.();\n currentShape = null;\n }\n const idx = shapes.indexOf(action.shape);\n if (idx !== -1) shapes.splice(idx, 1);\n action.shape.group?.remove();\n action.shape.clipGroup?.remove();\n action.shape.clipPath?.remove();\n } else\n if (action.shape.type === 'text') {\n // Handle text creation undo\n if (action.shape.element && action.shape.element.parentNode) {\n action.shape.element.parentNode.removeChild(action.shape.element);\n } else if (action.shape.parentNode) {\n action.shape.parentNode.removeChild(action.shape);\n }\n\n // Remove from shapes array\n const idx = shapes.indexOf(action.shape.element || action.shape);\n if (idx !== -1) shapes.splice(idx, 1);\n\n // Clean up any arrow attachments to this text\n if (typeof cleanupAttachments === 'function') {\n cleanupAttachments(action.shape.element || action.shape);\n }\n } else if (action.shape.type === 'image') {\n // Handle image creation undo\n action.shape.remove();\n } else if (action.shape.type === 'icon') {\n // Handle icon creation undo - call the remove method\n action.shape.remove();\n } else {\n // Handle other shape creation undo\n const idx = shapes.indexOf(action.shape);\n if (idx !== -1) shapes.splice(idx, 1);\n if (action.shape.group && action.shape.group.parentNode) {\n action.shape.group.parentNode.removeChild(action.shape.group);\n }\n \n // Handle frame cleanup\n if (action.shape.shapeName === 'frame') {\n action.shape.destroy();\n }\n }\n redoStack.push(action);\n return;\n}\n \n if (action.type === 'delete') {\n if (action.shape.type === 'text') {\n // Handle text deletion undo\n if (svg) {\n svg.appendChild(action.shape.element || action.shape);\n // Add back to shapes array\n shapes.push(action.shape.element || action.shape);\n }\n \n // Restore arrow attachments if any existed\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore the old attachment state\n arrow.restoreAttachmentState(arrowData.oldAttachments);\n });\n }\n } else if (action.shape.type === 'image') {\n // Handle image deletion undo\n action.shape.restore();\n } else {\n // Handle other shape deletion undo\n shapes.push(action.shape);\n if (svg) {\n svg.appendChild(action.shape.group);\n }\n\n // Issue #24 bug #7: rehydrate frame state. The delete path\n // orphaned the frame (removed <g>, clipGroup, clipPath from\n // DOM) but kept the JS object intact. Re-attach clipGroup +\n // clipPath, then re-parent every child from the snapshot via\n // addShapeToFrame. Skip children that were subsequently\n // deleted (they'll get re-added when their own delete action\n // is undone in turn).\n if (action.shape.shapeName === 'frame' && svg) {\n if (action.shape.clipGroup && !action.shape.clipGroup.parentNode) {\n svg.appendChild(action.shape.clipGroup);\n }\n if (action.shape.clipPath && !action.shape.clipPath.parentNode) {\n const defs = svg.querySelector('defs');\n if (defs) defs.appendChild(action.shape.clipPath);\n else svg.insertBefore(action.shape.clipPath, svg.firstChild);\n }\n if (action.childSnapshot && Array.isArray(action.childSnapshot)) {\n for (const child of action.childSnapshot) {\n if (!child) continue;\n if (shapes.indexOf(child) === -1) continue;\n if (typeof action.shape.addShapeToFrame === 'function') {\n action.shape.addShapeToFrame(child);\n }\n }\n }\n }\n }\n redoStack.push(action);\n return;\n }\n \n if (action.type === 'transform') {\n // Handle frame attachment changes first\n if (action.frameAttachment) {\n // Use manual frame operations to avoid undo recursion\n if (action.frameAttachment.newFrame) {\n const frameIndex = action.frameAttachment.newFrame.containedShapes.indexOf(action.shape);\n if (frameIndex > -1) {\n action.frameAttachment.newFrame.containedShapes.splice(frameIndex, 1);\n if (action.shape.group && action.shape.group.parentNode === action.frameAttachment.newFrame.clipGroup) {\n action.frameAttachment.newFrame.clipGroup.removeChild(action.shape.group);\n svg.appendChild(action.shape.group);\n }\n }\n }\n if (action.frameAttachment.oldFrame) {\n if (!action.frameAttachment.oldFrame.containedShapes.includes(action.shape)) {\n action.frameAttachment.oldFrame.containedShapes.push(action.shape);\n action.shape.parentFrame = action.frameAttachment.oldFrame;\n if (action.shape.group && action.shape.group.parentNode === svg) {\n svg.removeChild(action.shape.group);\n action.frameAttachment.oldFrame.clipGroup.appendChild(action.shape.group);\n }\n }\n } else {\n action.shape.parentFrame = null;\n }\n }\n \n if (action.shape.type === 'text') {\n // Enhanced text transform undo\n const textElement = (action.shape.element || action.shape).querySelector('text');\n if (textElement && action.oldPos.fontSize !== undefined) {\n textElement.setAttribute('font-size', action.oldPos.fontSize + 'px');\n }\n \n // Restore position and rotation\n const centerX = textElement ? textElement.getBBox().x + textElement.getBBox().width / 2 : 0;\n const centerY = textElement ? textElement.getBBox().y + textElement.getBBox().height / 2 : 0;\n \n (action.shape.element || action.shape).setAttribute('transform', \n `translate(${action.oldPos.x}, ${action.oldPos.y}) rotate(${action.oldPos.rotation}, ${centerX}, ${centerY})`\n );\n \n (action.shape.element || action.shape).setAttribute('data-x', action.oldPos.x);\n (action.shape.element || action.shape).setAttribute('data-y', action.oldPos.y);\n \n // Update attached arrows after text undo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore arrow attachments to old state\n arrow.restoreAttachmentState(arrowData.oldAttachments);\n \n // Store current state for redo\n arrowData.newPoints = {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n };\n arrowData.newAttachments = arrow.getAttachmentState();\n });\n }\n \n // Update feedback if selected\n if (selectedElement === (action.shape.element || action.shape) && updateSelectionFeedback) {\n setTimeout(updateSelectionFeedback, 0);\n }\n } else if (action.shape.type === 'image') {\n // Enhanced image transform undo\n action.shape.restore(action.oldPos);\n \n // Update attached arrows after image undo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore arrow attachments to old state\n arrow.restoreAttachmentState(arrowData.oldAttachments);\n \n // Store current state for redo\n arrowData.newPoints = {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n };\n arrowData.newAttachments = arrow.getAttachmentState();\n });\n }\n } else if (action.shape.shapeName === 'circle') {\n // Enhanced circle transform undo\n action.shape.x = action.oldPos.x;\n action.shape.y = action.oldPos.y;\n action.shape.rx = action.oldPos.rx;\n action.shape.ry = action.oldPos.ry;\n action.shape.rotation = action.oldPos.rotation;\n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n\n // Update attached arrows after circle undo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore arrow attachments to old state\n arrow.restoreAttachmentState(arrowData.oldAttachments);\n \n // Store current state for redo\n arrowData.newPoints = {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n };\n arrowData.newAttachments = arrow.getAttachmentState();\n });\n }\n } else if (action.shape.shapeName === 'line') {\n // Enhanced line transform undo with curve support\n action.shape.startPoint = { x: action.oldPos.startPoint.x, y: action.oldPos.startPoint.y };\n action.shape.endPoint = { x: action.oldPos.endPoint.x, y: action.oldPos.endPoint.y };\n \n // Restore curve state\n action.shape.isCurved = action.oldPos.isCurved || false;\n if (action.oldPos.controlPoint) {\n action.shape.controlPoint = { x: action.oldPos.controlPoint.x, y: action.oldPos.controlPoint.y };\n } else {\n action.shape.controlPoint = null;\n }\n \n // Handle frame attachment changes\n if (action.frameAttachment) {\n // Remove from new frame if it exists\n if (action.frameAttachment.newFrame) {\n const frameIndex = action.frameAttachment.newFrame.containedShapes.indexOf(action.shape);\n if (frameIndex > -1) {\n action.frameAttachment.newFrame.containedShapes.splice(frameIndex, 1);\n if (action.shape.group && action.shape.group.parentNode === action.frameAttachment.newFrame.clipGroup) {\n action.frameAttachment.newFrame.clipGroup.removeChild(action.shape.group);\n svg.appendChild(action.shape.group);\n }\n }\n }\n \n // Add back to old frame if it exists\n if (action.frameAttachment.oldFrame) {\n if (!action.frameAttachment.oldFrame.containedShapes.includes(action.shape)) {\n action.frameAttachment.oldFrame.containedShapes.push(action.shape);\n action.shape.parentFrame = action.frameAttachment.oldFrame;\n if (action.shape.group && action.shape.group.parentNode === svg) {\n svg.removeChild(action.shape.group);\n action.frameAttachment.oldFrame.clipGroup.appendChild(action.shape.group);\n }\n }\n } else {\n action.shape.parentFrame = null;\n }\n }\n \n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n }\n else if (action.shape.shapeName === 'arrow') {\n // Enhanced arrow transform undo with attachment restoration\n action.shape.startPoint = { x: action.oldPos.startPoint.x, y: action.oldPos.startPoint.y };\n action.shape.endPoint = { x: action.oldPos.endPoint.x, y: action.oldPos.endPoint.y };\n action.shape.controlPoint1 = action.oldPos.controlPoint1 ? \n { x: action.oldPos.controlPoint1.x, y: action.oldPos.controlPoint1.y } : null;\n action.shape.controlPoint2 = action.oldPos.controlPoint2 ? \n { x: action.oldPos.controlPoint2.x, y: action.oldPos.controlPoint2.y } : null;\n \n // Restore attachment state\n if (action.oldPos.attachments) {\n action.shape.restoreAttachmentState(action.oldPos.attachments);\n } else {\n // Clear attachments if none existed before\n action.shape.attachedToStart = null;\n action.shape.attachedToEnd = null;\n }\n \n action.shape.isSelected = false;\n action.shape.draw();\n \n\n \n } \n else if (action.shape.type === 'icon') {\n \n action.shape.restore(action.oldPos);\n \n // Update attached arrows after icon undo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore arrow attachments to old state\n arrow.restoreAttachmentState(arrowData.oldAttachments);\n \n // Store current state for redo\n arrowData.newPoints = {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n };\n arrowData.newAttachments = arrow.getAttachmentState();\n });\n }\n }\n else if (action.shape.shapeName === 'freehandStroke') {\n // Handle freehand stroke transform undo\n action.shape.points = JSON.parse(JSON.stringify(action.oldPos.points));\n action.shape.rotation = action.oldPos.rotation;\n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n } else if (action.shape.shapeName === \"rectangle\") {\n action.shape.x = action.oldPos.x;\n action.shape.y = action.oldPos.y;\n action.shape.height = action.oldPos.height;\n action.shape.width = action.oldPos.width;\n action.shape.rotation = action.oldPos.rotation;\n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n\n // Update attached arrows after rectangle undo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n arrow.restoreAttachmentState(arrowData.oldAttachments);\n arrowData.newPoints = {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n };\n arrowData.newAttachments = arrow.getAttachmentState();\n });\n }\n }\n redoStack.push(action);\n return;\n }\n \n if (action.type === 'optionsChange') {\n if (!action.newOptions && action.shape?.options) {\n action.newOptions = action.shape.shapeName === 'arrow'\n ? {\n ...action.shape.options,\n arrowOutlineStyle: action.shape.arrowOutlineStyle,\n arrowHeadStyle: action.shape.arrowHeadStyle,\n arrowCurved: action.shape.arrowCurved,\n arrowCurveAmount: action.shape.arrowCurveAmount,\n }\n : { ...action.shape.options };\n }\n if (action.shape.type === 'text') {\n // Handle text options change undo\n const textElement = (action.shape.element || action.shape).querySelector('text');\n if (textElement) {\n if (action.oldOptions.color) textElement.setAttribute('fill', action.oldOptions.color);\n if (action.oldOptions.font) textElement.setAttribute('font-family', action.oldOptions.font);\n if (action.oldOptions.size) textElement.setAttribute('font-size', action.oldOptions.size);\n if (action.oldOptions.align) textElement.setAttribute('text-anchor', action.oldOptions.align);\n \n // Update feedback if selected\n if (selectedElement === (action.shape.element || action.shape) && updateSelectionFeedback) {\n setTimeout(updateSelectionFeedback, 0);\n }\n }\n } else if (action.shape.shapeName === 'arrow') {\n // Handle arrow options change undo\n action.shape.options = { ...action.oldOptions };\n action.shape.arrowOutlineStyle = action.oldOptions.arrowOutlineStyle;\n action.shape.arrowHeadStyle = action.oldOptions.arrowHeadStyle;\n action.shape.arrowCurved = action.oldOptions.arrowCurved;\n action.shape.arrowCurveAmount = action.oldOptions.arrowCurveAmount;\n action.shape.draw();\n } else {\n // Handle other shape options change undo\n action.shape.options = action.oldOptions;\n action.shape.draw();\n }\n redoStack.push(action);\n return;\n }\n } finally {\n refreshSelectionAfterAction();\n notifyCollaboration();\n }\n}\n\nexport function redo() {\n if (redoStack.length === 0) return;\n const action = redoStack.pop();\n try {\n if (action.type === 'frameTransform') {\n // Handle frame transformation redo\n action.shape.x = action.newPos.x;\n action.shape.y = action.newPos.y;\n action.shape.width = action.newPos.width;\n action.shape.height = action.newPos.height;\n action.shape.rotation = action.newPos.rotation;\n action.shape.frameName = action.newPos.frameName;\n \n // Restore contained shapes to their new positions\n action.containedShapes.forEach(shapeData => {\n const shape = shapeData.shape;\n shape.x = shapeData.newState.x;\n shape.y = shapeData.newState.y;\n shape.width = shapeData.newState.width;\n shape.height = shapeData.newState.height;\n shape.rotation = shapeData.newState.rotation;\n \n if (typeof shape.draw === 'function') {\n shape.draw();\n }\n });\n \n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n action.shape.updateClipPath();\n \n undoStack.push(action);\n return;\n }\n\n \n if (action.type === 'frameAttachment') {\n // Handle frame attachment/detachment redo WITHOUT calling the methods that track undo\n if (action.action === 'attach') {\n // Redo attach: manually add shape to frame\n if (action.oldFrame) {\n // Remove from old frame\n const oldFrameIndex = action.oldFrame.containedShapes.indexOf(action.shape);\n if (oldFrameIndex > -1) {\n action.oldFrame.containedShapes.splice(oldFrameIndex, 1);\n if (action.shape.group && action.shape.group.parentNode === action.oldFrame.clipGroup) {\n action.oldFrame.clipGroup.removeChild(action.shape.group);\n svg.appendChild(action.shape.group);\n }\n }\n }\n \n // Add to new frame\n if (!action.frame.containedShapes.includes(action.shape)) {\n action.frame.containedShapes.push(action.shape);\n action.shape.parentFrame = action.frame;\n \n if (action.shape.group && action.shape.group.parentNode === svg) {\n svg.removeChild(action.shape.group);\n action.frame.clipGroup.appendChild(action.shape.group);\n }\n }\n } else if (action.action === 'detach') {\n // Redo detach: manually remove shape from frame\n const frameIndex = action.frame.containedShapes.indexOf(action.shape);\n if (frameIndex > -1) {\n action.frame.containedShapes.splice(frameIndex, 1);\n action.shape.parentFrame = null;\n \n if (action.shape.group && action.shape.group.parentNode === action.frame.clipGroup) {\n action.frame.clipGroup.removeChild(action.shape.group);\n svg.appendChild(action.shape.group);\n }\n }\n }\n \n if (typeof action.shape.draw === 'function') {\n action.shape.draw();\n }\n \n undoStack.push(action);\n return;\n }\n\n // Handle mode conversion redo (code \u2194 text)\n if (action.type === 'create' && action.shape.type === 'modeConvert') {\n // Redo: remove the old shape, restore the new shape\n const newShape = action.shape.newShape;\n const newElement = action.shape.newElement;\n const oldShape = action.shape.oldShape;\n const oldElement = action.shape.oldElement;\n\n // Remove old shape from DOM and shapes array\n if (oldElement && oldElement.parentNode) {\n oldElement.parentNode.removeChild(oldElement);\n }\n const oldIdx = shapes.indexOf(oldShape);\n if (oldIdx !== -1) shapes.splice(oldIdx, 1);\n\n // Restore new shape to DOM and shapes array\n if (svg && newElement) {\n svg.appendChild(newElement);\n }\n if (newShape) {\n shapes.push(newShape);\n }\n\n undoStack.push(action);\n return;\n }\n\n if (action.type === 'create') {\n if (action.frameCreation && action.shape.shapeName === 'frame') {\n const frame = action.shape;\n let defs = svg?.querySelector('defs');\n if (!defs && svg) {\n defs = document.createElementNS('http://www.w3.org/2000/svg', 'defs');\n svg.appendChild(defs);\n }\n if (defs && frame.clipPath && !frame.clipPath.parentNode) defs.appendChild(frame.clipPath);\n if (svg && frame.group && !frame.group.parentNode) svg.appendChild(frame.group);\n if (svg && frame.clipGroup && !frame.clipGroup.parentNode) svg.appendChild(frame.clipGroup);\n if (shapes.indexOf(frame) === -1) {\n const index = action.shapeIndex >= 0 ? Math.min(action.shapeIndex, shapes.length) : shapes.length;\n shapes.splice(index, 0, frame);\n }\n frame.containedShapes = [];\n frame.draw();\n frame.updateClipPath();\n for (const child of action.containedShapes || []) {\n if (child && shapes.includes(child)) frame.addShapeToFrame(child);\n }\n } else\n if (action.shape.type === 'text') {\n // Handle text creation redo\n if (svg) {\n svg.appendChild(action.shape.element || action.shape);\n // Add back to shapes array\n shapes.push(action.shape.element || action.shape);\n }\n }\n else if (action.shape.type === 'image') {\n // Handle image creation redo\n action.shape.restore();\n } else if (action.shape.type === 'icon') {\n // Handle icon creation redo - append the group, not the shape object\n if (svg && action.shape.group) {\n svg.appendChild(action.shape.group);\n }\n // Add back to shapes array\n if (shapes.indexOf(action.shape) === -1) {\n shapes.push(action.shape);\n }\n } else {\n // Handle other shape creation redo\n shapes.push(action.shape);\n if (svg) {\n svg.appendChild(action.shape.group);\n }\n }\n undoStack.push(action);\n return;\n}\n \n if (action.type === 'delete') {\n if (action.shape.type === 'text') {\n // Handle text deletion redo\n if ((action.shape.element || action.shape).parentNode) {\n (action.shape.element || action.shape).parentNode.removeChild(action.shape.element || action.shape);\n }\n // Remove from shapes array\n const idx = shapes.indexOf(action.shape.element || action.shape);\n if (idx !== -1) shapes.splice(idx, 1);\n \n // Clean up arrow attachments again\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Detach from the deleted text\n if (arrow.attachedToStart && arrow.attachedToStart.shape === (action.shape.element || action.shape)) {\n arrow.detachFromShape(true);\n }\n if (arrow.attachedToEnd && arrow.attachedToEnd.shape === (action.shape.element || action.shape)) {\n arrow.detachFromShape(false);\n }\n arrow.draw();\n });\n }\n }\n else if (action.shape.type === 'image') {\n // Handle image deletion redo\n action.shape.remove();\n } else {\n // Handle other shape deletion redo\n const idx = shapes.indexOf(action.shape);\n if (idx !== -1) shapes.splice(idx, 1);\n\n // Issue #24 bug #7: for a regular frame, re-orphan instead of\n // destroy() \u2014 releases children visually, detaches the frame's\n // own DOM bits, but keeps the JS object and child references\n // intact so a subsequent undo can rehydrate again.\n if (action.shape.shapeName === 'frame' && !action.shape._diagramType && action.childSnapshot) {\n for (const child of action.childSnapshot) {\n if (!child) continue;\n const el = child.group || child.element;\n if (el && svg) {\n if (action.shape.clipGroup && el.parentNode === action.shape.clipGroup) {\n action.shape.clipGroup.removeChild(el);\n }\n if (el.parentNode !== svg) svg.appendChild(el);\n }\n child.parentFrame = null;\n delete child.isBeingMovedByFrame;\n }\n action.shape.containedShapes = [];\n if (action.shape.group && action.shape.group.parentNode) action.shape.group.parentNode.removeChild(action.shape.group);\n if (action.shape.clipGroup && action.shape.clipGroup.parentNode) action.shape.clipGroup.parentNode.removeChild(action.shape.clipGroup);\n if (action.shape.clipPath && action.shape.clipPath.parentNode) action.shape.clipPath.parentNode.removeChild(action.shape.clipPath);\n } else {\n if (action.shape.group && action.shape.group.parentNode) {\n action.shape.group.parentNode.removeChild(action.shape.group);\n }\n // Diagram frame OR no snapshot \u2192 fall back to destroy().\n if (action.shape.shapeName === 'frame' && typeof action.shape.destroy === 'function') {\n action.shape.destroy();\n }\n }\n }\n undoStack.push(action);\n return;\n }\n \n if (action.type === 'transform') {\n // Handle frame attachment changes first\n if (action.frameAttachment) {\n // Use manual frame operations to avoid undo recursion\n if (action.frameAttachment.oldFrame) {\n const oldFrameIndex = action.frameAttachment.oldFrame.containedShapes.indexOf(action.shape);\n if (oldFrameIndex > -1) {\n action.frameAttachment.oldFrame.containedShapes.splice(oldFrameIndex, 1);\n if (action.shape.group && action.shape.group.parentNode === action.frameAttachment.oldFrame.clipGroup) {\n action.frameAttachment.oldFrame.clipGroup.removeChild(action.shape.group);\n svg.appendChild(action.shape.group);\n }\n }\n }\n if (action.frameAttachment.newFrame) {\n if (!action.frameAttachment.newFrame.containedShapes.includes(action.shape)) {\n action.frameAttachment.newFrame.containedShapes.push(action.shape);\n action.shape.parentFrame = action.frameAttachment.newFrame;\n if (action.shape.group && action.shape.group.parentNode === svg) {\n svg.removeChild(action.shape.group);\n action.frameAttachment.newFrame.clipGroup.appendChild(action.shape.group);\n }\n }\n } else {\n action.shape.parentFrame = null;\n }\n }\n \n if (action.shape.type === 'text') {\n // Enhanced text transform redo\n const textElement = (action.shape.element || action.shape).querySelector('text');\n if (textElement && action.newPos.fontSize !== undefined) {\n textElement.setAttribute('font-size', action.newPos.fontSize + 'px');\n }\n \n // Restore position and rotation\n const centerX = textElement ? textElement.getBBox().x + textElement.getBBox().width / 2 : 0;\n const centerY = textElement ? textElement.getBBox().y + textElement.getBBox().height / 2 : 0;\n \n (action.shape.element || action.shape).setAttribute('transform', \n `translate(${action.newPos.x}, ${action.newPos.y}) rotate(${action.newPos.rotation}, ${centerX}, ${centerY})`\n );\n \n (action.shape.element || action.shape).setAttribute('data-x', action.newPos.x);\n (action.shape.element || action.shape).setAttribute('data-y', action.newPos.y);\n \n // Update attached arrows after text redo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore arrow attachments to new state\n if (arrowData.newAttachments) {\n arrow.restoreAttachmentState(arrowData.newAttachments);\n } else {\n // If no new attachments stored, recalculate based on current text position\n arrow.updateAttachments();\n }\n });\n }\n \n // Update feedback if selected\n if (selectedElement === (action.shape.element || action.shape) && updateSelectionFeedback) {\n setTimeout(updateSelectionFeedback, 0);\n }\n } else if (action.shape.type === 'image') {\n // Enhanced image transform redo\n action.shape.restore(action.newPos);\n \n // Update attached arrows after image redo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore arrow attachments to new state\n if (arrowData.newAttachments) {\n arrow.restoreAttachmentState(arrowData.newAttachments);\n } else {\n // If no new attachments stored, recalculate based on current image position\n arrow.updateAttachments();\n }\n });\n }\n } else if (action.shape.shapeName === 'circle') {\n // Enhanced circle transform redo\n action.shape.x = action.newPos.x;\n action.shape.y = action.newPos.y;\n action.shape.rx = action.newPos.rx;\n action.shape.ry = action.newPos.ry;\n action.shape.rotation = action.newPos.rotation;\n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n\n // Update attached arrows after circle redo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore arrow attachments to new state\n if (arrowData.newAttachments) {\n arrow.restoreAttachmentState(arrowData.newAttachments);\n } else {\n // If no new attachments stored, recalculate based on current circle position\n arrow.updateAttachments();\n }\n });\n }\n } else if (action.shape.shapeName === 'line') {\n // Enhanced line transform redo with curve support\n action.shape.startPoint = { x: action.newPos.startPoint.x, y: action.newPos.startPoint.y };\n action.shape.endPoint = { x: action.newPos.endPoint.x, y: action.newPos.endPoint.y };\n \n // Restore curve state\n action.shape.isCurved = action.newPos.isCurved || false;\n if (action.newPos.controlPoint) {\n action.shape.controlPoint = { x: action.newPos.controlPoint.x, y: action.newPos.controlPoint.y };\n } else {\n action.shape.controlPoint = null;\n }\n \n // Handle frame attachment changes\n if (action.frameAttachment) {\n // Remove from old frame if it exists\n if (action.frameAttachment.oldFrame) {\n const oldFrameIndex = action.frameAttachment.oldFrame.containedShapes.indexOf(action.shape);\n if (oldFrameIndex > -1) {\n action.frameAttachment.oldFrame.containedShapes.splice(oldFrameIndex, 1);\n if (action.shape.group && action.shape.group.parentNode === action.frameAttachment.oldFrame.clipGroup) {\n action.frameAttachment.oldFrame.clipGroup.removeChild(action.shape.group);\n svg.appendChild(action.shape.group);\n }\n }\n }\n \n // Add to new frame if it exists\n if (action.frameAttachment.newFrame) {\n if (!action.frameAttachment.newFrame.containedShapes.includes(action.shape)) {\n action.frameAttachment.newFrame.containedShapes.push(action.shape);\n action.shape.parentFrame = action.frameAttachment.newFrame;\n if (action.shape.group && action.shape.group.parentNode === svg) {\n svg.removeChild(action.shape.group);\n action.frameAttachment.newFrame.clipGroup.appendChild(action.shape.group);\n }\n }\n } else {\n action.shape.parentFrame = null;\n }\n }\n \n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n }\n else if (action.shape.shapeName === 'arrow') {\n // Enhanced arrow transform redo with attachment restoration\n action.shape.startPoint = { x: action.newPos.startPoint.x, y: action.newPos.startPoint.y };\n action.shape.endPoint = { x: action.newPos.endPoint.x, y: action.newPos.endPoint.y };\n action.shape.controlPoint1 = action.newPos.controlPoint1 ? \n { x: action.newPos.controlPoint1.x, y: action.newPos.controlPoint1.y } : null;\n action.shape.controlPoint2 = action.newPos.controlPoint2 ? \n { x: action.newPos.controlPoint2.x, y: action.newPos.controlPoint2.y } : null;\n \n // Restore attachment state\n if (action.newPos.attachments) {\n action.shape.restoreAttachmentState(action.newPos.attachments);\n } else {\n // Clear attachments if none should exist\n action.shape.attachedToStart = null;\n action.shape.attachedToEnd = null;\n }\n \n action.shape.isSelected = false;\n action.shape.draw();\n \n } \n else if (action.shape.type === 'icon') {\n action.shape.restore(action.newPos);\n \n // Update attached arrows after icon redo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore arrow attachments to new state\n if (arrowData.newAttachments) {\n arrow.restoreAttachmentState(arrowData.newAttachments);\n } else {\n // If no new attachments stored, recalculate based on current icon position\n arrow.updateAttachments();\n }\n });\n }\n }\n else if (action.shape.shapeName === 'freehandStroke') {\n // Handle freehand stroke transform redo\n action.shape.points = JSON.parse(JSON.stringify(action.newPos.points));\n action.shape.rotation = action.newPos.rotation;\n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n } else if (action.shape.shapeName === \"rectangle\") {\n // Enhanced rectangle transform redo\n action.shape.x = action.newPos.x;\n action.shape.y = action.newPos.y;\n action.shape.height = action.newPos.height;\n action.shape.width = action.newPos.width;\n action.shape.rotation = action.newPos.rotation;\n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n\n // Update attached arrows after rectangle redo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore arrow attachments to new state\n if (arrowData.newAttachments) {\n arrow.restoreAttachmentState(arrowData.newAttachments);\n } else {\n // If no new attachments stored, recalculate based on current rectangle position\n arrow.updateAttachments();\n }\n });\n }\n }\n undoStack.push(action);\n return;\n }\n \n if (action.type === 'optionsChange') {\n if (action.shape.type === 'text') {\n // Handle text options change redo\n const textElement = (action.shape.element || action.shape).querySelector('text');\n if (textElement) {\n if (action.newOptions.color) textElement.setAttribute('fill', action.newOptions.color);\n if (action.newOptions.font) textElement.setAttribute('font-family', action.newOptions.font);\n if (action.newOptions.size) textElement.setAttribute('font-size', action.newOptions.size);\n if (action.newOptions.align) textElement.setAttribute('text-anchor', action.newOptions.align);\n \n // Update feedback if selected\n if (selectedElement === (action.shape.element || action.shape) && updateSelectionFeedback) {\n setTimeout(updateSelectionFeedback, 0);\n }\n }\n } else if (action.shape.shapeName === 'arrow') {\n action.shape.options = { ...action.newOptions };\n action.shape.arrowOutlineStyle = action.newOptions.arrowOutlineStyle;\n action.shape.arrowHeadStyle = action.newOptions.arrowHeadStyle;\n action.shape.arrowCurved = action.newOptions.arrowCurved;\n action.shape.arrowCurveAmount = action.newOptions.arrowCurveAmount;\n action.shape.draw();\n } else {\n action.shape.options = { ...action.newOptions };\n action.shape.draw();\n }\n undoStack.push(action);\n return;\n }\n } finally {\n refreshSelectionAfterAction();\n notifyCollaboration();\n }\n}\n\n// Optional: Keyboard shortcuts\ndocument.addEventListener('keydown', (e) => {\n if ((e.ctrlKey || e.metaKey) && e.key === 'z') {\n e.preventDefault();\n undo();\n }\n if ((e.ctrlKey || e.metaKey) && (e.key === 'y' || (e.shiftKey && e.key === 'z'))) {\n e.preventDefault();\n redo();\n }\n});\n\n// Attach to buttons\ndocument.getElementById('undo')?.addEventListener('click', undo);\ndocument.getElementById('redo')?.addEventListener('click', redo);\n\n// Expose globally for plain scripts\nwindow.pushCreateAction = pushCreateAction;\nwindow.pushDeleteAction = pushDeleteAction;\nwindow.pushDeleteActionWithAttachments = pushDeleteActionWithAttachments;\nwindow.pushTransformAction = pushTransformAction;\nwindow.pushOptionsChangeAction = pushOptionsChangeAction;\nwindow.pushCreateActionWithAttachments = pushCreateActionWithAttachments;\nwindow.undo = undo;\nwindow.redo = redo;\n"],
5
- "mappings": ";;;AAIA,IAAM,YAAY,CAAC;AACnB,IA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E;AACE,gCAA4B;AAC5B,wBAAoB;AAAA,EACxB;AACJ;AAGA,SAAS,iBAAiB,WAAW,CAAC,MAAM;AACxC,OAAK,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,KAAK;AAC3C,MAAE,eAAe;AACjB,SAAK;AAAA,EACT;AACA,OAAK,EAAE,WAAW,EAAE,aAAa,EAAE,QAAQ,OAAQ,EAAE,YAAY,EAAE,QAAQ,MAAO;AAC9E,MAAE,eAAe;AACjB,SAAK;AAAA,EACT;AACJ,CAAC;AAGD,SAAS,eAAe,MAAM,GAAG,iBAAiB,SAAS,IAAI;AAC/D,SAAS,eAAe,MAAM,GAAG,iBAAiB,SAAS,IAAI;AAG/D,OAAO,mBAAmB;AAC1B,OAAO,mBAAmB;AAC1B,OAAO,kCAAkC;AACzC,OAAO,sBAAsB;AAC7B,OAAO,0BAA0B;AACjC,OAAO,kCAAkC;AACzC,OAAO,OAAO;AACd,OAAO,OAAO;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/tools/rectangleTool.js"],
4
- "sourcesContent": ["/* eslint-disable */\n// Rectangle tool event handlers - extracted from drawSquare.js\n// Depends on globals: svg, shapes, currentShape, rough, currentZoom, lastMousePos\n// Depends on globals: isSquareToolActive, isSelectionToolActive\n// Depends on globals: squareSideBar, disableAllSideBars\nimport { pushCreateAction, pushDeleteAction, pushOptionsChangeAction, pushTransformAction, pushFrameAttachmentAction } from '../core/UndoRedo.js';\nimport { cleanupAttachments } from './arrowTool.js';\nimport { calculateSnap, clearSnapGuides } from '../core/SnapGuides.js';\n\nlet isDrawingSquare = false;\nlet isDraggingShapeSquare = false;\nlet isResizingShapeSquare = false;\nlet isRotatingShapeSquare = false;\nlet resizingAnchorIndexSquare = null;\nlet startRotationMouseAngleSquare = 0;\nlet startShapeRotationSquare = 0;\nconst rc = rough.svg(svg); \nlet startX, startY;\n// Issue #38 follow-up: null sentinel means \"use theme default at draw\n// time\". The legacy `\"#fff\"` literal was invisible on the light canvas;\n// reading the body's `theme-dark` class lets the same code produce a\n// readable stroke in either mode. As soon as the user picks a colour\n// from the sidebar this var holds that value verbatim.\nfunction getThemeStroke() {\n if (typeof document === 'undefined') return '#fff';\n return document.body && document.body.classList.contains('theme-dark') ? '#fff' : '#1a1a2e';\n}\nlet squareStrokecolor = null;\nlet squareBackgroundColor = \"transparent\";\nlet squareFillStyleValue = \"none\";\nlet squareStrokeThicknes = 2;\nlet squareOutlineStyle = \"solid\";\nlet dragOldPosSquare = null;\nlet draggedShapeInitialFrame = null;\nlet hoveredFrame = null;\n\nlet SquarecolorOptions = document.querySelectorAll(\".squareStrokeSpan\");\nlet backgroundColorOptionsSquare = document.querySelectorAll(\".squareBackgroundSpan\");\nlet fillStyleOptions = document.querySelectorAll(\".squareFillStyleSpan\");\nlet squareStrokeThicknessValue = document.querySelectorAll(\".squareStrokeThickSpan\");\nlet squareOutlineStyleValue = document.querySelectorAll(\".squareOutlineStyle\");\n\n\n\nfunction getSVGCoordsFromMouse(e) {\n // Use the SVG's current viewBox to map mouse to SVG coordinates\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\nfunction deleteCurrentShape() {\n if (currentShape && currentShape.shapeName === 'rectangle') {\n const idx = shapes.indexOf(currentShape);\n if (idx !== -1) shapes.splice(idx, 1);\n \n // Clean up any arrow attachments before deleting\n cleanupAttachments(currentShape);\n \n if (currentShape.group.parentNode) {\n currentShape.group.parentNode.removeChild(currentShape.group);\n }\n pushDeleteAction(currentShape);\n currentShape = null;\n disableAllSideBars();\n }\n}\n\n// --- Main event handlers ---\nconst handleMouseDownRect = (e) => {\n const { x: mouseX, y: mouseY } = getSVGCoordsFromMouse(e);\n if (isSquareToolActive) {\n startX = mouseX;\n startY = mouseY;\n isDrawingSquare = true;\n\n if (currentShape) {\n currentShape.removeSelection();\n currentShape = null;\n disableAllSideBars();\n }\n\n let initialOptions = {\n stroke: squareStrokecolor ?? getThemeStroke(),\n fill: squareBackgroundColor,\n fillStyle: squareFillStyleValue,\n strokeWidth: squareStrokeThicknes,\n };\n if (squareOutlineStyle === \"dashed\") {\n initialOptions.strokeDasharray = \"10,10\";\n } else if (squareOutlineStyle === \"dotted\") {\n initialOptions.strokeDasharray = \"2,8\";\n } else {\n initialOptions.strokeDasharray = \"\";\n }\n\n currentShape = new Rectangle(startX, startY, 0, 0, initialOptions);\n currentShape.setDrawingState(true);\n\n } else if (isSelectionToolActive) {\n let clickedOnShape = false;\n if (currentShape && currentShape.shapeName === 'rectangle' && currentShape.isSelected) {\n const anchorInfo = currentShape.isNearAnchor(mouseX, mouseY);\n if (anchorInfo) {\n dragOldPosSquare = { x: currentShape.x, y: currentShape.y, width: currentShape.width, height: currentShape.height, rotation: currentShape.rotation };\n if (anchorInfo.type === 'resize') {\n isResizingShapeSquare = true;\n resizingAnchorIndexSquare = anchorInfo.index;\n } else if (anchorInfo.type === 'rotate') {\n isRotatingShapeSquare = true;\n\n const CTM = currentShape.group.getCTM();\n if (CTM) {\n const svgPoint = svg.createSVGPoint();\n svgPoint.x = currentShape.width / 2;\n svgPoint.y = currentShape.height / 2;\n const centerSVG = svgPoint.matrixTransform(CTM);\n startRotationMouseAngleSquare = Math.atan2(mouseY - centerSVG.y, mouseX - centerSVG.x) * 180 / Math.PI;\n startShapeRotationSquare = currentShape.rotation;\n } else {\n isRotatingShapeSquare = false; \n console.warn(\"Could not get CTM for rotation.\");\n }\n }\n clickedOnShape = true;\n } else if (currentShape.contains(mouseX, mouseY)) {\n isDraggingShapeSquare = true;\n dragOldPosSquare = { x: currentShape.x, y: currentShape.y, width: currentShape.width, height: currentShape.height, rotation: currentShape.rotation };\n \n // Store initial frame state\n draggedShapeInitialFrame = currentShape.parentFrame || null;\n \n // Temporarily remove from frame clipping if dragging\n if (currentShape.parentFrame) {\n currentShape.parentFrame.temporarilyRemoveFromFrame(currentShape);\n }\n \n startX = mouseX; \n startY = mouseY;\n clickedOnShape = true;\n }\n }\n\n if (!clickedOnShape) {\n let shapeToSelect = null;\n for (let i = shapes.length - 1; i >= 0; i--) {\n const shape = shapes[i];\n if (shape.shapeName === 'rectangle' && shape.contains(mouseX, mouseY)) {\n shapeToSelect = shape;\n break; \n }\n }\n if (currentShape && currentShape !== shapeToSelect) {\n currentShape.removeSelection();\n currentShape = null;\n disableAllSideBars();\n }\n if (shapeToSelect) {\n currentShape = shapeToSelect;\n currentShape.isSelected = true;\n currentShape.draw(); \n isDraggingShapeSquare = true; \n dragOldPosSquare = { x: currentShape.x, y: currentShape.y, width: currentShape.width, height: currentShape.height, rotation: currentShape.rotation };\n \n // Store initial frame state\n draggedShapeInitialFrame = currentShape.parentFrame || null;\n \n // Temporarily remove from frame clipping if dragging\n if (currentShape.parentFrame) {\n currentShape.parentFrame.temporarilyRemoveFromFrame(currentShape);\n }\n \n startX = mouseX; \n startY = mouseY;\n clickedOnShape = true; \n }\n }\n if (!clickedOnShape && currentShape) {\n currentShape.removeSelection();\n currentShape = null;\n disableAllSideBars();\n }\n }\n};\n\n\nconst handleMouseMoveRect = (e) => {\n const { x: mouseX, y: mouseY } = getSVGCoordsFromMouse(e);\n const svgRect = svg.getBoundingClientRect();\n lastMousePos = {\n x: e.clientX - svgRect.left, \n y: e.clientY - svgRect.top\n };\n\n if (isDrawingSquare && isSquareToolActive && currentShape) {\n let width = mouseX - startX;\n let height = mouseY - startY;\n currentShape.x = width < 0 ? startX + width : startX;\n currentShape.y = height < 0 ? startY + height : startY;\n currentShape.width = Math.abs(width);\n currentShape.height = Math.abs(height);\n \n // Force update the element size while drawing (but use cached rough element)\n if (currentShape.element && currentShape.width > 0 && currentShape.height > 0) {\n // Remove old element\n if (currentShape.element.parentNode === currentShape.group) {\n currentShape.group.removeChild(currentShape.element);\n }\n \n // Create new rough element with current size\n const roughRect = rc.rectangle(0, 0, currentShape.width, currentShape.height, currentShape.options);\n currentShape.element = roughRect;\n currentShape.group.appendChild(roughRect);\n }\n \n // Update transform\n const rotateCenterX = currentShape.width / 2;\n const rotateCenterY = currentShape.height / 2;\n currentShape.group.setAttribute('transform', `translate(${currentShape.x}, ${currentShape.y}) rotate(${currentShape.rotation}, ${rotateCenterX}, ${rotateCenterY})`);\n \n // Check for frame containment while drawing\n shapes.forEach(frame => {\n if (frame.shapeName === 'frame') {\n if (frame.isShapeInFrame(currentShape)) {\n frame.highlightFrame();\n hoveredFrame = frame;\n } else if (hoveredFrame === frame) {\n frame.removeHighlight();\n hoveredFrame = null;\n }\n }\n });\n \n } else if (isDraggingShapeSquare && currentShape && currentShape.isSelected) {\n let dx = mouseX - startX;\n let dy = mouseY - startY;\n currentShape.move(dx, dy);\n startX = mouseX;\n startY = mouseY;\n // Snap guides\n if (window.__sketchStoreApi && window.__sketchStoreApi.getState().snapToObjects) {\n const snap = calculateSnap(currentShape, e.shiftKey, e.clientX, e.clientY);\n if (snap.dx || snap.dy) {\n currentShape.move(snap.dx, snap.dy);\n }\n } else {\n clearSnapGuides();\n }\n\n // Issue #24 bug #4: track the actual containing frame at every\n // move so the mouseUp logic re-parents correctly. Without this\n // hoveredFrame stays at null for existing-shape drags and the\n // shape is detached the moment the user nudges it by 1 px inside\n // its own parent frame.\n let newHover = null;\n for (const f of shapes) {\n if (f.shapeName !== 'frame') continue;\n if (f === currentShape) continue;\n if (typeof f.isShapeInFrame === 'function' && f.isShapeInFrame(currentShape)) {\n newHover = f;\n break;\n }\n }\n if (hoveredFrame && hoveredFrame !== newHover && typeof hoveredFrame.removeHighlight === 'function') {\n hoveredFrame.removeHighlight();\n }\n if (newHover && newHover !== hoveredFrame && typeof newHover.highlightFrame === 'function') {\n newHover.highlightFrame();\n }\n hoveredFrame = newHover;\n } else if (isResizingShapeSquare && currentShape && currentShape.isSelected && resizingAnchorIndexSquare !== null) {\n currentShape.updatePosition(resizingAnchorIndexSquare, mouseX, mouseY);\n currentShape._skipAnchors = true;\n currentShape.draw();\n currentShape._skipAnchors = false;\n } else if (isRotatingShapeSquare && currentShape && currentShape.isSelected) {\n const CTM = currentShape.group.getCTM();\n if (CTM) {\n const svgPoint = svg.createSVGPoint();\n svgPoint.x = currentShape.width / 2;\n svgPoint.y = currentShape.height / 2;\n const centerSVG = svgPoint.matrixTransform(CTM);\n const currentRotationMouseAngle = Math.atan2(mouseY - centerSVG.y, mouseX - centerSVG.x) * 180 / Math.PI;\n const angleDiff = currentRotationMouseAngle - startRotationMouseAngleSquare;\n let newRotation = startShapeRotationSquare + angleDiff;\n const snapAngle = 15;\n if (e.shiftKey) {\n newRotation = Math.round(newRotation / snapAngle) * snapAngle;\n }\n currentShape.rotate(newRotation);\n currentShape._skipAnchors = true;\n currentShape.draw();\n currentShape._skipAnchors = false;\n svg.style.cursor = 'grabbing'; \n } else {\n isRotatingShapeSquare = false;\n svg.style.cursor = 'default';\n }\n } else if (isSelectionToolActive && !isDrawingSquare && currentShape && currentShape.isSelected) {\n const anchorInfo = currentShape.isNearAnchor(mouseX, mouseY);\n if (anchorInfo) {\n if (anchorInfo.type === 'resize') {\n const baseDirection = anchorInfo.index; \n const rotatedCursor = currentShape.getRotatedCursor(baseDirection, currentShape.rotation);\n svg.style.cursor = rotatedCursor + '-resize';\n } else if (anchorInfo.type === 'rotate') {\n svg.style.cursor = 'grab';\n }\n } else if (currentShape.contains(mouseX, mouseY)) {\n svg.style.cursor = 'move';\n } else {\n svg.style.cursor = 'default';\n }\n } else if (isSelectionToolActive && !isDrawingSquare && !isDraggingShapeSquare && !isResizingShapeSquare && !isRotatingShapeSquare) {\n let hoveredShape = null;\n for (let i = shapes.length - 1; i >= 0; i--) {\n const shape = shapes[i];\n if (shape.shapeName === 'rectangle' && shape.contains(mouseX, mouseY)) {\n hoveredShape = shape;\n break;\n }\n }\n if (hoveredShape) {\n svg.style.cursor = 'pointer';\n } else {\n svg.style.cursor = 'default'; \n }\n }\n};\n\n \nconst handleMouseUpRect = (e) => {\n if (isDrawingSquare && currentShape) {\n currentShape.setDrawingState(false);\n if (currentShape.width === 0 || currentShape.height === 0) {\n if (currentShape.group.parentNode) {\n currentShape.group.parentNode.removeChild(currentShape.group);\n }\n currentShape = null;\n } else {\n currentShape.draw();\n shapes.push(currentShape);\n pushCreateAction(currentShape);\n\n // Check for frame containment and track attachment\n const finalFrame = hoveredFrame;\n if (finalFrame) {\n finalFrame.addShapeToFrame(currentShape);\n // Track the attachment for undo\n pushFrameAttachmentAction(finalFrame, currentShape, 'attach', null);\n }\n\n // Auto-select the drawn shape and switch to selection tool\n const drawnShape = currentShape;\n if (window.__sketchStoreApi) window.__sketchStoreApi.setActiveTool('select', { afterDraw: true });\n currentShape = drawnShape;\n currentShape.isSelected = true;\n if (typeof currentShape.addAnchors === 'function') {\n currentShape.addAnchors();\n }\n }\n \n // Clear frame highlighting\n if (hoveredFrame) {\n hoveredFrame.removeHighlight();\n hoveredFrame = null;\n }\n }\n\n if ((isDraggingShapeSquare || isResizingShapeSquare || isRotatingShapeSquare) && dragOldPosSquare && currentShape) {\n // Issue #34 bug #2: for drag operations the actual frame transfer\n // happens AFTER this mouseUp block \u2014 so `currentShape.parentFrame`\n // at this point still points at the OLD frame. Use the hovered\n // frame (tracked during mousemove) as the authoritative new\n // destination instead, so the undo action records a real\n // attachment delta and Ctrl+Z re-attaches the shape correctly.\n const newPos = {\n x: currentShape.x,\n y: currentShape.y,\n width: currentShape.width,\n height: currentShape.height,\n rotation: currentShape.rotation,\n parentFrame: isDraggingShapeSquare ? (hoveredFrame || null) : currentShape.parentFrame,\n };\n const oldPos = {\n ...dragOldPosSquare,\n parentFrame: draggedShapeInitialFrame\n };\n \n const stateChanged = oldPos.x !== newPos.x || oldPos.y !== newPos.y ||\n oldPos.width !== newPos.width || oldPos.height !== newPos.height ||\n oldPos.rotation !== newPos.rotation;\n\n const frameChanged = oldPos.parentFrame !== newPos.parentFrame;\n\n if (stateChanged || frameChanged) {\n pushTransformAction(currentShape, oldPos, newPos);\n }\n \n // Handle frame containment changes after drag\n if (isDraggingShapeSquare) {\n const finalFrame = hoveredFrame;\n \n // If shape moved to a different frame\n if (draggedShapeInitialFrame !== finalFrame) {\n // Remove from initial frame\n if (draggedShapeInitialFrame) {\n draggedShapeInitialFrame.removeShapeFromFrame(currentShape);\n }\n \n // Add to new frame\n if (finalFrame) {\n finalFrame.addShapeToFrame(currentShape);\n }\n \n // Track the frame change for undo\n if (frameChanged) {\n pushFrameAttachmentAction(finalFrame || draggedShapeInitialFrame, currentShape, \n finalFrame ? 'attach' : 'detach', draggedShapeInitialFrame);\n }\n } else if (draggedShapeInitialFrame) {\n // Shape stayed in same frame, restore clipping\n draggedShapeInitialFrame.restoreToFrame(currentShape);\n }\n }\n \n dragOldPosSquare = null;\n draggedShapeInitialFrame = null;\n }\n \n // Clear frame highlighting\n if (hoveredFrame) {\n hoveredFrame.removeHighlight();\n hoveredFrame = null;\n }\n\n isDrawingSquare = false;\n isDraggingShapeSquare = false;\n isResizingShapeSquare = false;\n isRotatingShapeSquare = false;\n resizingAnchorIndexSquare = null;\n startRotationMouseAngleSquare = 0;\n startShapeRotationSquare = 0;\n clearSnapGuides();\n svg.style.cursor = 'default';\n};\n\nSquarecolorOptions.forEach((span) => {\n span.addEventListener(\"click\", (event) => {\n event.stopPropagation();\n if (currentShape && currentShape.shapeName === 'rectangle' && currentShape.isSelected) {\n pushOptionsChangeAction(currentShape, { ...currentShape.options }); \n squareStrokecolor = span.getAttribute(\"data-id\"); \n currentShape.options.stroke = squareStrokecolor; \n currentShape.draw();\n currentShape.updateSidebar(); \n } else {\n squareStrokecolor = span.getAttribute(\"data-id\");\n }\n SquarecolorOptions.forEach((el) => el.classList.remove(\"selected\"));\n span.classList.add(\"selected\"); \n });\n});\n\nbackgroundColorOptionsSquare.forEach((span) => {\n span.addEventListener(\"click\", (event) => {\n event.stopPropagation();\n if (currentShape && currentShape.shapeName === 'rectangle' && currentShape.isSelected) {\n pushOptionsChangeAction(currentShape, { ...currentShape.options });\n squareBackgroundColor = span.getAttribute(\"data-id\");\n currentShape.options.fill = squareBackgroundColor;\n currentShape.draw();\n currentShape.updateSidebar();\n } else {\n squareBackgroundColor = span.getAttribute(\"data-id\");\n }\n backgroundColorOptionsSquare.forEach((el) => el.classList.remove(\"selected\"));\n span.classList.add(\"selected\");\n });\n});\n\nfillStyleOptions.forEach((span) => {\n span.addEventListener(\"click\", (event) => {\n event.stopPropagation()\n if (currentShape && currentShape.shapeName === 'rectangle' && currentShape.isSelected) {\n pushOptionsChangeAction(currentShape, { ...currentShape.options });\n squareFillStyleValue = span.getAttribute(\"data-id\");\n currentShape.options.fillStyle = squareFillStyleValue;\n currentShape.draw();\n currentShape.updateSidebar();\n } else {\n squareFillStyleValue = span.getAttribute(\"data-id\");\n }\n fillStyleOptions.forEach((el) => el.classList.remove(\"selected\"));\n span.classList.add(\"selected\");\n });\n});\n\nsquareStrokeThicknessValue.forEach((span) => {\n span.addEventListener(\"click\", (event) => {\n event.stopPropagation()\n if (currentShape && currentShape.shapeName === 'rectangle' && currentShape.isSelected) {\n pushOptionsChangeAction(currentShape, { ...currentShape.options });\n squareStrokeThicknes = parseInt(span.getAttribute(\"data-id\"));\n currentShape.options.strokeWidth = squareStrokeThicknes;\n currentShape.draw();\n currentShape.updateSidebar();\n } else {\n squareStrokeThicknes = parseInt(span.getAttribute(\"data-id\"));\n }\n squareStrokeThicknessValue.forEach((el) => el.classList.remove(\"selected\"));\n span.classList.add(\"selected\");\n });\n});\n\nsquareOutlineStyleValue.forEach((span) => {\n span.addEventListener(\"click\", (event) => {\n event.stopPropagation();\n if (currentShape && currentShape.shapeName === 'rectangle' && currentShape.isSelected) {\n pushOptionsChangeAction(currentShape, { ...currentShape.options });\n squareOutlineStyle = span.getAttribute(\"data-id\");\n if (squareOutlineStyle === \"dashed\") {\n currentShape.options.strokeDasharray = \"10,10\";\n } else if (squareOutlineStyle === \"dotted\") {\n currentShape.options.strokeDasharray = \"2,8\";\n } else {\n currentShape.options.strokeDasharray = \"\";\n }\n currentShape.draw();\n currentShape.updateSidebar();\n } else {\n squareOutlineStyle = span.getAttribute(\"data-id\");\n }\n squareOutlineStyleValue.forEach((el) => el.classList.remove(\"selected\"));\n span.classList.add(\"selected\");\n });\n});\n\nwindow.Rectangle = Rectangle;\n\n// Bridge rectangle tool settings to React sidebar\nwindow.rectToolSettings = {\n get strokeColor() { return squareStrokecolor; },\n set strokeColor(v) { squareStrokecolor = v; },\n get bgColor() { return squareBackgroundColor; },\n set bgColor(v) { squareBackgroundColor = v; },\n get fillStyle() { return squareFillStyleValue; },\n set fillStyle(v) { squareFillStyleValue = v; },\n get strokeWidth() { return squareStrokeThicknes; },\n set strokeWidth(v) { squareStrokeThicknes = v; },\n get outlineStyle() { return squareOutlineStyle; },\n set outlineStyle(v) { squareOutlineStyle = v; },\n};\nwindow.updateSelectedRectStyle = function(changes) {\n if (currentShape && currentShape.shapeName === 'rectangle' && currentShape.isSelected) {\n pushOptionsChangeAction(currentShape, { ...currentShape.options });\n if (changes.stroke !== undefined) { squareStrokecolor = changes.stroke; currentShape.options.stroke = changes.stroke; }\n if (changes.fill !== undefined) { squareBackgroundColor = changes.fill; currentShape.options.fill = changes.fill; }\n if (changes.fillStyle !== undefined) { squareFillStyleValue = changes.fillStyle; currentShape.options.fillStyle = changes.fillStyle; }\n if (changes.strokeWidth !== undefined) { squareStrokeThicknes = changes.strokeWidth; currentShape.options.strokeWidth = changes.strokeWidth; }\n if (changes.outlineStyle !== undefined) {\n squareOutlineStyle = changes.outlineStyle;\n if (changes.outlineStyle === \"dashed\") currentShape.options.strokeDasharray = \"10,10\";\n else if (changes.outlineStyle === \"dotted\") currentShape.options.strokeDasharray = \"2,8\";\n else currentShape.options.strokeDasharray = \"\";\n }\n currentShape.draw();\n } else {\n if (changes.stroke !== undefined) squareStrokecolor = changes.stroke;\n if (changes.fill !== undefined) squareBackgroundColor = changes.fill;\n if (changes.fillStyle !== undefined) squareFillStyleValue = changes.fillStyle;\n if (changes.strokeWidth !== undefined) squareStrokeThicknes = changes.strokeWidth;\n if (changes.outlineStyle !== undefined) squareOutlineStyle = changes.outlineStyle;\n }\n};\n\nexport { handleMouseDownRect, handleMouseMoveRect, handleMouseUpRect };\n"],
5
- "mappings": ";;;;;;;;;;;;;AASA,IAAI,kBAAkB;AACtB,IAAI,wBAAwB;AAC5B,IAAI,wBAAwB;AAC5B,IAAI,wBAAwB;AAC5B,IAAI,4BAA4B;AAChC,IAAI,gCAAgC;AACpC,IAAI,2BAA2B;AAC/B,IAAM,KAAK,MAAM,IAAI,GAAG;AACxB,IAAI;AAAJ,IAAY;AAMZ,SAAS,iBAAiB;AACtB,MAAI,OAAO,aAAa,YAAa,QAAO;AAC5C,SAAO,SAAS,QAAQ,SAAS,KAAK,UAAU,SAAS,YAAY,IAAI,SAAS;AACtF;AACA,IAAI,oBAAoB;AACxB,IAAI,wBAAwB;AAC5B,IAAI,uBAAuB;AAC3B,IAAI,uBAAuB;AAC3B,IAAI,qBAAqB;AACzB,IAAI,mBAAmB;AACvB,IAAI,2BAA2B;AAC/B,IAAI,eAAe;AAEnB,IAAI,qBAAqB,SAAS,iBAAiB,mBAAmB;AACtE,IAAI,+BAA+B,SAAS,iBAAiB,uBAAuB;AACpF,IAAI,mBAAmB,SAAS,iBAAiB,sBAAsB;AACvE,IAAI,6BAA6B,SAAS,iBAAiB,wBAAwB;AACnF,IAAI,0BAA0B,SAAS,iBAAiB,qBAAqB;AAI7E,SAAS,sBAAsB,GAAG;AAE9B,QAAM,UAAU,IAAI,QAAQ;AAC5B,QAAM,OAAO,IAAI,sBAAsB;AACvC,QAAM,SAAS,EAAE,UAAU,KAAK;AAChC,QAAM,SAAS,EAAE,UAAU,KAAK;AAChC,QAAM,OAAO,QAAQ,IAAK,SAAS,KAAK,QAAS,QAAQ;AACzD,QAAM,OAAO,QAAQ,IAAK,SAAS,KAAK,SAAU,QAAQ;AAC1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,OAAW,sBAAqB,QAAQ;AAAA,EACzE;AACJ;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/shapes/Rectangle.js"],
4
- "sourcesContent": ["/* eslint-disable */\nimport { registerRotationAnchor } from '../core/ScreenSpaceControls.js';\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 registerRotationAnchor(this.rotationAnchor, { radius: 8, edgeY: expandedY });\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": ";;;;;;AAMA,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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