@elixpo/lixsketch 5.6.5 → 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 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  updateAttachedArrows
4
- } from "./chunk-XYUFEIZR.js";
4
+ } from "./chunk-DWEFPKDO.js";
5
5
 
6
6
  // src/shapes/ImageShape.js
7
7
  var isDragging = false;
@@ -312,4 +312,4 @@ var ImageShape = class {
312
312
  export {
313
313
  ImageShape
314
314
  };
315
- //# sourceMappingURL=chunk-ASBC5G35.js.map
315
+ //# sourceMappingURL=chunk-B6CYUZC4.js.map
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  updateAttachedArrows
4
- } from "./chunk-XYUFEIZR.js";
4
+ } from "./chunk-DWEFPKDO.js";
5
5
 
6
6
  // src/shapes/Line.js
7
7
  var rc = rough.svg(svg);
@@ -625,4 +625,4 @@ var Line = class {
625
625
  export {
626
626
  Line
627
627
  };
628
- //# sourceMappingURL=chunk-OP56XPWF.js.map
628
+ //# sourceMappingURL=chunk-DNFPTVIP.js.map
@@ -5,7 +5,7 @@ import {
5
5
  pushFrameAttachmentAction,
6
6
  pushOptionsChangeAction,
7
7
  pushTransformAction
8
- } from "./chunk-6GPEWDRB.js";
8
+ } from "./chunk-M7GAB24F.js";
9
9
 
10
10
  // src/core/SnapGuides.js
11
11
  var SNAP_THRESHOLD = 6;
@@ -744,4 +744,4 @@ export {
744
744
  updateAttachedArrows,
745
745
  cleanupAttachments
746
746
  };
747
- //# sourceMappingURL=chunk-XYUFEIZR.js.map
747
+ //# sourceMappingURL=chunk-DWEFPKDO.js.map
@@ -10,14 +10,14 @@ import {
10
10
  setCodeLanguage,
11
11
  updateCodeBackground,
12
12
  wrapCodeElement
13
- } from "./chunk-M6TMN76K.js";
13
+ } from "./chunk-ULPIHUVC.js";
14
14
  import {
15
15
  registerRotationAnchor
16
16
  } from "./chunk-PAKA6HUX.js";
17
17
  import {
18
18
  cleanupAttachments,
19
19
  updateAttachedArrows
20
- } from "./chunk-XYUFEIZR.js";
20
+ } from "./chunk-DWEFPKDO.js";
21
21
  import {
22
22
  pushCreateAction,
23
23
  pushDeleteActionWithAttachments,
@@ -26,7 +26,7 @@ import {
26
26
  pushTransformAction,
27
27
  setTextReferences,
28
28
  updateSelectedElement
29
- } from "./chunk-6GPEWDRB.js";
29
+ } from "./chunk-M7GAB24F.js";
30
30
 
31
31
  // src/tools/textTool.js
32
32
  function getThemeStroke() {
@@ -1516,4 +1516,4 @@ export {
1516
1516
  handleTextMouseUp,
1517
1517
  updateCodeToggleForShape
1518
1518
  };
1519
- //# sourceMappingURL=chunk-GQUZPON4.js.map
1519
+ //# sourceMappingURL=chunk-F56XUE5S.js.map
@@ -2,13 +2,13 @@
2
2
  import {
3
3
  calculateSnap,
4
4
  clearSnapGuides
5
- } from "./chunk-XYUFEIZR.js";
5
+ } from "./chunk-DWEFPKDO.js";
6
6
  import {
7
7
  pushCreateAction,
8
8
  pushFrameAttachmentAction,
9
9
  pushOptionsChangeAction,
10
10
  pushTransformAction
11
- } from "./chunk-6GPEWDRB.js";
11
+ } from "./chunk-M7GAB24F.js";
12
12
 
13
13
  // src/tools/rectangleTool.js
14
14
  var isDrawingSquare = false;
