@elixpo/lixsketch 5.5.16 → 5.5.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react/Circle-QQMKCKFR.js +8 -0
- package/dist/react/{CopyPaste-AAHQTNVL.js → CopyPaste-C2SHB7QD.js} +3 -3
- package/dist/react/{EventDispatcher-K4CNNBAU.js → EventDispatcher-ZCKWAHIX.js} +3 -3
- package/dist/react/Rectangle-MZ6ZB6KM.js +8 -0
- package/dist/react/{SceneSerializer-YK44QZ6B.js → SceneSerializer-IQGUAK45.js} +3 -3
- package/dist/react/{SketchEngine-B7XCB3BS.js → SketchEngine-RFEF27MN.js} +8 -8
- package/dist/react/{chunk-URB6MY46.js → chunk-7DC26DDU.js} +10 -6
- package/dist/react/chunk-7DC26DDU.js.map +7 -0
- package/dist/react/{chunk-GZ6NPDAB.js → chunk-N7NZLF6P.js} +4 -3
- package/dist/react/chunk-N7NZLF6P.js.map +7 -0
- package/dist/react/{chunk-VN62KLOC.js → chunk-X6AHYG5J.js} +11 -7
- package/dist/react/chunk-X6AHYG5J.js.map +7 -0
- package/dist/react/{chunk-24TW3M7X.js → chunk-XCJOF6BM.js} +4 -3
- package/dist/react/{chunk-24TW3M7X.js.map → chunk-XCJOF6BM.js.map} +2 -2
- package/dist/react/{iconTool-GPZ7O7NH.js → iconTool-YD4GRXAP.js} +2 -2
- package/dist/react/{imageTool-D5R4XGEU.js → imageTool-WJVV4WI3.js} +2 -2
- package/dist/react/index.js +2 -2
- package/package.json +1 -1
- package/src/shapes/Circle.js +3 -2
- package/src/shapes/Rectangle.js +3 -2
- package/src/tools/iconTool.js +10 -6
- package/src/tools/imageTool.js +9 -5
- package/dist/react/Circle-ZH76FPOR.js +0 -8
- package/dist/react/Rectangle-2LNCIQDZ.js +0 -8
- package/dist/react/chunk-GZ6NPDAB.js.map +0 -7
- package/dist/react/chunk-URB6MY46.js.map +0 -7
- package/dist/react/chunk-VN62KLOC.js.map +0 -7
- /package/dist/react/{Circle-ZH76FPOR.js.map → Circle-QQMKCKFR.js.map} +0 -0
- /package/dist/react/{CopyPaste-AAHQTNVL.js.map → CopyPaste-C2SHB7QD.js.map} +0 -0
- /package/dist/react/{EventDispatcher-K4CNNBAU.js.map → EventDispatcher-ZCKWAHIX.js.map} +0 -0
- /package/dist/react/{Rectangle-2LNCIQDZ.js.map → Rectangle-MZ6ZB6KM.js.map} +0 -0
- /package/dist/react/{SceneSerializer-YK44QZ6B.js.map → SceneSerializer-IQGUAK45.js.map} +0 -0
- /package/dist/react/{SketchEngine-B7XCB3BS.js.map → SketchEngine-RFEF27MN.js.map} +0 -0
- /package/dist/react/{iconTool-GPZ7O7NH.js.map → iconTool-YD4GRXAP.js.map} +0 -0
- /package/dist/react/{imageTool-D5R4XGEU.js.map → imageTool-WJVV4WI3.js.map} +0 -0
package/src/tools/iconTool.js
CHANGED
|
@@ -440,7 +440,8 @@ function addSelectionOutline() {
|
|
|
440
440
|
const centerX = x + width / 2;
|
|
441
441
|
const centerY = y + height / 2;
|
|
442
442
|
|
|
443
|
-
const
|
|
443
|
+
const zoom = window.currentZoom || 1;
|
|
444
|
+
const selectionPadding = 8 / zoom;
|
|
444
445
|
const expandedX = x - selectionPadding;
|
|
445
446
|
const expandedY = y - selectionPadding;
|
|
446
447
|
const expandedWidth = width + 2 * selectionPadding;
|
|
@@ -589,8 +590,8 @@ function addResizeAnchors(x, y, width, height, centerX, centerY, iconWidth, rota
|
|
|
589
590
|
if (!svg) return;
|
|
590
591
|
|
|
591
592
|
const zoom = window.currentZoom || 1;
|
|
592
|
-
const anchorSize =
|
|
593
|
-
const anchorStrokeWidth =
|
|
593
|
+
const anchorSize = 10 / zoom;
|
|
594
|
+
const anchorStrokeWidth = 2 / zoom;
|
|
594
595
|
|
|
595
596
|
const positions = [
|
|
596
597
|
{ x: x, y: y, cursor: "nw-resize" },
|
|
@@ -608,6 +609,7 @@ function addResizeAnchors(x, y, width, height, centerX, centerY, iconWidth, rota
|
|
|
608
609
|
anchor.setAttribute("fill", "#121212");
|
|
609
610
|
anchor.setAttribute("stroke", "#5B57D1");
|
|
610
611
|
anchor.setAttribute("stroke-width", anchorStrokeWidth);
|
|
612
|
+
anchor.setAttribute("vector-effect", "non-scaling-stroke");
|
|
611
613
|
anchor.setAttribute("class", "resize-anchor");
|
|
612
614
|
anchor.setAttribute("transform", `rotate(${rotation}, ${centerX}, ${centerY})`);
|
|
613
615
|
anchor.style.cursor = pos.cursor;
|
|
@@ -623,9 +625,10 @@ function addRotationAnchor(x, y, width, height, centerX, centerY, iconWidth, rot
|
|
|
623
625
|
const svg = getSVGElement();
|
|
624
626
|
if (!svg) return;
|
|
625
627
|
|
|
626
|
-
const
|
|
627
|
-
const
|
|
628
|
-
const
|
|
628
|
+
const zoom = window.currentZoom || 1;
|
|
629
|
+
const anchorRadius = 5 / zoom;
|
|
630
|
+
const anchorStrokeWidth = 2 / zoom;
|
|
631
|
+
const rotationDistance = 30 / zoom;
|
|
629
632
|
|
|
630
633
|
const rotationAnchorX = x + width / 2;
|
|
631
634
|
const rotationAnchorY = y - rotationDistance;
|
|
@@ -638,6 +641,7 @@ function addRotationAnchor(x, y, width, height, centerX, centerY, iconWidth, rot
|
|
|
638
641
|
rotationAnchor.setAttribute('fill', '#121212');
|
|
639
642
|
rotationAnchor.setAttribute('stroke', '#5B57D1');
|
|
640
643
|
rotationAnchor.setAttribute('stroke-width', anchorStrokeWidth);
|
|
644
|
+
rotationAnchor.setAttribute('vector-effect', 'non-scaling-stroke');
|
|
641
645
|
rotationAnchor.setAttribute('style', 'pointer-events: all; cursor: grab;');
|
|
642
646
|
rotationAnchor.setAttribute('transform', `rotate(${rotation}, ${centerX}, ${centerY})`);
|
|
643
647
|
|
package/src/tools/imageTool.js
CHANGED
|
@@ -592,7 +592,8 @@ function addSelectionOutline() {
|
|
|
592
592
|
const width = parseFloat(selectedImage.getAttribute('width'));
|
|
593
593
|
const height = parseFloat(selectedImage.getAttribute('height'));
|
|
594
594
|
|
|
595
|
-
const
|
|
595
|
+
const zoom = window.currentZoom || 1;
|
|
596
|
+
const selectionPadding = 8 / zoom; // Padding around the selection
|
|
596
597
|
const expandedX = x - selectionPadding;
|
|
597
598
|
const expandedY = y - selectionPadding;
|
|
598
599
|
const expandedWidth = width + 2 * selectionPadding;
|
|
@@ -651,7 +652,7 @@ function removeSelectionOutline() {
|
|
|
651
652
|
function addResizeAnchors(x, y, width, height, centerX, centerY) {
|
|
652
653
|
const zoom = window.currentZoom || 1;
|
|
653
654
|
const anchorSize = 10 / zoom;
|
|
654
|
-
const anchorStrokeWidth = 2;
|
|
655
|
+
const anchorStrokeWidth = 2 / zoom;
|
|
655
656
|
|
|
656
657
|
const positions = [
|
|
657
658
|
{ x: x, y: y }, // Top-left
|
|
@@ -669,6 +670,7 @@ function addResizeAnchors(x, y, width, height, centerX, centerY) {
|
|
|
669
670
|
anchor.setAttribute("fill", "#121212");
|
|
670
671
|
anchor.setAttribute("stroke", "#5B57D1");
|
|
671
672
|
anchor.setAttribute("stroke-width", anchorStrokeWidth);
|
|
673
|
+
anchor.setAttribute("vector-effect", "non-scaling-stroke");
|
|
672
674
|
anchor.setAttribute("class", "resize-anchor");
|
|
673
675
|
anchor.style.cursor = ["nw-resize", "ne-resize", "sw-resize", "se-resize"][i];
|
|
674
676
|
|
|
@@ -684,17 +686,19 @@ function addResizeAnchors(x, y, width, height, centerX, centerY) {
|
|
|
684
686
|
}
|
|
685
687
|
|
|
686
688
|
function addRotationAnchor(x, y, width, height, centerX, centerY) {
|
|
687
|
-
const
|
|
688
|
-
const
|
|
689
|
+
const zoom = window.currentZoom || 1;
|
|
690
|
+
const anchorStrokeWidth = 2 / zoom;
|
|
691
|
+
const rotationAnchorPos = { x: x + width / 2, y: y - 30 / zoom };
|
|
689
692
|
|
|
690
693
|
const rotationAnchor = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
|
|
691
694
|
rotationAnchor.setAttribute('cx', rotationAnchorPos.x);
|
|
692
695
|
rotationAnchor.setAttribute('cy', rotationAnchorPos.y);
|
|
693
|
-
rotationAnchor.setAttribute('r',
|
|
696
|
+
rotationAnchor.setAttribute('r', 5 / zoom);
|
|
694
697
|
rotationAnchor.setAttribute('class', 'rotation-anchor');
|
|
695
698
|
rotationAnchor.setAttribute('fill', '#121212');
|
|
696
699
|
rotationAnchor.setAttribute('stroke', '#5B57D1');
|
|
697
700
|
rotationAnchor.setAttribute('stroke-width', anchorStrokeWidth);
|
|
701
|
+
rotationAnchor.setAttribute('vector-effect', 'non-scaling-stroke');
|
|
698
702
|
rotationAnchor.setAttribute('style', 'pointer-events: all;');
|
|
699
703
|
|
|
700
704
|
// Apply the same rotation as the image
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/shapes/Circle.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable */\n// Circle shape class - extracted from drawCircle.js\n// Depends on globals: svg, shapes, rough, currentShape, currentZoom, rc\n\nconst rc = rough.svg(svg);\nlet isDraggingShapeCircle = false;\nlet isResizingShapeCircle = false;\nlet isRotatingShapeCircle = false;\nlet hoveredFrameCircle = null;\nconst colorOptionsCircle = document.querySelectorAll(\".circleStrokeSpan\");\nconst backgroundColorOptionsCircle = document.querySelectorAll(\".circleBackgroundSpan\");\nconst fillStyleOptionsCircle = document.querySelectorAll(\".circleFillStyleSpan\");\nconst strokeThicknessValueCircle = document.querySelectorAll(\".circleStrokeThickSpan\");\nconst outlineStyleValueCircle = document.querySelectorAll(\".circleOutlineStyle\");\n\nclass Circle {\n constructor(x, y, rx, ry, options = {}) {\n this.x = x; \n this.y = y; \n this.rx = rx; \n this.ry = ry; \n this.options = {\n roughness: 1.5,\n stroke: \"#fff\",\n strokeWidth: 2,\n fill: \"transparent\",\n fillStyle: \"none\",\n strokeDasharray: \"\",\n ...options\n };\n this.element = null;\n this.isSelected = false;\n this.rotation = 0;\n this.group = document.createElementNS('http://www.w3.org/2000/svg', 'g');\n this.anchors = [];\n this.rotationAnchor = null;\n this.selectionPadding = 8;\n this.selectionOutline = null;\n this.shapeName = \"circle\";\n this.shapeID = `circle-${String(Date.now()).slice(0, 8)}-${Math.floor(Math.random() * 10000)}`;\n this.group.setAttribute('id', this.shapeID);\n\n // Frame attachment properties\n this.parentFrame = null;\n\n // Embedded label support\n this.label = options.label || '';\n this.labelElement = null;\n this.labelColor = options.labelColor || '#e0e0e0';\n this.labelFontSize = options.labelFontSize || 14;\n this._isEditingLabel = false;\n this._hitArea = null;\n this._labelBg = null;\n\n // Shading / gradient support for research paper style diagrams\n this.shadeColor = options.shadeColor || null;\n this.shadeOpacity = options.shadeOpacity !== undefined ? options.shadeOpacity : 0.15;\n this.shadeDirection = options.shadeDirection || 'bottom';\n this._shadeEllipse = null;\n this._shadeGradient = null;\n\n if(!this.group.parentNode) {\n svg.appendChild(this.group);\n }\n this._lastDrawn = {\n width: null,\n height: null,\n options: null\n };\n this._setupLabelDblClick();\n this.draw();\n }\n\n // Add width and height properties for frame compatibility\n get width() {\n return this.rx * 2;\n }\n \n set width(value) {\n this.rx = value / 2;\n }\n \n get height() {\n return this.ry * 2;\n }\n \n set height(value) {\n this.ry = value / 2;\n }\n\n draw() {\n const childrenToRemove = [];\n const preserveSet = this._skipAnchors ? new Set([...this.anchors, this.selectionOutline, this.rotationAnchor].filter(Boolean)) : null;\n for (let i = 0; i < this.group.children.length; i++) {\n const child = this.group.children[i];\n if (child !== this.element && child !== this.labelElement && child !== this._hitArea && child !== this._labelBg && child !== this._shadeEllipse) {\n if (preserveSet && preserveSet.has(child)) continue;\n childrenToRemove.push(child);\n }\n }\n childrenToRemove.forEach(child => this.group.removeChild(child));\n const optionsString = JSON.stringify(this.options);\n const isInitialDraw = this.element === null;\n const sizeChanged = this.rx !== this._lastDrawn.rx || this.ry !== this._lastDrawn.ry;\n const optionsChanged = optionsString !== this._lastDrawn.options;\n if (isInitialDraw || optionsChanged || sizeChanged) {\n if (this.element && this.element.parentNode === this.group) {\n this.group.removeChild(this.element);\n }\n\n const roughEllipse = rc.ellipse(0, 0, this.rx * 2, this.ry * 2, this.options);\n this.element = roughEllipse;\n this.group.appendChild(roughEllipse);\n\n this._lastDrawn.rx = this.rx;\n this._lastDrawn.ry = this.ry;\n this._lastDrawn.options = optionsString;\n }\n\n // Hit area for dblclick detection\n if (!this._hitArea) {\n this._hitArea = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse');\n this._hitArea.setAttribute('fill', 'transparent');\n this._hitArea.setAttribute('stroke', 'none');\n this._hitArea.setAttribute('style', 'pointer-events: all;');\n this.group.insertBefore(this._hitArea, this.group.firstChild);\n }\n this._hitArea.setAttribute('cx', 0);\n this._hitArea.setAttribute('cy', 0);\n this._hitArea.setAttribute('rx', this.rx);\n this._hitArea.setAttribute('ry', this.ry);\n\n // Shading / gradient overlay\n this._updateShade();\n\n // Update embedded label\n this._updateLabelElement();\n\n this.group.setAttribute('transform', `translate(${this.x}, ${this.y}) rotate(${this.rotation}, 0, 0)`);\n if (this.isSelected) {\n if (this._skipAnchors) {\n this.updateSelectionControls();\n } else {\n this.addAnchors();\n }\n }\n if (!this.group.parentNode) {\n svg.appendChild(this.group);\n }\n }\n\n move(dx, dy) {\n this.x += dx;\n this.y += dy;\n\n // Fast path: just update the transform \u2014 no need to rebuild RoughJS element\n this.group.setAttribute('transform', `translate(${this.x}, ${this.y}) rotate(${this.rotation}, 0, 0)`);\n\n this.updateAttachedArrows();\n\n // Only update frame containment if we're actively dragging the shape itself\n // and not being moved by a parent frame\n if (isDraggingShapeCircle && !this.isBeingMovedByFrame) {\n this.updateFrameContainment();\n }\n }\n\n updateFrameContainment() {\n // Don't update if we're being moved by a frame\n if (this.isBeingMovedByFrame) return;\n \n let targetFrame = null;\n \n // Find which frame this shape is over\n shapes.forEach(shape => {\n if (shape.shapeName === 'frame' && shape.isShapeInFrame(this)) {\n targetFrame = shape;\n }\n });\n \n // If we have a parent frame and we're being dragged, temporarily remove clipping\n if (this.parentFrame && isDraggingShapeCircle) {\n this.parentFrame.temporarilyRemoveFromFrame(this);\n }\n \n // Update frame highlighting\n if (hoveredFrameCircle && hoveredFrameCircle !== targetFrame) {\n hoveredFrameCircle.removeHighlight();\n }\n \n if (targetFrame && targetFrame !== hoveredFrameCircle) {\n targetFrame.highlightFrame();\n }\n \n hoveredFrameCircle = targetFrame;\n }\n\n getRotatedCursor(direction, angle) {\n const directions = ['ns', 'nesw', 'ew', 'nwse'];\n angle = angle % 360;\n if (angle < 0) angle += 360;\n\n const baseDirectionMap = {\n '0': 'nwse', '1': 'nesw', \n '2': 'nesw', '3': 'nwse', \n '4': 'ns', '5': 'ns', \n '6': 'ew', '7': 'ew' \n };\n const baseDirection = baseDirectionMap[direction];\n let effectiveAngle = angle; \n if (baseDirection === 'nesw') {\n effectiveAngle += 45;\n } else if (baseDirection === 'ew') {\n effectiveAngle += 90;\n } else if (baseDirection === 'nwse') {\n effectiveAngle += 135;\n }\n effectiveAngle = effectiveAngle % 360;\n if (effectiveAngle < 0) effectiveAngle += 360;\n const index = Math.round(effectiveAngle / 45) % 4; \n let finalIndex;\n if (effectiveAngle >= 337.5 || effectiveAngle < 22.5) finalIndex = 0; \n else if (effectiveAngle >= 22.5 && effectiveAngle < 67.5) finalIndex = 1; \n else if (effectiveAngle >= 67.5 && effectiveAngle < 112.5) finalIndex = 2; \n else if (effectiveAngle >= 112.5 && effectiveAngle < 157.5) finalIndex = 3;\n else if (effectiveAngle >= 157.5 && effectiveAngle < 202.5) finalIndex = 0; \n else if (effectiveAngle >= 202.5 && effectiveAngle < 247.5) finalIndex = 1; \n else if (effectiveAngle >= 247.5 && effectiveAngle < 292.5) finalIndex = 2; \n else if (effectiveAngle >= 292.5 && effectiveAngle < 337.5) finalIndex = 3; \n else finalIndex = 0; \n return directions[finalIndex];\n }\n addAnchors() {\n const zoom = window.currentZoom || 1;\n const anchorSize = 10 / zoom;\n const anchorStrokeWidth = 2;\n const self = this;\n const expandedX = -this.rx - this.selectionPadding;\n const expandedY = -this.ry - this.selectionPadding; \n const expandedWidth = this.rx * 2 + 2 * this.selectionPadding;\n const expandedHeight = this.ry * 2 + 2 * this.selectionPadding;\n\n const positions = [\n { x: expandedX, y: expandedY }, \n { x: expandedX + expandedWidth, y: expandedY }, \n { x: expandedX, y: expandedY + expandedHeight }, \n { x: expandedX + expandedWidth, y: expandedY + expandedHeight }, \n { x: expandedX + expandedWidth / 2, y: expandedY }, \n { x: expandedX + expandedWidth / 2, y: expandedY + expandedHeight }, \n { x: expandedX, y: expandedHeight / 2 + expandedY }, \n { x: expandedX + expandedWidth, y: expandedHeight / 2 + expandedY } \n ];\n\n const outlinePoints = [\n [positions[0].x, positions[0].y],\n [positions[1].x, positions[1].y],\n [positions[3].x, positions[3].y],\n [positions[2].x, positions[2].y],\n [positions[0].x, positions[0].y]\n ];\n\n this.anchors.forEach(anchor => {\n if (anchor.parentNode === this.group) {\n this.group.removeChild(anchor);\n }\n });\n if (this.rotationAnchor && this.rotationAnchor.parentNode === this.group) {\n this.group.removeChild(this.rotationAnchor);\n }\n if (this.selectionOutline && this.selectionOutline.parentNode === this.group) {\n this.group.removeChild(this.selectionOutline);\n }\n\n this.anchors = [];\n const anchorDirections = {\n 0: 'nwse', \n 1: 'nesw', \n 2: 'nesw', \n 3: 'nwse', \n 4: 'ns', \n 5: 'ns', \n 6: 'ew', \n 7: 'ew' \n };\n\n positions.forEach((pos, i) => {\n const anchor = document.createElementNS('http://www.w3.org/2000/svg', 'rect');\n anchor.setAttribute('x', pos.x - anchorSize / 2);\n anchor.setAttribute('y', pos.y - anchorSize / 2);\n anchor.setAttribute('width', anchorSize);\n anchor.setAttribute('height', anchorSize);\n anchor.setAttribute('class', 'anchor');\n anchor.setAttribute('data-index', i);\n anchor.setAttribute('fill', '#121212');\n anchor.setAttribute('stroke', '#5B57D1');\n anchor.setAttribute('stroke-width', anchorStrokeWidth);\n anchor.setAttribute('vector-effect', 'non-scaling-stroke');\n anchor.setAttribute('style', 'pointer-events: all;');\n\n anchor.addEventListener('mouseover', function () {\n const index = this.getAttribute('data-index');\n const baseDirection = anchorDirections[index];\n const rotatedCursor = self.getRotatedCursor(index, self.rotation); \n svg.style.cursor = rotatedCursor + '-resize';\n });\n\n anchor.addEventListener('mouseout', function () {\n if (!isResizingShapeCircle && !isDraggingShapeCircle && !isRotatingShapeCircle) {\n svg.style.cursor = 'default';\n }\n });\n\n this.group.appendChild(anchor);\n this.anchors[i] = anchor;\n });\n const rotationAnchorPos = { x: expandedX + expandedWidth / 2, y: expandedY - 30 / zoom };\n this.rotationAnchor = document.createElementNS('http://www.w3.org/2000/svg', 'circle');\n this.rotationAnchor.setAttribute('cx', rotationAnchorPos.x);\n this.rotationAnchor.setAttribute('cy', rotationAnchorPos.y);\n this.rotationAnchor.setAttribute('r', 8 / zoom);\n this.rotationAnchor.setAttribute('class', 'rotate-anchor');\n this.rotationAnchor.setAttribute('fill', '#121212');\n this.rotationAnchor.setAttribute('stroke', '#5B57D1');\n this.rotationAnchor.setAttribute('stroke-width', anchorStrokeWidth);\n this.rotationAnchor.setAttribute('vector-effect', 'non-scaling-stroke');\n this.rotationAnchor.setAttribute('style', 'pointer-events: all;');\n this.group.appendChild(this.rotationAnchor);\n\n this.rotationAnchor.addEventListener('mouseover', function () {\n if (!isResizingShapeCircle && !isDraggingShapeCircle && !isRotatingShapeCircle) {\n svg.style.cursor = 'grab';\n }\n });\n this.rotationAnchor.addEventListener('mouseout', function () {\n if (!isResizingShapeCircle && !isDraggingShapeCircle && !isRotatingShapeCircle) {\n svg.style.cursor = 'default';\n }\n });\n\n const pointsAttr = outlinePoints.map(p => p.join(',')).join(' ');\n const outline = document.createElementNS('http://www.w3.org/2000/svg', 'polyline');\n outline.setAttribute('points', pointsAttr);\n outline.setAttribute('fill', 'none');\n outline.setAttribute('stroke', '#5B57D1');\n outline.setAttribute('stroke-width', 1.5);\n outline.setAttribute('vector-effect', 'non-scaling-stroke');\n outline.setAttribute('stroke-dasharray', '4 2');\n outline.setAttribute('style', 'pointer-events: none;');\n this.group.appendChild(outline);\n this.selectionOutline = outline;\n\n disableAllSideBars();\n circleSideBar.classList.remove(\"hidden\");\n if (window.__showSidebarForShape) window.__showSidebarForShape('circle');\n this.updateSidebar();\n }\n\n updateSelectionControls() {\n if (!this.selectionOutline || this.anchors.length === 0) return;\n\n const anchorSize = 10;\n const expandedX = -this.rx - this.selectionPadding;\n const expandedY = -this.ry - this.selectionPadding;\n const expandedWidth = this.rx * 2 + 2 * this.selectionPadding;\n const expandedHeight = this.ry * 2 + 2 * this.selectionPadding;\n\n const positions = [\n { x: expandedX, y: expandedY },\n { x: expandedX + expandedWidth, y: expandedY },\n { x: expandedX, y: expandedY + expandedHeight },\n { x: expandedX + expandedWidth, y: expandedY + expandedHeight },\n { x: expandedX + expandedWidth / 2, y: expandedY },\n { x: expandedX + expandedWidth / 2, y: expandedY + expandedHeight },\n { x: expandedX, y: expandedHeight / 2 + expandedY },\n { x: expandedX + expandedWidth, y: expandedHeight / 2 + expandedY }\n ];\n\n positions.forEach((pos, i) => {\n if (this.anchors[i]) {\n this.anchors[i].setAttribute('x', pos.x - anchorSize / 2);\n this.anchors[i].setAttribute('y', pos.y - anchorSize / 2);\n }\n });\n\n const outlinePoints = [\n [positions[0].x, positions[0].y],\n [positions[1].x, positions[1].y],\n [positions[3].x, positions[3].y],\n [positions[2].x, positions[2].y],\n [positions[0].x, positions[0].y]\n ];\n this.selectionOutline.setAttribute('points', outlinePoints.map(p => p.join(',')).join(' '));\n\n if (this.rotationAnchor) {\n this.rotationAnchor.setAttribute('cx', expandedX + expandedWidth / 2);\n this.rotationAnchor.setAttribute('cy', expandedY - 30);\n }\n }\n\n removeSelection() {\n this.anchors.forEach(anchor => {\n if (anchor.parentNode === this.group) {\n this.group.removeChild(anchor);\n }\n });\n if (this.rotationAnchor && this.rotationAnchor.parentNode === this.group) {\n this.group.removeChild(this.rotationAnchor);\n }\n if (this.selectionOutline && this.selectionOutline.parentNode === this.group) {\n this.group.removeChild(this.selectionOutline);\n }\n this.anchors = [];\n this.rotationAnchor = null;\n this.selectionOutline = null;\n this.isSelected = false;\n }\n contains(x, y) {\n if (!this.element || !this.rx || !this.ry) return false;\n // Mouse coordinates are in canvas space; invert the circle's own\n // translation/rotation without mixing in the viewport CTM.\n const angle = -(this.rotation || 0) * Math.PI / 180;\n const translatedX = x - this.x;\n const translatedY = y - this.y;\n const dx = translatedX * Math.cos(angle) - translatedY * Math.sin(angle);\n const dy = translatedX * Math.sin(angle) + translatedY * Math.cos(angle);\n const rx = this.rx;\n const ry = this.ry;\n return ((dx * dx) / (rx * rx) + (dy * dy) / (ry * ry)) <= 1.05; \n }\n isNearAnchor(x, y) {\n if (!this.isSelected) return null;\n const buffer = 10 / currentZoom; // Scale buffer by zoom level\n const anchorSize = 10 / currentZoom; // Scale anchor size by zoom level\n\n // Iterate through anchors\n for (let i = 0; i < this.anchors.length; i++) {\n const anchor = this.anchors[i];\n const anchorLocalX = parseFloat(anchor.getAttribute('x')) + anchorSize / 2;\n const anchorLocalY = parseFloat(anchor.getAttribute('y')) + anchorSize / 2;\n const svgPoint = svg.createSVGPoint();\n svgPoint.x = anchorLocalX;\n svgPoint.y = anchorLocalY;\n const transformedPoint = svgPoint.matrixTransform(this.group.getCTM());\n \n const anchorLeft = transformedPoint.x - anchorSize/2 - buffer;\n const anchorRight = transformedPoint.x + anchorSize/2 + buffer;\n const anchorTop = transformedPoint.y - anchorSize/2 - buffer;\n const anchorBottom = transformedPoint.y + anchorSize/2 + buffer;\n \n if (x >= anchorLeft && x <= anchorRight && y >= anchorTop && y <= anchorBottom) {\n return { type: 'resize', index: i };\n }\n }\n\n // Check rotation anchor\n if (this.rotationAnchor) {\n const rotateAnchorLocalX = parseFloat(this.rotationAnchor.getAttribute('cx'));\n const rotateAnchorLocalY = parseFloat(this.rotationAnchor.getAttribute('cy'));\n const svgPoint = svg.createSVGPoint();\n svgPoint.x = rotateAnchorLocalX;\n svgPoint.y = rotateAnchorLocalY;\n const transformedPoint = svgPoint.matrixTransform(this.group.getCTM());\n \n const rotateAnchorRadius = parseFloat(this.rotationAnchor.getAttribute('r')) / currentZoom;\n const distSq = (x - transformedPoint.x)**2 + (y - transformedPoint.y)**2;\n if (distSq <= (rotateAnchorRadius + buffer)**2) {\n return { type: 'rotate' };\n }\n }\n\n return null;\n }\n\n updatePosition(anchorIndex, newMouseX, newMouseY) {\n const CTM = this.group.getCTM();\n if (!CTM) return;\n \n const inverseCTM = CTM.inverse();\n const svgPoint = svg.createSVGPoint();\n svgPoint.x = newMouseX;\n svgPoint.y = newMouseY;\n const transformedPoint = svgPoint.matrixTransform(inverseCTM);\n \n const dx = transformedPoint.x;\n const dy = transformedPoint.y;\n \n const MIN_RADIUS = 10;\n \n switch (anchorIndex) {\n case 0: // top-left\n case 1: // top-right\n case 2: // bottom-left\n case 3: // bottom-right\n this.rx = Math.max(Math.abs(dx), MIN_RADIUS);\n this.ry = Math.max(Math.abs(dy), MIN_RADIUS);\n break;\n \n case 4: // top-center\n case 5: // bottom-center\n this.ry = Math.max(Math.abs(dy), MIN_RADIUS);\n break;\n \n case 6: // left-center\n case 7: // right-center\n this.rx = Math.max(Math.abs(dx), MIN_RADIUS);\n break;\n }\n this.updateAttachedArrows();\n }\n updateAttachedArrows() {\n shapes.forEach(shape => {\n if (shape && shape.shapeName === 'arrow' && typeof shape.updateAttachments === 'function') {\n if ((shape.attachedToStart && shape.attachedToStart.shape === this) ||\n (shape.attachedToEnd && shape.attachedToEnd.shape === this)) {\n shape.updateAttachments();\n }\n }\n });\n }\n _updateShade() {\n if (!this.shadeColor) {\n if (this._shadeEllipse && this._shadeEllipse.parentNode === this.group) {\n this.group.removeChild(this._shadeEllipse);\n this._shadeEllipse = null;\n }\n if (this._shadeGradient && this._shadeGradient.parentNode) {\n this._shadeGradient.parentNode.removeChild(this._shadeGradient);\n this._shadeGradient = null;\n }\n return;\n }\n\n let defs = svg.querySelector('defs');\n if (!defs) {\n defs = document.createElementNS('http://www.w3.org/2000/svg', 'defs');\n svg.appendChild(defs);\n }\n\n const gradId = `shade-${this.shapeID}`;\n if (!this._shadeGradient) {\n this._shadeGradient = document.createElementNS('http://www.w3.org/2000/svg', 'radialGradient');\n this._shadeGradient.setAttribute('id', gradId);\n defs.appendChild(this._shadeGradient);\n }\n\n // Radial gradient for circles - center to edge fade\n this._shadeGradient.setAttribute('cx', '50%');\n this._shadeGradient.setAttribute('cy', '50%');\n this._shadeGradient.setAttribute('r', '50%');\n\n while (this._shadeGradient.firstChild) this._shadeGradient.removeChild(this._shadeGradient.firstChild);\n const stop1 = document.createElementNS('http://www.w3.org/2000/svg', 'stop');\n stop1.setAttribute('offset', '0%');\n stop1.setAttribute('stop-color', this.shadeColor);\n stop1.setAttribute('stop-opacity', this.shadeOpacity);\n const stop2 = document.createElementNS('http://www.w3.org/2000/svg', 'stop');\n stop2.setAttribute('offset', '100%');\n stop2.setAttribute('stop-color', this.shadeColor);\n stop2.setAttribute('stop-opacity', '0');\n this._shadeGradient.appendChild(stop1);\n this._shadeGradient.appendChild(stop2);\n\n if (!this._shadeEllipse) {\n this._shadeEllipse = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse');\n this._shadeEllipse.setAttribute('pointer-events', 'none');\n }\n this._shadeEllipse.setAttribute('cx', 0);\n this._shadeEllipse.setAttribute('cy', 0);\n this._shadeEllipse.setAttribute('rx', this.rx);\n this._shadeEllipse.setAttribute('ry', this.ry);\n this._shadeEllipse.setAttribute('fill', `url(#${gradId})`);\n\n if (this._shadeEllipse.parentNode === this.group) this.group.removeChild(this._shadeEllipse);\n if (this.element && this.element.nextSibling) {\n this.group.insertBefore(this._shadeEllipse, this.element.nextSibling);\n } else {\n this.group.appendChild(this._shadeEllipse);\n }\n }\n\n _updateLabelElement() {\n if (!this.label) {\n if (this.labelElement && this.labelElement.parentNode === this.group) {\n this.group.removeChild(this.labelElement);\n this.labelElement = null;\n }\n if (this._labelBg && this._labelBg.parentNode === this.group) {\n this.group.removeChild(this._labelBg);\n this._labelBg = null;\n }\n return;\n }\n\n if (!this.labelElement) {\n this.labelElement = document.createElementNS('http://www.w3.org/2000/svg', 'text');\n this.labelElement.setAttribute('class', 'shape-label');\n this.labelElement.setAttribute('pointer-events', 'none');\n }\n\n // Circle center is at (0, 0) in local coords\n this.labelElement.setAttribute('x', 0);\n this.labelElement.setAttribute('y', 0);\n this.labelElement.setAttribute('text-anchor', 'middle');\n this.labelElement.setAttribute('dominant-baseline', 'central');\n this.labelElement.setAttribute('fill', this.labelColor);\n this.labelElement.setAttribute('font-size', this.labelFontSize);\n this.labelElement.setAttribute('font-family', 'lixFont, sans-serif');\n this.labelElement.textContent = this.label;\n\n // Background padding rect behind text (like arrows have)\n const canvasBg = window.getComputedStyle(svg).backgroundColor || '#000';\n if (!this._labelBg) {\n this._labelBg = document.createElementNS('http://www.w3.org/2000/svg', 'rect');\n this._labelBg.setAttribute('pointer-events', 'none');\n }\n this._labelBg.setAttribute('fill', canvasBg);\n const hPadding = 6;\n const vPadding = 2;\n const charWidth = this.labelFontSize * 0.6;\n const bgW = this.label.length * charWidth + hPadding * 2;\n const bgH = this.labelFontSize + vPadding * 2;\n this._labelBg.setAttribute('x', -bgW / 2);\n this._labelBg.setAttribute('y', -bgH / 2);\n this._labelBg.setAttribute('width', bgW);\n this._labelBg.setAttribute('height', bgH);\n this._labelBg.setAttribute('rx', 3);\n\n // Re-append bg then text on top\n if (this._labelBg.parentNode === this.group) this.group.removeChild(this._labelBg);\n if (this.labelElement.parentNode === this.group) this.group.removeChild(this.labelElement);\n this.group.appendChild(this._labelBg);\n this.group.appendChild(this.labelElement);\n }\n\n _setupLabelDblClick() {\n this.group.addEventListener('dblclick', (e) => {\n e.stopPropagation();\n e.preventDefault();\n this.startLabelEdit();\n });\n }\n\n startLabelEdit() {\n if (this._isEditingLabel) return;\n this._isEditingLabel = true;\n\n if (this.labelElement) {\n this.labelElement.setAttribute('visibility', 'hidden');\n }\n\n // Get shape's screen position via CTM\n const ctm = this.group.getScreenCTM();\n if (!ctm) { this._isEditingLabel = false; return; }\n\n // Map the ellipse bounding box to screen coords\n const pt1 = svg.createSVGPoint();\n pt1.x = -this.rx; pt1.y = -this.ry;\n const screenTL = pt1.matrixTransform(ctm);\n const pt2 = svg.createSVGPoint();\n pt2.x = this.rx; pt2.y = this.ry;\n const screenBR = pt2.matrixTransform(ctm);\n\n const screenW = Math.abs(screenBR.x - screenTL.x);\n const screenH = Math.abs(screenBR.y - screenTL.y);\n const screenX = Math.min(screenTL.x, screenBR.x);\n const screenY = Math.min(screenTL.y, screenBR.y);\n\n // Create HTML overlay\n const overlay = document.createElement('div');\n overlay.className = 'shape-label-editor';\n overlay.style.cssText = `\n position: fixed; z-index: 10000;\n left: ${screenX}px; top: ${screenY}px;\n width: ${screenW}px; height: ${screenH}px;\n display: flex; align-items: center; justify-content: center;\n pointer-events: auto;\n `;\n\n const canvasBg = window.getComputedStyle(svg).backgroundColor || '#000';\n const input = document.createElement('div');\n input.setAttribute('contenteditable', 'true');\n input.style.cssText = `\n max-width: ${screenW - 8}px; min-width: 30px; min-height: 20px;\n background: ${canvasBg}; border: none;\n outline: none; padding: 2px 6px;\n color: ${this.labelColor}; font-size: ${Math.max(12, this.labelFontSize * (screenW / Math.max(this.rx * 2, 1)))}px;\n font-family: lixFont, sans-serif; text-align: center;\n white-space: pre-wrap; word-break: break-word;\n cursor: text;\n `;\n if (this.label) {\n input.textContent = this.label;\n } else {\n input.innerHTML = ' ';\n }\n\n overlay.appendChild(input);\n document.body.appendChild(overlay);\n\n setTimeout(() => {\n input.focus();\n const sel = window.getSelection();\n const range = document.createRange();\n range.selectNodeContents(input);\n sel.removeAllRanges();\n sel.addRange(range);\n }, 10);\n\n const finishEdit = () => {\n const newText = input.textContent.trim().replace(/\\u00A0/g, '');\n this.label = newText;\n this._isEditingLabel = false;\n\n if (overlay.parentNode) overlay.parentNode.removeChild(overlay);\n if (this.labelElement) this.labelElement.setAttribute('visibility', 'visible');\n this.draw();\n };\n\n input.addEventListener('blur', finishEdit);\n input.addEventListener('keydown', (e) => {\n e.stopPropagation();\n if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); input.blur(); }\n if (e.key === 'Escape') { input.textContent = this.label; input.blur(); }\n });\n input.addEventListener('pointerdown', (e) => e.stopPropagation());\n input.addEventListener('pointermove', (e) => e.stopPropagation());\n input.addEventListener('pointerup', (e) => e.stopPropagation());\n }\n\n setLabel(text, color, fontSize) {\n this.label = text || '';\n if (color) this.labelColor = color;\n if (fontSize) this.labelFontSize = fontSize;\n this.draw();\n }\n\n rotate(angle) {\n angle = angle % 360;\n if (angle < 0) angle += 360;\n this.rotation = angle;\n }\n // No-op: React sidebar handles UI updates via Zustand store\n updateSidebar() {}\n\n}\n\nexport { Circle };\n"],
|
|
5
|
-
"mappings": ";;;AAIA,IAAM,KAAK,MAAM,IAAI,GAAG;AACxB,IAAI,wBAAwB;AAC5B,IAAI,wBAAwB;AAC5B,IAAI,wBAAwB;AAC5B,IAAI,qBAAqB;AACzB,IAAM,qBAAqB,SAAS,iBAAiB,mBAAmB;AACxE,IAAM,+BAA+B,SAAS,iBAAiB,uBAAuB;AACtF,IAAM,yBAAyB,SAAS,iBAAiB,sBAAsB;AAC/E,IAAM,6BAA6B,SAAS,iBAAiB,wBAAwB;AACrF,IAAM,0BAA0B,SAAS,iBAAiB,qBAAqB;AAE/E,IAAM,SAAN,MAAa;AAAA,EACT,YAAY,GAAG,GAAG,IAAI,IAAI,UAAU,CAAC,GAAG;AACpC,SAAK,IAAI;AACT,SAAK,IAAI;AACT,SAAK,KAAK;AACV,SAAK,KAAK;AACV,SAAK,UAAU;AAAA,MACX,WAAW;AAAA,MACX,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,MAAM;AAAA,MACN,WAAW;AAAA,MACX,iBAAiB;AAAA,MACjB,GAAG;AAAA,IACP;AACA,SAAK,UAAU;AACf,SAAK,aAAa;AAClB,SAAK,WAAW;AAChB,SAAK,QAAQ,SAAS,gBAAgB,8BAA8B,GAAG;AAC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;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/tools/imageTool.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable */\n// Image tool event handlers - extracted from imageTool.js\nimport { pushCreateAction, pushDeleteAction, pushTransformAction, pushFrameAttachmentAction } from '../core/UndoRedo.js';\nimport { updateAttachedArrows as updateArrowsForShape, cleanupAttachments } from './arrowTool.js';\nimport { compressImage } from '../utils/imageCompressor.js';\nimport { isAllowedImage, IMAGE_ACCEPT_ATTR } from '../utils/allowedImageTypes.js';\n\n\nlet isDraggingImage = false;\nlet imageToPlace = null;\nlet imageX = 0;\nlet imageY = 0;\nlet scaleFactor = 0.2;\nlet currentImageElement = null;\n\nlet selectedImage = null;\nlet originalX, originalY, originalWidth, originalHeight;\nlet currentAnchor = null;\nlet isDragging = false;\nlet isRotatingImage = false;\nlet dragOffsetX, dragOffsetY;\nlet startRotationMouseAngle = null;\nlet startImageRotation = null;\nlet imageRotation = 0;\nlet aspect_ratio_lock = true;\nconst minImageSize = 20;\n\n// Frame attachment variables\nlet draggedShapeInitialFrameImage = null;\nlet hoveredFrameImage = null;\n\n// Per-room image size limit: 5MB total\nconst ROOM_IMAGE_LIMIT_BYTES = 5 * 1024 * 1024;\nif (!window.__roomImageBytesUsed) window.__roomImageBytesUsed = 0;\n\n\n// Convert SVG element to our ImageShape class\nfunction wrapImageElement(element) {\n const imageShape = new ImageShape(element);\n return imageShape;\n}\n\n/**\n * Async image upload pipeline:\n * 1. Show loading indicator on the image\n * 2. Compress the image adaptively\n * 3. Get a signed upload URL from the worker\n * 4. Upload compressed image to Cloudinary\n * 5. Replace the base64 href with Cloudinary URL\n * 6. Remove loading indicator\n */\nasync function uploadImageToCloudinary(imageShape) {\n const workerUrl = window.__WORKER_URL;\n const sessionId = window.__sessionID;\n if (!workerUrl || !sessionId) return;\n\n const href = imageShape.element.getAttribute('href') || '';\n if (!href.startsWith('data:')) return; // already a URL, skip\n\n imageShape.uploadStatus = 'uploading';\n imageShape.uploadAbortController = new AbortController();\n const signal = imageShape.uploadAbortController.signal;\n\n imageShape.showUploadIndicator();\n\n try {\n // Step 1: Compress\n const compressed = await compressImage(href);\n if (signal.aborted) return;\n\n // Step 2: Get signed upload params\n const signRes = await fetch(`${workerUrl}/api/images/sign`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n sessionId,\n filename: `img_${Date.now()}`,\n }),\n signal,\n });\n if (!signRes.ok) throw new Error('Failed to get upload signature');\n const signData = await signRes.json();\n if (signal.aborted) return;\n\n // Step 3: Upload to Cloudinary\n const formData = new FormData();\n formData.append('file', compressed.blob);\n formData.append('api_key', signData.apiKey);\n formData.append('timestamp', String(signData.timestamp));\n formData.append('signature', signData.signature);\n formData.append('folder', signData.folder);\n formData.append('public_id', signData.publicId);\n\n const uploadRes = await fetch(\n `https://api.cloudinary.com/v1_1/${signData.cloudName}/image/upload`,\n { method: 'POST', body: formData, signal }\n );\n if (!uploadRes.ok) throw new Error('Cloudinary upload failed');\n const uploadData = await uploadRes.json();\n if (signal.aborted) return;\n\n // Step 4: Replace base64 with Cloudinary URL\n const cloudUrl = uploadData.secure_url || uploadData.url;\n imageShape.element.setAttribute('href', cloudUrl);\n imageShape.element.setAttribute('data-href', cloudUrl);\n imageShape.element.setAttribute('data-cloudinary-id', uploadData.public_id);\n\n // Update file size tracking with actual compressed size\n const oldSize = imageShape.element.__fileSize || 0;\n const newSize = uploadData.bytes || compressed.compressedSize;\n imageShape.element.__fileSize = newSize;\n window.__roomImageBytesUsed = Math.max(0, (window.__roomImageBytesUsed || 0) - oldSize + newSize);\n\n imageShape.uploadStatus = 'done';\n console.log(`[ImageUpload] Uploaded to Cloudinary: ${cloudUrl} (${(newSize / 1024).toFixed(1)}KB)`);\n } catch (err) {\n if (signal.aborted) {\n console.log('[ImageUpload] Upload aborted (image deleted)');\n return;\n }\n console.warn('[ImageUpload] Upload failed:', err);\n imageShape.uploadStatus = 'failed';\n } finally {\n imageShape.removeUploadIndicator();\n imageShape.uploadAbortController = null;\n }\n}\n\ndocument.getElementById(\"importImage\")?.addEventListener('click', () => {\n console.log('Import image clicked');\n isImageToolActive = true;\n console.log('isImageToolActive set to:', isImageToolActive);\n\n // Create a file input element\n const fileInput = document.createElement('input');\n fileInput.type = 'file';\n fileInput.accept = IMAGE_ACCEPT_ATTR; // Static images only \u2014 see allowedImageTypes.js\n fileInput.style.display = 'none'; // Hide the input element\n \n // Add the input to the document temporarily\n document.body.appendChild(fileInput);\n \n let fileSelected = false;\n\n // Handle file selection\n fileInput.addEventListener('change', (event) => {\n const file = event.target.files[0];\n if (file) {\n fileSelected = true;\n handleImageUpload(file);\n }\n document.body.removeChild(fileInput);\n });\n\n // Detect cancel\n const onFocus = () => {\n window.removeEventListener('focus', onFocus);\n setTimeout(() => {\n if (!fileSelected) {\n isImageToolActive = false;\n if (window.__sketchEngine?.setActiveTool) {\n window.__sketchEngine.setActiveTool('select');\n }\n if (fileInput.parentNode) {\n document.body.removeChild(fileInput);\n }\n }\n }, 300);\n };\n window.addEventListener('focus', onFocus);\n\n // Trigger the file picker\n fileInput.click();\n});\n\n\nconst loadHardcodedImage = (imagePath) => {\n console.log('Loading hardcoded image:', imagePath);\n const img = new Image();\n img.onload = () => {\n console.log('Image loaded successfully');\n const canvas = document.createElement('canvas');\n const ctx = canvas.getContext('2d');\n canvas.width = img.width;\n canvas.height = img.height;\n ctx.drawImage(img, 0, 0);\n imageToPlace = canvas.toDataURL();\n isDraggingImage = true;\n console.log('Image ready to place, isDraggingImage:', isDraggingImage);\n };\n img.onerror = (error) => {\n console.error('Failed to load the hardcoded image:', error);\n console.error('Image path:', imagePath);\n };\n img.src = imagePath;\n};\n\nconst handleImageUpload = async (file) => {\n if (!file || !isImageToolActive) return;\n\n // Validate file type against the canonical allowlist (avif, jpeg, jpg,\n // png, bmp, svg, webp). Animated GIF, HEIC, TIFF, video, audio, and\n // arbitrary files are rejected here.\n if (!isAllowedImage(file)) {\n console.error('Rejected file type:', file.type, file.name);\n alert('Unsupported file type. Allowed: AVIF, JPEG, PNG, BMP, SVG, WebP.');\n isImageToolActive = false;\n return;\n }\n\n // Per-room 5MB total image limit\n if (window.__roomImageBytesUsed + file.size > ROOM_IMAGE_LIMIT_BYTES) {\n const usedMB = (window.__roomImageBytesUsed / (1024 * 1024)).toFixed(2);\n const fileMB = (file.size / (1024 * 1024)).toFixed(2);\n alert(`Room image limit reached (5 MB). Used: ${usedMB} MB, this file: ${fileMB} MB. Delete some images to free space.`);\n isImageToolActive = false;\n return;\n }\n\n const maxSize = 5 * 1024 * 1024; // 5MB per file (matches room limit)\n if (file.size > maxSize) {\n console.error('File size too large');\n alert('Image file is too large. Please select an image smaller than 5 MB.');\n return;\n }\n\n console.log('Processing image file:', file.name, 'Size:', file.size, 'Type:', file.type);\n\n // Read \u2192 optionally compress \u2192 place. We compress client-side BEFORE\n // placement so that consumers without an upload pipeline (VS Code\n // extension, offline npm usage) still embed a compressed data URL\n // rather than the original. SVGs are passed through unchanged because\n // rasterizing them would destroy their vector fidelity.\n try {\n const rawDataUrl = await readFileAsDataUrl(file);\n const isSvg = (file.type || '').toLowerCase() === 'image/svg+xml'\n || (file.name || '').toLowerCase().endsWith('.svg');\n\n let placedDataUrl = rawDataUrl;\n let placedSize = file.size;\n if (!isSvg) {\n try {\n const compressed = await compressImage(rawDataUrl);\n if (compressed?.dataUrl) {\n placedDataUrl = compressed.dataUrl;\n placedSize = compressed.compressedSize || placedSize;\n }\n } catch (err) {\n console.warn('[ImageTool] Pre-placement compression failed, using raw:', err);\n }\n }\n\n window.__pendingImageFileSize = placedSize;\n imageToPlace = placedDataUrl;\n isDraggingImage = true;\n console.log('Image loaded and ready to place', { size: placedSize, isSvg });\n } catch (err) {\n console.error('Error reading file:', err);\n alert('Error reading the image file. Please try again.');\n isImageToolActive = false;\n }\n};\n\nfunction readFileAsDataUrl(file) {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = (e) => resolve(e.target.result);\n reader.onerror = (err) => reject(err);\n reader.readAsDataURL(file);\n });\n}\n\n// Add coordinate conversion function like in other tools\nfunction getSVGCoordsFromMouse(e) {\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\n// Event handler for mousemove on the SVG\nconst handleMouseMoveImage = (e) => {\n if (!isDraggingImage || !imageToPlace || !isImageToolActive) return; // Also check isImageToolActive\n\n // Get mouse coordinates relative to the SVG element\n const { x, y } = getSVGCoordsFromMouse(e);\n imageX = x;\n imageY = y;\n\n drawMiniatureImage();\n \n // Check for frame containment while placing image (but don't apply clipping yet)\n if (typeof shapes !== 'undefined' && Array.isArray(shapes)) {\n shapes.forEach(frame => {\n if (frame.shapeName === 'frame') {\n // Create temporary image bounds for frame checking\n const tempImageBounds = {\n x: imageX - 50, // Half of miniature width\n y: imageY - 50, // Approximate half height\n width: 100,\n height: 100\n };\n \n if (frame.isShapeInFrame(tempImageBounds)) {\n frame.highlightFrame();\n hoveredFrameImage = frame;\n } else if (hoveredFrameImage === frame) {\n frame.removeHighlight();\n hoveredFrameImage = null;\n }\n }\n });\n }\n};\n\nconst drawMiniatureImage = () => {\n if (!isDraggingImage || !imageToPlace || !isImageToolActive) return; // Also check isImageToolActive\n\n const miniatureWidth = 100; // Fixed width for miniature (adjust as needed)\n getImageAspectRatio(imageToPlace)\n .then(aspectRatio => {\n const miniatureHeight = miniatureWidth * aspectRatio; // Maintain aspect ratio\n\n // Remove the previous miniature image, if it exists\n if (currentImageElement) {\n svg.removeChild(currentImageElement);\n currentImageElement = null; // Important: clear the reference\n }\n\n // Create an SVG image element for the miniature\n currentImageElement = document.createElementNS(\"http://www.w3.org/2000/svg\", \"image\");\n currentImageElement.setAttribute(\"href\", imageToPlace);\n currentImageElement.setAttribute(\"x\", imageX - miniatureWidth / 2); \n currentImageElement.setAttribute(\"y\", imageY - miniatureHeight / 2);\n currentImageElement.setAttribute(\"width\", miniatureWidth);\n currentImageElement.setAttribute(\"height\", miniatureHeight);\n currentImageElement.setAttribute(\"preserveAspectRatio\", \"xMidYMid meet\");\n\n svg.appendChild(currentImageElement);\n })\n .catch(error => {\n console.error(\"Error getting aspect ratio:\", error);\n \n });\n};\n\nfunction getImageAspectRatio(dataUrl) {\n return new Promise((resolve, reject) => {\n const img = new Image();\n img.onload = () => {\n resolve(img.height / img.width);\n };\n img.onerror = () => {\n reject(new Error('Failed to load image for aspect ratio calculation.'));\n };\n img.src = dataUrl;\n });\n}\n\n// Update the handleMouseDownImage function to create proper group structure\nconst handleMouseDownImage = async (e) => {\n if (!isDraggingImage || !imageToPlace || !isImageToolActive) {\n // Handle image selection if selection tool is active\n if (isSelectionToolActive) {\n const clickedImage = e.target.closest('image');\n if (clickedImage) {\n selectImage({ target: clickedImage, stopPropagation: () => e.stopPropagation() });\n return;\n }\n }\n return;\n }\n\n try {\n //Get aspect ratio before we clear the temporary image data.\n let aspectRatio = await getImageAspectRatio(imageToPlace);\n\n // Remove the miniature\n if (currentImageElement) {\n svg.removeChild(currentImageElement);\n currentImageElement = null;\n }\n\n // Calculate actual dimensions of the placed image\n const placedImageWidth = 200; // Adjust as needed\n const placedImageHeight = placedImageWidth * aspectRatio;\n\n // Get SVG coordinates\n const { x: placedX, y: placedY } = getSVGCoordsFromMouse(e);\n\n // Create a new SVG image element for the final image\n const finalImage = document.createElementNS(\"http://www.w3.org/2000/svg\", \"image\");\n finalImage.setAttribute(\"href\", imageToPlace);\n finalImage.setAttribute(\"x\", placedX - placedImageWidth / 2);\n finalImage.setAttribute(\"y\", placedY - placedImageHeight / 2);\n finalImage.setAttribute(\"width\", placedImageWidth);\n finalImage.setAttribute(\"height\", placedImageHeight);\n finalImage.setAttribute(\"preserveAspectRatio\", \"xMidYMid meet\");\n\n // Store data for undo/redo\n finalImage.setAttribute('data-href', imageToPlace);\n finalImage.setAttribute('data-x', placedX - placedImageWidth / 2);\n finalImage.setAttribute('data-y', placedY - placedImageHeight / 2);\n finalImage.setAttribute('data-width', placedImageWidth);\n finalImage.setAttribute('data-height', placedImageHeight);\n \n // Add arrow attachment support data attributes\n finalImage.setAttribute('type', 'image');\n finalImage.setAttribute('data-shape-x', placedX - placedImageWidth / 2);\n finalImage.setAttribute('data-shape-y', placedY - placedImageHeight / 2);\n finalImage.setAttribute('data-shape-width', placedImageWidth);\n finalImage.setAttribute('data-shape-height', placedImageHeight);\n finalImage.setAttribute('data-shape-rotation', 0);\n finalImage.shapeID = `image-${String(Date.now()).slice(0, 8)}-${Math.floor(Math.random() * 10000)}`;\n\n // Don't add to SVG directly - let ImageShape wrapper handle it\n // svg.appendChild(finalImage);\n\n // Create ImageShape wrapper for frame functionality\n const imageShape = wrapImageElement(finalImage);\n\n // Add to shapes array for arrow attachment and frame functionality\n if (typeof shapes !== 'undefined' && Array.isArray(shapes)) {\n shapes.push(imageShape);\n console.log('Image added to shapes array for arrow attachment and frame functionality');\n } else {\n console.warn('shapes array not found - arrows and frames may not work with images');\n }\n\n // Check for frame containment and track attachment\n const finalFrame = hoveredFrameImage;\n if (finalFrame) {\n finalFrame.addShapeToFrame(imageShape);\n // Track the attachment for undo\n pushFrameAttachmentAction(finalFrame, imageShape, 'attach', null);\n }\n\n // Add to undo stack for image creation\n pushCreateAction({\n type: 'image',\n element: imageShape,\n remove: () => {\n if (imageShape.group && imageShape.group.parentNode) {\n imageShape.group.parentNode.removeChild(imageShape.group);\n }\n // Remove from shapes array\n if (typeof shapes !== 'undefined' && Array.isArray(shapes)) {\n const idx = shapes.indexOf(imageShape);\n if (idx !== -1) shapes.splice(idx, 1);\n }\n // Clean up arrow attachments when image is removed\n if (typeof cleanupAttachments === 'function') {\n cleanupAttachments(finalImage);\n }\n },\n restore: () => {\n svg.appendChild(imageShape.group);\n // Add back to shapes array\n if (typeof shapes !== 'undefined' && Array.isArray(shapes)) {\n if (shapes.indexOf(imageShape) === -1) {\n shapes.push(imageShape);\n }\n }\n }\n });\n\n // Track image size for room limit\n const placedFileSize = window.__pendingImageFileSize || 0;\n finalImage.__fileSize = placedFileSize;\n window.__roomImageBytesUsed = (window.__roomImageBytesUsed || 0) + placedFileSize;\n window.__pendingImageFileSize = 0;\n\n // Add click event to the newly added image\n finalImage.addEventListener('click', selectImage);\n\n // Clear frame highlighting\n if (hoveredFrameImage) {\n hoveredFrameImage.removeHighlight();\n hoveredFrameImage = null;\n }\n\n // Auto-select the placed image and switch to selection tool\n const placedShape = imageShape;\n if (window.__sketchStoreApi) window.__sketchStoreApi.setActiveTool('select', { afterDraw: true });\n currentShape = placedShape;\n currentShape.isSelected = true;\n placedShape.selectShape();\n\n // Fire async upload pipeline. We dispatch via window.uploadImageToCloudinary\n // so embedded hosts (e.g. blogs.elixpo) can swap in a postMessage-based\n // implementation that routes uploads through the host's media API.\n const uploader = (typeof window !== 'undefined' && window.uploadImageToCloudinary) || uploadImageToCloudinary;\n uploader(imageShape).catch(err => {\n console.warn('[ImageTool] Upload pipeline error:', err);\n });\n\n } catch (error) {\n console.error(\"Error placing image:\", error);\n isDraggingImage = false;\n imageToPlace = null;\n isImageToolActive = false; // Important: Reset the tool state.\n } finally {\n isDraggingImage = false;\n imageToPlace = null;\n isImageToolActive = false; // Important: Reset the tool state.\n }\n};\n\nconst handleMouseUpImage = (e) => {\n // Only deselect if the user actually clicked (mousedown+mouseup) on a non-image area\n // of the SVG canvas \u2014 not when the mouse just leaves to the UI\n if (isSelectionToolActive && selectedImage) {\n const clickedElement = e.target;\n const isOnSVG = clickedElement === svg || clickedElement.ownerSVGElement === svg;\n const isImageElement = clickedElement.tagName === 'image';\n const isAnchorElement = clickedElement.classList.contains('resize-anchor') ||\n clickedElement.classList.contains('rotation-anchor') ||\n clickedElement.classList.contains('selection-outline');\n\n // Only deselect if mouseup is directly on the SVG background (not on any shape/anchor)\n if (isOnSVG && !isImageElement && !isAnchorElement && clickedElement === svg && !isDragging && !isRotatingImage && !currentAnchor) {\n removeSelectionOutline();\n selectedImage = null;\n if (window.__sketchStoreApi) {\n window.__sketchStoreApi.clearSelectedShapeSidebar();\n }\n }\n }\n \n // Clear frame highlighting if placing image\n if (hoveredFrameImage) {\n hoveredFrameImage.removeHighlight();\n hoveredFrameImage = null;\n }\n};\n\nfunction selectImage(event) {\n if (!isSelectionToolActive) return;\n\n event.stopPropagation(); // Prevent click from propagating to the SVG\n\n if (selectedImage) {\n removeSelectionOutline();\n }\n\n selectedImage = event.target;\n \n // Get the current rotation from the image transform attribute\n const transform = selectedImage.getAttribute('transform');\n if (transform) {\n const rotateMatch = transform.match(/rotate\\(([^,]+)/);\n if (rotateMatch) {\n imageRotation = parseFloat(rotateMatch[1]);\n }\n } else {\n imageRotation = 0;\n }\n \n addSelectionOutline();\n\n // Store original dimensions for resizing\n originalX = parseFloat(selectedImage.getAttribute('x'));\n originalY = parseFloat(selectedImage.getAttribute('y'));\n originalWidth = parseFloat(selectedImage.getAttribute('width'));\n originalHeight = parseFloat(selectedImage.getAttribute('height'));\n\n // Add drag event listeners to the selected image\n selectedImage.addEventListener('pointerdown', startDrag);\n selectedImage.addEventListener('pointerup', stopDrag);\n selectedImage.addEventListener('pointerleave', stopDrag);\n\n // Set currentShape for sidebar + layer controls\n const imageShape = (typeof shapes !== 'undefined' && Array.isArray(shapes))\n ? shapes.find(s => s.shapeName === 'image' && s.element === selectedImage)\n : null;\n if (imageShape) {\n window.currentShape = imageShape;\n }\n if (typeof window.__showSidebarForShape === 'function') {\n window.__showSidebarForShape('image');\n }\n}\n\nfunction addSelectionOutline() {\n if (!selectedImage) return;\n\n const x = parseFloat(selectedImage.getAttribute('x'));\n const y = parseFloat(selectedImage.getAttribute('y'));\n const width = parseFloat(selectedImage.getAttribute('width'));\n const height = parseFloat(selectedImage.getAttribute('height'));\n\n const selectionPadding = 8; // Padding around the selection\n const expandedX = x - selectionPadding;\n const expandedY = y - selectionPadding;\n const expandedWidth = width + 2 * selectionPadding;\n const expandedHeight = height + 2 * selectionPadding;\n\n // Create a dashed outline\n const outlinePoints = [\n [expandedX, expandedY],\n [expandedX + expandedWidth, expandedY],\n [expandedX + expandedWidth, expandedY + expandedHeight],\n [expandedX, expandedY + expandedHeight],\n [expandedX, expandedY]\n ];\n const pointsAttr = outlinePoints.map(p => p.join(',')).join(' ');\n const outline = document.createElementNS(\"http://www.w3.org/2000/svg\", \"polyline\");\n outline.setAttribute(\"points\", pointsAttr);\n outline.setAttribute(\"fill\", \"none\");\n outline.setAttribute(\"stroke\", \"#5B57D1\");\n outline.setAttribute(\"stroke-width\", 1.5);\n outline.setAttribute(\"stroke-dasharray\", \"4 2\");\n outline.setAttribute(\"style\", \"pointer-events: none;\");\n outline.setAttribute(\"class\", \"selection-outline\");\n\n // Apply the same rotation as the image\n const centerX = x + width / 2;\n const centerY = y + height / 2;\n outline.setAttribute('transform', `rotate(${imageRotation}, ${centerX}, ${centerY})`);\n\n svg.appendChild(outline);\n\n // Add resize anchors\n addResizeAnchors(expandedX, expandedY, expandedWidth, expandedHeight, centerX, centerY);\n \n // Add rotation anchor\n addRotationAnchor(expandedX, expandedY, expandedWidth, expandedHeight, centerX, centerY);\n}\n\nfunction removeSelectionOutline() {\n // Remove ALL selection outlines (querySelectorAll to prevent stacking)\n svg.querySelectorAll(\".selection-outline\").forEach(el => el.remove());\n\n // Remove resize anchors\n removeResizeAnchors();\n\n // Remove rotation anchor\n removeRotationAnchor();\n\n // Remove drag event listeners\n if (selectedImage) {\n selectedImage.removeEventListener('pointerdown', startDrag);\n selectedImage.removeEventListener('pointerup', stopDrag);\n selectedImage.removeEventListener('pointerleave', stopDrag);\n }\n}\n\nfunction addResizeAnchors(x, y, width, height, centerX, centerY) {\n const zoom = window.currentZoom || 1;\n const anchorSize = 10 / zoom;\n const anchorStrokeWidth = 2;\n\n const positions = [\n { x: x, y: y }, // Top-left\n { x: x + width, y: y }, // Top-right\n { x: x, y: y + height }, // Bottom-left\n { x: x + width, y: y + height } // Bottom-right\n ];\n\n positions.forEach((pos, i) => {\n const anchor = document.createElementNS(\"http://www.w3.org/2000/svg\", \"rect\");\n anchor.setAttribute(\"x\", pos.x - anchorSize / 2);\n anchor.setAttribute(\"y\", pos.y - anchorSize / 2);\n anchor.setAttribute(\"width\", anchorSize);\n anchor.setAttribute(\"height\", anchorSize);\n anchor.setAttribute(\"fill\", \"#121212\");\n anchor.setAttribute(\"stroke\", \"#5B57D1\");\n anchor.setAttribute(\"stroke-width\", anchorStrokeWidth);\n anchor.setAttribute(\"class\", \"resize-anchor\");\n anchor.style.cursor = [\"nw-resize\", \"ne-resize\", \"sw-resize\", \"se-resize\"][i];\n\n // Apply the same rotation as the image\n anchor.setAttribute('transform', `rotate(${imageRotation}, ${centerX}, ${centerY})`);\n\n svg.appendChild(anchor);\n\n // Add event listeners for resizing\n anchor.addEventListener('pointerdown', startResize);\n anchor.addEventListener('pointerup', stopResize);\n });\n}\n\nfunction addRotationAnchor(x, y, width, height, centerX, centerY) {\n const anchorStrokeWidth = 2;\n const rotationAnchorPos = { x: x + width / 2, y: y - 30 };\n \n const rotationAnchor = document.createElementNS('http://www.w3.org/2000/svg', 'circle');\n rotationAnchor.setAttribute('cx', rotationAnchorPos.x);\n rotationAnchor.setAttribute('cy', rotationAnchorPos.y);\n rotationAnchor.setAttribute('r', 8);\n rotationAnchor.setAttribute('class', 'rotation-anchor');\n rotationAnchor.setAttribute('fill', '#121212');\n rotationAnchor.setAttribute('stroke', '#5B57D1');\n rotationAnchor.setAttribute('stroke-width', anchorStrokeWidth);\n rotationAnchor.setAttribute('style', 'pointer-events: all;');\n \n // Apply the same rotation as the image\n rotationAnchor.setAttribute('transform', `rotate(${imageRotation}, ${centerX}, ${centerY})`);\n \n svg.appendChild(rotationAnchor);\n\n // Add event listeners for rotation\n rotationAnchor.addEventListener('pointerdown', startRotation);\n rotationAnchor.addEventListener('pointerup', stopRotation);\n \n rotationAnchor.addEventListener('mouseover', function () {\n if (!isRotatingImage && !isDragging) {\n rotationAnchor.style.cursor = 'grab';\n }\n });\n \n rotationAnchor.addEventListener('mouseout', function () {\n if (!isRotatingImage && !isDragging) {\n rotationAnchor.style.cursor = 'default';\n }\n });\n}\n\nfunction removeRotationAnchor() {\n svg.querySelectorAll(\".rotation-anchor\").forEach(el => el.remove());\n}\n\nfunction addAnchor(x, y, cursor) {\n const anchorSize = 8 / (window.currentZoom || 1);\n const anchor = document.createElementNS(\"http://www.w3.org/2000/svg\", \"rect\");\n anchor.setAttribute(\"x\", x);\n anchor.setAttribute(\"y\", y);\n anchor.setAttribute(\"width\", anchorSize);\n anchor.setAttribute(\"height\", anchorSize);\n anchor.setAttribute(\"fill\", \"white\");\n anchor.setAttribute(\"stroke\", \"black\");\n anchor.setAttribute(\"stroke-width\", \"1\");\n anchor.setAttribute(\"class\", \"resize-anchor\"); // For easy removal\n anchor.style.cursor = cursor;\n\n svg.appendChild(anchor);\n\n // Add event listeners for dragging\n anchor.addEventListener('pointerdown', startResize);\n anchor.addEventListener('pointerup', stopResize);\n\n}\n\nfunction removeResizeAnchors() {\n const anchors = svg.querySelectorAll(\".resize-anchor\");\n anchors.forEach(anchor => svg.removeChild(anchor));\n}\n\nfunction startResize(event) {\n event.preventDefault();\n event.stopPropagation();\n\n currentAnchor = event.target;\n \n // Store original values at the start of resize\n originalX = parseFloat(selectedImage.getAttribute('x'));\n originalY = parseFloat(selectedImage.getAttribute('y'));\n originalWidth = parseFloat(selectedImage.getAttribute('width'));\n originalHeight = parseFloat(selectedImage.getAttribute('height'));\n \n // Store original rotation\n const transform = selectedImage.getAttribute('transform');\n if (transform) {\n const rotateMatch = transform.match(/rotate\\(([^,]+)/);\n if (rotateMatch) {\n imageRotation = parseFloat(rotateMatch[1]);\n }\n }\n \n svg.addEventListener('pointermove', resizeImage);\n document.addEventListener('pointerup', stopResize);\n}\n\nfunction stopResize(event) {\n stopInteracting(); // Call the combined stop function\n document.removeEventListener('pointerup', stopResize); // Remove the global mouseup listener\n}\n\nfunction resizeImage(event) {\n if (!selectedImage || !currentAnchor) return;\n\n const { x: globalX, y: globalY } = getSVGCoordsFromMouse(event);\n\n // Use ORIGINAL center for consistent inverse rotation (avoids drift)\n const centerX = originalX + originalWidth / 2;\n const centerY = originalY + originalHeight / 2;\n\n // Convert mouse position to local coordinates accounting for rotation\n let localX = globalX;\n let localY = globalY;\n\n if (imageRotation !== 0) {\n const rotationRad = (imageRotation * Math.PI) / 180;\n const translatedX = globalX - centerX;\n const translatedY = globalY - centerY;\n localX = translatedX * Math.cos(-rotationRad) - translatedY * Math.sin(-rotationRad) + centerX;\n localY = translatedX * Math.sin(-rotationRad) + translatedY * Math.cos(-rotationRad) + centerY;\n }\n\n // Calculate resize deltas in local coordinate space\n let dx = localX - originalX;\n let dy = localY - originalY;\n\n let newWidth = originalWidth;\n let newHeight = originalHeight;\n let newX = originalX;\n let newY = originalY;\n const aspectRatio = originalHeight / originalWidth;\n\n // Track which corner is fixed (relative to original rect)\n let fixedRelX, fixedRelY;\n\n switch (currentAnchor.style.cursor) {\n case \"nw-resize\":\n newWidth = originalWidth - dx;\n newHeight = originalHeight - dy;\n if (aspect_ratio_lock) {\n newHeight = newWidth * aspectRatio;\n dy = originalHeight - newHeight;\n }\n newX = originalX + (originalWidth - newWidth);\n newY = originalY + (originalHeight - newHeight);\n fixedRelX = originalWidth; fixedRelY = originalHeight;\n break;\n case \"ne-resize\":\n newWidth = dx;\n newHeight = originalHeight - dy;\n if (aspect_ratio_lock) {\n newHeight = newWidth * aspectRatio;\n dy = originalHeight - newHeight;\n }\n newX = originalX;\n newY = originalY + (originalHeight - newHeight);\n fixedRelX = 0; fixedRelY = originalHeight;\n break;\n case \"sw-resize\":\n newWidth = originalWidth - dx;\n newHeight = dy;\n if (aspect_ratio_lock) {\n newHeight = newWidth * aspectRatio;\n dy = newHeight;\n }\n newX = originalX + (originalWidth - newWidth);\n newY = originalY;\n fixedRelX = originalWidth; fixedRelY = 0;\n break;\n case \"se-resize\":\n newWidth = dx;\n newHeight = dy;\n if (aspect_ratio_lock) {\n newHeight = newWidth * aspectRatio;\n }\n newX = originalX;\n newY = originalY;\n fixedRelX = 0; fixedRelY = 0;\n break;\n }\n\n // Ensure minimum size\n newWidth = Math.max(minImageSize, newWidth);\n newHeight = Math.max(minImageSize, newHeight);\n\n // Compensate for rotation center shift when rotated\n if (imageRotation !== 0) {\n const rad = (imageRotation * Math.PI) / 180;\n const cosR = Math.cos(rad);\n const sinR = Math.sin(rad);\n\n // Compute rotated world position of the fixed corner in the original rect\n const oldCX = originalX + originalWidth / 2;\n const oldCY = originalY + originalHeight / 2;\n const odx = (originalX + fixedRelX) - oldCX;\n const ody = (originalY + fixedRelY) - oldCY;\n const fixedWorldX = oldCX + odx * cosR - ody * sinR;\n const fixedWorldY = oldCY + odx * sinR + ody * cosR;\n\n // Determine where the fixed corner sits in the new rect (relative to new origin)\n const fixedNewRelX = fixedRelX === 0 ? 0 : newWidth;\n const fixedNewRelY = fixedRelY === 0 ? 0 : newHeight;\n\n // Solve for new origin so the fixed corner stays in place\n const ncx = newWidth / 2;\n const ncy = newHeight / 2;\n const ndx = fixedNewRelX - ncx;\n const ndy = fixedNewRelY - ncy;\n const rotX = ncx + ndx * cosR - ndy * sinR;\n const rotY = ncy + ndx * sinR + ndy * cosR;\n\n newX = fixedWorldX - rotX;\n newY = fixedWorldY - rotY;\n }\n\n // Apply the new dimensions and position\n selectedImage.setAttribute('width', newWidth);\n selectedImage.setAttribute('height', newHeight);\n selectedImage.setAttribute('x', newX);\n selectedImage.setAttribute('y', newY);\n\n // Update data attributes for arrow attachment\n selectedImage.setAttribute('data-shape-x', newX);\n selectedImage.setAttribute('data-shape-y', newY);\n selectedImage.setAttribute('data-shape-width', newWidth);\n selectedImage.setAttribute('data-shape-height', newHeight);\n\n // Reapply the rotation transform with the new center\n const newCenterX = newX + newWidth / 2;\n const newCenterY = newY + newHeight / 2;\n selectedImage.setAttribute('transform', `rotate(${imageRotation}, ${newCenterX}, ${newCenterY})`);\n\n // Update attached arrows during resize\n updateArrowsForShape(selectedImage);\n\n // Update the selection outline and anchors\n removeSelectionOutline();\n addSelectionOutline();\n}\n\nfunction stopRotation(event) {\n if (!isRotatingImage) return;\n stopInteracting();\n isRotatingImage = false;\n startRotationMouseAngle = null;\n startImageRotation = null;\n svg.removeEventListener('pointermove', rotateImage);\n document.removeEventListener('pointerup', stopRotation);\n svg.style.cursor = 'default';\n}\n\nfunction startDrag(event) {\n if (!isSelectionToolActive || !selectedImage) return;\n\n event.preventDefault();\n event.stopPropagation();\n\n isDragging = true;\n \n // Store original values at the start of drag\n originalX = parseFloat(selectedImage.getAttribute('x'));\n originalY = parseFloat(selectedImage.getAttribute('y'));\n originalWidth = parseFloat(selectedImage.getAttribute('width'));\n originalHeight = parseFloat(selectedImage.getAttribute('height'));\n \n // Store original rotation\n const transform = selectedImage.getAttribute('transform');\n if (transform) {\n const rotateMatch = transform.match(/rotate\\(([^,]+)/);\n if (rotateMatch) {\n imageRotation = parseFloat(rotateMatch[1]);\n }\n }\n\n // Find the ImageShape wrapper for frame functionality\n let imageShape = null;\n if (typeof shapes !== 'undefined' && Array.isArray(shapes)) {\n imageShape = shapes.find(shape => shape.shapeName === 'image' && shape.element === selectedImage);\n }\n\n if (imageShape) {\n // Store initial frame state\n draggedShapeInitialFrameImage = imageShape.parentFrame || null;\n \n // Temporarily remove from frame clipping if dragging\n if (imageShape.parentFrame) {\n imageShape.parentFrame.temporarilyRemoveFromFrame(imageShape);\n }\n }\n\n const { x, y } = getSVGCoordsFromMouse(event);\n dragOffsetX = x - parseFloat(selectedImage.getAttribute('x'));\n dragOffsetY = y - parseFloat(selectedImage.getAttribute('y'));\n\n svg.addEventListener('pointermove', dragImage);\n document.addEventListener('pointerup', stopDrag);\n}\n\nfunction dragImage(event) {\n if (!isDragging || !selectedImage) return;\n\n const { x, y } = getSVGCoordsFromMouse(event);\n let newX = x - dragOffsetX;\n let newY = y - dragOffsetY;\n\n selectedImage.setAttribute('x', newX);\n selectedImage.setAttribute('y', newY);\n\n // Update data attributes for arrow attachment\n selectedImage.setAttribute('data-shape-x', newX);\n selectedImage.setAttribute('data-shape-y', newY);\n\n // Reapply the rotation transform with the new position\n const newCenterX = newX + parseFloat(selectedImage.getAttribute('width')) / 2;\n const newCenterY = newY + parseFloat(selectedImage.getAttribute('height')) / 2;\n selectedImage.setAttribute('transform', `rotate(${imageRotation}, ${newCenterX}, ${newCenterY})`);\n\n // Update frame containment for ImageShape wrapper\n if (typeof shapes !== 'undefined' && Array.isArray(shapes)) {\n const imageShape = shapes.find(shape => shape.shapeName === 'image' && shape.element === selectedImage);\n if (imageShape) {\n imageShape.updateFrameContainment();\n }\n }\n\n // Update attached arrows during drag\n updateArrowsForShape(selectedImage);\n\n // Update the selection outline and anchors\n removeSelectionOutline();\n addSelectionOutline();\n}\n\nfunction stopDrag(event) {\n stopInteracting(); // Call the combined stop function\n document.removeEventListener('pointerup', stopDrag); // Remove the global mouseup listener\n}\n\nfunction startRotation(event) {\n event.preventDefault();\n event.stopPropagation();\n\n if (!selectedImage) return;\n\n isRotatingImage = true;\n \n // Get image center\n const imgX = parseFloat(selectedImage.getAttribute('x'));\n const imgY = parseFloat(selectedImage.getAttribute('y'));\n const imgWidth = parseFloat(selectedImage.getAttribute('width'));\n const imgHeight = parseFloat(selectedImage.getAttribute('height'));\n \n const centerX = imgX + imgWidth / 2;\n const centerY = imgY + imgHeight / 2;\n\n // Calculate initial mouse angle relative to image center\n const { x: mouseX, y: mouseY } = getSVGCoordsFromMouse(event);\n \n startRotationMouseAngle = Math.atan2(mouseY - centerY, mouseX - centerX) * 180 / Math.PI;\n startImageRotation = imageRotation;\n\n svg.addEventListener('pointermove', rotateImage);\n document.addEventListener('pointerup', stopRotation);\n \n svg.style.cursor = 'grabbing';\n}\n\nfunction rotateImage(event) {\n if (!isRotatingImage || !selectedImage) return;\n\n // Get image center\n const imgX = parseFloat(selectedImage.getAttribute('x'));\n const imgY = parseFloat(selectedImage.getAttribute('y'));\n const imgWidth = parseFloat(selectedImage.getAttribute('width'));\n const imgHeight = parseFloat(selectedImage.getAttribute('height'));\n \n const centerX = imgX + imgWidth / 2;\n const centerY = imgY + imgHeight / 2;\n\n // Calculate current mouse angle\n const { x: mouseX, y: mouseY } = getSVGCoordsFromMouse(event);\n \n const currentMouseAngle = Math.atan2(mouseY - centerY, mouseX - centerX) * 180 / Math.PI;\n const angleDiff = currentMouseAngle - startRotationMouseAngle;\n \n imageRotation = startImageRotation + angleDiff;\n imageRotation = imageRotation % 360;\n if (imageRotation < 0) imageRotation += 360;\n\n // Apply rotation transform\n selectedImage.setAttribute('transform', `rotate(${imageRotation}, ${centerX}, ${centerY})`);\n \n // Update data attribute for arrow attachment\n selectedImage.setAttribute('data-shape-rotation', imageRotation);\n\n // Update attached arrows during rotation\n updateArrowsForShape(selectedImage);\n\n // Update the selection outline and anchors\n removeSelectionOutline();\n addSelectionOutline();\n}\n\nfunction stopInteracting() {\n // Store transform data before stopping interaction\n if (selectedImage && (isDragging || isRotatingImage || currentAnchor)) {\n const newPos = {\n x: parseFloat(selectedImage.getAttribute('x')),\n y: parseFloat(selectedImage.getAttribute('y')),\n width: parseFloat(selectedImage.getAttribute('width')),\n height: parseFloat(selectedImage.getAttribute('height')),\n rotation: imageRotation\n };\n \n // Get the original rotation from the stored start rotation or current rotation\n let originalRotation = imageRotation;\n if (isRotatingImage && startImageRotation !== null) {\n originalRotation = startImageRotation;\n }\n \n const oldPos = {\n x: originalX,\n y: originalY,\n width: originalWidth,\n height: originalHeight,\n rotation: originalRotation\n };\n\n // Find the ImageShape wrapper for frame tracking\n let imageShape = null;\n if (typeof shapes !== 'undefined' && Array.isArray(shapes)) {\n imageShape = shapes.find(shape => shape.shapeName === 'image' && shape.element === selectedImage);\n }\n\n // Add frame information for undo tracking\n const oldPosWithFrame = {\n ...oldPos,\n parentFrame: draggedShapeInitialFrameImage\n };\n // Issue #34 bug #2: for drag, hoveredFrameImage tracks the actual\n // destination \u2014 imageShape.parentFrame is still the OLD frame here.\n // Resize / rotate don't move between frames, so fall back to the\n // shape's own parent for those.\n const newPosWithFrame = {\n ...newPos,\n parentFrame: isDragging\n ? (hoveredFrameImage || null)\n : (imageShape ? imageShape.parentFrame : null),\n };\n\n // Only push transform action if something actually changed\n const stateChanged = newPos.x !== oldPos.x || newPos.y !== oldPos.y || \n newPos.width !== oldPos.width || newPos.height !== oldPos.height ||\n newPos.rotation !== oldPos.rotation;\n const frameChanged = oldPosWithFrame.parentFrame !== newPosWithFrame.parentFrame;\n\n if (stateChanged || frameChanged) {\n pushTransformAction({\n type: 'image',\n element: selectedImage,\n restore: (pos) => {\n selectedImage.setAttribute('x', pos.x);\n selectedImage.setAttribute('y', pos.y);\n selectedImage.setAttribute('width', pos.width);\n selectedImage.setAttribute('height', pos.height);\n const centerX = pos.x + pos.width / 2;\n const centerY = pos.y + pos.height / 2;\n selectedImage.setAttribute('transform', `rotate(${pos.rotation}, ${centerX}, ${centerY})`);\n imageRotation = pos.rotation;\n \n // Update selection outline if image is selected\n if (selectedImage) {\n removeSelectionOutline();\n addSelectionOutline();\n }\n \n // Update data attributes for arrow attachment consistency\n selectedImage.setAttribute('data-shape-x', pos.x);\n selectedImage.setAttribute('data-shape-y', pos.y);\n selectedImage.setAttribute('data-shape-width', pos.width);\n selectedImage.setAttribute('data-shape-height', pos.height);\n selectedImage.setAttribute('data-shape-rotation', pos.rotation);\n \n // Update attached arrows\n updateArrowsForShape(selectedImage);\n }\n }, oldPosWithFrame, newPosWithFrame);\n }\n\n // Handle frame containment changes after drag\n if (isDragging && imageShape) {\n const finalFrame = hoveredFrameImage;\n \n // If shape moved to a different frame\n if (draggedShapeInitialFrameImage !== finalFrame) {\n // Remove from initial frame\n if (draggedShapeInitialFrameImage) {\n draggedShapeInitialFrameImage.removeShapeFromFrame(imageShape);\n }\n \n // Add to new frame\n if (finalFrame) {\n finalFrame.addShapeToFrame(imageShape);\n }\n \n // Track the frame change for undo\n if (frameChanged) {\n pushFrameAttachmentAction(finalFrame || draggedShapeInitialFrameImage, imageShape, \n finalFrame ? 'attach' : 'detach', draggedShapeInitialFrameImage);\n }\n } else if (draggedShapeInitialFrameImage) {\n // Shape stayed in same frame, restore clipping\n draggedShapeInitialFrameImage.restoreToFrame(imageShape);\n }\n }\n \n draggedShapeInitialFrameImage = null;\n }\n\n // Clear frame highlighting\n if (hoveredFrameImage) {\n hoveredFrameImage.removeHighlight();\n hoveredFrameImage = null;\n }\n\n isDragging = false;\n isRotatingImage = false;\n svg.removeEventListener('pointermove', dragImage);\n svg.removeEventListener('pointermove', resizeImage);\n svg.removeEventListener('pointermove', rotateImage);\n currentAnchor = null;\n startRotationMouseAngle = null;\n startImageRotation = null;\n\n // Update originalX, originalY, originalWidth and originalHeight after dragging/resizing is complete\n if (selectedImage) {\n originalX = parseFloat(selectedImage.getAttribute('x'));\n originalY = parseFloat(selectedImage.getAttribute('y'));\n originalWidth = parseFloat(selectedImage.getAttribute('width'));\n originalHeight = parseFloat(selectedImage.getAttribute('height'));\n \n // Update the current rotation from the image transform\n const transform = selectedImage.getAttribute('transform');\n if (transform) {\n const rotateMatch = transform.match(/rotate\\(([^,]+)/);\n if (rotateMatch) {\n imageRotation = parseFloat(rotateMatch[1]);\n }\n }\n \n // Update data attributes for arrow attachment consistency\n selectedImage.setAttribute('data-shape-x', originalX);\n selectedImage.setAttribute('data-shape-y', originalY);\n selectedImage.setAttribute('data-shape-width', originalWidth);\n selectedImage.setAttribute('data-shape-height', originalHeight);\n selectedImage.setAttribute('data-shape-rotation', imageRotation);\n \n // Update attached arrows after interaction ends\n updateArrowsForShape(selectedImage);\n }\n}\n\n// Add delete functionality for images\nfunction deleteCurrentImage() {\n if (selectedImage) {\n // Find the ImageShape wrapper\n let imageShape = (typeof shapes !== 'undefined' && Array.isArray(shapes))\n ? shapes.find(s => s.shapeName === 'image' && s.element === selectedImage)\n : null;\n\n // Abort any in-progress upload\n if (imageShape?.uploadAbortController) {\n imageShape.uploadAbortController.abort();\n imageShape.removeUploadIndicator();\n }\n\n // Release image bytes from room limit\n const freedBytes = selectedImage.__fileSize || 0;\n window.__roomImageBytesUsed = Math.max(0, (window.__roomImageBytesUsed || 0) - freedBytes);\n\n // If image is hosted on Cloudinary, delete it from storage\n const imgHref = selectedImage.getAttribute('href') || selectedImage.getAttributeNS('http://www.w3.org/1999/xlink', 'href') || '';\n if (imgHref.includes('cloudinary.com') || imgHref.includes('res.cloudinary')) {\n const match = imgHref.match(/\\/upload\\/(?:v\\d+\\/)?(lixsketch\\/.+?)(?:\\.\\w+)?$/);\n if (match) {\n const publicId = match[1];\n const workerUrl = window.__WORKER_URL;\n if (workerUrl) {\n fetch(`${workerUrl}/api/images/delete`, {\n method: 'DELETE',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ publicId }),\n }).catch(err => console.warn('[ImageTool] Cloudinary cleanup failed:', err));\n }\n }\n }\n\n if (imageShape) {\n const idx = shapes.indexOf(imageShape);\n if (idx !== -1) shapes.splice(idx, 1);\n\n // Remove the group (which contains the image)\n if (imageShape.group && imageShape.group.parentNode) {\n imageShape.group.parentNode.removeChild(imageShape.group);\n }\n }\n \n // Fallback: if no ImageShape wrapper found, remove the image directly\n if (!imageShape && selectedImage.parentNode) {\n selectedImage.parentNode.removeChild(selectedImage);\n }\n \n // Clean up any arrow attachments before deleting\n if (typeof cleanupAttachments === 'function') {\n cleanupAttachments(selectedImage);\n }\n \n // Push delete action for undo\n if (imageShape) {\n pushDeleteAction(imageShape);\n }\n \n // Clean up selection\n removeSelectionOutline();\n selectedImage = null;\n }\n}\n\ndocument.addEventListener('keydown', (e) => {\n if (e.key === 'Delete' && selectedImage) {\n deleteCurrentImage();\n }\n});\n\n// Expose upload pipeline globally so generated/pasted images can use it\nwindow.uploadImageToCloudinary = uploadImageToCloudinary;\n\n// Window bridge: allow React UI to trigger the file picker\nwindow.openImageFilePicker = function() {\n isImageToolActive = true;\n const fileInput = document.createElement('input');\n fileInput.type = 'file';\n fileInput.accept = IMAGE_ACCEPT_ATTR;\n fileInput.style.display = 'none';\n document.body.appendChild(fileInput);\n\n let fileSelected = false;\n\n fileInput.addEventListener('change', (event) => {\n const file = event.target.files[0];\n if (file) {\n fileSelected = true;\n handleImageUpload(file);\n }\n document.body.removeChild(fileInput);\n });\n\n // Detect cancel: when focus returns to window without a file being selected\n const onFocus = () => {\n window.removeEventListener('focus', onFocus);\n // Delay to let 'change' fire first if a file was selected\n setTimeout(() => {\n if (!fileSelected) {\n // User cancelled \u2014 switch back to select tool\n isImageToolActive = false;\n if (window.__sketchEngine?.setActiveTool) {\n window.__sketchEngine.setActiveTool('select');\n }\n if (fileInput.parentNode) {\n document.body.removeChild(fileInput);\n }\n }\n }, 300);\n };\n window.addEventListener('focus', onFocus);\n\n fileInput.click();\n};\n\nexport { handleMouseDownImage, handleMouseMoveImage, handleMouseUpImage };"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAQA,IAAI,kBAAkB;AACtB,IAAI,eAAe;AACnB,IAAI,SAAS;AACb,IAAI,SAAS;AAEb,IAAI,sBAAsB;AAE1B,IAAI,gBAAgB;AACpB,IAAI;AAAJ,IAAe;AAAf,IAA0B;AAA1B,IAAyC;AACzC,IAAI,gBAAgB;AACpB,IAAI,aAAa;AACjB,IAAI,kBAAkB;AACtB,IAAI;AAAJ,IAAiB;AACjB,IAAI,0BAA0B;AAC9B,IAAI,qBAAqB;AACzB,IAAI,gBAAgB;AACpB,IAAI,oBAAoB;AACxB,IAAM,eAAe;AAGrB,IAAI,gCAAgC;AACpC,IAAI,oBAAoB;AAGxB,IAAM,yBAAyB,IAAI,OAAO;AAC1C,IAAI,CAAC,OAAO,qBAAsB,QAAO,uBAAuB;AAIhE,SAAS,iBAAiB,SAAS;AAC/B,QAAM,aAAa,IAAI,WAAW,OAAO;AACzC,SAAO;AACX;AAWA,eAAe,wBAAwB,YAAY;A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