@elixpo/lixsketch 5.4.7 → 5.5.1

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 (218) hide show
  1. package/dist/react/AIRenderer-M4LMJ66J.js +1105 -0
  2. package/dist/react/AIRenderer-M4LMJ66J.js.map +7 -0
  3. package/dist/react/Arrow-BJDAXPMH.js +8 -0
  4. package/dist/react/Arrow-BJDAXPMH.js.map +7 -0
  5. package/dist/react/Circle-KPG7TKIX.js +8 -0
  6. package/dist/react/Circle-KPG7TKIX.js.map +7 -0
  7. package/dist/react/CodeShape-K4DIZAIV.js +8 -0
  8. package/dist/react/CodeShape-K4DIZAIV.js.map +7 -0
  9. package/dist/react/CopyPaste-4CKJRHJ3.js +569 -0
  10. package/dist/react/CopyPaste-4CKJRHJ3.js.map +7 -0
  11. package/dist/react/EraserTrail-PA6IQLQN.js +20 -0
  12. package/dist/react/EraserTrail-PA6IQLQN.js.map +7 -0
  13. package/dist/react/EventDispatcher-SRFH6LQZ.js +463 -0
  14. package/dist/react/EventDispatcher-SRFH6LQZ.js.map +7 -0
  15. package/dist/react/Frame-6UR5XPAX.js +10 -0
  16. package/dist/react/Frame-6UR5XPAX.js.map +7 -0
  17. package/dist/react/FreehandStroke-CK24NUT3.js +8 -0
  18. package/dist/react/FreehandStroke-CK24NUT3.js.map +7 -0
  19. package/dist/react/GraphEngine-QE5B2PMR.js +340 -0
  20. package/dist/react/GraphEngine-QE5B2PMR.js.map +7 -0
  21. package/dist/react/GraphMathParser-2WMTY4IE.js +10 -0
  22. package/dist/react/GraphMathParser-2WMTY4IE.js.map +7 -0
  23. package/dist/react/IconShape-KMIA6T2H.js +10 -0
  24. package/dist/react/IconShape-KMIA6T2H.js.map +7 -0
  25. package/dist/react/ImageShape-CHHGBXUQ.js +10 -0
  26. package/dist/react/ImageShape-CHHGBXUQ.js.map +7 -0
  27. package/dist/react/LayerOrder-XCHF4MSS.js +66 -0
  28. package/dist/react/LayerOrder-XCHF4MSS.js.map +7 -0
  29. package/dist/react/Line-2KOQEEGA.js +10 -0
  30. package/dist/react/Line-2KOQEEGA.js.map +7 -0
  31. package/dist/react/LixScriptParser-JYWJX375.js +1033 -0
  32. package/dist/react/LixScriptParser-JYWJX375.js.map +7 -0
  33. package/dist/react/MermaidFlowchartRenderer-4QBAZ5MB.js +412 -0
  34. package/dist/react/MermaidFlowchartRenderer-4QBAZ5MB.js.map +7 -0
  35. package/dist/react/MermaidSequenceParser-UKG2NSZY.js +8 -0
  36. package/dist/react/MermaidSequenceParser-UKG2NSZY.js.map +7 -0
  37. package/dist/react/MermaidSequenceRenderer-HPLHY5II.js +387 -0
  38. package/dist/react/MermaidSequenceRenderer-HPLHY5II.js.map +7 -0
  39. package/dist/react/Rectangle-6FE7RN6W.js +8 -0
  40. package/dist/react/Rectangle-6FE7RN6W.js.map +7 -0
  41. package/dist/react/ResizeCode-WAMDTKSW.js +2 -0
  42. package/dist/react/ResizeCode-WAMDTKSW.js.map +7 -0
  43. package/dist/react/ResizeShapes-LKEQTITP.js +250 -0
  44. package/dist/react/ResizeShapes-LKEQTITP.js.map +7 -0
  45. package/dist/react/SceneSerializer-4U4B24JM.js +739 -0
  46. package/dist/react/SceneSerializer-4U4B24JM.js.map +7 -0
  47. package/dist/react/Selection-VVUHY5YJ.js +34 -0
  48. package/dist/react/Selection-VVUHY5YJ.js.map +7 -0
  49. package/dist/react/SketchEngine-YA4RG3KX.js +413 -0
  50. package/dist/react/SketchEngine-YA4RG3KX.js.map +7 -0
  51. package/dist/react/TextShape-54ZJ66E3.js +8 -0
  52. package/dist/react/TextShape-54ZJ66E3.js.map +7 -0
  53. package/dist/react/UndoRedo-M2JZUBKN.js +30 -0
  54. package/dist/react/UndoRedo-M2JZUBKN.js.map +7 -0
  55. package/dist/react/ZoomPan-U3TXC5AJ.js +186 -0
  56. package/dist/react/ZoomPan-U3TXC5AJ.js.map +7 -0
  57. package/dist/react/arrowTool-CWEMIRXK.js +17 -0
  58. package/dist/react/arrowTool-CWEMIRXK.js.map +7 -0
  59. package/dist/react/boxicons-5JNJQPUP.woff +0 -0
  60. package/dist/react/boxicons-6NVWQSCQ.eot +0 -0
  61. package/dist/react/boxicons-AQ5N6WP7.woff2 +0 -0
  62. package/dist/react/boxicons-GDR4JU3X.ttf +0 -0
  63. package/dist/react/boxicons-NNFHLMOR.svg +1660 -0
  64. package/dist/react/chunk-2OQXI7QB.js +564 -0
  65. package/dist/react/chunk-2OQXI7QB.js.map +7 -0
  66. package/dist/react/chunk-5OUBTHHO.js +187 -0
  67. package/dist/react/chunk-5OUBTHHO.js.map +7 -0
  68. package/dist/react/chunk-6PFXZKL2.js +628 -0
  69. package/dist/react/chunk-6PFXZKL2.js.map +7 -0
  70. package/dist/react/chunk-6SFNWGGZ.js +453 -0
  71. package/dist/react/chunk-6SFNWGGZ.js.map +7 -0
  72. package/dist/react/chunk-7TZSIR6V.js +210 -0
  73. package/dist/react/chunk-7TZSIR6V.js.map +7 -0
  74. package/dist/react/chunk-AJAZC37E.js +662 -0
  75. package/dist/react/chunk-AJAZC37E.js.map +7 -0
  76. package/dist/react/chunk-BU4D2WYQ.js +1213 -0
  77. package/dist/react/chunk-BU4D2WYQ.js.map +7 -0
  78. package/dist/react/chunk-BZE4CEBG.js +747 -0
  79. package/dist/react/chunk-BZE4CEBG.js.map +7 -0
  80. package/dist/react/chunk-CB2RANCB.js +212 -0
  81. package/dist/react/chunk-CB2RANCB.js.map +7 -0
  82. package/dist/react/chunk-DNAG7ML6.js +128 -0
  83. package/dist/react/chunk-DNAG7ML6.js.map +7 -0
  84. package/dist/react/chunk-HZWLPXFN.js +198 -0
  85. package/dist/react/chunk-HZWLPXFN.js.map +7 -0
  86. package/dist/react/chunk-I6HCCIXB.js +572 -0
  87. package/dist/react/chunk-I6HCCIXB.js.map +7 -0
  88. package/dist/react/chunk-IZ5OGWGW.js +235 -0
  89. package/dist/react/chunk-IZ5OGWGW.js.map +7 -0
  90. package/dist/react/chunk-JJCJNLNN.js +1490 -0
  91. package/dist/react/chunk-JJCJNLNN.js.map +7 -0
  92. package/dist/react/chunk-JQ3IRFDP.js +222 -0
  93. package/dist/react/chunk-JQ3IRFDP.js.map +7 -0
  94. package/dist/react/chunk-L5OARZJ7.js +1134 -0
  95. package/dist/react/chunk-L5OARZJ7.js.map +7 -0
  96. package/dist/react/chunk-LHRTXNVE.js +1600 -0
  97. package/dist/react/chunk-LHRTXNVE.js.map +7 -0
  98. package/dist/react/chunk-Q2GA4MBZ.js +1653 -0
  99. package/dist/react/chunk-Q2GA4MBZ.js.map +7 -0
  100. package/dist/react/chunk-QNSE5BAY.js +519 -0
  101. package/dist/react/chunk-QNSE5BAY.js.map +7 -0
  102. package/dist/react/chunk-QXFBG7OM.js +191 -0
  103. package/dist/react/chunk-QXFBG7OM.js.map +7 -0
  104. package/dist/react/chunk-T6ZVV5ZO.js +714 -0
  105. package/dist/react/chunk-T6ZVV5ZO.js.map +7 -0
  106. package/dist/react/chunk-URB6MY46.js +974 -0
  107. package/dist/react/chunk-URB6MY46.js.map +7 -0
  108. package/dist/react/chunk-VN62KLOC.js +931 -0
  109. package/dist/react/chunk-VN62KLOC.js.map +7 -0
  110. package/dist/react/chunk-VQVEPJSA.js +158 -0
  111. package/dist/react/chunk-VQVEPJSA.js.map +7 -0
  112. package/dist/react/chunk-XISEAGBV.js +1632 -0
  113. package/dist/react/chunk-XISEAGBV.js.map +7 -0
  114. package/dist/react/chunk-YKJUBFHE.js +575 -0
  115. package/dist/react/chunk-YKJUBFHE.js.map +7 -0
  116. package/dist/react/circleTool-NUATSEI2.js +14 -0
  117. package/dist/react/circleTool-NUATSEI2.js.map +7 -0
  118. package/dist/react/codeTool-MHCB2FNB.js +38 -0
  119. package/dist/react/codeTool-MHCB2FNB.js.map +7 -0
  120. package/dist/react/eraserTool-2GS2LQCS.js +103 -0
  121. package/dist/react/eraserTool-2GS2LQCS.js.map +7 -0
  122. package/dist/react/frameTool-PWVKKXSP.js +14 -0
  123. package/dist/react/frameTool-PWVKKXSP.js.map +7 -0
  124. package/dist/react/freehandTool-SLYGASVP.js +14 -0
  125. package/dist/react/freehandTool-SLYGASVP.js.map +7 -0
  126. package/dist/react/iconTool-GPZ7O7NH.js +18 -0
  127. package/dist/react/iconTool-GPZ7O7NH.js.map +7 -0
  128. package/dist/react/imageTool-D5R4XGEU.js +15 -0
  129. package/dist/react/imageTool-D5R4XGEU.js.map +7 -0
  130. package/dist/react/index.js +5349 -0
  131. package/dist/react/index.js.map +7 -0
  132. package/dist/react/laserTool-XVMV63AV.js +239 -0
  133. package/dist/react/laserTool-XVMV63AV.js.map +7 -0
  134. package/dist/react/lineTool-WNI5EMZ5.js +14 -0
  135. package/dist/react/lineTool-WNI5EMZ5.js.map +7 -0
  136. package/dist/react/lixCode-OJMVUXXI.ttf +0 -0
  137. package/dist/react/lixDefault-JEAPAUJL.ttf +0 -0
  138. package/dist/react/lixFancy-BPXYM5CQ.ttf +0 -0
  139. package/dist/react/lixFont-CPKEUDVM.woff2 +0 -0
  140. package/dist/react/rectangleTool-U7DZ6ZTA.js +14 -0
  141. package/dist/react/rectangleTool-U7DZ6ZTA.js.map +7 -0
  142. package/dist/react/styles.css +6627 -0
  143. package/dist/react/textTool-M7S6F3VC.js +21 -0
  144. package/dist/react/textTool-M7S6F3VC.js.map +7 -0
  145. package/package.json +39 -5
  146. package/src/EngineShortcuts.js +83 -27
  147. package/src/core/AIRenderer.js +30 -18
  148. package/src/core/GraphEngine.js +64 -41
  149. package/src/core/MermaidFlowchartRenderer.js +153 -88
  150. package/src/core/MermaidSequenceRenderer.js +168 -93
  151. package/src/core/SceneSerializer.js +86 -2
  152. package/src/core/Selection.js +119 -19
  153. package/src/core/UndoRedo.js +82 -15
  154. package/src/core/ZoomPan.js +15 -5
  155. package/src/index.js +14 -1
  156. package/src/react/LixSketchCanvas.jsx +347 -0
  157. package/src/react/components/AppMenu.jsx +482 -0
  158. package/src/react/components/Footer.jsx +85 -0
  159. package/src/react/components/Toolbar.jsx +140 -0
  160. package/src/react/components/canvas/CanvasLoadingOverlay.jsx +76 -0
  161. package/src/react/components/canvas/ContextMenu.jsx +466 -0
  162. package/src/react/components/canvas/FindBar.jsx +177 -0
  163. package/src/react/components/canvas/ImageSourcePicker.jsx +133 -0
  164. package/src/react/components/canvas/MultiSelectActions.jsx +120 -0
  165. package/src/react/components/canvas/SVGCanvas.jsx +145 -0
  166. package/src/react/components/canvas/SaveStatusIndicator.jsx +29 -0
  167. package/src/react/components/modals/CanvasPropertiesModal.jsx +358 -0
  168. package/src/react/components/modals/CommandPalette.jsx +307 -0
  169. package/src/react/components/modals/ExportImageModal.jsx +287 -0
  170. package/src/react/components/modals/GraphModal.jsx +174 -0
  171. package/src/react/components/modals/HelpModal.jsx +208 -0
  172. package/src/react/components/modals/LixScriptModal.jsx +130 -0
  173. package/src/react/components/modals/ShortcutsModal.jsx +125 -0
  174. package/src/react/components/sidebars/ArrowSidebar.jsx +173 -0
  175. package/src/react/components/sidebars/CircleSidebar.jsx +134 -0
  176. package/src/react/components/sidebars/FrameSidebar.jsx +263 -0
  177. package/src/react/components/sidebars/IconSidebar.jsx +279 -0
  178. package/src/react/components/sidebars/ImageSidebar.jsx +69 -0
  179. package/src/react/components/sidebars/LineSidebar.jsx +109 -0
  180. package/src/react/components/sidebars/PaintbrushSidebar.jsx +119 -0
  181. package/src/react/components/sidebars/RectangleSidebar.jsx +165 -0
  182. package/src/react/components/sidebars/ShapeSidebar.jsx +130 -0
  183. package/src/react/components/sidebars/TextSidebar.jsx +174 -0
  184. package/src/react/hooks/inertStores.js +58 -0
  185. package/src/react/hooks/useSketchEngine.js +76 -0
  186. package/src/react/hooks/useTranslation.js +92 -0
  187. package/src/react/index.js +41 -0
  188. package/src/react/store/useSketchStore.js +234 -0
  189. package/src/react/store/useUIStore.js +196 -0
  190. package/src/react/styles/arrowSidebar.css +263 -0
  191. package/src/react/styles/canvasStroke.css +47 -0
  192. package/src/react/styles/canvasTools.css +769 -0
  193. package/src/react/styles/circleSidebar.css +206 -0
  194. package/src/react/styles/fonts/fonts.css +29 -0
  195. package/src/react/styles/fonts/lixCode.ttf +0 -0
  196. package/src/react/styles/fonts/lixDefault.ttf +0 -0
  197. package/src/react/styles/fonts/lixDocs.ttf +0 -0
  198. package/src/react/styles/fonts/lixFancy.ttf +0 -0
  199. package/src/react/styles/fonts/lixFont.woff2 +0 -0
  200. package/src/react/styles/lineSidebar.css +207 -0
  201. package/src/react/styles/paintbrushSidebar.css +247 -0
  202. package/src/react/styles/squareSidebar.css +206 -0
  203. package/src/react/styles/writeText.css +149 -0
  204. package/src/react/styles.css +175 -0
  205. package/src/react/toolsEnum.js +20 -0
  206. package/src/react/utils/toast.js +18 -0
  207. package/src/shapes/Frame.js +7 -1
  208. package/src/shapes/Line.js +11 -5
  209. package/src/tools/arrowTool.js +30 -4
  210. package/src/tools/circleTool.js +33 -9
  211. package/src/tools/codeTool.js +5 -3
  212. package/src/tools/frameTool.js +47 -7
  213. package/src/tools/freehandTool.js +12 -4
  214. package/src/tools/iconTool.js +7 -1
  215. package/src/tools/imageTool.js +7 -1
  216. package/src/tools/lineTool.js +27 -3
  217. package/src/tools/rectangleTool.js +45 -8
  218. package/src/tools/textTool.js +23 -6