@@ -84,18 +84,10 @@ var handleMouseDownRect = (e) => {
84
84
  resizingAnchorIndexSquare = anchorInfo.index;
85
85
  } else if (anchorInfo.type === "rotate") {
86
86
  isRotatingShapeSquare = true;
87
- const CTM = currentShape.group.getCTM();
88
- if (CTM) {
89
- const svgPoint = svg.createSVGPoint();
90
- svgPoint.x = currentShape.width / 2;
91
- svgPoint.y = currentShape.height / 2;
92
- const centerSVG = svgPoint.matrixTransform(CTM);
93
- startRotationMouseAngleSquare = Math.atan2(mouseY - centerSVG.y, mouseX - centerSVG.x) * 180 / Math.PI;
94
- startShapeRotationSquare = currentShape.rotation;
95
- } else {
96
- isRotatingShapeSquare = false;
97
- console.warn("Could not get CTM for rotation.");
98
- }
87
+ const centerX = currentShape.x + currentShape.width / 2;
88
+ const centerY = currentShape.y + currentShape.height / 2;
89
+ startRotationMouseAngleSquare = Math.atan2(mouseY - centerY, mouseX - centerX) * 180 / Math.PI;
90
+ startShapeRotationSquare = currentShape.rotation;
99
91
  }
100
92
  clickedOnShape = true;
101
93
  } else if (currentShape.contains(mouseX, mouseY)) {
@@ -218,28 +210,20 @@ var handleMouseMoveRect = (e) => {
218
210
  currentShape.draw();
219
211
  currentShape._skipAnchors = false;
220
212
  } else if (isRotatingShapeSquare && currentShape && currentShape.isSelected) {
221
- const CTM = currentShape.group.getCTM();
222
- if (CTM) {
223
- const svgPoint = svg.createSVGPoint();
224
- svgPoint.x = currentShape.width / 2;
225
- svgPoint.y = currentShape.height / 2;
226
- const centerSVG = svgPoint.matrixTransform(CTM);
227
- const currentRotationMouseAngle = Math.atan2(mouseY - centerSVG.y, mouseX - centerSVG.x) * 180 / Math.PI;
228
- const angleDiff = currentRotationMouseAngle - startRotationMouseAngleSquare;
229
- let newRotation = startShapeRotationSquare + angleDiff;
230
- const snapAngle = 15;
231
- if (e.shiftKey) {
232
- newRotation = Math.round(newRotation / snapAngle) * snapAngle;
233
- }
234
- currentShape.rotate(newRotation);
235
- currentShape._skipAnchors = true;
236
- currentShape.draw();
237
- currentShape._skipAnchors = false;
238
- svg.style.cursor = "grabbing";
239
- } else {
240
- isRotatingShapeSquare = false;
241
- svg.style.cursor = "default";
213
+ const centerX = currentShape.x + currentShape.width / 2;
214
+ const centerY = currentShape.y + currentShape.height / 2;
215
+ const currentRotationMouseAngle = Math.atan2(mouseY - centerY, mouseX - centerX) * 180 / Math.PI;
216
+ const angleDiff = currentRotationMouseAngle - startRotationMouseAngleSquare;
217
+ let newRotation = startShapeRotationSquare + angleDiff;
218
+ const snapAngle = 15;
219
+ if (e.shiftKey) {
220
+ newRotation = Math.round(newRotation / snapAngle) * snapAngle;
242
221
  }
222
+ currentShape.rotate(newRotation);
223
+ currentShape._skipAnchors = true;
224
+ currentShape.draw();
225
+ currentShape._skipAnchors = false;
226
+ svg.style.cursor = "grabbing";
243
227
  } else if (isSelectionToolActive && !isDrawingSquare && currentShape && currentShape.isSelected) {
244
228
  const anchorInfo = currentShape.isNearAnchor(mouseX, mouseY);
245
229
  if (anchorInfo) {
@@ -516,4 +500,4 @@ export {
516
500
  handleMouseMoveRect,
517
501
  handleMouseUpRect
518
502
  };
519
- //# sourceMappingURL=chunk-7CM5XQDN.js.map
503
+ //# sourceMappingURL=chunk-G3DJQY65.js.map
@@ -0,0 +1,7 @@
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 centerX = currentShape.x + currentShape.width / 2;\n const centerY = currentShape.y + currentShape.height / 2;\n startRotationMouseAngleSquare = Math.atan2(mouseY - centerY, mouseX - centerX) * 180 / Math.PI;\n startShapeRotationSquare = currentShape.rotation;\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 centerX = currentShape.x + currentShape.width / 2;\n const centerY = currentShape.y + currentShape.height / 2;\n const currentRotationMouseAngle = Math.atan2(mouseY - centerY, mouseX - centerX) * 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 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 }\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BAAwB,QAAQ;AAAM,mBAAa,QAAQ,OAAO,QAAQ;AAAA,IAAM;AAClH,QAAI,QAAQ,cAAc,QAAW;AAAE,6BAAuB,QAAQ;AAAW,mBAAa,QAAQ,YAAY,QAAQ;AAAA,IAAW;AACrI,QAAI,QAAQ,gBAAgB,QAAW;AAAE,6BAAuB,QAAQ;AAAa,mBAAa,QAAQ,cAAc,QAAQ;AAAA,IAAa;AAC7I,QAAI,QAAQ,iBAAiB,QAAW;AACpC,2BAAqB,QAAQ;AAC7B,UAAI,QAAQ,iBAAiB,SAAU,cAAa,QAAQ,kBAAkB;AAAA,eACrE,QAAQ,iBAAiB,SAAU,cAAa,QAAQ,kBAAkB;AAAA,UAC9E,cAAa,QAAQ,kBAAkB;AAAA,IAChD;AACA,iBAAa,KAAK;AAAA,EACtB,OAAO;AACH,QAAI,QAAQ,WAAW,OAAW,qBAAoB,QAAQ;AAC9D,QAAI,QAAQ,SAAS,OAAW,yBAAwB,QAAQ;AAChE,QAAI,QAAQ,cAAc,OAAW,wBAAuB,QAAQ;AACpE,QAAI,QAAQ,gBAAgB,OAAW,wBAAuB,QAAQ;AACtE,QAAI,QAAQ,iBAAiB,OAAW,sBAAqB,QAAQ;AAAA,EACzE;AACJ;",
6
+ "names": []
7
+ }
@@ -10,13 +10,13 @@ import {
10
10
  import {
11
11
  cleanupAttachments,
12
12
  updateAttachedArrows
13
- } from "./chunk-XYUFEIZR.js";
13
+ } from "./chunk-DWEFPKDO.js";
14
14
  import {
15
15
  pushCreateAction,
16
16
  pushDeleteAction,
17
17
  pushFrameAttachmentAction,
18
18
  pushTransformAction
19
- } from "./chunk-6GPEWDRB.js";
19
+ } from "./chunk-M7GAB24F.js";
20
20
 
21
21
  // src/tools/imageTool.js
22
22
  var isDraggingImage = false;
@@ -1038,4 +1038,4 @@ export {
1038
1038
  handleMouseDownImage,
1039
1039
  handleMouseUpImage
1040
1040
  };
1041
- //# sourceMappingURL=chunk-LJR7EVW2.js.map
1041
+ //# sourceMappingURL=chunk-JEGLUNBC.js.map
@@ -39,10 +39,29 @@ function pushCreateAction(shape, meta = null) {
39
39
  function pushDeleteAction(shape, meta = null) {
40
40
  const action = { type: "delete", shape };
41
41
  if (meta && meta.childSnapshot) action.childSnapshot = meta.childSnapshot;
42
+ if (Number.isInteger(meta?.shapeIndex)) action.shapeIndex = meta.shapeIndex;
42
43
  undoStack.push(action);
43
44
  redoStack.length = 0;
44
45
  notifyCollaboration();
45
46
  }
47
+ function pushCanvasResetAction(snapshot, restore, reset) {
48
+ if (!snapshot || typeof restore !== "function" || typeof reset !== "function") return;
49
+ undoStack.length = 0;
50
+ redoStack.length = 0;
51
+ undoStack.push({ type: "canvasReset", snapshot, restore, reset });
52
+ }
53
+ function invalidateCanvasResetUndo() {
54
+ for (let index = undoStack.length - 1; index >= 0; index -= 1) {
55
+ if (undoStack[index]?.type === "canvasReset") undoStack.splice(index, 1);
56
+ }
57
+ for (let index = redoStack.length - 1; index >= 0; index -= 1) {
58
+ if (redoStack[index]?.type === "canvasReset") redoStack.splice(index, 1);
59
+ }
60
+ }
61
+ function clearUndoHistory() {
62
+ undoStack.length = 0;
63
+ redoStack.length = 0;
64
+ }
46
65
  function pushDeleteActionWithAttachments(shape) {
47
66
  let affectedArrows = [];
48
67
  if (shape.type === "text" || shape.shapeName === "text") {
@@ -371,6 +390,14 @@ function pushOptionsChangeAction(shape, oldOptions, newOptions = null) {
371
390
  redoStack.length = 0;
372
391
  notifyCollaboration();
373
392
  }
393
+ function applyOptionsSnapshot(shape, options) {
394
+ shape.options = { ...options };
395
+ if (shape.shapeName === "frame") {
396
+ shape.fillColor = options.fillColor;
397
+ shape.fillStyle = options.fillStyle;
398
+ }
399
+ shape.draw();
400
+ }
374
401
  function refreshSelectionAfterAction() {
375
402
  const ms = typeof window !== "undefined" ? window.multiSelection : null;
376
403
  if (!ms) return;
@@ -386,6 +413,12 @@ function undo() {
386
413
  if (undoStack.length === 0) return;
387
414
  const action = undoStack.pop();
388
415
  try {
416
+ if (action.type === "canvasReset") {
417
+ action.restore(action.snapshot);
418
+ redoStack.push(action);
419
+ notifyCollaboration();
420
+ return;
421
+ }
389
422
  if (action.type === "frameTransform") {
390
423
  action.shape.x = action.oldPos.x;
391
424
  action.shape.y = action.oldPos.y;
@@ -527,7 +560,10 @@ function undo() {
527
560
  } else if (action.shape.type === "image") {
528
561
  action.shape.restore();
529
562
  } else {
530
- shapes.push(action.shape);
563
+ if (shapes.indexOf(action.shape) === -1) {
564
+ const index = Number.isInteger(action.shapeIndex) ? Math.min(Math.max(action.shapeIndex, 0), shapes.length) : shapes.length;
565
+ shapes.splice(index, 0, action.shape);
566
+ }
531
567
  if (svg) {
532
568
  svg.appendChild(action.shape.group);
533
569
  }
@@ -760,8 +796,7 @@ function undo() {
760
796
  action.shape.arrowCurveAmount = action.oldOptions.arrowCurveAmount;
761
797
  action.shape.draw();
762
798
  } else {
763
- action.shape.options = action.oldOptions;
764
- action.shape.draw();
799
+ applyOptionsSnapshot(action.shape, action.oldOptions);
765
800
  }
766
801
  redoStack.push(action);
767
802
  return;
@@ -775,6 +810,12 @@ function redo() {
775
810
  if (redoStack.length === 0) return;
776
811
  const action = redoStack.pop();
777
812
  try {
813
+ if (action.type === "canvasReset") {
814
+ action.reset();
815
+ undoStack.push(action);
816
+ notifyCollaboration();
817
+ return;
818
+ }
778
819
  if (action.type === "frameTransform") {
779
820
  action.shape.x = action.newPos.x;
780
821
  action.shape.y = action.newPos.y;
@@ -1145,8 +1186,7 @@ function redo() {
1145
1186
  action.shape.arrowCurveAmount = action.newOptions.arrowCurveAmount;
1146
1187
  action.shape.draw();
1147
1188
  } else {
1148
- action.shape.options = { ...action.newOptions };
1149
- action.shape.draw();
1189
+ applyOptionsSnapshot(action.shape, action.newOptions);
1150
1190
  }
1151
1191
  undoStack.push(action);
1152
1192
  return;
@@ -1170,6 +1210,9 @@ document.getElementById("undo")?.addEventListener("click", undo);
1170
1210
  document.getElementById("redo")?.addEventListener("click", redo);
1171
1211
  window.pushCreateAction = pushCreateAction;
1172
1212
  window.pushDeleteAction = pushDeleteAction;
1213
+ window.pushCanvasResetAction = pushCanvasResetAction;
1214
+ window.invalidateCanvasResetUndo = invalidateCanvasResetUndo;
1215
+ window.clearUndoHistory = clearUndoHistory;
1173
1216
  window.pushDeleteActionWithAttachments = pushDeleteActionWithAttachments;
1174
1217
  window.pushTransformAction = pushTransformAction;
1175
1218
  window.pushOptionsChangeAction = pushOptionsChangeAction;
@@ -1183,6 +1226,9 @@ export {
1183
1226
  updateSelectedElement,
1184
1227
  pushCreateAction,
1185
1228
  pushDeleteAction,
1229
+ pushCanvasResetAction,
1230
+ invalidateCanvasResetUndo,
1231
+ clearUndoHistory,
1186
1232
  pushDeleteActionWithAttachments,
1187
1233
  pushFrameAttachmentAction,
1188
1234
  pushCreateActionWithAttachments,
@@ -1191,4 +1237,4 @@ export {
1191
1237
  undo,
1192
1238
  redo
1193
1239
  };
1194
- //# sourceMappingURL=chunk-6GPEWDRB.js.map
1240
+ //# sourceMappingURL=chunk-M7GAB24F.js.map