@@ -0,0 +1,519 @@
1
+ "use client";
2
+ import {
3
+ calculateSnap,
4
+ clearSnapGuides
5
+ } from "./chunk-BZE4CEBG.js";
6
+ import {
7
+ pushCreateAction,
8
+ pushFrameAttachmentAction,
9
+ pushOptionsChangeAction,
10
+ pushTransformAction
11
+ } from "./chunk-L5OARZJ7.js";
12
+
13
+ // src/tools/rectangleTool.js
14
+ var isDrawingSquare = false;
15
+ var isDraggingShapeSquare = false;
16
+ var isResizingShapeSquare = false;
17
+ var isRotatingShapeSquare = false;
18
+ var resizingAnchorIndexSquare = null;
19
+ var startRotationMouseAngleSquare = 0;
20
+ var startShapeRotationSquare = 0;
21
+ var rc = rough.svg(svg);
22
+ var startX;
23
+ var startY;
24
+ function getThemeStroke() {
25
+ if (typeof document === "undefined") return "#fff";
26
+ return document.body && document.body.classList.contains("theme-dark") ? "#fff" : "#1a1a2e";
27
+ }
28
+ var squareStrokecolor = null;
29
+ var squareBackgroundColor = "transparent";
30
+ var squareFillStyleValue = "none";
31
+ var squareStrokeThicknes = 2;
32
+ var squareOutlineStyle = "solid";
33
+ var dragOldPosSquare = null;
34
+ var draggedShapeInitialFrame = null;
35
+ var hoveredFrame = null;
36
+ var SquarecolorOptions = document.querySelectorAll(".squareStrokeSpan");
37
+ var backgroundColorOptionsSquare = document.querySelectorAll(".squareBackgroundSpan");
38
+ var fillStyleOptions = document.querySelectorAll(".squareFillStyleSpan");
39
+ var squareStrokeThicknessValue = document.querySelectorAll(".squareStrokeThickSpan");
40
+ var squareOutlineStyleValue = document.querySelectorAll(".squareOutlineStyle");
41
+ function getSVGCoordsFromMouse(e) {
42
+ const viewBox = svg.viewBox.baseVal;
43
+ const rect = svg.getBoundingClientRect();
44
+ const mouseX = e.clientX - rect.left;
45
+ const mouseY = e.clientY - rect.top;
46
+ const svgX = viewBox.x + mouseX / rect.width * viewBox.width;
47
+ const svgY = viewBox.y + mouseY / rect.height * viewBox.height;
48
+ return { x: svgX, y: svgY };
49
+ }
50
+ var handleMouseDownRect = (e) => {
51
+ const { x: mouseX, y: mouseY } = getSVGCoordsFromMouse(e);
52
+ if (isSquareToolActive) {
53
+ startX = mouseX;
54
+ startY = mouseY;
55
+ isDrawingSquare = true;
56
+ if (currentShape) {
57
+ currentShape.removeSelection();
58
+ currentShape = null;
59
+ disableAllSideBars();
60
+ }
61
+ let initialOptions = {
62
+ stroke: squareStrokecolor ?? getThemeStroke(),
63
+ fill: squareBackgroundColor,
64
+ fillStyle: squareFillStyleValue,
65
+ strokeWidth: squareStrokeThicknes
66
+ };
67
+ if (squareOutlineStyle === "dashed") {
68
+ initialOptions.strokeDasharray = "10,10";
69
+ } else if (squareOutlineStyle === "dotted") {
70
+ initialOptions.strokeDasharray = "2,8";
71
+ } else {
72
+ initialOptions.strokeDasharray = "";
73
+ }
74
+ currentShape = new Rectangle(startX, startY, 0, 0, initialOptions);
75
+ currentShape.setDrawingState(true);
76
+ } else if (isSelectionToolActive) {
77
+ let clickedOnShape = false;
78
+ if (currentShape && currentShape.shapeName === "rectangle" && currentShape.isSelected) {
79
+ const anchorInfo = currentShape.isNearAnchor(mouseX, mouseY);
80
+ if (anchorInfo) {
81
+ dragOldPosSquare = { x: currentShape.x, y: currentShape.y, width: currentShape.width, height: currentShape.height, rotation: currentShape.rotation };
82
+ if (anchorInfo.type === "resize") {
83
+ isResizingShapeSquare = true;
84
+ resizingAnchorIndexSquare = anchorInfo.index;
85
+ } else if (anchorInfo.type === "rotate") {
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
+ }
99
+ }
100
+ clickedOnShape = true;
101
+ } else if (currentShape.contains(mouseX, mouseY)) {
102
+ isDraggingShapeSquare = true;
103
+ dragOldPosSquare = { x: currentShape.x, y: currentShape.y, width: currentShape.width, height: currentShape.height, rotation: currentShape.rotation };
104
+ draggedShapeInitialFrame = currentShape.parentFrame || null;
105
+ if (currentShape.parentFrame) {
106
+ currentShape.parentFrame.temporarilyRemoveFromFrame(currentShape);
107
+ }
108
+ startX = mouseX;
109
+ startY = mouseY;
110
+ clickedOnShape = true;
111
+ }
112
+ }
113
+ if (!clickedOnShape) {
114
+ let shapeToSelect = null;
115
+ for (let i = shapes.length - 1; i >= 0; i--) {
116
+ const shape = shapes[i];
117
+ if (shape.shapeName === "rectangle" && shape.contains(mouseX, mouseY)) {
118
+ shapeToSelect = shape;
119
+ break;
120
+ }
121
+ }
122
+ if (currentShape && currentShape !== shapeToSelect) {
123
+ currentShape.removeSelection();
124
+ currentShape = null;
125
+ disableAllSideBars();
126
+ }
127
+ if (shapeToSelect) {
128
+ currentShape = shapeToSelect;
129
+ currentShape.isSelected = true;
130
+ currentShape.draw();
131
+ isDraggingShapeSquare = true;
132
+ dragOldPosSquare = { x: currentShape.x, y: currentShape.y, width: currentShape.width, height: currentShape.height, rotation: currentShape.rotation };
133
+ draggedShapeInitialFrame = currentShape.parentFrame || null;
134
+ if (currentShape.parentFrame) {
135
+ currentShape.parentFrame.temporarilyRemoveFromFrame(currentShape);
136
+ }
137
+ startX = mouseX;
138
+ startY = mouseY;
139
+ clickedOnShape = true;
140
+ }
141
+ }
142
+ if (!clickedOnShape && currentShape) {
143
+ currentShape.removeSelection();
144
+ currentShape = null;
145
+ disableAllSideBars();
146
+ }
147
+ }
148
+ };
149
+ var handleMouseMoveRect = (e) => {
150
+ const { x: mouseX, y: mouseY } = getSVGCoordsFromMouse(e);
151
+ const svgRect = svg.getBoundingClientRect();
152
+ lastMousePos = {
153
+ x: e.clientX - svgRect.left,
154
+ y: e.clientY - svgRect.top
155
+ };
156
+ if (isDrawingSquare && isSquareToolActive && currentShape) {
157
+ let width = mouseX - startX;
158
+ let height = mouseY - startY;
159
+ currentShape.x = width < 0 ? startX + width : startX;
160
+ currentShape.y = height < 0 ? startY + height : startY;
161
+ currentShape.width = Math.abs(width);
162
+ currentShape.height = Math.abs(height);
163
+ if (currentShape.element && currentShape.width > 0 && currentShape.height > 0) {
164
+ if (currentShape.element.parentNode === currentShape.group) {
165
+ currentShape.group.removeChild(currentShape.element);
166
+ }
167
+ const roughRect = rc.rectangle(0, 0, currentShape.width, currentShape.height, currentShape.options);
168
+ currentShape.element = roughRect;
169
+ currentShape.group.appendChild(roughRect);
170
+ }
171
+ const rotateCenterX = currentShape.width / 2;
172
+ const rotateCenterY = currentShape.height / 2;
173
+ currentShape.group.setAttribute("transform", `translate(${currentShape.x}, ${currentShape.y}) rotate(${currentShape.rotation}, ${rotateCenterX}, ${rotateCenterY})`);
174
+ shapes.forEach((frame) => {
175
+ if (frame.shapeName === "frame") {
176
+ if (frame.isShapeInFrame(currentShape)) {
177
+ frame.highlightFrame();
178
+ hoveredFrame = frame;
179
+ } else if (hoveredFrame === frame) {
180
+ frame.removeHighlight();
181
+ hoveredFrame = null;
182
+ }
183
+ }
184
+ });
185
+ } else if (isDraggingShapeSquare && currentShape && currentShape.isSelected) {
186
+ let dx = mouseX - startX;
187
+ let dy = mouseY - startY;
188
+ currentShape.move(dx, dy);
189
+ startX = mouseX;
190
+ startY = mouseY;
191
+ if (window.__sketchStoreApi && window.__sketchStoreApi.getState().snapToObjects) {
192
+ const snap = calculateSnap(currentShape, e.shiftKey, e.clientX, e.clientY);
193
+ if (snap.dx || snap.dy) {
194
+ currentShape.move(snap.dx, snap.dy);
195
+ }
196
+ } else {
197
+ clearSnapGuides();
198
+ }
199
+ let newHover = null;
200
+ for (const f of shapes) {
201
+ if (f.shapeName !== "frame") continue;
202
+ if (f === currentShape) continue;
203
+ if (typeof f.isShapeInFrame === "function" && f.isShapeInFrame(currentShape)) {
204
+ newHover = f;
205
+ break;
206
+ }
207
+ }
208
+ if (hoveredFrame && hoveredFrame !== newHover && typeof hoveredFrame.removeHighlight === "function") {
209
+ hoveredFrame.removeHighlight();
210
+ }
211
+ if (newHover && newHover !== hoveredFrame && typeof newHover.highlightFrame === "function") {
212
+ newHover.highlightFrame();
213
+ }
214
+ hoveredFrame = newHover;
215
+ } else if (isResizingShapeSquare && currentShape && currentShape.isSelected && resizingAnchorIndexSquare !== null) {
216
+ currentShape.updatePosition(resizingAnchorIndexSquare, mouseX, mouseY);
217
+ currentShape._skipAnchors = true;
218
+ currentShape.draw();
219
+ currentShape._skipAnchors = false;
220
+ } 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";
242
+ }
243
+ } else if (isSelectionToolActive && !isDrawingSquare && currentShape && currentShape.isSelected) {
244
+ const anchorInfo = currentShape.isNearAnchor(mouseX, mouseY);
245
+ if (anchorInfo) {
246
+ if (anchorInfo.type === "resize") {
247
+ const baseDirection = anchorInfo.index;
248
+ const rotatedCursor = currentShape.getRotatedCursor(baseDirection, currentShape.rotation);
249
+ svg.style.cursor = rotatedCursor + "-resize";
250
+ } else if (anchorInfo.type === "rotate") {
251
+ svg.style.cursor = "grab";
252
+ }
253
+ } else if (currentShape.contains(mouseX, mouseY)) {
254
+ svg.style.cursor = "move";
255
+ } else {
256
+ svg.style.cursor = "default";
257
+ }
258
+ } else if (isSelectionToolActive && !isDrawingSquare && !isDraggingShapeSquare && !isResizingShapeSquare && !isRotatingShapeSquare) {
259
+ let hoveredShape = null;
260
+ for (let i = shapes.length - 1; i >= 0; i--) {
261
+ const shape = shapes[i];
262
+ if (shape.shapeName === "rectangle" && shape.contains(mouseX, mouseY)) {
263
+ hoveredShape = shape;
264
+ break;
265
+ }
266
+ }
267
+ if (hoveredShape) {
268
+ svg.style.cursor = "pointer";
269
+ } else {
270
+ svg.style.cursor = "default";
271
+ }
272
+ }
273
+ };
274
+ var handleMouseUpRect = (e) => {
275
+ if (isDrawingSquare && currentShape) {
276
+ currentShape.setDrawingState(false);
277
+ if (currentShape.width === 0 || currentShape.height === 0) {
278
+ if (currentShape.group.parentNode) {
279
+ currentShape.group.parentNode.removeChild(currentShape.group);
280
+ }
281
+ currentShape = null;
282
+ } else {
283
+ currentShape.draw();
284
+ shapes.push(currentShape);
285
+ pushCreateAction(currentShape);
286
+ const finalFrame = hoveredFrame;
287
+ if (finalFrame) {
288
+ finalFrame.addShapeToFrame(currentShape);
289
+ pushFrameAttachmentAction(finalFrame, currentShape, "attach", null);
290
+ }
291
+ const drawnShape = currentShape;
292
+ if (window.__sketchStoreApi) window.__sketchStoreApi.setActiveTool("select", { afterDraw: true });
293
+ currentShape = drawnShape;
294
+ currentShape.isSelected = true;
295
+ if (typeof currentShape.addAnchors === "function") {
296
+ currentShape.addAnchors();
297
+ }
298
+ }
299
+ if (hoveredFrame) {
300
+ hoveredFrame.removeHighlight();
301
+ hoveredFrame = null;
302
+ }
303
+ }
304
+ if ((isDraggingShapeSquare || isResizingShapeSquare || isRotatingShapeSquare) && dragOldPosSquare && currentShape) {
305
+ const newPos = {
306
+ x: currentShape.x,
307
+ y: currentShape.y,
308
+ width: currentShape.width,
309
+ height: currentShape.height,
310
+ rotation: currentShape.rotation,
311
+ parentFrame: isDraggingShapeSquare ? hoveredFrame || null : currentShape.parentFrame
312
+ };
313
+ const oldPos = {
314
+ ...dragOldPosSquare,
315
+ parentFrame: draggedShapeInitialFrame
316
+ };
317
+ const stateChanged = oldPos.x !== newPos.x || oldPos.y !== newPos.y || oldPos.width !== newPos.width || oldPos.height !== newPos.height || oldPos.rotation !== newPos.rotation;
318
+ const frameChanged = oldPos.parentFrame !== newPos.parentFrame;
319
+ if (stateChanged || frameChanged) {
320
+ pushTransformAction(currentShape, oldPos, newPos);
321
+ }
322
+ if (isDraggingShapeSquare) {
323
+ const finalFrame = hoveredFrame;
324
+ if (draggedShapeInitialFrame !== finalFrame) {
325
+ if (draggedShapeInitialFrame) {
326
+ draggedShapeInitialFrame.removeShapeFromFrame(currentShape);
327
+ }
328
+ if (finalFrame) {
329
+ finalFrame.addShapeToFrame(currentShape);
330
+ }
331
+ if (frameChanged) {
332
+ pushFrameAttachmentAction(
333
+ finalFrame || draggedShapeInitialFrame,
334
+ currentShape,
335
+ finalFrame ? "attach" : "detach",
336
+ draggedShapeInitialFrame
337
+ );
338
+ }
339
+ } else if (draggedShapeInitialFrame) {
340
+ draggedShapeInitialFrame.restoreToFrame(currentShape);
341
+ }
342
+ }
343
+ dragOldPosSquare = null;
344
+ draggedShapeInitialFrame = null;
345
+ }
346
+ if (hoveredFrame) {
347
+ hoveredFrame.removeHighlight();
348
+ hoveredFrame = null;
349
+ }
350
+ isDrawingSquare = false;
351
+ isDraggingShapeSquare = false;
352
+ isResizingShapeSquare = false;
353
+ isRotatingShapeSquare = false;
354
+ resizingAnchorIndexSquare = null;
355
+ startRotationMouseAngleSquare = 0;
356
+ startShapeRotationSquare = 0;
357
+ clearSnapGuides();
358
+ svg.style.cursor = "default";
359
+ };
360
+ SquarecolorOptions.forEach((span) => {
361
+ span.addEventListener("click", (event) => {
362
+ event.stopPropagation();
363
+ if (currentShape && currentShape.shapeName === "rectangle" && currentShape.isSelected) {
364
+ pushOptionsChangeAction(currentShape, { ...currentShape.options });
365
+ squareStrokecolor = span.getAttribute("data-id");
366
+ currentShape.options.stroke = squareStrokecolor;
367
+ currentShape.draw();
368
+ currentShape.updateSidebar();
369
+ } else {
370
+ squareStrokecolor = span.getAttribute("data-id");
371
+ }
372
+ SquarecolorOptions.forEach((el) => el.classList.remove("selected"));
373
+ span.classList.add("selected");
374
+ });
375
+ });
376
+ backgroundColorOptionsSquare.forEach((span) => {
377
+ span.addEventListener("click", (event) => {
378
+ event.stopPropagation();
379
+ if (currentShape && currentShape.shapeName === "rectangle" && currentShape.isSelected) {
380
+ pushOptionsChangeAction(currentShape, { ...currentShape.options });
381
+ squareBackgroundColor = span.getAttribute("data-id");
382
+ currentShape.options.fill = squareBackgroundColor;
383
+ currentShape.draw();
384
+ currentShape.updateSidebar();
385
+ } else {
386
+ squareBackgroundColor = span.getAttribute("data-id");
387
+ }
388
+ backgroundColorOptionsSquare.forEach((el) => el.classList.remove("selected"));
389
+ span.classList.add("selected");
390
+ });
391
+ });
392
+ fillStyleOptions.forEach((span) => {
393
+ span.addEventListener("click", (event) => {
394
+ event.stopPropagation();
395
+ if (currentShape && currentShape.shapeName === "rectangle" && currentShape.isSelected) {
396
+ pushOptionsChangeAction(currentShape, { ...currentShape.options });
397
+ squareFillStyleValue = span.getAttribute("data-id");
398
+ currentShape.options.fillStyle = squareFillStyleValue;
399
+ currentShape.draw();
400
+ currentShape.updateSidebar();
401
+ } else {
402
+ squareFillStyleValue = span.getAttribute("data-id");
403
+ }
404
+ fillStyleOptions.forEach((el) => el.classList.remove("selected"));
405
+ span.classList.add("selected");
406
+ });
407
+ });
408
+ squareStrokeThicknessValue.forEach((span) => {
409
+ span.addEventListener("click", (event) => {
410
+ event.stopPropagation();
411
+ if (currentShape && currentShape.shapeName === "rectangle" && currentShape.isSelected) {
412
+ pushOptionsChangeAction(currentShape, { ...currentShape.options });
413
+ squareStrokeThicknes = parseInt(span.getAttribute("data-id"));
414
+ currentShape.options.strokeWidth = squareStrokeThicknes;
415
+ currentShape.draw();
416
+ currentShape.updateSidebar();
417
+ } else {
418
+ squareStrokeThicknes = parseInt(span.getAttribute("data-id"));
419
+ }
420
+ squareStrokeThicknessValue.forEach((el) => el.classList.remove("selected"));
421
+ span.classList.add("selected");
422
+ });
423
+ });
424
+ squareOutlineStyleValue.forEach((span) => {
425
+ span.addEventListener("click", (event) => {
426
+ event.stopPropagation();
427
+ if (currentShape && currentShape.shapeName === "rectangle" && currentShape.isSelected) {
428
+ pushOptionsChangeAction(currentShape, { ...currentShape.options });
429
+ squareOutlineStyle = span.getAttribute("data-id");
430
+ if (squareOutlineStyle === "dashed") {
431
+ currentShape.options.strokeDasharray = "10,10";
432
+ } else if (squareOutlineStyle === "dotted") {
433
+ currentShape.options.strokeDasharray = "2,8";
434
+ } else {
435
+ currentShape.options.strokeDasharray = "";
436
+ }
437
+ currentShape.draw();
438
+ currentShape.updateSidebar();
439
+ } else {
440
+ squareOutlineStyle = span.getAttribute("data-id");
441
+ }
442
+ squareOutlineStyleValue.forEach((el) => el.classList.remove("selected"));
443
+ span.classList.add("selected");
444
+ });
445
+ });
446
+ window.Rectangle = Rectangle;
447
+ window.rectToolSettings = {
448
+ get strokeColor() {
449
+ return squareStrokecolor;
450
+ },
451
+ set strokeColor(v) {
452
+ squareStrokecolor = v;
453
+ },
454
+ get bgColor() {
455
+ return squareBackgroundColor;
456
+ },
457
+ set bgColor(v) {
458
+ squareBackgroundColor = v;
459
+ },
460
+ get fillStyle() {
461
+ return squareFillStyleValue;
462
+ },
463
+ set fillStyle(v) {
464
+ squareFillStyleValue = v;
465
+ },
466
+ get strokeWidth() {
467
+ return squareStrokeThicknes;
468
+ },
469
+ set strokeWidth(v) {
470
+ squareStrokeThicknes = v;
471
+ },
472
+ get outlineStyle() {
473
+ return squareOutlineStyle;
474
+ },
475
+ set outlineStyle(v) {
476
+ squareOutlineStyle = v;
477
+ }
478
+ };
479
+ window.updateSelectedRectStyle = function(changes) {
480
+ if (currentShape && currentShape.shapeName === "rectangle" && currentShape.isSelected) {
481
+ pushOptionsChangeAction(currentShape, { ...currentShape.options });
482
+ if (changes.stroke !== void 0) {
483
+ squareStrokecolor = changes.stroke;
484
+ currentShape.options.stroke = changes.stroke;
485
+ }
486
+ if (changes.fill !== void 0) {
487
+ squareBackgroundColor = changes.fill;
488
+ currentShape.options.fill = changes.fill;
489
+ }
490
+ if (changes.fillStyle !== void 0) {
491
+ squareFillStyleValue = changes.fillStyle;
492
+ currentShape.options.fillStyle = changes.fillStyle;
493
+ }
494
+ if (changes.strokeWidth !== void 0) {
495
+ squareStrokeThicknes = changes.strokeWidth;
496
+ currentShape.options.strokeWidth = changes.strokeWidth;
497
+ }
498
+ if (changes.outlineStyle !== void 0) {
499
+ squareOutlineStyle = changes.outlineStyle;
500
+ if (changes.outlineStyle === "dashed") currentShape.options.strokeDasharray = "10,10";
501
+ else if (changes.outlineStyle === "dotted") currentShape.options.strokeDasharray = "2,8";
502
+ else currentShape.options.strokeDasharray = "";
503
+ }
504
+ currentShape.draw();
505
+ } else {
506
+ if (changes.stroke !== void 0) squareStrokecolor = changes.stroke;
507
+ if (changes.fill !== void 0) squareBackgroundColor = changes.fill;
508
+ if (changes.fillStyle !== void 0) squareFillStyleValue = changes.fillStyle;
509
+ if (changes.strokeWidth !== void 0) squareStrokeThicknes = changes.strokeWidth;
510
+ if (changes.outlineStyle !== void 0) squareOutlineStyle = changes.outlineStyle;
511
+ }
512
+ };
513
+
514
+ export {
515
+ handleMouseDownRect,
516
+ handleMouseMoveRect,
517
+ handleMouseUpRect
518
+ };
519
+ //# sourceMappingURL=chunk-QNSE5BAY.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 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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