stickyflow 0.11.2 → 0.12.0
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/CHANGELOG.md +27 -0
- package/dist/binding/index.cjs +9 -9
- package/dist/binding/index.d.cts +3 -3
- package/dist/binding/index.d.ts +3 -3
- package/dist/binding/index.js +3 -3
- package/dist/{chunk-WZA3DJJH.cjs → chunk-3OF37CZX.cjs} +15 -15
- package/dist/{chunk-WZA3DJJH.cjs.map → chunk-3OF37CZX.cjs.map} +1 -1
- package/dist/{chunk-VYQ6N5SI.cjs → chunk-3XPNGIMV.cjs} +37 -37
- package/dist/chunk-3XPNGIMV.cjs.map +1 -0
- package/dist/{chunk-G6IW2IX3.js → chunk-4SXXMOXR.js} +31 -5
- package/dist/chunk-4SXXMOXR.js.map +1 -0
- package/dist/{chunk-4KBU4CFU.cjs → chunk-EG7VZJZX.cjs} +23 -23
- package/dist/{chunk-4KBU4CFU.cjs.map → chunk-EG7VZJZX.cjs.map} +1 -1
- package/dist/{chunk-BFQWCOEC.js → chunk-FYSJMUJI.js} +3 -3
- package/dist/{chunk-BFQWCOEC.js.map → chunk-FYSJMUJI.js.map} +1 -1
- package/dist/{chunk-UD6IG2PG.js → chunk-LDRUTQF7.js} +4 -4
- package/dist/{chunk-UD6IG2PG.js.map → chunk-LDRUTQF7.js.map} +1 -1
- package/dist/{chunk-DGAVCN4D.js → chunk-Q4OIDWT6.js} +6 -6
- package/dist/chunk-Q4OIDWT6.js.map +1 -0
- package/dist/{chunk-UHKFJBY5.cjs → chunk-SKGJXCAO.cjs} +31 -5
- package/dist/chunk-SKGJXCAO.cjs.map +1 -0
- package/dist/{chunk-TQIYK5OA.js → chunk-UCOMSZPC.js} +12 -10
- package/dist/chunk-UCOMSZPC.js.map +1 -0
- package/dist/{chunk-EHH6ZDK6.cjs → chunk-ZE2KRWOM.cjs} +665 -663
- package/dist/chunk-ZE2KRWOM.cjs.map +1 -0
- package/dist/index.cjs +36 -36
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +5 -5
- package/dist/interaction/index.cjs +364 -260
- package/dist/interaction/index.cjs.map +1 -1
- package/dist/interaction/index.js +131 -27
- package/dist/interaction/index.js.map +1 -1
- package/dist/{runtime-C-C5v9po.d.cts → runtime-BJDaqo6f.d.cts} +1 -1
- package/dist/{runtime-lCAfU-1Q.d.ts → runtime-DaconR36.d.ts} +1 -1
- package/dist/{runtimeTypes-BDA_CfWh.d.ts → runtimeTypes-BE_GI1yU.d.ts} +1 -1
- package/dist/{runtimeTypes-B7p6b1Bi.d.cts → runtimeTypes-BE_nllY6.d.cts} +1 -1
- package/dist/stickyflow-diagram.global.js +39 -39
- package/dist/stickyflow-diagram.global.js.map +1 -1
- package/dist/viewer/index.cjs +9 -9
- package/dist/viewer/index.d.cts +1 -1
- package/dist/viewer/index.d.ts +1 -1
- package/dist/viewer/index.js +4 -4
- package/dist/web-component/index.cjs +6 -6
- package/dist/web-component/index.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-DGAVCN4D.js.map +0 -1
- package/dist/chunk-EHH6ZDK6.cjs.map +0 -1
- package/dist/chunk-G6IW2IX3.js.map +0 -1
- package/dist/chunk-TQIYK5OA.js.map +0 -1
- package/dist/chunk-UHKFJBY5.cjs.map +0 -1
- package/dist/chunk-VYQ6N5SI.cjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunk3OF37CZX_cjs = require('../chunk-3OF37CZX.cjs');
|
|
4
|
+
var chunkSKGJXCAO_cjs = require('../chunk-SKGJXCAO.cjs');
|
|
5
5
|
|
|
6
6
|
// src/runtime/interaction/chartValue/coordinates.ts
|
|
7
7
|
function pointerUserY(svg, event) {
|
|
@@ -70,13 +70,13 @@ function updateConnectedLine(svg, drag) {
|
|
|
70
70
|
}));
|
|
71
71
|
const line = findConnectedLine(svg, drag.owner.id, drag.series);
|
|
72
72
|
if (line) {
|
|
73
|
-
line.setAttribute("d",
|
|
73
|
+
line.setAttribute("d", chunkSKGJXCAO_cjs.linePathData(points, drag.lineTension));
|
|
74
74
|
}
|
|
75
75
|
const area = findConnectedLineArea(svg, drag.owner.id, drag.series);
|
|
76
76
|
if (area && points.length > 1) {
|
|
77
77
|
const first = points[0];
|
|
78
78
|
const last = points[points.length - 1];
|
|
79
|
-
const d = `${
|
|
79
|
+
const d = `${chunkSKGJXCAO_cjs.linePathData(points, drag.lineTension)} L ${last.x} ${drag.baseY} L ${first.x} ${drag.baseY} Z`;
|
|
80
80
|
area.setAttribute("d", d);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
@@ -90,14 +90,14 @@ function setBarPath(svg, drag, d) {
|
|
|
90
90
|
function updateChartValuePreview(svg, drag, value) {
|
|
91
91
|
if (drag.isBar && drag.scale.horizontal) {
|
|
92
92
|
const width = Math.max(0, pixelForValue(value, drag.scale) - drag.barX);
|
|
93
|
-
setBarPath(svg, drag,
|
|
93
|
+
setBarPath(svg, drag, chunkSKGJXCAO_cjs.roundedBarPath(drag.barX, drag.barTop, width, drag.barHeight, drag.barRadius));
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
96
|
const y = pixelForValue(value, drag.scale);
|
|
97
97
|
if (drag.isBar) {
|
|
98
98
|
const top = Math.min(y, drag.baseY);
|
|
99
99
|
const height = Math.max(0, Math.abs(drag.baseY - y));
|
|
100
|
-
setBarPath(svg, drag,
|
|
100
|
+
setBarPath(svg, drag, chunkSKGJXCAO_cjs.barShapePath(drag.barX, top, drag.barWidth, height, drag.barRadius));
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
103
|
drag.element.setAttribute("cy", String(y));
|
|
@@ -120,24 +120,24 @@ function labelShift(placement, origin, top, height) {
|
|
|
120
120
|
}
|
|
121
121
|
function resizePill(pill, text, label, dy) {
|
|
122
122
|
const fontSize = parseFloat(text.getAttribute("font-size") ?? "12");
|
|
123
|
-
const size =
|
|
123
|
+
const size = chunkSKGJXCAO_cjs.barLabelSize(label, fontSize, true);
|
|
124
124
|
const stored = pill.dataset.sfPillY ?? (pill.getAttribute("d") ?? "").split(/\s+/)[2];
|
|
125
125
|
pill.dataset.sfPillY = stored;
|
|
126
126
|
const centerX = Number(text.getAttribute("x"));
|
|
127
|
-
pill.setAttribute("d",
|
|
127
|
+
pill.setAttribute("d", chunkSKGJXCAO_cjs.pillPath(centerX - size.width / 2, Number(stored), size.width, size.height));
|
|
128
128
|
pill.setAttribute("transform", `translate(0 ${dy})`);
|
|
129
129
|
}
|
|
130
130
|
function updateHorizontalBarLabel(label, drag, origin, value) {
|
|
131
|
-
const content =
|
|
131
|
+
const content = chunkSKGJXCAO_cjs.formatBarLabel(value, label.template);
|
|
132
132
|
(label.text.querySelector("tspan") ?? label.text).textContent = content;
|
|
133
133
|
if (label.placement === "axis") {
|
|
134
134
|
return true;
|
|
135
135
|
}
|
|
136
136
|
const fontSize = parseFloat(label.text.getAttribute("font-size") ?? "12");
|
|
137
|
-
const size =
|
|
137
|
+
const size = chunkSKGJXCAO_cjs.barLabelSize(content, fontSize, label.pill !== null);
|
|
138
138
|
const width = Math.max(0, pixelForValue(value, drag.scale) - origin.left);
|
|
139
139
|
const end = origin.left + width;
|
|
140
|
-
const center = label.placement === "outside" ? end +
|
|
140
|
+
const center = label.placement === "outside" ? end + chunkSKGJXCAO_cjs.BAR_LABEL.gap + size.width / 2 : label.placement === "inside" ? end - chunkSKGJXCAO_cjs.BAR_LABEL.gap - size.width / 2 : origin.left + width / 2;
|
|
141
141
|
const stored = label.text.dataset.sfLabelX ?? label.text.getAttribute("x") ?? "0";
|
|
142
142
|
label.text.dataset.sfLabelX = stored;
|
|
143
143
|
label.text.setAttribute("transform", `translate(${center - Number(stored)} 0)`);
|
|
@@ -145,7 +145,7 @@ function updateHorizontalBarLabel(label, drag, origin, value) {
|
|
|
145
145
|
const pillY = label.pill.dataset.sfPillY ?? (label.pill.getAttribute("d") ?? "").split(/\s+/)[2];
|
|
146
146
|
label.pill.dataset.sfPillY = pillY;
|
|
147
147
|
label.pill.removeAttribute("transform");
|
|
148
|
-
label.pill.setAttribute("d",
|
|
148
|
+
label.pill.setAttribute("d", chunkSKGJXCAO_cjs.pillPath(center - size.width / 2, Number(pillY), size.width, size.height));
|
|
149
149
|
}
|
|
150
150
|
return true;
|
|
151
151
|
}
|
|
@@ -161,7 +161,7 @@ function updateBarLabel(svg, drag, origin, value) {
|
|
|
161
161
|
const top = Math.min(y, drag.baseY);
|
|
162
162
|
const height = Math.abs(drag.baseY - y);
|
|
163
163
|
const dy = labelShift(label.placement, origin, top, height);
|
|
164
|
-
const content =
|
|
164
|
+
const content = chunkSKGJXCAO_cjs.formatBarLabel(value, label.template);
|
|
165
165
|
(label.text.querySelector("tspan") ?? label.text).textContent = content;
|
|
166
166
|
label.text.setAttribute("transform", `translate(0 ${dy})`);
|
|
167
167
|
if (label.pill) {
|
|
@@ -177,7 +177,7 @@ var HEIGHT = 18;
|
|
|
177
177
|
var GAP = 8;
|
|
178
178
|
var BACKGROUND = "rgba(15, 23, 42, 0.9)";
|
|
179
179
|
function element(svg, tag) {
|
|
180
|
-
return svg.ownerDocument.createElementNS(
|
|
180
|
+
return svg.ownerDocument.createElementNS(chunk3OF37CZX_cjs.SVG_NAMESPACE, tag);
|
|
181
181
|
}
|
|
182
182
|
function createValueReadout(svg) {
|
|
183
183
|
const group = element(svg, "g");
|
|
@@ -273,7 +273,7 @@ function resolveChartValueDrag(svg, event) {
|
|
|
273
273
|
if (!target) {
|
|
274
274
|
return null;
|
|
275
275
|
}
|
|
276
|
-
const scale = parseValueScale(
|
|
276
|
+
const scale = parseValueScale(chunk3OF37CZX_cjs.findOwnerNode(svg, target.owner.id, chunk3OF37CZX_cjs.isPrimary));
|
|
277
277
|
const geometry = scale ? resolveChartValueGeometry(svg, target, scale) : null;
|
|
278
278
|
if (!scale || !geometry) {
|
|
279
279
|
return null;
|
|
@@ -293,13 +293,13 @@ function createChartValueDragState(target, scale, geometry, pointerId) {
|
|
|
293
293
|
};
|
|
294
294
|
}
|
|
295
295
|
function isChartValuePointer(event) {
|
|
296
|
-
return event.button === 0 && !
|
|
296
|
+
return event.button === 0 && !chunk3OF37CZX_cjs.isCameraGesture(event);
|
|
297
297
|
}
|
|
298
298
|
function findChartValueMark(event) {
|
|
299
299
|
return event.target?.closest?.("[data-sf-value-index]");
|
|
300
300
|
}
|
|
301
301
|
function readChartValueTarget(mark) {
|
|
302
|
-
const owner =
|
|
302
|
+
const owner = chunk3OF37CZX_cjs.resolveOwner(mark);
|
|
303
303
|
if (owner?.role !== "chart") {
|
|
304
304
|
return null;
|
|
305
305
|
}
|
|
@@ -458,8 +458,8 @@ function bindChartValueDrag(viewer, emitter) {
|
|
|
458
458
|
|
|
459
459
|
// src/runtime/interaction/colorEdit/color.ts
|
|
460
460
|
function normalizeHex(value) {
|
|
461
|
-
const channels =
|
|
462
|
-
return channels &&
|
|
461
|
+
const channels = chunkSKGJXCAO_cjs.parseHexRgb(value);
|
|
462
|
+
return channels && chunkSKGJXCAO_cjs.rgbToHex(...channels);
|
|
463
463
|
}
|
|
464
464
|
var COLOR_FUNCTION = /^rgba?\(\s*(\d{1,3})\s*[, ]\s*(\d{1,3})\s*[, ]\s*(\d{1,3})\s*(?:[,/]\s*(\d*\.?\d+)(%?)\s*)?\)$/i;
|
|
465
465
|
var HEX_WITH_ALPHA = /^#([0-9a-f]{6})([0-9a-f]{2})$/i;
|
|
@@ -498,14 +498,14 @@ function clampChannel(value) {
|
|
|
498
498
|
return Math.max(0, Math.min(255, Math.round(value)));
|
|
499
499
|
}
|
|
500
500
|
function hexToRgb(hex) {
|
|
501
|
-
const [r, g, b] =
|
|
501
|
+
const [r, g, b] = chunkSKGJXCAO_cjs.parseHexRgb(hex) ?? [0, 0, 0];
|
|
502
502
|
return { r, g, b };
|
|
503
503
|
}
|
|
504
504
|
function rgbToHex2(rgb) {
|
|
505
|
-
return
|
|
505
|
+
return chunkSKGJXCAO_cjs.rgbToHex(clampChannel(rgb.r), clampChannel(rgb.g), clampChannel(rgb.b));
|
|
506
506
|
}
|
|
507
507
|
function hsvToRgb2(hsv) {
|
|
508
|
-
const { r, g, b } =
|
|
508
|
+
const { r, g, b } = chunkSKGJXCAO_cjs.hsvToRgb(
|
|
509
509
|
(hsv.h % 360 + 360) % 360,
|
|
510
510
|
Math.max(0, Math.min(1, hsv.s)),
|
|
511
511
|
Math.max(0, Math.min(1, hsv.v))
|
|
@@ -513,7 +513,7 @@ function hsvToRgb2(hsv) {
|
|
|
513
513
|
return { r, g, b };
|
|
514
514
|
}
|
|
515
515
|
function rgbToHsv2(rgb) {
|
|
516
|
-
return
|
|
516
|
+
return chunkSKGJXCAO_cjs.rgbToHsv(clampChannel(rgb.r), clampChannel(rgb.g), clampChannel(rgb.b));
|
|
517
517
|
}
|
|
518
518
|
function hexToHsv(hex) {
|
|
519
519
|
return rgbToHsv2(hexToRgb(hex));
|
|
@@ -1753,7 +1753,7 @@ var ColorEditSession = class {
|
|
|
1753
1753
|
const hasOverride = target.node.getAttribute("data-sf-color-override") === "true";
|
|
1754
1754
|
this.#open = openColorPopover({
|
|
1755
1755
|
seed: seedFrom(fill, readGradientValue(this.#svg, fill)),
|
|
1756
|
-
anchor:
|
|
1756
|
+
anchor: chunk3OF37CZX_cjs.screenRectOf(target.node),
|
|
1757
1757
|
theme: resolveTheme(this.#theme),
|
|
1758
1758
|
allowGradient: !target.solidOnly,
|
|
1759
1759
|
onCommit: (color) => {
|
|
@@ -1835,7 +1835,7 @@ function resolveTarget(event, selector, pathOf, rules) {
|
|
|
1835
1835
|
return null;
|
|
1836
1836
|
}
|
|
1837
1837
|
const path = pathOf(node);
|
|
1838
|
-
const owner =
|
|
1838
|
+
const owner = chunk3OF37CZX_cjs.resolveOwner(node);
|
|
1839
1839
|
if (!path || !owner || !isEditablePath(path, rules) || requiresPriorSelection(node, owner)) {
|
|
1840
1840
|
return null;
|
|
1841
1841
|
}
|
|
@@ -1857,7 +1857,7 @@ function resolveZoneGradientTarget(event) {
|
|
|
1857
1857
|
if (!node) {
|
|
1858
1858
|
return null;
|
|
1859
1859
|
}
|
|
1860
|
-
const owner =
|
|
1860
|
+
const owner = chunk3OF37CZX_cjs.resolveOwner(node);
|
|
1861
1861
|
if (!owner) {
|
|
1862
1862
|
return null;
|
|
1863
1863
|
}
|
|
@@ -1893,7 +1893,7 @@ var ZoneGradientSession = class {
|
|
|
1893
1893
|
const beforeStops = sortStops(gradient.stops);
|
|
1894
1894
|
this.#open = openColorPopover({
|
|
1895
1895
|
seed: seedFrom(fill, gradient),
|
|
1896
|
-
anchor:
|
|
1896
|
+
anchor: chunk3OF37CZX_cjs.screenRectOf(target.node),
|
|
1897
1897
|
theme: resolveTheme(this.#theme),
|
|
1898
1898
|
allowGradient: true,
|
|
1899
1899
|
lockStops: true,
|
|
@@ -1966,15 +1966,15 @@ function bindDeleteSelection(viewer, emitter) {
|
|
|
1966
1966
|
}
|
|
1967
1967
|
|
|
1968
1968
|
// src/runtime/interaction/events.ts
|
|
1969
|
-
var Emitter2 = class extends
|
|
1969
|
+
var Emitter2 = class extends chunk3OF37CZX_cjs.Emitter {
|
|
1970
1970
|
};
|
|
1971
1971
|
|
|
1972
1972
|
// src/runtime/interaction/linkPreview/geometry.ts
|
|
1973
1973
|
function anchorPoint(bounds, side, other) {
|
|
1974
1974
|
if (side) {
|
|
1975
|
-
return
|
|
1975
|
+
return chunkSKGJXCAO_cjs.pointAtPort(bounds, { side, offset: 0.5 });
|
|
1976
1976
|
}
|
|
1977
|
-
return
|
|
1977
|
+
return chunkSKGJXCAO_cjs.edgePointToward(bounds, other);
|
|
1978
1978
|
}
|
|
1979
1979
|
function polylinePathData(points) {
|
|
1980
1980
|
if (points.length < 4) {
|
|
@@ -1991,7 +1991,7 @@ function previewPathData(points, segments, pathType, strokeWidth) {
|
|
|
1991
1991
|
return `M ${points[0]} ${points[1]} C ${points[2]} ${points[3]} ${points[4]} ${points[5]} ${points[6]} ${points[7]}`;
|
|
1992
1992
|
}
|
|
1993
1993
|
if (pathType === "orthogonal" && segments.length > 0) {
|
|
1994
|
-
return
|
|
1994
|
+
return chunkSKGJXCAO_cjs.roundedOrthogonalPathData(segments, Math.max(16, strokeWidth * 4));
|
|
1995
1995
|
}
|
|
1996
1996
|
return polylinePathData(points);
|
|
1997
1997
|
}
|
|
@@ -2011,8 +2011,8 @@ function previewLink(fromSide, toSide) {
|
|
|
2011
2011
|
function routePreviewLink(fromBounds, toBounds, fromSide, toSide, pathType) {
|
|
2012
2012
|
const from = anchorPoint(fromBounds, fromSide, toBounds);
|
|
2013
2013
|
const to = anchorPoint(toBounds, toSide, fromBounds);
|
|
2014
|
-
const { points, segments } =
|
|
2015
|
-
return { points, segments, midpoint:
|
|
2014
|
+
const { points, segments } = chunkSKGJXCAO_cjs.calculateLinkRoute(previewLink(fromSide, toSide), from, to, pathType);
|
|
2015
|
+
return { points, segments, midpoint: chunkSKGJXCAO_cjs.getLineMidpoint(points, pathType, from, to) };
|
|
2016
2016
|
}
|
|
2017
2017
|
|
|
2018
2018
|
// src/runtime/interaction/linkPreview/discovery.ts
|
|
@@ -2044,7 +2044,7 @@ function resolveOppositeEndpoint(svg, path, canvasObjectId) {
|
|
|
2044
2044
|
if (!otherId) {
|
|
2045
2045
|
return null;
|
|
2046
2046
|
}
|
|
2047
|
-
const otherPrimary =
|
|
2047
|
+
const otherPrimary = chunk3OF37CZX_cjs.findOwnerNode(svg, otherId, chunk3OF37CZX_cjs.isPrimary);
|
|
2048
2048
|
return otherPrimary ? { draggedIsFrom, bounds: otherPrimary.getBBox() } : null;
|
|
2049
2049
|
}
|
|
2050
2050
|
function captureLiveLinkLabel(svg, draft, draggedBounds) {
|
|
@@ -2091,8 +2091,8 @@ function resolveOtherFacePoint(svg, path, canvasObjectId) {
|
|
|
2091
2091
|
if (!otherId || !face || !otherFace) {
|
|
2092
2092
|
return null;
|
|
2093
2093
|
}
|
|
2094
|
-
const otherPrimary =
|
|
2095
|
-
const otherGeometry = otherPrimary &&
|
|
2094
|
+
const otherPrimary = chunk3OF37CZX_cjs.findOwnerNode(svg, otherId, chunk3OF37CZX_cjs.isPrimary);
|
|
2095
|
+
const otherGeometry = otherPrimary && chunk3OF37CZX_cjs.isometricGeometryOf(otherPrimary);
|
|
2096
2096
|
if (!otherGeometry?.bounds) {
|
|
2097
2097
|
return null;
|
|
2098
2098
|
}
|
|
@@ -2103,7 +2103,7 @@ function resolveOtherFacePoint(svg, path, canvasObjectId) {
|
|
|
2103
2103
|
height: otherGeometry.height,
|
|
2104
2104
|
depth: otherGeometry.depth
|
|
2105
2105
|
};
|
|
2106
|
-
return { otherPoint:
|
|
2106
|
+
return { otherPoint: chunkSKGJXCAO_cjs.isometricFaceCenter(otherObject, otherFace), draggedIsFrom, face };
|
|
2107
2107
|
}
|
|
2108
2108
|
function findLiveFaceLinks(svg, canvasObjectId) {
|
|
2109
2109
|
const escapedId = CSS.escape(canvasObjectId);
|
|
@@ -2122,7 +2122,7 @@ function findLiveFaceLinks(svg, canvasObjectId) {
|
|
|
2122
2122
|
|
|
2123
2123
|
// src/runtime/interaction/linkPreview/faceUpdate.ts
|
|
2124
2124
|
function updateLiveFaceLink(link, liveObject) {
|
|
2125
|
-
const draggedPoint =
|
|
2125
|
+
const draggedPoint = chunkSKGJXCAO_cjs.isometricFaceCenter(liveObject, link.face);
|
|
2126
2126
|
const from = link.draggedIsFrom ? draggedPoint : link.otherPoint;
|
|
2127
2127
|
const to = link.draggedIsFrom ? link.otherPoint : draggedPoint;
|
|
2128
2128
|
link.path.setAttribute("d", `M ${from.x} ${from.y} L ${to.x} ${to.y}`);
|
|
@@ -2146,7 +2146,7 @@ function updateLabelGap(link, points) {
|
|
|
2146
2146
|
if (!link.labelGapSize) {
|
|
2147
2147
|
return;
|
|
2148
2148
|
}
|
|
2149
|
-
const gap =
|
|
2149
|
+
const gap = chunkSKGJXCAO_cjs.labelGapDash(points, link.pathType, link.labelGapSize.width, link.labelGapSize.height);
|
|
2150
2150
|
if (gap) {
|
|
2151
2151
|
link.path.setAttribute("stroke-dasharray", `${gap.dashBefore} ${gap.gapLength} 1000000`);
|
|
2152
2152
|
} else {
|
|
@@ -2192,11 +2192,11 @@ function readIsometricSnapStep(svg) {
|
|
|
2192
2192
|
return step > 0 ? step : null;
|
|
2193
2193
|
}
|
|
2194
2194
|
function nearestIsometricLatticePoint(point, step) {
|
|
2195
|
-
const u = point.x / (
|
|
2196
|
-
const v = point.y / (
|
|
2195
|
+
const u = point.x / (chunkSKGJXCAO_cjs.AXIS_COS * step);
|
|
2196
|
+
const v = point.y / (chunkSKGJXCAO_cjs.AXIS_SIN * step);
|
|
2197
2197
|
const i = Math.round((u + v) / 2);
|
|
2198
2198
|
const j = Math.round((u - v) / 2);
|
|
2199
|
-
return { x: (i + j) *
|
|
2199
|
+
return { x: (i + j) * chunkSKGJXCAO_cjs.AXIS_COS * step, y: (i - j) * chunkSKGJXCAO_cjs.AXIS_SIN * step };
|
|
2200
2200
|
}
|
|
2201
2201
|
function snapToStep(value, step, min) {
|
|
2202
2202
|
return Math.max(min, Math.round(value / step) * step);
|
|
@@ -2209,21 +2209,21 @@ var LABEL_FONT_SIZE = 12;
|
|
|
2209
2209
|
var LABEL_LINE_HEIGHT = 1.2;
|
|
2210
2210
|
var LABEL_BASELINE_OFFSET = -LABEL_GAP - LABEL_HEIGHT + (LABEL_HEIGHT - LABEL_FONT_SIZE * LABEL_LINE_HEIGHT) / 2 + LABEL_FONT_SIZE;
|
|
2211
2211
|
function applyIsometricAxisPreview(nodes, object, cornerRadius, overlay, svg) {
|
|
2212
|
-
const faces =
|
|
2213
|
-
nodes.top?.setAttribute("d",
|
|
2214
|
-
nodes.front?.setAttribute("d",
|
|
2215
|
-
nodes.side?.setAttribute("d",
|
|
2212
|
+
const faces = chunkSKGJXCAO_cjs.isometricFaces(object);
|
|
2213
|
+
nodes.top?.setAttribute("d", chunkSKGJXCAO_cjs.roundedPolygonPath(faces.top, 0));
|
|
2214
|
+
nodes.front?.setAttribute("d", chunkSKGJXCAO_cjs.roundedPolygonPath(faces.front, 0));
|
|
2215
|
+
nodes.side?.setAttribute("d", chunkSKGJXCAO_cjs.roundedPolygonPath(faces.right, 0));
|
|
2216
2216
|
const silhouette = [faces.top[0], faces.top[1], faces.right[2], faces.front[2], faces.front[3], faces.top[3]];
|
|
2217
|
-
const hullPath =
|
|
2217
|
+
const hullPath = chunkSKGJXCAO_cjs.roundedPolygonPath(silhouette, cornerRadius);
|
|
2218
2218
|
nodes.hull?.setAttribute("d", hullPath);
|
|
2219
2219
|
if (overlay.halo) {
|
|
2220
|
-
|
|
2220
|
+
chunk3OF37CZX_cjs.updateHalo(overlay.halo, hullPath);
|
|
2221
2221
|
}
|
|
2222
|
-
const placements =
|
|
2222
|
+
const placements = chunk3OF37CZX_cjs.axisArrowPlacements(object);
|
|
2223
2223
|
Object.keys(placements).forEach((axis) => {
|
|
2224
2224
|
const group = overlay.arrows[axis];
|
|
2225
2225
|
if (group) {
|
|
2226
|
-
|
|
2226
|
+
chunk3OF37CZX_cjs.updateAxisArrowGroup(group, placements[axis].origin, placements[axis].direction, svg);
|
|
2227
2227
|
}
|
|
2228
2228
|
});
|
|
2229
2229
|
nodes.seams?.setAttribute(
|
|
@@ -2241,9 +2241,9 @@ function applyIsometricAxisPreview(nodes, object, cornerRadius, overlay, svg) {
|
|
|
2241
2241
|
x: footprintCenter.x + (point.x - footprintCenter.x) * shadowSpread,
|
|
2242
2242
|
y: footprintCenter.y + (point.y - footprintCenter.y) * shadowSpread
|
|
2243
2243
|
}));
|
|
2244
|
-
nodes.groundShadow.setAttribute("d",
|
|
2244
|
+
nodes.groundShadow.setAttribute("d", chunkSKGJXCAO_cjs.roundedPolygonPath(footprint, 0));
|
|
2245
2245
|
}
|
|
2246
|
-
const anchor =
|
|
2246
|
+
const anchor = chunkSKGJXCAO_cjs.isometricTopFaceCenter(object);
|
|
2247
2247
|
if (nodes.labelGuide) {
|
|
2248
2248
|
nodes.labelGuide.setAttribute("d", `M ${anchor.x} ${anchor.y - LABEL_GAP} L ${anchor.x} ${anchor.y}`);
|
|
2249
2249
|
}
|
|
@@ -2259,7 +2259,7 @@ function applyIsometricAxisPreview(nodes, object, cornerRadius, overlay, svg) {
|
|
|
2259
2259
|
// src/runtime/interaction/isometricAxisResize/state.ts
|
|
2260
2260
|
var AXES = ["width", "height", "depth"];
|
|
2261
2261
|
function collectNodes(svg, ownerId) {
|
|
2262
|
-
const all =
|
|
2262
|
+
const all = chunk3OF37CZX_cjs.findAllOwnerNodes(svg, ownerId);
|
|
2263
2263
|
const bySuffix = (suffix) => all.find((el2) => el2.id.endsWith(suffix)) ?? null;
|
|
2264
2264
|
return {
|
|
2265
2265
|
top: bySuffix("-top"),
|
|
@@ -2287,14 +2287,14 @@ function findResizeHandle(event) {
|
|
|
2287
2287
|
return { captureTarget, axis: handleAttr.slice(4), overlay, ownerId };
|
|
2288
2288
|
}
|
|
2289
2289
|
function overlayPartsOf(overlay) {
|
|
2290
|
-
const overlayHalo = overlay.querySelector(`[${
|
|
2290
|
+
const overlayHalo = overlay.querySelector(`[${chunk3OF37CZX_cjs.ISO_HALO_ATTR}]`) ?? null;
|
|
2291
2291
|
const overlayArrows = Object.fromEntries(
|
|
2292
2292
|
AXES.map((axis) => [
|
|
2293
2293
|
axis,
|
|
2294
2294
|
overlay.querySelector(`[data-sf-resize-handle="iso-${axis}"]`) ?? null
|
|
2295
2295
|
])
|
|
2296
2296
|
);
|
|
2297
|
-
const overlayDuplicateBubbles = overlay.querySelector(`[${
|
|
2297
|
+
const overlayDuplicateBubbles = overlay.querySelector(`[${chunk3OF37CZX_cjs.ISO_DUPLICATE_BUBBLES_ATTR}]`) ?? null;
|
|
2298
2298
|
if (overlayDuplicateBubbles) {
|
|
2299
2299
|
overlayDuplicateBubbles.style.display = "none";
|
|
2300
2300
|
}
|
|
@@ -2306,16 +2306,16 @@ function createIsometricAxisDragState(svg, event) {
|
|
|
2306
2306
|
return null;
|
|
2307
2307
|
}
|
|
2308
2308
|
const { captureTarget, axis, overlay, ownerId } = handle;
|
|
2309
|
-
const primary =
|
|
2310
|
-
const owner = primary &&
|
|
2309
|
+
const primary = chunk3OF37CZX_cjs.findOwnerNode(svg, ownerId, chunk3OF37CZX_cjs.isPrimary);
|
|
2310
|
+
const owner = primary && chunk3OF37CZX_cjs.resolveOwner(primary);
|
|
2311
2311
|
if (!primary || owner?.role !== "isometric") {
|
|
2312
2312
|
return null;
|
|
2313
2313
|
}
|
|
2314
|
-
const startUser =
|
|
2314
|
+
const startUser = chunk3OF37CZX_cjs.pointerUserPoint(svg, event);
|
|
2315
2315
|
if (!startUser) {
|
|
2316
2316
|
return null;
|
|
2317
2317
|
}
|
|
2318
|
-
const geometry =
|
|
2318
|
+
const geometry = chunk3OF37CZX_cjs.isometricGeometryOf(primary);
|
|
2319
2319
|
const bounds = geometry?.bounds ?? primary.getBBox();
|
|
2320
2320
|
const nodes = collectNodes(svg, ownerId);
|
|
2321
2321
|
[nodes.top, nodes.front, nodes.side].forEach((node) => {
|
|
@@ -2335,7 +2335,7 @@ function createIsometricAxisDragState(svg, event) {
|
|
|
2335
2335
|
pointerId: event.pointerId,
|
|
2336
2336
|
startUser,
|
|
2337
2337
|
start,
|
|
2338
|
-
cornerRadius: geometry?.cornerRadius ?? Number(primary.getAttribute(
|
|
2338
|
+
cornerRadius: geometry?.cornerRadius ?? Number(primary.getAttribute(chunkSKGJXCAO_cjs.CORNER_RADIUS_ATTR)) ?? 0,
|
|
2339
2339
|
nodes,
|
|
2340
2340
|
...overlayPartsOf(overlay),
|
|
2341
2341
|
liveFaceLinks: findLiveFaceLinks(svg, ownerId),
|
|
@@ -2352,15 +2352,15 @@ function nextGeometry(drag, point, step) {
|
|
|
2352
2352
|
const dx = point.x - drag.startUser.x;
|
|
2353
2353
|
const dy = point.y - drag.startUser.y;
|
|
2354
2354
|
if (axis === "width") {
|
|
2355
|
-
const delta2 = dx *
|
|
2355
|
+
const delta2 = dx * chunkSKGJXCAO_cjs.AXIS_COS + dy * chunkSKGJXCAO_cjs.AXIS_SIN;
|
|
2356
2356
|
return { ...start, width: length(start.width + delta2, MIN_SIZE) };
|
|
2357
2357
|
}
|
|
2358
2358
|
if (axis === "height") {
|
|
2359
2359
|
return { ...start, height: length(start.height + dy, MIN_SIZE) };
|
|
2360
2360
|
}
|
|
2361
|
-
const delta = -dx *
|
|
2361
|
+
const delta = -dx * chunkSKGJXCAO_cjs.AXIS_COS + dy * chunkSKGJXCAO_cjs.AXIS_SIN;
|
|
2362
2362
|
const depth = length(start.depth + delta, 0);
|
|
2363
|
-
const x = start.x + (start.depth - depth) *
|
|
2363
|
+
const x = start.x + (start.depth - depth) * chunkSKGJXCAO_cjs.AXIS_COS;
|
|
2364
2364
|
return { ...start, x, depth };
|
|
2365
2365
|
}
|
|
2366
2366
|
var IsometricAxisResizeSession = class {
|
|
@@ -2372,7 +2372,7 @@ var IsometricAxisResizeSession = class {
|
|
|
2372
2372
|
this.#emitter = emitter;
|
|
2373
2373
|
}
|
|
2374
2374
|
pointerDown = (event) => {
|
|
2375
|
-
if (event.button !== 0 || this.#drag ||
|
|
2375
|
+
if (event.button !== 0 || this.#drag || chunk3OF37CZX_cjs.isCameraGesture(event)) {
|
|
2376
2376
|
return;
|
|
2377
2377
|
}
|
|
2378
2378
|
this.#drag = createIsometricAxisDragState(this.#svg, event);
|
|
@@ -2382,7 +2382,7 @@ var IsometricAxisResizeSession = class {
|
|
|
2382
2382
|
if (!drag || event.pointerId !== drag.pointerId) {
|
|
2383
2383
|
return;
|
|
2384
2384
|
}
|
|
2385
|
-
const point =
|
|
2385
|
+
const point = chunk3OF37CZX_cjs.pointerUserPoint(this.#svg, event);
|
|
2386
2386
|
if (!point) {
|
|
2387
2387
|
return;
|
|
2388
2388
|
}
|
|
@@ -2480,7 +2480,7 @@ function findLabelMark(event) {
|
|
|
2480
2480
|
);
|
|
2481
2481
|
}
|
|
2482
2482
|
function isLabelPointer(event) {
|
|
2483
|
-
return event.button === 0 && !
|
|
2483
|
+
return event.button === 0 && !chunk3OF37CZX_cjs.isCameraGesture(event);
|
|
2484
2484
|
}
|
|
2485
2485
|
function findHull(svg, ownerId) {
|
|
2486
2486
|
return svg.querySelector(`[data-sf-id="${CSS.escape(ownerId)}"][data-sf-primary="true"]`);
|
|
@@ -2496,21 +2496,21 @@ function resolveIsometricLabelDrag(svg, event) {
|
|
|
2496
2496
|
if (!clicked) {
|
|
2497
2497
|
return null;
|
|
2498
2498
|
}
|
|
2499
|
-
const owner =
|
|
2499
|
+
const owner = chunk3OF37CZX_cjs.resolveOwner(clicked);
|
|
2500
2500
|
if (owner?.role !== "isometric") {
|
|
2501
2501
|
return null;
|
|
2502
2502
|
}
|
|
2503
2503
|
const hull = findHull(svg, owner.id);
|
|
2504
|
-
const geometry = hull ?
|
|
2504
|
+
const geometry = hull ? chunk3OF37CZX_cjs.isometricGeometryOf(hull) : null;
|
|
2505
2505
|
if (!geometry?.bounds) {
|
|
2506
2506
|
return null;
|
|
2507
2507
|
}
|
|
2508
|
-
const start =
|
|
2508
|
+
const start = chunk3OF37CZX_cjs.pointerUserPoint(svg, event);
|
|
2509
2509
|
if (!start) {
|
|
2510
2510
|
return null;
|
|
2511
2511
|
}
|
|
2512
2512
|
const anchorX = geometry.bounds.x + geometry.bounds.width / 2;
|
|
2513
|
-
const anchorY = geometry.bounds.y + geometry.bounds.width * (
|
|
2513
|
+
const anchorY = geometry.bounds.y + geometry.bounds.width * (chunkSKGJXCAO_cjs.AXIS_SIN / chunkSKGJXCAO_cjs.AXIS_COS) / 2;
|
|
2514
2514
|
const text = findBySuffix(svg, `-${owner.id}-label`);
|
|
2515
2515
|
if (!text) {
|
|
2516
2516
|
return null;
|
|
@@ -2562,7 +2562,7 @@ var IsometricLabelDragSession = class {
|
|
|
2562
2562
|
if (!this.#drag || event.pointerId !== this.#drag.pointerId) {
|
|
2563
2563
|
return;
|
|
2564
2564
|
}
|
|
2565
|
-
const point =
|
|
2565
|
+
const point = chunk3OF37CZX_cjs.pointerUserPoint(this.#svg, event);
|
|
2566
2566
|
if (!point) {
|
|
2567
2567
|
return;
|
|
2568
2568
|
}
|
|
@@ -2637,7 +2637,7 @@ function isIsometricDirection(value) {
|
|
|
2637
2637
|
function bindIsometricQuickDuplicate(viewer, emitter) {
|
|
2638
2638
|
const svg = viewer.svg;
|
|
2639
2639
|
const onPointerDown = (event) => {
|
|
2640
|
-
if (event.button !== 0 ||
|
|
2640
|
+
if (event.button !== 0 || chunk3OF37CZX_cjs.isCameraGesture(event)) {
|
|
2641
2641
|
return;
|
|
2642
2642
|
}
|
|
2643
2643
|
const bubble = event.target?.closest("[data-sf-quick-duplicate]");
|
|
@@ -2648,7 +2648,7 @@ function bindIsometricQuickDuplicate(viewer, emitter) {
|
|
|
2648
2648
|
const overlay = bubble.closest("[data-sf-selection-overlay]");
|
|
2649
2649
|
const sourceId = overlay?.getAttribute("data-sf-selection-overlay");
|
|
2650
2650
|
const primary = sourceId ? svg.querySelector(`[data-sf-id="${CSS.escape(sourceId)}"][data-sf-primary="true"]`) : null;
|
|
2651
|
-
const owner = primary &&
|
|
2651
|
+
const owner = primary && chunk3OF37CZX_cjs.resolveOwner(primary);
|
|
2652
2652
|
if (!owner) {
|
|
2653
2653
|
return;
|
|
2654
2654
|
}
|
|
@@ -2703,7 +2703,7 @@ function updateEndpointPreview(drag, draggedPoint, draggedSide) {
|
|
|
2703
2703
|
const toPoint = drag.end === "to" ? draggedPoint : drag.fixedPoint;
|
|
2704
2704
|
const fromSide = drag.end === "from" ? draggedSide : drag.fixedSide;
|
|
2705
2705
|
const toSide = drag.end === "to" ? draggedSide : drag.fixedSide;
|
|
2706
|
-
const { points, segments } =
|
|
2706
|
+
const { points, segments } = chunkSKGJXCAO_cjs.calculateLinkRoute(previewLink(fromSide, toSide), fromPoint, toPoint, drag.pathType);
|
|
2707
2707
|
drag.path.setAttribute("d", previewPathData(points, segments, drag.pathType, drag.strokeWidth));
|
|
2708
2708
|
}
|
|
2709
2709
|
|
|
@@ -2725,7 +2725,7 @@ var LinkGhost = class {
|
|
|
2725
2725
|
constructor(svg, path) {
|
|
2726
2726
|
this.#svg = svg;
|
|
2727
2727
|
this.#path = path;
|
|
2728
|
-
this.#anchors = svg.ownerDocument.createElementNS(
|
|
2728
|
+
this.#anchors = svg.ownerDocument.createElementNS(chunk3OF37CZX_cjs.SVG_NAMESPACE, "g");
|
|
2729
2729
|
this.#anchors.setAttribute("data-sf-link-target", "");
|
|
2730
2730
|
this.#anchors.setAttribute("pointer-events", "none");
|
|
2731
2731
|
}
|
|
@@ -2735,7 +2735,7 @@ var LinkGhost = class {
|
|
|
2735
2735
|
for (const name of RESTORED_ATTRIBUTES) {
|
|
2736
2736
|
this.#saved.set(name, this.#path.getAttribute(name));
|
|
2737
2737
|
}
|
|
2738
|
-
const dash = GHOST_DASH_PX /
|
|
2738
|
+
const dash = GHOST_DASH_PX / chunk3OF37CZX_cjs.pxPerUnit(this.#svg);
|
|
2739
2739
|
this.#path.setAttribute("stroke-dasharray", `${dash} ${dash}`);
|
|
2740
2740
|
this.#path.setAttribute("stroke-linecap", "round");
|
|
2741
2741
|
this.#path.setAttribute("opacity", GHOST_OPACITY);
|
|
@@ -2764,7 +2764,7 @@ var LinkGhost = class {
|
|
|
2764
2764
|
if (!bounds) {
|
|
2765
2765
|
return;
|
|
2766
2766
|
}
|
|
2767
|
-
const unit = 1 /
|
|
2767
|
+
const unit = 1 / chunk3OF37CZX_cjs.pxPerUnit(this.#svg);
|
|
2768
2768
|
const centers = [
|
|
2769
2769
|
[bounds.x + bounds.width / 2, bounds.y],
|
|
2770
2770
|
[bounds.x + bounds.width, bounds.y + bounds.height / 2],
|
|
@@ -2772,7 +2772,7 @@ var LinkGhost = class {
|
|
|
2772
2772
|
[bounds.x, bounds.y + bounds.height / 2]
|
|
2773
2773
|
];
|
|
2774
2774
|
for (const [cx, cy] of centers) {
|
|
2775
|
-
const dot = this.#svg.ownerDocument.createElementNS(
|
|
2775
|
+
const dot = this.#svg.ownerDocument.createElementNS(chunk3OF37CZX_cjs.SVG_NAMESPACE, "circle");
|
|
2776
2776
|
dot.setAttribute("cx", String(cx));
|
|
2777
2777
|
dot.setAttribute("cy", String(cy));
|
|
2778
2778
|
dot.setAttribute("r", String(ANCHOR_RADIUS_PX * unit));
|
|
@@ -2792,7 +2792,7 @@ function collectEndpointCandidates(svg) {
|
|
|
2792
2792
|
if (element2.getAttribute("data-sf-role") === "link") {
|
|
2793
2793
|
continue;
|
|
2794
2794
|
}
|
|
2795
|
-
const owner =
|
|
2795
|
+
const owner = chunk3OF37CZX_cjs.resolveOwner(element2);
|
|
2796
2796
|
if (owner) {
|
|
2797
2797
|
candidates.push({ owner, bounds: element2.getBBox() });
|
|
2798
2798
|
}
|
|
@@ -2869,7 +2869,7 @@ function inferFixedSide(svg, reference, fixedPrimary) {
|
|
|
2869
2869
|
if (reference.declaredSide) {
|
|
2870
2870
|
return reference.declaredSide;
|
|
2871
2871
|
}
|
|
2872
|
-
const draggedPrimary = reference.draggedId ?
|
|
2872
|
+
const draggedPrimary = reference.draggedId ? chunk3OF37CZX_cjs.findOwnerNode(svg, reference.draggedId, chunk3OF37CZX_cjs.isPrimary) : null;
|
|
2873
2873
|
if (!draggedPrimary) {
|
|
2874
2874
|
return "right";
|
|
2875
2875
|
}
|
|
@@ -2877,7 +2877,7 @@ function inferFixedSide(svg, reference, fixedPrimary) {
|
|
|
2877
2877
|
}
|
|
2878
2878
|
function resolveFixedEndpoint(svg, path, draggedEnd) {
|
|
2879
2879
|
const reference = fixedEndpointReference(path, draggedEnd);
|
|
2880
|
-
const fixedPrimary = reference.fixedId ?
|
|
2880
|
+
const fixedPrimary = reference.fixedId ? chunk3OF37CZX_cjs.findOwnerNode(svg, reference.fixedId, chunk3OF37CZX_cjs.isPrimary) : null;
|
|
2881
2881
|
if (!fixedPrimary) {
|
|
2882
2882
|
return null;
|
|
2883
2883
|
}
|
|
@@ -2896,8 +2896,8 @@ function selectLinkEndpoint(svg, event) {
|
|
|
2896
2896
|
if (!target || !end || !linkId) {
|
|
2897
2897
|
return null;
|
|
2898
2898
|
}
|
|
2899
|
-
const path =
|
|
2900
|
-
const linkOwner = path &&
|
|
2899
|
+
const path = chunk3OF37CZX_cjs.findOwnerNode(svg, linkId, chunk3OF37CZX_cjs.isPrimary);
|
|
2900
|
+
const linkOwner = path && chunk3OF37CZX_cjs.resolveOwner(path);
|
|
2901
2901
|
if (!path || !linkOwner) {
|
|
2902
2902
|
return null;
|
|
2903
2903
|
}
|
|
@@ -2939,8 +2939,8 @@ function nearestPort(bounds, point) {
|
|
|
2939
2939
|
let nearest = { side: "right", offset: 0.5 };
|
|
2940
2940
|
let nearestDistance = Infinity;
|
|
2941
2941
|
for (const side of SIDES2) {
|
|
2942
|
-
const offset = Math.max(0, Math.min(1,
|
|
2943
|
-
const candidate =
|
|
2942
|
+
const offset = Math.max(0, Math.min(1, chunkSKGJXCAO_cjs.relativeOffsetOnRectangleSide(bounds, side, point)));
|
|
2943
|
+
const candidate = chunkSKGJXCAO_cjs.pointAtPort(bounds, { side, offset });
|
|
2944
2944
|
const distance = Math.hypot(candidate.x - point.x, candidate.y - point.y);
|
|
2945
2945
|
if (distance < nearestDistance) {
|
|
2946
2946
|
nearestDistance = distance;
|
|
@@ -2999,7 +2999,7 @@ function resolveLinkTarget(candidates, fixedPoint, point, unitsPerPx) {
|
|
|
2999
2999
|
}
|
|
3000
3000
|
const port = snapPort(candidate.bounds, point, unitsPerPx);
|
|
3001
3001
|
return {
|
|
3002
|
-
point:
|
|
3002
|
+
point: chunkSKGJXCAO_cjs.pointAtPort(candidate.bounds, port),
|
|
3003
3003
|
side: port.side,
|
|
3004
3004
|
hit: { owner: candidate.owner, side: port.side, offset: port.offset },
|
|
3005
3005
|
bounds: candidate.bounds
|
|
@@ -3023,7 +3023,7 @@ var LinkEndpointSession = class {
|
|
|
3023
3023
|
this.#emitter = emitter;
|
|
3024
3024
|
}
|
|
3025
3025
|
pointerDown = (event) => {
|
|
3026
|
-
if (event.button !== 0 || this.#drag ||
|
|
3026
|
+
if (event.button !== 0 || this.#drag || chunk3OF37CZX_cjs.isCameraGesture(event)) {
|
|
3027
3027
|
return;
|
|
3028
3028
|
}
|
|
3029
3029
|
this.#drag = createLinkEndpointDragState(this.#svg, event);
|
|
@@ -3037,7 +3037,7 @@ var LinkEndpointSession = class {
|
|
|
3037
3037
|
return;
|
|
3038
3038
|
}
|
|
3039
3039
|
drag.moved = true;
|
|
3040
|
-
const target = resolveEndpointTarget(drag, endpointPointerPosition(this.#svg, event), 1 /
|
|
3040
|
+
const target = resolveEndpointTarget(drag, endpointPointerPosition(this.#svg, event), 1 / chunk3OF37CZX_cjs.pxPerUnit(this.#svg));
|
|
3041
3041
|
updateEndpointPreview(drag, target.point, target.side);
|
|
3042
3042
|
drag.ghost.show(target.hit !== null, target.bounds);
|
|
3043
3043
|
};
|
|
@@ -3103,7 +3103,7 @@ function snapCandidates(svg, axis, excludeIds) {
|
|
|
3103
3103
|
return values;
|
|
3104
3104
|
}
|
|
3105
3105
|
function movedSegments(drag, value) {
|
|
3106
|
-
const next = drag.segments.map((
|
|
3106
|
+
const next = drag.segments.map((segment2) => ({ ...segment2 }));
|
|
3107
3107
|
const target = next[drag.index];
|
|
3108
3108
|
const before = next[drag.index - 1];
|
|
3109
3109
|
const after = next[drag.index + 1];
|
|
@@ -3129,16 +3129,16 @@ function movedSegments(drag, value) {
|
|
|
3129
3129
|
return next;
|
|
3130
3130
|
}
|
|
3131
3131
|
function pathSegments(segments) {
|
|
3132
|
-
return segments.map((
|
|
3133
|
-
const start = { x:
|
|
3134
|
-
const end = { x:
|
|
3132
|
+
return segments.map((segment2) => {
|
|
3133
|
+
const start = { x: segment2.ax, y: segment2.ay };
|
|
3134
|
+
const end = { x: segment2.bx, y: segment2.by };
|
|
3135
3135
|
return {
|
|
3136
3136
|
start,
|
|
3137
3137
|
end,
|
|
3138
3138
|
midpoint: { x: (start.x + end.x) / 2, y: (start.y + end.y) / 2 },
|
|
3139
|
-
originalMidpoint: { x:
|
|
3139
|
+
originalMidpoint: { x: segment2.ox, y: segment2.oy },
|
|
3140
3140
|
isHorizontal: Math.abs(end.x - start.x) > Math.abs(end.y - start.y),
|
|
3141
|
-
canMove:
|
|
3141
|
+
canMove: segment2.movable
|
|
3142
3142
|
};
|
|
3143
3143
|
});
|
|
3144
3144
|
}
|
|
@@ -3151,7 +3151,7 @@ var LinkSegmentSession = class {
|
|
|
3151
3151
|
this.#emitter = emitter;
|
|
3152
3152
|
}
|
|
3153
3153
|
pointerDown = (event) => {
|
|
3154
|
-
if (event.button !== 0 || this.#drag ||
|
|
3154
|
+
if (event.button !== 0 || this.#drag || chunk3OF37CZX_cjs.isCameraGesture(event)) {
|
|
3155
3155
|
return;
|
|
3156
3156
|
}
|
|
3157
3157
|
const target = event.target;
|
|
@@ -3161,24 +3161,24 @@ var LinkSegmentSession = class {
|
|
|
3161
3161
|
if (!handle || !overlay || !linkId) {
|
|
3162
3162
|
return;
|
|
3163
3163
|
}
|
|
3164
|
-
const path =
|
|
3165
|
-
const owner = path &&
|
|
3164
|
+
const path = chunk3OF37CZX_cjs.findOwnerNode(this.#svg, linkId, chunk3OF37CZX_cjs.isPrimary);
|
|
3165
|
+
const owner = path && chunk3OF37CZX_cjs.resolveOwner(path);
|
|
3166
3166
|
const index = Number(handle.getAttribute("data-sf-link-segment"));
|
|
3167
3167
|
const segments = path ? parseSegments(path) : [];
|
|
3168
|
-
const
|
|
3169
|
-
const point =
|
|
3170
|
-
if (!path || !owner || !
|
|
3168
|
+
const segment2 = segments[index];
|
|
3169
|
+
const point = chunk3OF37CZX_cjs.pointerUserPoint(this.#svg, event);
|
|
3170
|
+
if (!path || !owner || !segment2 || !point) {
|
|
3171
3171
|
return;
|
|
3172
3172
|
}
|
|
3173
3173
|
const axis = handle.getAttribute("data-sf-link-segment-axis") === "x" ? "x" : "y";
|
|
3174
3174
|
const guide = document.createElementNS(SVG_NAMESPACE2, "line");
|
|
3175
3175
|
guide.setAttribute("stroke", GUIDE_COLOR);
|
|
3176
3176
|
guide.setAttribute("stroke-dasharray", "4 4");
|
|
3177
|
-
guide.setAttribute("stroke-width", String(1 /
|
|
3177
|
+
guide.setAttribute("stroke-width", String(1 / chunk3OF37CZX_cjs.pxPerUnit(this.#svg)));
|
|
3178
3178
|
guide.setAttribute("visibility", "hidden");
|
|
3179
3179
|
overlay.appendChild(guide);
|
|
3180
3180
|
handle.setPointerCapture?.(event.pointerId);
|
|
3181
|
-
const current = axis === "y" ?
|
|
3181
|
+
const current = axis === "y" ? segment2.ay : segment2.ax;
|
|
3182
3182
|
this.#drag = {
|
|
3183
3183
|
owner,
|
|
3184
3184
|
path,
|
|
@@ -3187,7 +3187,7 @@ var LinkSegmentSession = class {
|
|
|
3187
3187
|
segments,
|
|
3188
3188
|
index,
|
|
3189
3189
|
axis,
|
|
3190
|
-
base: axis === "y" ?
|
|
3190
|
+
base: axis === "y" ? segment2.oy : segment2.ox,
|
|
3191
3191
|
start: axis === "y" ? point.y : point.x,
|
|
3192
3192
|
origin: current,
|
|
3193
3193
|
originalD: path.getAttribute("d") ?? "",
|
|
@@ -3209,7 +3209,7 @@ var LinkSegmentSession = class {
|
|
|
3209
3209
|
return;
|
|
3210
3210
|
}
|
|
3211
3211
|
drag.moved = true;
|
|
3212
|
-
const point =
|
|
3212
|
+
const point = chunk3OF37CZX_cjs.pointerUserPoint(this.#svg, event);
|
|
3213
3213
|
if (!point) {
|
|
3214
3214
|
return;
|
|
3215
3215
|
}
|
|
@@ -3235,8 +3235,8 @@ var LinkSegmentSession = class {
|
|
|
3235
3235
|
doubleClick = (event) => {
|
|
3236
3236
|
const handle = event.target?.closest("[data-sf-link-segment]");
|
|
3237
3237
|
const linkId = handle?.closest("[data-sf-selection-overlay]")?.getAttribute("data-sf-selection-overlay");
|
|
3238
|
-
const path = linkId ?
|
|
3239
|
-
const owner = path &&
|
|
3238
|
+
const path = linkId ? chunk3OF37CZX_cjs.findOwnerNode(this.#svg, linkId, chunk3OF37CZX_cjs.isPrimary) : null;
|
|
3239
|
+
const owner = path && chunk3OF37CZX_cjs.resolveOwner(path);
|
|
3240
3240
|
if (!handle || !owner) {
|
|
3241
3241
|
return;
|
|
3242
3242
|
}
|
|
@@ -3259,7 +3259,7 @@ var LinkSegmentSession = class {
|
|
|
3259
3259
|
if (isSnapDisabled(this.#svg)) {
|
|
3260
3260
|
return { value: raw, snapped: null };
|
|
3261
3261
|
}
|
|
3262
|
-
const threshold = SNAP_PX /
|
|
3262
|
+
const threshold = SNAP_PX / chunk3OF37CZX_cjs.pxPerUnit(this.#svg);
|
|
3263
3263
|
let best = null;
|
|
3264
3264
|
for (const candidate of [drag.base, ...drag.candidates]) {
|
|
3265
3265
|
const closer = best === null || Math.abs(candidate - raw) < Math.abs(best - raw);
|
|
@@ -3272,14 +3272,14 @@ var LinkSegmentSession = class {
|
|
|
3272
3272
|
#preview(drag, snapped) {
|
|
3273
3273
|
const next = movedSegments(drag, drag.value);
|
|
3274
3274
|
const strokeWidth = Number(drag.path.getAttribute("stroke-width")) || 2;
|
|
3275
|
-
const data =
|
|
3275
|
+
const data = chunkSKGJXCAO_cjs.roundedOrthogonalPathData(pathSegments(next), Math.max(16, strokeWidth * 4));
|
|
3276
3276
|
drag.path.setAttribute("d", data);
|
|
3277
3277
|
drag.overlay.querySelector("path")?.setAttribute("d", data);
|
|
3278
|
-
const
|
|
3278
|
+
const segment2 = next[drag.index];
|
|
3279
3279
|
const width = Number(drag.handle.getAttribute("width"));
|
|
3280
3280
|
const height = Number(drag.handle.getAttribute("height"));
|
|
3281
|
-
drag.handle.setAttribute("x", String((
|
|
3282
|
-
drag.handle.setAttribute("y", String((
|
|
3281
|
+
drag.handle.setAttribute("x", String((segment2.ax + segment2.bx) / 2 - width / 2));
|
|
3282
|
+
drag.handle.setAttribute("y", String((segment2.ay + segment2.by) / 2 - height / 2));
|
|
3283
3283
|
const view = this.#svg.viewBox.baseVal;
|
|
3284
3284
|
if (snapped === null) {
|
|
3285
3285
|
drag.guide.setAttribute("visibility", "hidden");
|
|
@@ -3444,10 +3444,70 @@ function nearestCandidates(bounds, candidates, limit = 50) {
|
|
|
3444
3444
|
return [...candidates].sort((first, second) => centerDistance(bounds, first) - centerDistance(bounds, second)).slice(0, limit);
|
|
3445
3445
|
}
|
|
3446
3446
|
|
|
3447
|
+
// src/runtime/interaction/snapping/gaps.ts
|
|
3448
|
+
function rowOf(bounds, candidates, axis) {
|
|
3449
|
+
const [crossStart, crossSize] = axis === "x" ? ["y", "height"] : ["x", "width"];
|
|
3450
|
+
const [start, size] = axis === "x" ? ["x", "width"] : ["y", "height"];
|
|
3451
|
+
return candidates.filter(
|
|
3452
|
+
(candidate) => candidate[crossStart] < bounds[crossStart] + bounds[crossSize] && bounds[crossStart] < candidate[crossStart] + candidate[crossSize]
|
|
3453
|
+
).map((candidate) => ({
|
|
3454
|
+
start: candidate[start],
|
|
3455
|
+
end: candidate[start] + candidate[size],
|
|
3456
|
+
cross: candidate[crossStart] + candidate[crossSize] / 2
|
|
3457
|
+
})).sort((first, second) => first.start - second.start);
|
|
3458
|
+
}
|
|
3459
|
+
function segment(axis, from, to, cross) {
|
|
3460
|
+
return axis === "x" ? { orientation: "segment", x1: from, y1: cross, x2: to, y2: cross } : { orientation: "segment", x1: cross, y1: from, x2: cross, y2: to };
|
|
3461
|
+
}
|
|
3462
|
+
function axisGapSnap(bounds, candidates, axis, threshold) {
|
|
3463
|
+
const row = rowOf(bounds, candidates, axis);
|
|
3464
|
+
const start = axis === "x" ? bounds.x : bounds.y;
|
|
3465
|
+
const size = axis === "x" ? bounds.width : bounds.height;
|
|
3466
|
+
const center = start + size / 2;
|
|
3467
|
+
const before = row.filter((span) => (span.start + span.end) / 2 < center).at(-1);
|
|
3468
|
+
const after = row.find((span) => (span.start + span.end) / 2 >= center);
|
|
3469
|
+
const pairs = row.slice(1).map((span, index) => ({ first: row[index], second: span, gap: span.start - row[index].end }));
|
|
3470
|
+
let best = null;
|
|
3471
|
+
const consider = (target, guides) => {
|
|
3472
|
+
const delta = target - start;
|
|
3473
|
+
if (Math.abs(delta) < threshold && (!best || Math.abs(delta) < Math.abs(best.delta))) {
|
|
3474
|
+
best = { delta, guides };
|
|
3475
|
+
}
|
|
3476
|
+
};
|
|
3477
|
+
if (before && after) {
|
|
3478
|
+
const target = (before.end + after.start - size) / 2;
|
|
3479
|
+
if (target >= before.end) {
|
|
3480
|
+
consider(target, [
|
|
3481
|
+
segment(axis, before.end, target, before.cross),
|
|
3482
|
+
segment(axis, target + size, after.start, after.cross)
|
|
3483
|
+
]);
|
|
3484
|
+
}
|
|
3485
|
+
}
|
|
3486
|
+
for (const { first, second, gap } of pairs) {
|
|
3487
|
+
if (gap <= 0) {
|
|
3488
|
+
continue;
|
|
3489
|
+
}
|
|
3490
|
+
const existing = segment(axis, first.end, second.start, first.cross);
|
|
3491
|
+
if (before) {
|
|
3492
|
+
consider(before.end + gap, [existing, segment(axis, before.end, before.end + gap, before.cross)]);
|
|
3493
|
+
}
|
|
3494
|
+
if (after) {
|
|
3495
|
+
consider(after.start - gap - size, [existing, segment(axis, after.start - gap, after.start, after.cross)]);
|
|
3496
|
+
}
|
|
3497
|
+
}
|
|
3498
|
+
return best;
|
|
3499
|
+
}
|
|
3500
|
+
function computeGapSnap(bounds, candidates, threshold) {
|
|
3501
|
+
return {
|
|
3502
|
+
x: axisGapSnap(bounds, candidates, "x", threshold),
|
|
3503
|
+
y: axisGapSnap(bounds, candidates, "y", threshold)
|
|
3504
|
+
};
|
|
3505
|
+
}
|
|
3506
|
+
|
|
3447
3507
|
// src/runtime/interaction/snapping/isometricDiagonal.ts
|
|
3448
3508
|
var AXES2 = [
|
|
3449
|
-
{ x:
|
|
3450
|
-
{ x: -
|
|
3509
|
+
{ x: chunkSKGJXCAO_cjs.AXIS_COS, y: chunkSKGJXCAO_cjs.AXIS_SIN },
|
|
3510
|
+
{ x: -chunkSKGJXCAO_cjs.AXIS_COS, y: chunkSKGJXCAO_cjs.AXIS_SIN }
|
|
3451
3511
|
];
|
|
3452
3512
|
var GUIDE_OVERHANG = 40;
|
|
3453
3513
|
function snapIsometricDiagonal(apex, rawDx, rawDy, candidates, threshold) {
|
|
@@ -3515,13 +3575,13 @@ function isometricApexOf(svg, drag, declared = false) {
|
|
|
3515
3575
|
if (lead.owner.role !== "isometric") {
|
|
3516
3576
|
return null;
|
|
3517
3577
|
}
|
|
3518
|
-
const primary =
|
|
3519
|
-
const geometry = primary &&
|
|
3578
|
+
const primary = chunk3OF37CZX_cjs.findOwnerNode(svg, lead.owner.id, chunk3OF37CZX_cjs.isPrimary);
|
|
3579
|
+
const geometry = primary && chunk3OF37CZX_cjs.isometricGeometryOf(primary);
|
|
3520
3580
|
if (!geometry) {
|
|
3521
3581
|
return null;
|
|
3522
3582
|
}
|
|
3523
3583
|
const frame = declared && geometry.bounds ? geometry.bounds : lead.draggedBounds;
|
|
3524
|
-
return { x: frame.x + geometry.depth *
|
|
3584
|
+
return { x: frame.x + geometry.depth * chunkSKGJXCAO_cjs.AXIS_COS, y: frame.y };
|
|
3525
3585
|
}
|
|
3526
3586
|
function snapIsometricGrid(svg, drag, rawDx, rawDy) {
|
|
3527
3587
|
const step = readIsometricSnapStep(svg);
|
|
@@ -3538,8 +3598,8 @@ function snapIsometricMove(svg, drag, rawDx, rawDy) {
|
|
|
3538
3598
|
return null;
|
|
3539
3599
|
}
|
|
3540
3600
|
const excludedIds = new Set(drag.canvasObjects.map((canvasObject) => canvasObject.owner.id));
|
|
3541
|
-
const candidates =
|
|
3542
|
-
const snap = snapIsometricDiagonal(apex, rawDx, rawDy, candidates, snapDistancePx(svg) /
|
|
3601
|
+
const candidates = chunk3OF37CZX_cjs.findIsometricApexCandidates(svg, excludedIds);
|
|
3602
|
+
const snap = snapIsometricDiagonal(apex, rawDx, rawDy, candidates, snapDistancePx(svg) / chunk3OF37CZX_cjs.pxPerUnit(svg));
|
|
3543
3603
|
return snap ? { dx: snap.dx, dy: snap.dy, guides: [snap.guide] } : null;
|
|
3544
3604
|
}
|
|
3545
3605
|
function snapMove(svg, drag, rawDx, rawDy) {
|
|
@@ -3556,18 +3616,24 @@ function snapMove(svg, drag, rawDx, rawDy) {
|
|
|
3556
3616
|
}
|
|
3557
3617
|
const leadBounds = offsetBounds(drag.canvasObjects[0].draggedBounds, rawDx, rawDy);
|
|
3558
3618
|
const excludedIds = new Set(drag.canvasObjects.map((canvasObject) => canvasObject.owner.id));
|
|
3559
|
-
const candidates = nearestCandidates(leadBounds,
|
|
3619
|
+
const candidates = nearestCandidates(leadBounds, chunk3OF37CZX_cjs.findSnapCandidateBounds(svg, excludedIds));
|
|
3620
|
+
const threshold = snapDistancePx(svg) / chunk3OF37CZX_cjs.pxPerUnit(svg);
|
|
3560
3621
|
const snap = computeSnap(leadBounds, candidates, {
|
|
3561
|
-
threshold
|
|
3622
|
+
threshold,
|
|
3562
3623
|
activeX: MOVE_ACTIVE_POINTS,
|
|
3563
3624
|
activeY: MOVE_ACTIVE_POINTS,
|
|
3564
3625
|
guideOverhang: GUIDE_OVERHANG2
|
|
3565
3626
|
});
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3627
|
+
const gaps = computeGapSnap(leadBounds, candidates, threshold);
|
|
3628
|
+
const pick = (align, gap) => {
|
|
3629
|
+
if (gap && (!align.guide || Math.abs(gap.delta) < Math.abs(align.delta))) {
|
|
3630
|
+
return gap;
|
|
3631
|
+
}
|
|
3632
|
+
return { delta: align.delta, guides: align.guide ? [align.guide] : [] };
|
|
3570
3633
|
};
|
|
3634
|
+
const x = pick(snap.x, gaps.x);
|
|
3635
|
+
const y = pick(snap.y, gaps.y);
|
|
3636
|
+
return { dx: rawDx + x.delta, dy: rawDy + y.delta, guides: [...x.guides, ...y.guides] };
|
|
3571
3637
|
}
|
|
3572
3638
|
|
|
3573
3639
|
// src/runtime/interaction/move/completion.ts
|
|
@@ -3619,7 +3685,7 @@ function isCompositeOwner(owner) {
|
|
|
3619
3685
|
return owner !== null && owner !== void 0 && COMPOSITE_ROLES.has(owner.role);
|
|
3620
3686
|
}
|
|
3621
3687
|
function hasDerivedHeight(owner) {
|
|
3622
|
-
return owner !== null && owner !== void 0 &&
|
|
3688
|
+
return owner !== null && owner !== void 0 && chunk3OF37CZX_cjs.DERIVED_HEIGHT_ROLES.has(owner.role);
|
|
3623
3689
|
}
|
|
3624
3690
|
|
|
3625
3691
|
// src/runtime/interaction/move/canvasObjectCapture.ts
|
|
@@ -3640,7 +3706,7 @@ function parentContainerBounds(svg, primary, groupIds) {
|
|
|
3640
3706
|
if (!parentId || groupIds.has(parentId)) {
|
|
3641
3707
|
return void 0;
|
|
3642
3708
|
}
|
|
3643
|
-
const container =
|
|
3709
|
+
const container = chunk3OF37CZX_cjs.findOwnerNode(svg, parentId, chunk3OF37CZX_cjs.isPrimary);
|
|
3644
3710
|
if (!container) {
|
|
3645
3711
|
return void 0;
|
|
3646
3712
|
}
|
|
@@ -3648,14 +3714,14 @@ function parentContainerBounds(svg, primary, groupIds) {
|
|
|
3648
3714
|
return { x: bbox.x, y: bbox.y, width: bbox.width, height: bbox.height };
|
|
3649
3715
|
}
|
|
3650
3716
|
function captureCanvasObject(svg, owner, groupIds) {
|
|
3651
|
-
const nodes =
|
|
3652
|
-
const primary =
|
|
3717
|
+
const nodes = chunk3OF37CZX_cjs.findAllOwnerNodes(svg, owner.id);
|
|
3718
|
+
const primary = chunk3OF37CZX_cjs.findOwnerNode(svg, owner.id, chunk3OF37CZX_cjs.isPrimary);
|
|
3653
3719
|
if (!nodes.length || !primary) {
|
|
3654
3720
|
return null;
|
|
3655
3721
|
}
|
|
3656
3722
|
const overlays = [...svg.querySelectorAll(`[data-sf-selection-overlay="${CSS.escape(owner.id)}"]`)];
|
|
3657
3723
|
const draggedBounds = primary.getBBox();
|
|
3658
|
-
const isometricGeometry = owner.role === "isometric" ?
|
|
3724
|
+
const isometricGeometry = owner.role === "isometric" ? chunk3OF37CZX_cjs.isometricGeometryOf(primary) : null;
|
|
3659
3725
|
const isometricSize = isometricGeometry ? { width: isometricGeometry.width, height: isometricGeometry.height, depth: isometricGeometry.depth } : void 0;
|
|
3660
3726
|
return {
|
|
3661
3727
|
owner,
|
|
@@ -3697,7 +3763,7 @@ function captureInternalLinks(svg, groupIds) {
|
|
|
3697
3763
|
if (!linkId || !belongsToMoveGroup(path, groupIds)) {
|
|
3698
3764
|
continue;
|
|
3699
3765
|
}
|
|
3700
|
-
const nodes =
|
|
3766
|
+
const nodes = chunk3OF37CZX_cjs.findAllOwnerNodes(svg, linkId);
|
|
3701
3767
|
if (nodes.length) {
|
|
3702
3768
|
links.push({ nodes, baseTransforms: nodes.map((node) => node.getAttribute("transform")) });
|
|
3703
3769
|
}
|
|
@@ -3731,7 +3797,7 @@ function containedChildren(viewer, owner) {
|
|
|
3731
3797
|
return [];
|
|
3732
3798
|
}
|
|
3733
3799
|
const nodes = viewer.svg.querySelectorAll(`[data-sf-parent-frame="${CSS.escape(owner.id)}"]`);
|
|
3734
|
-
return [...nodes].map((node) =>
|
|
3800
|
+
return [...nodes].map((node) => chunk3OF37CZX_cjs.resolveOwner(node)).filter((ref) => ref !== null);
|
|
3735
3801
|
}
|
|
3736
3802
|
function selectedMoveGroup(viewer, owner) {
|
|
3737
3803
|
const selection = viewer.getSelection();
|
|
@@ -3748,7 +3814,7 @@ function isChartInteractiveMark(target) {
|
|
|
3748
3814
|
}
|
|
3749
3815
|
function createMoveDragState(viewer, event, startUser) {
|
|
3750
3816
|
const target = event.target;
|
|
3751
|
-
const owner =
|
|
3817
|
+
const owner = chunk3OF37CZX_cjs.resolveOwner(target);
|
|
3752
3818
|
if (!hasMovableGeometry(owner) || isChartInteractiveMark(target)) {
|
|
3753
3819
|
return null;
|
|
3754
3820
|
}
|
|
@@ -3782,7 +3848,7 @@ var MoveSession = class {
|
|
|
3782
3848
|
this.#emitter = emitter;
|
|
3783
3849
|
}
|
|
3784
3850
|
pointerDown = (event) => {
|
|
3785
|
-
if (event.button !== 0 || this.#drag ||
|
|
3851
|
+
if (event.button !== 0 || this.#drag || chunk3OF37CZX_cjs.isCameraGesture(event)) {
|
|
3786
3852
|
return;
|
|
3787
3853
|
}
|
|
3788
3854
|
this.#drag = createMoveDragState(this.#viewer, event, movePointerPosition(this.#svg, event));
|
|
@@ -3800,7 +3866,7 @@ var MoveSession = class {
|
|
|
3800
3866
|
const delta = snapMove(this.#svg, drag, rawDelta.dx, rawDelta.dy);
|
|
3801
3867
|
const clamped = clampMoveDelta(drag.canvasObjects, delta.dx, delta.dy);
|
|
3802
3868
|
applyMovePreview(drag, clamped.dx, clamped.dy);
|
|
3803
|
-
|
|
3869
|
+
chunk3OF37CZX_cjs.updateAlignmentGuides(this.#svg, delta.guides, MOVE_GUIDE_COLOR);
|
|
3804
3870
|
};
|
|
3805
3871
|
pointerUp = (event) => {
|
|
3806
3872
|
const drag = this.#drag;
|
|
@@ -3809,7 +3875,7 @@ var MoveSession = class {
|
|
|
3809
3875
|
}
|
|
3810
3876
|
this.#drag = null;
|
|
3811
3877
|
event.target.releasePointerCapture?.(drag.pointerId);
|
|
3812
|
-
|
|
3878
|
+
chunk3OF37CZX_cjs.clearAlignmentGuides(this.#svg);
|
|
3813
3879
|
emitMoveCompletion(this.#svg, this.#emitter, drag, event);
|
|
3814
3880
|
};
|
|
3815
3881
|
cancel() {
|
|
@@ -3955,9 +4021,9 @@ var START_POINT_RADIUS_PX = 6;
|
|
|
3955
4021
|
var POINT_STROKE_WIDTH_PX = 1.5;
|
|
3956
4022
|
function createPathDrawPreview(svg) {
|
|
3957
4023
|
const document2 = svg.ownerDocument;
|
|
3958
|
-
const group = document2.createElementNS(
|
|
4024
|
+
const group = document2.createElementNS(chunk3OF37CZX_cjs.SVG_NAMESPACE, "g");
|
|
3959
4025
|
group.setAttribute("pointer-events", "none");
|
|
3960
|
-
const line = document2.createElementNS(
|
|
4026
|
+
const line = document2.createElementNS(chunk3OF37CZX_cjs.SVG_NAMESPACE, "path");
|
|
3961
4027
|
line.setAttribute("fill", "none");
|
|
3962
4028
|
line.setAttribute("stroke", PREVIEW_COLOR);
|
|
3963
4029
|
line.setAttribute("stroke-linecap", "round");
|
|
@@ -3967,8 +4033,8 @@ function createPathDrawPreview(svg) {
|
|
|
3967
4033
|
}
|
|
3968
4034
|
function pointMarker(svg, point, highlighted) {
|
|
3969
4035
|
const document2 = svg.ownerDocument;
|
|
3970
|
-
const unit = 1 /
|
|
3971
|
-
const circle = document2.createElementNS(
|
|
4036
|
+
const unit = 1 / chunk3OF37CZX_cjs.pxPerUnit(svg);
|
|
4037
|
+
const circle = document2.createElementNS(chunk3OF37CZX_cjs.SVG_NAMESPACE, "circle");
|
|
3972
4038
|
circle.setAttribute("cx", String(point.x));
|
|
3973
4039
|
circle.setAttribute("cy", String(point.y));
|
|
3974
4040
|
circle.setAttribute("r", String((highlighted ? START_POINT_RADIUS_PX : POINT_RADIUS_PX) * unit));
|
|
@@ -3982,11 +4048,11 @@ function updatePathDrawPreview(svg, state) {
|
|
|
3982
4048
|
if (!previewLine || !previewGroup) {
|
|
3983
4049
|
return;
|
|
3984
4050
|
}
|
|
3985
|
-
const unit = 1 /
|
|
4051
|
+
const unit = 1 / chunk3OF37CZX_cjs.pxPerUnit(svg);
|
|
3986
4052
|
previewLine.setAttribute("stroke-width", String(LINE_WIDTH_PX * unit));
|
|
3987
4053
|
previewLine.setAttribute("stroke-dasharray", `${DASH_PX * unit} ${GAP_PX * unit}`);
|
|
3988
4054
|
const live = state.cursor ? [...state.points, state.cursor] : state.points;
|
|
3989
|
-
previewLine.setAttribute("d",
|
|
4055
|
+
previewLine.setAttribute("d", chunkSKGJXCAO_cjs.freeformPathData({ points: live, tension: state.tension, closed: false }));
|
|
3990
4056
|
while (previewGroup.childNodes.length > 1) {
|
|
3991
4057
|
previewGroup.lastChild?.remove();
|
|
3992
4058
|
}
|
|
@@ -4046,12 +4112,12 @@ var PathDrawSession = class {
|
|
|
4046
4112
|
}
|
|
4047
4113
|
}
|
|
4048
4114
|
pointerDown = (event) => {
|
|
4049
|
-
if (!this.#state.active || event.button !== 0 ||
|
|
4115
|
+
if (!this.#state.active || event.button !== 0 || chunk3OF37CZX_cjs.isCameraGesture(event)) {
|
|
4050
4116
|
return;
|
|
4051
4117
|
}
|
|
4052
4118
|
event.stopPropagation();
|
|
4053
4119
|
event.preventDefault();
|
|
4054
|
-
const point =
|
|
4120
|
+
const point = chunk3OF37CZX_cjs.pointerUserPoint(this.#svg, event);
|
|
4055
4121
|
if (!point) {
|
|
4056
4122
|
return;
|
|
4057
4123
|
}
|
|
@@ -4070,14 +4136,14 @@ var PathDrawSession = class {
|
|
|
4070
4136
|
this.#state.cursor = resolved.point;
|
|
4071
4137
|
this.#state.willClose = false;
|
|
4072
4138
|
updatePathDrawPreview(this.#svg, this.#state);
|
|
4073
|
-
|
|
4139
|
+
chunk3OF37CZX_cjs.clearAlignmentGuides(this.#svg);
|
|
4074
4140
|
};
|
|
4075
4141
|
pointerMove = (event) => {
|
|
4076
4142
|
if (!this.#state.active) {
|
|
4077
4143
|
return;
|
|
4078
4144
|
}
|
|
4079
4145
|
event.stopPropagation();
|
|
4080
|
-
const point =
|
|
4146
|
+
const point = chunk3OF37CZX_cjs.pointerUserPoint(this.#svg, event);
|
|
4081
4147
|
if (!point) {
|
|
4082
4148
|
return;
|
|
4083
4149
|
}
|
|
@@ -4086,9 +4152,9 @@ var PathDrawSession = class {
|
|
|
4086
4152
|
this.#state.willClose = resolved.willClose;
|
|
4087
4153
|
updatePathDrawPreview(this.#svg, this.#state);
|
|
4088
4154
|
if (resolved.guide) {
|
|
4089
|
-
|
|
4155
|
+
chunk3OF37CZX_cjs.updateAlignmentGuides(this.#svg, [resolved.guide], GUIDE_COLOR2);
|
|
4090
4156
|
} else {
|
|
4091
|
-
|
|
4157
|
+
chunk3OF37CZX_cjs.clearAlignmentGuides(this.#svg);
|
|
4092
4158
|
}
|
|
4093
4159
|
};
|
|
4094
4160
|
pointerUp = (event) => {
|
|
@@ -4123,10 +4189,10 @@ var PathDrawSession = class {
|
|
|
4123
4189
|
} else if (event.key === "Backspace" && this.#state.points.length > 0) {
|
|
4124
4190
|
event.preventDefault();
|
|
4125
4191
|
this.#state.points = this.#state.points.slice(0, -1);
|
|
4126
|
-
const closeSnapUnits = CLOSE_SNAP_PX /
|
|
4192
|
+
const closeSnapUnits = CLOSE_SNAP_PX / chunk3OF37CZX_cjs.pxPerUnit(this.#svg);
|
|
4127
4193
|
this.#state.willClose = this.#state.cursor ? isCloseToStart(this.#state.points, this.#state.cursor, closeSnapUnits) : false;
|
|
4128
4194
|
updatePathDrawPreview(this.#svg, this.#state);
|
|
4129
|
-
|
|
4195
|
+
chunk3OF37CZX_cjs.clearAlignmentGuides(this.#svg);
|
|
4130
4196
|
}
|
|
4131
4197
|
};
|
|
4132
4198
|
keyUp = (event) => {
|
|
@@ -4135,7 +4201,7 @@ var PathDrawSession = class {
|
|
|
4135
4201
|
}
|
|
4136
4202
|
};
|
|
4137
4203
|
#resolvePoint(raw) {
|
|
4138
|
-
const closeSnapUnits = CLOSE_SNAP_PX /
|
|
4204
|
+
const closeSnapUnits = CLOSE_SNAP_PX / chunk3OF37CZX_cjs.pxPerUnit(this.#svg);
|
|
4139
4205
|
if (isCloseToStart(this.#state.points, raw, closeSnapUnits)) {
|
|
4140
4206
|
return { point: this.#state.points[0], willClose: true, guide: null };
|
|
4141
4207
|
}
|
|
@@ -4145,7 +4211,7 @@ var PathDrawSession = class {
|
|
|
4145
4211
|
return { point: raw, willClose: false, guide: null };
|
|
4146
4212
|
}
|
|
4147
4213
|
const angleSnapped = snapTo45Degrees(last, raw);
|
|
4148
|
-
const guideSnapUnits = GUIDE_SNAP_PX /
|
|
4214
|
+
const guideSnapUnits = GUIDE_SNAP_PX / chunk3OF37CZX_cjs.pxPerUnit(this.#svg);
|
|
4149
4215
|
const { point, guide } = snapToSessionGuides(last, angleSnapped, points.slice(0, -1), raw, guideSnapUnits);
|
|
4150
4216
|
return { point, willClose: false, guide };
|
|
4151
4217
|
}
|
|
@@ -4159,7 +4225,7 @@ var PathDrawSession = class {
|
|
|
4159
4225
|
}
|
|
4160
4226
|
#reset(callExit) {
|
|
4161
4227
|
this.#state.previewGroup?.remove();
|
|
4162
|
-
|
|
4228
|
+
chunk3OF37CZX_cjs.clearAlignmentGuides(this.#svg);
|
|
4163
4229
|
const exit = this.#state.onExit;
|
|
4164
4230
|
this.#state = createIdlePathDrawState();
|
|
4165
4231
|
this.#shiftHeld = false;
|
|
@@ -4202,7 +4268,7 @@ function applyPathReshapePreview(drag, point) {
|
|
|
4202
4268
|
const points = drag.points.map(
|
|
4203
4269
|
(existing, index) => index === drag.pointIndex ? [point.x, point.y] : existing
|
|
4204
4270
|
);
|
|
4205
|
-
const d =
|
|
4271
|
+
const d = chunkSKGJXCAO_cjs.freeformPathData({
|
|
4206
4272
|
points: points.map(([x, y]) => ({ x, y })),
|
|
4207
4273
|
tension: drag.tension,
|
|
4208
4274
|
closed: drag.closed
|
|
@@ -4210,22 +4276,22 @@ function applyPathReshapePreview(drag, point) {
|
|
|
4210
4276
|
drag.pathNode.setAttribute("d", d);
|
|
4211
4277
|
drag.handle.setAttribute("cx", String(point.x));
|
|
4212
4278
|
drag.handle.setAttribute("cy", String(point.y));
|
|
4213
|
-
drag.overlay?.querySelector(`[${
|
|
4279
|
+
drag.overlay?.querySelector(`[${chunk3OF37CZX_cjs.PATH_HALO_ATTR}]`)?.setAttribute("d", d);
|
|
4214
4280
|
return points;
|
|
4215
4281
|
}
|
|
4216
4282
|
|
|
4217
4283
|
// src/runtime/interaction/pathReshape/target.ts
|
|
4218
4284
|
function resolvePathReshapeTarget(svg, event) {
|
|
4219
|
-
const handle = event.target?.closest?.(`[${
|
|
4220
|
-
const indexAttr = handle?.getAttribute(
|
|
4285
|
+
const handle = event.target?.closest?.(`[${chunkSKGJXCAO_cjs.PATH_POINT_INDEX_ATTR}]`) ?? null;
|
|
4286
|
+
const indexAttr = handle?.getAttribute(chunkSKGJXCAO_cjs.PATH_POINT_INDEX_ATTR) ?? null;
|
|
4221
4287
|
const pointIndex = indexAttr !== null ? Number(indexAttr) : Number.NaN;
|
|
4222
4288
|
const ownerId = handle?.closest("[data-sf-selection-overlay]")?.getAttribute("data-sf-selection-overlay");
|
|
4223
4289
|
if (!handle || !Number.isInteger(pointIndex) || !ownerId) {
|
|
4224
4290
|
return null;
|
|
4225
4291
|
}
|
|
4226
|
-
const pathNode =
|
|
4227
|
-
const owner = pathNode &&
|
|
4228
|
-
const geometry = pathNode &&
|
|
4292
|
+
const pathNode = chunk3OF37CZX_cjs.findOwnerNode(svg, ownerId, chunk3OF37CZX_cjs.isPrimary);
|
|
4293
|
+
const owner = pathNode && chunk3OF37CZX_cjs.resolveOwner(pathNode);
|
|
4294
|
+
const geometry = pathNode && chunk3OF37CZX_cjs.pathGeometryOf(pathNode);
|
|
4229
4295
|
if (!pathNode || !owner || !geometry || pointIndex < 0 || pointIndex >= geometry.points.length) {
|
|
4230
4296
|
return null;
|
|
4231
4297
|
}
|
|
@@ -4268,7 +4334,7 @@ var PathReshapeSession = class {
|
|
|
4268
4334
|
this.#emitter = emitter;
|
|
4269
4335
|
}
|
|
4270
4336
|
pointerDown = (event) => {
|
|
4271
|
-
if (event.button !== 0 || this.#drag ||
|
|
4337
|
+
if (event.button !== 0 || this.#drag || chunk3OF37CZX_cjs.isCameraGesture(event)) {
|
|
4272
4338
|
return;
|
|
4273
4339
|
}
|
|
4274
4340
|
this.#drag = createPathReshapeDragState(this.#svg, event);
|
|
@@ -4279,7 +4345,7 @@ var PathReshapeSession = class {
|
|
|
4279
4345
|
return;
|
|
4280
4346
|
}
|
|
4281
4347
|
drag.moved = true;
|
|
4282
|
-
const point =
|
|
4348
|
+
const point = chunk3OF37CZX_cjs.pointerUserPoint(this.#svg, event);
|
|
4283
4349
|
if (point) {
|
|
4284
4350
|
applyPathReshapePreview(drag, point);
|
|
4285
4351
|
}
|
|
@@ -4294,7 +4360,7 @@ var PathReshapeSession = class {
|
|
|
4294
4360
|
if (!drag.moved) {
|
|
4295
4361
|
return;
|
|
4296
4362
|
}
|
|
4297
|
-
const point =
|
|
4363
|
+
const point = chunk3OF37CZX_cjs.pointerUserPoint(this.#svg, event) ?? {
|
|
4298
4364
|
x: drag.points[drag.pointIndex][0],
|
|
4299
4365
|
y: drag.points[drag.pointIndex][1]
|
|
4300
4366
|
};
|
|
@@ -4335,7 +4401,7 @@ function updatePieLabelDragPreview(drag, dx, dy) {
|
|
|
4335
4401
|
}
|
|
4336
4402
|
const from = { x: drag.tickStartX, y: drag.tickStartY };
|
|
4337
4403
|
const to = { x: drag.restX + dx, y: drag.restY + dy };
|
|
4338
|
-
const clipped =
|
|
4404
|
+
const clipped = chunkSKGJXCAO_cjs.clipSegmentToRect(from, to, drag.halfWidth, drag.halfHeight);
|
|
4339
4405
|
drag.tickElement.setAttribute("d", `M ${from.x} ${from.y} L ${clipped.x} ${clipped.y}`);
|
|
4340
4406
|
drag.tickElement.setAttribute("stroke", PREVIEW_TICK_COLOR);
|
|
4341
4407
|
drag.tickElement.setAttribute("stroke-width", PREVIEW_TICK_STROKE_WIDTH);
|
|
@@ -4361,7 +4427,7 @@ function restoreAttribute(element2, name, value) {
|
|
|
4361
4427
|
|
|
4362
4428
|
// src/runtime/interaction/pieGeometry.ts
|
|
4363
4429
|
function readPieGeometry(svg, ownerId) {
|
|
4364
|
-
const raw =
|
|
4430
|
+
const raw = chunk3OF37CZX_cjs.findOwnerNode(svg, ownerId, chunk3OF37CZX_cjs.isPrimary)?.getAttribute("data-sf-pie-geometry");
|
|
4365
4431
|
if (!raw) {
|
|
4366
4432
|
return null;
|
|
4367
4433
|
}
|
|
@@ -4380,7 +4446,7 @@ function findLabelMark2(event) {
|
|
|
4380
4446
|
return event.target?.closest?.(selector);
|
|
4381
4447
|
}
|
|
4382
4448
|
function isLabelPointer2(event) {
|
|
4383
|
-
return event.button === 0 && !
|
|
4449
|
+
return event.button === 0 && !chunk3OF37CZX_cjs.isCameraGesture(event);
|
|
4384
4450
|
}
|
|
4385
4451
|
function findLabelSiblings(svg, ownerId, seriesId, mark) {
|
|
4386
4452
|
const selector = `[data-sf-id="${CSS.escape(ownerId)}"][data-sf-series="${CSS.escape(seriesId)}"][data-sf-mark="${mark}"]`;
|
|
@@ -4412,7 +4478,7 @@ function resolvePieLabelDrag(svg, event) {
|
|
|
4412
4478
|
if (!clicked) {
|
|
4413
4479
|
return null;
|
|
4414
4480
|
}
|
|
4415
|
-
const owner =
|
|
4481
|
+
const owner = chunk3OF37CZX_cjs.resolveOwner(clicked);
|
|
4416
4482
|
if (owner?.role !== "chart") {
|
|
4417
4483
|
return null;
|
|
4418
4484
|
}
|
|
@@ -4431,7 +4497,7 @@ function resolvePieLabelDrag(svg, event) {
|
|
|
4431
4497
|
const wedgeRadius = clicked.getAttribute("data-sf-pie-wedge-radius");
|
|
4432
4498
|
const explicitRadius = wedgeRadius === null ? Number.NaN : Number(wedgeRadius);
|
|
4433
4499
|
const outerRadius = Number.isFinite(explicitRadius) ? explicitRadius : geometry.outerRadius;
|
|
4434
|
-
const start =
|
|
4500
|
+
const start = chunk3OF37CZX_cjs.pointerUserPoint(svg, event);
|
|
4435
4501
|
if (!start) {
|
|
4436
4502
|
return null;
|
|
4437
4503
|
}
|
|
@@ -4453,13 +4519,13 @@ function resolvePieLabelDrag(svg, event) {
|
|
|
4453
4519
|
outerRadius,
|
|
4454
4520
|
anchorX: geometry.centerX + outerRadius * Math.cos(midAngle),
|
|
4455
4521
|
anchorY: geometry.centerY + outerRadius * Math.sin(midAngle),
|
|
4456
|
-
tickStartX: geometry.centerX + (outerRadius +
|
|
4457
|
-
tickStartY: geometry.centerY + (outerRadius +
|
|
4522
|
+
tickStartX: geometry.centerX + (outerRadius + chunkSKGJXCAO_cjs.LEADER_INSET) * Math.cos(midAngle),
|
|
4523
|
+
tickStartY: geometry.centerY + (outerRadius + chunkSKGJXCAO_cjs.LEADER_INSET) * Math.sin(midAngle),
|
|
4458
4524
|
restX,
|
|
4459
4525
|
restY,
|
|
4460
4526
|
startX: start.x,
|
|
4461
4527
|
startY: start.y,
|
|
4462
|
-
halfWidth:
|
|
4528
|
+
halfWidth: chunkSKGJXCAO_cjs.LABEL_WIDTH / 2,
|
|
4463
4529
|
halfHeight: fontSize * 1.2,
|
|
4464
4530
|
moved: false,
|
|
4465
4531
|
lastDx: 0,
|
|
@@ -4495,7 +4561,7 @@ var PieLabelDragSession = class {
|
|
|
4495
4561
|
if (!this.#drag || event.pointerId !== this.#drag.pointerId) {
|
|
4496
4562
|
return;
|
|
4497
4563
|
}
|
|
4498
|
-
const point =
|
|
4564
|
+
const point = chunk3OF37CZX_cjs.pointerUserPoint(this.#svg, event);
|
|
4499
4565
|
if (!point) {
|
|
4500
4566
|
return;
|
|
4501
4567
|
}
|
|
@@ -4527,8 +4593,8 @@ var PieLabelDragSession = class {
|
|
|
4527
4593
|
if (!drag.moved) {
|
|
4528
4594
|
return;
|
|
4529
4595
|
}
|
|
4530
|
-
const pathX =
|
|
4531
|
-
const pathY =
|
|
4596
|
+
const pathX = chunkSKGJXCAO_cjs.seriesLabelOffsetXProp(drag.seriesId);
|
|
4597
|
+
const pathY = chunkSKGJXCAO_cjs.seriesLabelOffsetYProp(drag.seriesId);
|
|
4532
4598
|
if (!pathX || !pathY) {
|
|
4533
4599
|
return;
|
|
4534
4600
|
}
|
|
@@ -4590,7 +4656,7 @@ function siblingNodes(svg, owner, path) {
|
|
|
4590
4656
|
});
|
|
4591
4657
|
}
|
|
4592
4658
|
function resolvePropertyDrag(svg, event, rules) {
|
|
4593
|
-
if (event.button !== 0 ||
|
|
4659
|
+
if (event.button !== 0 || chunk3OF37CZX_cjs.isCameraGesture(event)) {
|
|
4594
4660
|
return null;
|
|
4595
4661
|
}
|
|
4596
4662
|
const node = event.target?.closest?.('[data-sf-prop-kind="value"]');
|
|
@@ -4598,11 +4664,11 @@ function resolvePropertyDrag(svg, event, rules) {
|
|
|
4598
4664
|
return null;
|
|
4599
4665
|
}
|
|
4600
4666
|
const path = node.getAttribute("data-sf-prop");
|
|
4601
|
-
const owner =
|
|
4667
|
+
const owner = chunk3OF37CZX_cjs.resolveOwner(node);
|
|
4602
4668
|
if (!path || owner?.role !== "chart" || !isEditablePath(path, rules)) {
|
|
4603
4669
|
return null;
|
|
4604
4670
|
}
|
|
4605
|
-
const scale = parseValueScale(
|
|
4671
|
+
const scale = parseValueScale(chunk3OF37CZX_cjs.findOwnerNode(svg, owner.id, chunk3OF37CZX_cjs.isPrimary));
|
|
4606
4672
|
if (!scale) {
|
|
4607
4673
|
return null;
|
|
4608
4674
|
}
|
|
@@ -4871,7 +4937,7 @@ function resolvePropertyTarget(event, rules) {
|
|
|
4871
4937
|
return null;
|
|
4872
4938
|
}
|
|
4873
4939
|
const path = hit.getAttribute("data-sf-prop");
|
|
4874
|
-
const owner =
|
|
4940
|
+
const owner = chunk3OF37CZX_cjs.resolveOwner(hit);
|
|
4875
4941
|
if (!path || !owner || !isEditablePath(path, rules)) {
|
|
4876
4942
|
return null;
|
|
4877
4943
|
}
|
|
@@ -4910,7 +4976,7 @@ var PropertyEditingSession = class {
|
|
|
4910
4976
|
begin(target) {
|
|
4911
4977
|
this.cancel();
|
|
4912
4978
|
const { node } = target;
|
|
4913
|
-
const rect =
|
|
4979
|
+
const rect = chunk3OF37CZX_cjs.screenRectOf(node);
|
|
4914
4980
|
const fontSize = Number.parseFloat(node.getAttribute("font-size") || "12");
|
|
4915
4981
|
const originalText = node.textContent ?? "";
|
|
4916
4982
|
const anchor = node.getAttribute("text-anchor");
|
|
@@ -5000,15 +5066,15 @@ function crossedDuplicateDragThreshold(drag, event) {
|
|
|
5000
5066
|
var PREVIEW_STROKE_PX = 2;
|
|
5001
5067
|
var NEW_LINK_PATH_TYPE = "orthogonal";
|
|
5002
5068
|
function createDuplicatePreviewPath(svg) {
|
|
5003
|
-
const path = svg.ownerDocument.createElementNS(
|
|
5069
|
+
const path = svg.ownerDocument.createElementNS(chunk3OF37CZX_cjs.SVG_NAMESPACE, "path");
|
|
5004
5070
|
path.setAttribute("fill", "none");
|
|
5005
|
-
path.setAttribute("stroke-width", String(PREVIEW_STROKE_PX /
|
|
5071
|
+
path.setAttribute("stroke-width", String(PREVIEW_STROKE_PX / chunk3OF37CZX_cjs.pxPerUnit(svg)));
|
|
5006
5072
|
path.style.pointerEvents = "none";
|
|
5007
5073
|
return path;
|
|
5008
5074
|
}
|
|
5009
5075
|
function updateDuplicatePreview(drag, toPoint, toSide) {
|
|
5010
5076
|
const link = previewLink(drag.direction, toSide);
|
|
5011
|
-
const { points, segments } =
|
|
5077
|
+
const { points, segments } = chunkSKGJXCAO_cjs.calculateLinkRoute(link, drag.fixedPoint, toPoint, NEW_LINK_PATH_TYPE);
|
|
5012
5078
|
drag.previewPath.setAttribute("d", previewPathData(points, segments, NEW_LINK_PATH_TYPE, 2));
|
|
5013
5079
|
}
|
|
5014
5080
|
|
|
@@ -5019,7 +5085,7 @@ function duplicateCandidates(svg, sourceId) {
|
|
|
5019
5085
|
if (element2.getAttribute("data-sf-role") === "link") {
|
|
5020
5086
|
continue;
|
|
5021
5087
|
}
|
|
5022
|
-
const owner =
|
|
5088
|
+
const owner = chunk3OF37CZX_cjs.resolveOwner(element2);
|
|
5023
5089
|
if (owner && owner.id !== sourceId) {
|
|
5024
5090
|
candidates.push({ owner, bounds: element2.getBBox() });
|
|
5025
5091
|
}
|
|
@@ -5033,8 +5099,8 @@ function createQuickDuplicateDragState(svg, event, previewPath) {
|
|
|
5033
5099
|
if (!bubble || !direction || direction.startsWith("iso-") || !sourceId) {
|
|
5034
5100
|
return null;
|
|
5035
5101
|
}
|
|
5036
|
-
const primary =
|
|
5037
|
-
const sourceOwner = primary &&
|
|
5102
|
+
const primary = chunk3OF37CZX_cjs.findOwnerNode(svg, sourceId, chunk3OF37CZX_cjs.isPrimary);
|
|
5103
|
+
const sourceOwner = primary && chunk3OF37CZX_cjs.resolveOwner(primary);
|
|
5038
5104
|
if (!primary || !sourceOwner) {
|
|
5039
5105
|
return null;
|
|
5040
5106
|
}
|
|
@@ -5042,7 +5108,7 @@ function createQuickDuplicateDragState(svg, event, previewPath) {
|
|
|
5042
5108
|
return {
|
|
5043
5109
|
sourceOwner,
|
|
5044
5110
|
direction,
|
|
5045
|
-
fixedPoint:
|
|
5111
|
+
fixedPoint: chunkSKGJXCAO_cjs.pointAtPort(primary.getBBox(), { side: direction, offset: 0.5 }),
|
|
5046
5112
|
previewPath,
|
|
5047
5113
|
ghost: new LinkGhost(svg, previewPath),
|
|
5048
5114
|
candidates: duplicateCandidates(svg, sourceId),
|
|
@@ -5070,7 +5136,7 @@ var QuickDuplicateSession = class {
|
|
|
5070
5136
|
this.#emitter = emitter;
|
|
5071
5137
|
}
|
|
5072
5138
|
pointerDown = (event) => {
|
|
5073
|
-
if (event.button !== 0 || this.#drag ||
|
|
5139
|
+
if (event.button !== 0 || this.#drag || chunk3OF37CZX_cjs.isCameraGesture(event)) {
|
|
5074
5140
|
return;
|
|
5075
5141
|
}
|
|
5076
5142
|
this.#drag = createQuickDuplicateDragState(this.#svg, event, createDuplicatePreviewPath(this.#svg));
|
|
@@ -5084,7 +5150,7 @@ var QuickDuplicateSession = class {
|
|
|
5084
5150
|
return;
|
|
5085
5151
|
}
|
|
5086
5152
|
this.beginPreview(drag);
|
|
5087
|
-
const target = resolveDuplicateTarget(drag, duplicatePointerPosition(this.#svg, event), 1 /
|
|
5153
|
+
const target = resolveDuplicateTarget(drag, duplicatePointerPosition(this.#svg, event), 1 / chunk3OF37CZX_cjs.pxPerUnit(this.#svg));
|
|
5088
5154
|
updateDuplicatePreview(drag, target.point, target.side);
|
|
5089
5155
|
drag.ghost.show(target.hit !== null, target.bounds);
|
|
5090
5156
|
};
|
|
@@ -5142,14 +5208,14 @@ function seriesShapes(svg, ownerId, series) {
|
|
|
5142
5208
|
return [...svg.querySelectorAll(selector)];
|
|
5143
5209
|
}
|
|
5144
5210
|
function updateRadarVertexDragPreview(svg, drag, value) {
|
|
5145
|
-
const point =
|
|
5211
|
+
const point = chunkSKGJXCAO_cjs.radarVertexPoint(drag.frame, drag.index, value);
|
|
5146
5212
|
drag.element.setAttribute("cx", String(point.x));
|
|
5147
5213
|
drag.element.setAttribute("cy", String(point.y));
|
|
5148
5214
|
const points = seriesVertices(svg, drag.owner.id, drag.series).map((vertex) => ({
|
|
5149
5215
|
x: Number(vertex.getAttribute("cx")),
|
|
5150
5216
|
y: Number(vertex.getAttribute("cy"))
|
|
5151
5217
|
}));
|
|
5152
|
-
const path =
|
|
5218
|
+
const path = chunkSKGJXCAO_cjs.radarSeriesPath(points, drag.frame.curved, drag.frame.tension);
|
|
5153
5219
|
for (const shape of seriesShapes(svg, drag.owner.id, drag.series)) {
|
|
5154
5220
|
shape.setAttribute("d", path);
|
|
5155
5221
|
}
|
|
@@ -5204,7 +5270,7 @@ function findVertex(event) {
|
|
|
5204
5270
|
return event.target?.closest?.('[data-sf-mark="radar-vertex"]');
|
|
5205
5271
|
}
|
|
5206
5272
|
function isVertexPointer(event) {
|
|
5207
|
-
return event.button === 0 && !
|
|
5273
|
+
return event.button === 0 && !chunk3OF37CZX_cjs.isCameraGesture(event);
|
|
5208
5274
|
}
|
|
5209
5275
|
function resolveRadarVertexDrag(svg, event) {
|
|
5210
5276
|
if (!isVertexPointer(event)) {
|
|
@@ -5214,7 +5280,7 @@ function resolveRadarVertexDrag(svg, event) {
|
|
|
5214
5280
|
if (!element2) {
|
|
5215
5281
|
return null;
|
|
5216
5282
|
}
|
|
5217
|
-
const owner =
|
|
5283
|
+
const owner = chunk3OF37CZX_cjs.resolveOwner(element2);
|
|
5218
5284
|
if (owner?.role !== "chart") {
|
|
5219
5285
|
return null;
|
|
5220
5286
|
}
|
|
@@ -5223,7 +5289,7 @@ function resolveRadarVertexDrag(svg, event) {
|
|
|
5223
5289
|
if (!series || !Number.isInteger(index) || index < 0) {
|
|
5224
5290
|
return null;
|
|
5225
5291
|
}
|
|
5226
|
-
const frame = parseRadarFrame(
|
|
5292
|
+
const frame = parseRadarFrame(chunk3OF37CZX_cjs.findOwnerNode(svg, owner.id, chunk3OF37CZX_cjs.isPrimary));
|
|
5227
5293
|
if (!frame || index >= frame.count) {
|
|
5228
5294
|
return null;
|
|
5229
5295
|
}
|
|
@@ -5233,11 +5299,11 @@ function resolveRadarVertexDrag(svg, event) {
|
|
|
5233
5299
|
|
|
5234
5300
|
// src/runtime/interaction/radarVertexDrag/session.ts
|
|
5235
5301
|
function valueFrom(svg, event, drag) {
|
|
5236
|
-
const point =
|
|
5302
|
+
const point = chunk3OF37CZX_cjs.pointerUserPoint(svg, event);
|
|
5237
5303
|
if (!point) {
|
|
5238
5304
|
return null;
|
|
5239
5305
|
}
|
|
5240
|
-
return
|
|
5306
|
+
return chunkSKGJXCAO_cjs.radarValueAtPoint(drag.frame, drag.index, point.x, point.y);
|
|
5241
5307
|
}
|
|
5242
5308
|
var RadarVertexDragSession = class {
|
|
5243
5309
|
#svg;
|
|
@@ -5269,7 +5335,7 @@ var RadarVertexDragSession = class {
|
|
|
5269
5335
|
if (!this.#readout) {
|
|
5270
5336
|
this.#readout = createValueReadout(this.#svg);
|
|
5271
5337
|
}
|
|
5272
|
-
const vertex =
|
|
5338
|
+
const vertex = chunkSKGJXCAO_cjs.radarVertexPoint(this.#drag.frame, this.#drag.index, value);
|
|
5273
5339
|
positionRadarReadout(this.#readout, vertex, this.#drag.frame.centerY, value);
|
|
5274
5340
|
}
|
|
5275
5341
|
cancel() {
|
|
@@ -5360,7 +5426,7 @@ function captureTextFit(text) {
|
|
|
5360
5426
|
fontSize,
|
|
5361
5427
|
lineHeight,
|
|
5362
5428
|
padding: Math.max(8, text.strokeWidth * 2),
|
|
5363
|
-
longestWord: Math.max(0, ...words.map((word) =>
|
|
5429
|
+
longestWord: Math.max(0, ...words.map((word) => chunkSKGJXCAO_cjs.estimateTextWidth(word, fontSize, bold)))
|
|
5364
5430
|
};
|
|
5365
5431
|
}
|
|
5366
5432
|
var COMMIT_PRECISION = 10;
|
|
@@ -5371,7 +5437,7 @@ function minWidthForText(fit) {
|
|
|
5371
5437
|
return roundUpForCommit(fit.longestWord + fit.padding * 2);
|
|
5372
5438
|
}
|
|
5373
5439
|
function minHeightForText(fit, width) {
|
|
5374
|
-
const lines =
|
|
5440
|
+
const lines = chunkSKGJXCAO_cjs.wrapText(fit.rawText, Math.max(0, width - fit.padding * 2), fit.fontSize);
|
|
5375
5441
|
return roundUpForCommit(lines.length * fit.fontSize * fit.lineHeight + fit.padding * 2);
|
|
5376
5442
|
}
|
|
5377
5443
|
|
|
@@ -5505,7 +5571,7 @@ function applyRectBounds(rect, kind, bounds) {
|
|
|
5505
5571
|
rect.setAttribute("width", String(bounds.width));
|
|
5506
5572
|
rect.setAttribute("height", String(bounds.height));
|
|
5507
5573
|
if (kind === "pill") {
|
|
5508
|
-
rect.setAttribute("rx", String(
|
|
5574
|
+
rect.setAttribute("rx", String(chunkSKGJXCAO_cjs.pillCornerRadius(bounds.width, bounds.height)));
|
|
5509
5575
|
}
|
|
5510
5576
|
}
|
|
5511
5577
|
function applyEllipseBounds(ellipse, bounds) {
|
|
@@ -5515,7 +5581,7 @@ function applyEllipseBounds(ellipse, bounds) {
|
|
|
5515
5581
|
ellipse.setAttribute("ry", String(bounds.height / 2));
|
|
5516
5582
|
}
|
|
5517
5583
|
function applySymbolBounds(path, bounds) {
|
|
5518
|
-
const raw = path.getAttribute(
|
|
5584
|
+
const raw = path.getAttribute(chunkSKGJXCAO_cjs.SYMBOL_POINTS_ATTR);
|
|
5519
5585
|
if (!raw) {
|
|
5520
5586
|
return false;
|
|
5521
5587
|
}
|
|
@@ -5523,22 +5589,22 @@ function applySymbolBounds(path, bounds) {
|
|
|
5523
5589
|
x: bounds.x + x * bounds.width,
|
|
5524
5590
|
y: bounds.y + y * bounds.height
|
|
5525
5591
|
}));
|
|
5526
|
-
const tension = Number(path.getAttribute(
|
|
5527
|
-
path.setAttribute("d",
|
|
5592
|
+
const tension = Number(path.getAttribute(chunkSKGJXCAO_cjs.SYMBOL_TENSION_ATTR)) || 0;
|
|
5593
|
+
path.setAttribute("d", chunkSKGJXCAO_cjs.freeformPathData({ points, tension, closed: true }));
|
|
5528
5594
|
return true;
|
|
5529
5595
|
}
|
|
5530
5596
|
function applyPathBounds(path, kind, bounds) {
|
|
5531
5597
|
if (kind === "symbol" && applySymbolBounds(path, bounds)) {
|
|
5532
5598
|
return;
|
|
5533
5599
|
}
|
|
5534
|
-
const pathData =
|
|
5600
|
+
const pathData = chunkSKGJXCAO_cjs.localShapePath(kind, bounds.x, bounds.y, bounds.width, bounds.height);
|
|
5535
5601
|
if (pathData) {
|
|
5536
5602
|
path.setAttribute("d", pathData);
|
|
5537
5603
|
}
|
|
5538
5604
|
}
|
|
5539
5605
|
function applyFrameBoundaryBounds(path, bounds) {
|
|
5540
|
-
const cornerRadius = Number(path.getAttribute(
|
|
5541
|
-
const squareCorner = path.getAttribute(
|
|
5606
|
+
const cornerRadius = Number(path.getAttribute(chunkSKGJXCAO_cjs.CORNER_RADIUS_ATTR) ?? 0);
|
|
5607
|
+
const squareCorner = path.getAttribute(chunkSKGJXCAO_cjs.SQUARE_CORNER_ATTR);
|
|
5542
5608
|
const radii = {
|
|
5543
5609
|
topLeft: cornerRadius,
|
|
5544
5610
|
topRight: cornerRadius,
|
|
@@ -5548,7 +5614,7 @@ function applyFrameBoundaryBounds(path, bounds) {
|
|
|
5548
5614
|
if (squareCorner) {
|
|
5549
5615
|
radii[squareCorner] = 0;
|
|
5550
5616
|
}
|
|
5551
|
-
path.setAttribute("d",
|
|
5617
|
+
path.setAttribute("d", chunkSKGJXCAO_cjs.cornersRoundedRectPath(bounds.x, bounds.y, bounds.width, bounds.height, radii));
|
|
5552
5618
|
}
|
|
5553
5619
|
function applySingleNodeBounds(primary, kind, bounds) {
|
|
5554
5620
|
const tag = primary.tagName.toLowerCase();
|
|
@@ -5558,7 +5624,7 @@ function applySingleNodeBounds(primary, kind, bounds) {
|
|
|
5558
5624
|
applyEllipseBounds(primary, bounds);
|
|
5559
5625
|
} else if (tag === "foreignobject") {
|
|
5560
5626
|
applyRectBounds(primary, null, bounds);
|
|
5561
|
-
} else if (tag === "path" && primary.hasAttribute(
|
|
5627
|
+
} else if (tag === "path" && primary.hasAttribute(chunkSKGJXCAO_cjs.CORNER_RADIUS_ATTR)) {
|
|
5562
5628
|
applyFrameBoundaryBounds(primary, bounds);
|
|
5563
5629
|
} else if (tag === "path" && kind) {
|
|
5564
5630
|
applyPathBounds(primary, kind, bounds);
|
|
@@ -5597,7 +5663,7 @@ function updateSelectionRing(overlay, bounds) {
|
|
|
5597
5663
|
}
|
|
5598
5664
|
function updateSelectionOverlay(overlay, bounds) {
|
|
5599
5665
|
updateSelectionRing(overlay, bounds);
|
|
5600
|
-
for (const [centerX, centerY, name] of
|
|
5666
|
+
for (const [centerX, centerY, name] of chunk3OF37CZX_cjs.resizeHandlePositions(bounds)) {
|
|
5601
5667
|
const handle = overlay.querySelector(`[data-sf-resize-handle="${name}"]`);
|
|
5602
5668
|
if (!handle) {
|
|
5603
5669
|
continue;
|
|
@@ -5614,7 +5680,7 @@ function replaceTextLines(textElement, lines, x, lineHeight) {
|
|
|
5614
5680
|
textElement.removeChild(textElement.firstChild);
|
|
5615
5681
|
}
|
|
5616
5682
|
lines.forEach((line, index) => {
|
|
5617
|
-
const tspan = document.createElementNS(
|
|
5683
|
+
const tspan = document.createElementNS(chunk3OF37CZX_cjs.SVG_NAMESPACE, "tspan");
|
|
5618
5684
|
tspan.setAttribute("x", String(x));
|
|
5619
5685
|
if (index > 0) {
|
|
5620
5686
|
tspan.setAttribute("dy", `${lineHeight}px`);
|
|
@@ -5634,7 +5700,7 @@ function applyLiveText(textElement, rawText, bounds, strokeWidth) {
|
|
|
5634
5700
|
const height = Math.max(0, bounds.height - padding * 2);
|
|
5635
5701
|
const boxX = bounds.x + padding;
|
|
5636
5702
|
const boxY = bounds.y + padding;
|
|
5637
|
-
const lines =
|
|
5703
|
+
const lines = chunkSKGJXCAO_cjs.wrapText(rawText, width, fontSize);
|
|
5638
5704
|
const linePixels = fontSize * lineHeight;
|
|
5639
5705
|
const contentHeight = lines.length * linePixels;
|
|
5640
5706
|
const firstY = verticalAlign === "top" ? boxY + fontSize : verticalAlign === "bottom" ? boxY + height - contentHeight + fontSize : boxY + (height - contentHeight) / 2 + fontSize;
|
|
@@ -5647,7 +5713,7 @@ function applyLiveText(textElement, rawText, bounds, strokeWidth) {
|
|
|
5647
5713
|
|
|
5648
5714
|
// src/runtime/interaction/resize/preview.ts
|
|
5649
5715
|
function textBoundsFor(kind, bounds) {
|
|
5650
|
-
return kind === "person" ?
|
|
5716
|
+
return kind === "person" ? chunkSKGJXCAO_cjs.personLabelArea(bounds.x, bounds.y, bounds.width, bounds.height) : bounds;
|
|
5651
5717
|
}
|
|
5652
5718
|
function applyGeometryPreview(drag, bounds) {
|
|
5653
5719
|
if (drag.isComposite) {
|
|
@@ -5671,7 +5737,7 @@ function applyResizePreview(drag, bounds) {
|
|
|
5671
5737
|
applyLiveText(drag.text.el, drag.text.rawText, textBoundsFor(drag.kind, bounds), drag.text.strokeWidth);
|
|
5672
5738
|
}
|
|
5673
5739
|
if (drag.bubbles) {
|
|
5674
|
-
|
|
5740
|
+
chunk3OF37CZX_cjs.updateQuickDuplicateBubbles(drag.bubbles, bounds);
|
|
5675
5741
|
}
|
|
5676
5742
|
updateLiveLinks(drag.liveLinks, bounds);
|
|
5677
5743
|
}
|
|
@@ -5692,9 +5758,9 @@ function snapResize(svg, drag, pointer) {
|
|
|
5692
5758
|
};
|
|
5693
5759
|
}
|
|
5694
5760
|
const axes = HANDLE_AXES[drag.handle];
|
|
5695
|
-
const candidates = nearestCandidates(proposed,
|
|
5761
|
+
const candidates = nearestCandidates(proposed, chunk3OF37CZX_cjs.findSnapCandidateBounds(svg, /* @__PURE__ */ new Set([drag.owner.id])));
|
|
5696
5762
|
const snap = computeSnap(proposed, candidates, {
|
|
5697
|
-
threshold: snapDistancePx(svg) /
|
|
5763
|
+
threshold: snapDistancePx(svg) / chunk3OF37CZX_cjs.pxPerUnit(svg),
|
|
5698
5764
|
activeX: resizeActivePoints(axes.x),
|
|
5699
5765
|
activeY: resizeActivePoints(axes.y),
|
|
5700
5766
|
guideOverhang: GUIDE_OVERHANG3
|
|
@@ -5735,13 +5801,13 @@ function selectResizeTarget(svg, event) {
|
|
|
5735
5801
|
if (!ownerId) {
|
|
5736
5802
|
return null;
|
|
5737
5803
|
}
|
|
5738
|
-
const primary =
|
|
5739
|
-
const owner = primary &&
|
|
5804
|
+
const primary = chunk3OF37CZX_cjs.findOwnerNode(svg, ownerId, chunk3OF37CZX_cjs.isPrimary);
|
|
5805
|
+
const owner = primary && chunk3OF37CZX_cjs.resolveOwner(primary);
|
|
5740
5806
|
if (!primary || !hasEditableGeometry(owner)) {
|
|
5741
5807
|
return null;
|
|
5742
5808
|
}
|
|
5743
|
-
const nodes =
|
|
5744
|
-
const geometryNodes = isCompositeOwner(owner) ? nodes : nodes.filter((node) => !
|
|
5809
|
+
const nodes = chunk3OF37CZX_cjs.findAllOwnerNodes(svg, ownerId);
|
|
5810
|
+
const geometryNodes = isCompositeOwner(owner) ? nodes : nodes.filter((node) => !chunk3OF37CZX_cjs.isTextLabel(node));
|
|
5745
5811
|
if (!geometryNodes.length) {
|
|
5746
5812
|
return null;
|
|
5747
5813
|
}
|
|
@@ -5759,7 +5825,7 @@ function selectResizeTarget(svg, event) {
|
|
|
5759
5825
|
|
|
5760
5826
|
// src/runtime/interaction/resize/textCapture.ts
|
|
5761
5827
|
function captureResizeText(nodes, primary) {
|
|
5762
|
-
const textElement = nodes.find(
|
|
5828
|
+
const textElement = nodes.find(chunk3OF37CZX_cjs.isTextLabel);
|
|
5763
5829
|
const rawText = primary.getAttribute("aria-label");
|
|
5764
5830
|
if (!textElement || !rawText) {
|
|
5765
5831
|
return null;
|
|
@@ -5777,7 +5843,7 @@ function createResizeDragState(svg, event) {
|
|
|
5777
5843
|
if (!selection) {
|
|
5778
5844
|
return null;
|
|
5779
5845
|
}
|
|
5780
|
-
const startBounds =
|
|
5846
|
+
const startBounds = chunk3OF37CZX_cjs.symbolDeclaredBounds(selection.primary) ?? selection.primary.getBBox();
|
|
5781
5847
|
const composite = isCompositeOwner(selection.owner);
|
|
5782
5848
|
const isContainer = CONTAINER_ROLES.has(selection.owner.role);
|
|
5783
5849
|
selection.captureTarget.setPointerCapture?.(event.pointerId);
|
|
@@ -5790,7 +5856,7 @@ function createResizeDragState(svg, event) {
|
|
|
5790
5856
|
isComposite: composite,
|
|
5791
5857
|
geometryNodes: selection.geometryNodes,
|
|
5792
5858
|
insets: selection.geometryNodes.map(
|
|
5793
|
-
(node) => node === selection.primary ? NO_INSET : insetWithin(startBounds,
|
|
5859
|
+
(node) => node === selection.primary ? NO_INSET : insetWithin(startBounds, chunk3OF37CZX_cjs.symbolDeclaredBounds(node) ?? node.getBBox())
|
|
5794
5860
|
),
|
|
5795
5861
|
baseTransforms: selection.geometryNodes.map((node) => node.getAttribute("transform")),
|
|
5796
5862
|
overlay: selection.overlay,
|
|
@@ -5816,7 +5882,7 @@ var ResizeSession = class {
|
|
|
5816
5882
|
this.#emitter = emitter;
|
|
5817
5883
|
}
|
|
5818
5884
|
pointerDown = (event) => {
|
|
5819
|
-
if (event.button !== 0 || this.#drag ||
|
|
5885
|
+
if (event.button !== 0 || this.#drag || chunk3OF37CZX_cjs.isCameraGesture(event)) {
|
|
5820
5886
|
return;
|
|
5821
5887
|
}
|
|
5822
5888
|
this.#drag = createResizeDragState(this.#svg, event);
|
|
@@ -5831,7 +5897,7 @@ var ResizeSession = class {
|
|
|
5831
5897
|
const bounds = keepsProportions(drag, event.shiftKey) ? lockAspect(snapped.bounds, drag.startBounds, drag.handle) : snapped.bounds;
|
|
5832
5898
|
const { guides } = snapped;
|
|
5833
5899
|
applyResizePreview(drag, clampResizeToChildren(bounds, drag.childrenBounds));
|
|
5834
|
-
|
|
5900
|
+
chunk3OF37CZX_cjs.updateAlignmentGuides(this.#svg, guides, RESIZE_GUIDE_COLOR);
|
|
5835
5901
|
};
|
|
5836
5902
|
pointerUp = (event) => {
|
|
5837
5903
|
const drag = this.#drag;
|
|
@@ -5840,7 +5906,7 @@ var ResizeSession = class {
|
|
|
5840
5906
|
}
|
|
5841
5907
|
this.#drag = null;
|
|
5842
5908
|
event.target?.releasePointerCapture?.(drag.pointerId);
|
|
5843
|
-
|
|
5909
|
+
chunk3OF37CZX_cjs.clearAlignmentGuides(this.#svg);
|
|
5844
5910
|
if (!drag.moved) {
|
|
5845
5911
|
return;
|
|
5846
5912
|
}
|
|
@@ -5879,7 +5945,7 @@ function resolveSankeyNodeLabelTarget(event) {
|
|
|
5879
5945
|
if (!labelElement) {
|
|
5880
5946
|
return null;
|
|
5881
5947
|
}
|
|
5882
|
-
const owner =
|
|
5948
|
+
const owner = chunk3OF37CZX_cjs.resolveOwner(labelElement);
|
|
5883
5949
|
if (owner?.role !== "chart") {
|
|
5884
5950
|
return null;
|
|
5885
5951
|
}
|
|
@@ -5890,7 +5956,7 @@ function resolveSankeyNodeLabelTarget(event) {
|
|
|
5890
5956
|
return { owner, nodeId, labelElement };
|
|
5891
5957
|
}
|
|
5892
5958
|
function createSankeyNodeLabelEditor(target, emitter, onClose) {
|
|
5893
|
-
const rect =
|
|
5959
|
+
const rect = chunk3OF37CZX_cjs.screenRectOf(target.labelElement);
|
|
5894
5960
|
if (rect.width <= 0 && rect.height <= 0) {
|
|
5895
5961
|
return null;
|
|
5896
5962
|
}
|
|
@@ -5947,7 +6013,7 @@ function clearSankeyNodeDragPreview(drag) {
|
|
|
5947
6013
|
// src/runtime/interaction/sankeyNode/target.ts
|
|
5948
6014
|
var RIBBON_PATH = /^M\s+(-?[\d.]+)\s+(-?[\d.]+)\s+C\s+-?[\d.]+\s+-?[\d.]+\s+-?[\d.]+\s+(-?[\d.]+)\s+(-?[\d.]+)\s+-?[\d.]+\s+L\s+-?[\d.]+\s+(-?[\d.]+)\s+C\s+-?[\d.]+\s+-?[\d.]+\s+-?[\d.]+\s+(-?[\d.]+)\s+-?[\d.]+\s+-?[\d.]+\s+Z$/;
|
|
5949
6015
|
function isNodePointer(event) {
|
|
5950
|
-
return event.button === 0 && !
|
|
6016
|
+
return event.button === 0 && !chunk3OF37CZX_cjs.isCameraGesture(event);
|
|
5951
6017
|
}
|
|
5952
6018
|
function findNodeRect(event) {
|
|
5953
6019
|
return event.target?.closest?.('[data-sf-mark="sankey-node"]');
|
|
@@ -6005,7 +6071,7 @@ function resolveSankeyNodeDrag(svg, event) {
|
|
|
6005
6071
|
if (!rect) {
|
|
6006
6072
|
return null;
|
|
6007
6073
|
}
|
|
6008
|
-
const owner =
|
|
6074
|
+
const owner = chunk3OF37CZX_cjs.resolveOwner(rect);
|
|
6009
6075
|
if (owner?.role !== "chart") {
|
|
6010
6076
|
return null;
|
|
6011
6077
|
}
|
|
@@ -6013,7 +6079,7 @@ function resolveSankeyNodeDrag(svg, event) {
|
|
|
6013
6079
|
if (!nodeId) {
|
|
6014
6080
|
return null;
|
|
6015
6081
|
}
|
|
6016
|
-
const start =
|
|
6082
|
+
const start = chunk3OF37CZX_cjs.pointerUserPoint(svg, event);
|
|
6017
6083
|
if (!start) {
|
|
6018
6084
|
return null;
|
|
6019
6085
|
}
|
|
@@ -6059,7 +6125,7 @@ var SankeyNodeDragSession = class {
|
|
|
6059
6125
|
if (!this.#drag || event.pointerId !== this.#drag.pointerId) {
|
|
6060
6126
|
return;
|
|
6061
6127
|
}
|
|
6062
|
-
const point =
|
|
6128
|
+
const point = chunk3OF37CZX_cjs.pointerUserPoint(this.#svg, event);
|
|
6063
6129
|
if (!point) {
|
|
6064
6130
|
return;
|
|
6065
6131
|
}
|
|
@@ -6073,7 +6139,7 @@ var SankeyNodeDragSession = class {
|
|
|
6073
6139
|
const leadBounds = offsetBounds(drag.originalBounds, rawDx, rawDy);
|
|
6074
6140
|
const candidates = nearestCandidates(leadBounds, drag.siblingBounds);
|
|
6075
6141
|
const snap = computeSnap(leadBounds, candidates, {
|
|
6076
|
-
threshold: SNAP_THRESHOLD_PX /
|
|
6142
|
+
threshold: SNAP_THRESHOLD_PX / chunk3OF37CZX_cjs.pxPerUnit(this.#svg),
|
|
6077
6143
|
activeX: MOVE_ACTIVE_POINTS,
|
|
6078
6144
|
activeY: MOVE_ACTIVE_POINTS,
|
|
6079
6145
|
guideOverhang: GUIDE_OVERHANG4
|
|
@@ -6083,7 +6149,7 @@ var SankeyNodeDragSession = class {
|
|
|
6083
6149
|
drag.lastDx = dx;
|
|
6084
6150
|
drag.lastDy = dy;
|
|
6085
6151
|
updateSankeyNodeDragPreview(drag, dx, dy);
|
|
6086
|
-
|
|
6152
|
+
chunk3OF37CZX_cjs.updateAlignmentGuides(
|
|
6087
6153
|
this.#svg,
|
|
6088
6154
|
[snap.x.guide, snap.y.guide].filter((guide) => guide !== null),
|
|
6089
6155
|
GUIDE_COLOR3
|
|
@@ -6094,7 +6160,7 @@ var SankeyNodeDragSession = class {
|
|
|
6094
6160
|
clearSankeyNodeDragPreview(this.#drag);
|
|
6095
6161
|
}
|
|
6096
6162
|
this.#drag = null;
|
|
6097
|
-
|
|
6163
|
+
chunk3OF37CZX_cjs.clearAlignmentGuides(this.#svg);
|
|
6098
6164
|
}
|
|
6099
6165
|
finish(event) {
|
|
6100
6166
|
if (!this.#drag || event.pointerId !== this.#drag.pointerId) {
|
|
@@ -6104,7 +6170,7 @@ var SankeyNodeDragSession = class {
|
|
|
6104
6170
|
this.#drag = null;
|
|
6105
6171
|
event.target?.releasePointerCapture?.(drag.pointerId);
|
|
6106
6172
|
clearSankeyNodeDragPreview(drag);
|
|
6107
|
-
|
|
6173
|
+
chunk3OF37CZX_cjs.clearAlignmentGuides(this.#svg);
|
|
6108
6174
|
if (!drag.moved) {
|
|
6109
6175
|
return;
|
|
6110
6176
|
}
|
|
@@ -6160,7 +6226,7 @@ function bindSankeyNode(viewer, emitter) {
|
|
|
6160
6226
|
var FALLBACK_WIDTH = 120;
|
|
6161
6227
|
var FALLBACK_HEIGHT = 28;
|
|
6162
6228
|
function centeredLabelRect(primaryNode) {
|
|
6163
|
-
const primaryRect =
|
|
6229
|
+
const primaryRect = chunk3OF37CZX_cjs.screenRectOf(primaryNode);
|
|
6164
6230
|
return {
|
|
6165
6231
|
left: primaryRect.left + (primaryRect.width - FALLBACK_WIDTH) / 2,
|
|
6166
6232
|
top: primaryRect.top + (primaryRect.height - FALLBACK_HEIGHT) / 2,
|
|
@@ -6170,10 +6236,10 @@ function centeredLabelRect(primaryNode) {
|
|
|
6170
6236
|
}
|
|
6171
6237
|
function resolveTextEditRect(owner, textNode, primaryNode) {
|
|
6172
6238
|
if (owner.role === "shape") {
|
|
6173
|
-
return primaryNode ?
|
|
6239
|
+
return primaryNode ? chunk3OF37CZX_cjs.screenRectOf(primaryNode) : null;
|
|
6174
6240
|
}
|
|
6175
6241
|
if (textNode) {
|
|
6176
|
-
return
|
|
6242
|
+
return chunk3OF37CZX_cjs.screenRectOf(textNode);
|
|
6177
6243
|
}
|
|
6178
6244
|
return primaryNode ? centeredLabelRect(primaryNode) : null;
|
|
6179
6245
|
}
|
|
@@ -6193,8 +6259,8 @@ function textAlign(owner, textNode) {
|
|
|
6193
6259
|
return anchor === "end" ? "right" : "left";
|
|
6194
6260
|
}
|
|
6195
6261
|
function createActiveTextEditor(svg, owner, emitter, onClose) {
|
|
6196
|
-
const textNode =
|
|
6197
|
-
const primaryNode =
|
|
6262
|
+
const textNode = chunk3OF37CZX_cjs.findOwnerNode(svg, owner.id, chunk3OF37CZX_cjs.isTextLabel);
|
|
6263
|
+
const primaryNode = chunk3OF37CZX_cjs.findOwnerNode(svg, owner.id, chunk3OF37CZX_cjs.isPrimary);
|
|
6198
6264
|
const rect = resolveTextEditRect(owner, textNode, primaryNode);
|
|
6199
6265
|
if (!rect) {
|
|
6200
6266
|
return null;
|
|
@@ -6240,7 +6306,7 @@ function isFrameTitle(target) {
|
|
|
6240
6306
|
}
|
|
6241
6307
|
function resolveEditableTextOwner(event) {
|
|
6242
6308
|
const target = event.target;
|
|
6243
|
-
const owner =
|
|
6309
|
+
const owner = chunk3OF37CZX_cjs.resolveOwner(target);
|
|
6244
6310
|
if (!owner) {
|
|
6245
6311
|
return null;
|
|
6246
6312
|
}
|
|
@@ -6381,7 +6447,7 @@ function applyToken(target, lines, token) {
|
|
|
6381
6447
|
function maskSource(lines) {
|
|
6382
6448
|
let tokens;
|
|
6383
6449
|
try {
|
|
6384
|
-
tokens =
|
|
6450
|
+
tokens = chunkSKGJXCAO_cjs.tokenizeSource(lines.join("\n"));
|
|
6385
6451
|
} catch {
|
|
6386
6452
|
return null;
|
|
6387
6453
|
}
|
|
@@ -6413,7 +6479,7 @@ function braceDelta(masked) {
|
|
|
6413
6479
|
}
|
|
6414
6480
|
|
|
6415
6481
|
// src/runtime/interaction/sflPatch/scan/blocks.ts
|
|
6416
|
-
var OWNER_HEADER = /^\s*(Entity|Shape|Text|Image|Container|Chart|Path|Link|Isometric|Widget|Component|Connection|Shader)\s+([A-Za-z_][A-Za-z0-9_]*)\b/;
|
|
6482
|
+
var OWNER_HEADER = /^\s*(Entity|Shape|Text|Image|Container|Screen|Chart|Path|Link|Isometric|Widget|Component|Connection|Shader)\s+([A-Za-z_][A-Za-z0-9_]*)\b/;
|
|
6417
6483
|
var VALID_IDENT = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
6418
6484
|
function blockEndIn(masked, startLine) {
|
|
6419
6485
|
let depth = 0;
|
|
@@ -6529,8 +6595,8 @@ function parsePropertyPath(path) {
|
|
|
6529
6595
|
return null;
|
|
6530
6596
|
}
|
|
6531
6597
|
const blocks = [];
|
|
6532
|
-
for (const
|
|
6533
|
-
const block = parseBlockSegment(
|
|
6598
|
+
for (const segment2 of segments.slice(0, -1)) {
|
|
6599
|
+
const block = parseBlockSegment(segment2);
|
|
6534
6600
|
if (block === null) {
|
|
6535
6601
|
return null;
|
|
6536
6602
|
}
|
|
@@ -6538,15 +6604,15 @@ function parsePropertyPath(path) {
|
|
|
6538
6604
|
}
|
|
6539
6605
|
return { blocks, property };
|
|
6540
6606
|
}
|
|
6541
|
-
function parseBlockSegment(
|
|
6542
|
-
const match =
|
|
6607
|
+
function parseBlockSegment(segment2) {
|
|
6608
|
+
const match = segment2.match(BLOCK_SEGMENT);
|
|
6543
6609
|
if (!match) {
|
|
6544
6610
|
return null;
|
|
6545
6611
|
}
|
|
6546
6612
|
return match[2] === void 0 ? { name: match[1] } : { name: match[1], id: match[2] };
|
|
6547
6613
|
}
|
|
6548
|
-
function parsePropertySegment(
|
|
6549
|
-
const match =
|
|
6614
|
+
function parsePropertySegment(segment2) {
|
|
6615
|
+
const match = segment2.match(PROPERTY_SEGMENT);
|
|
6550
6616
|
if (!match) {
|
|
6551
6617
|
return null;
|
|
6552
6618
|
}
|
|
@@ -6717,7 +6783,7 @@ function resolveCanvasObjectInsertionTarget(sfl, lines, parentId) {
|
|
|
6717
6783
|
const modelRange = findFirstBlockOfKind(lines, "Model");
|
|
6718
6784
|
return modelRange ? { range: modelRange, origin: { x: 0, y: 0 } } : null;
|
|
6719
6785
|
}
|
|
6720
|
-
const parent =
|
|
6786
|
+
const parent = chunkSKGJXCAO_cjs.sflToCanvasState(sfl).canvasObjects.find((canvasObject) => canvasObject.id === parentId);
|
|
6721
6787
|
if (!parent) {
|
|
6722
6788
|
return null;
|
|
6723
6789
|
}
|
|
@@ -6885,6 +6951,42 @@ function outermostRemovalRanges(ranges) {
|
|
|
6885
6951
|
}
|
|
6886
6952
|
|
|
6887
6953
|
// src/runtime/interaction/sflPatch/canvasObjectPatch/remove.ts
|
|
6954
|
+
var GROUP_HEADER = /^\s*Group\s+([A-Za-z_][A-Za-z0-9_]*)\b/;
|
|
6955
|
+
var CHILD_BLOCK = /^\s*[A-Z][A-Za-z]*\s+[A-Za-z_]/;
|
|
6956
|
+
function enclosingGroups(lines, line) {
|
|
6957
|
+
const masked = maskLines(lines);
|
|
6958
|
+
if (masked === null) {
|
|
6959
|
+
return [];
|
|
6960
|
+
}
|
|
6961
|
+
const open = [];
|
|
6962
|
+
for (let i = 0; i < line; i++) {
|
|
6963
|
+
const delta = braceDelta(masked[i]);
|
|
6964
|
+
if (delta > 0) {
|
|
6965
|
+
const group = masked[i].match(GROUP_HEADER);
|
|
6966
|
+
open.push(group ? group[1] : null);
|
|
6967
|
+
for (let extra = 1; extra < delta; extra++) {
|
|
6968
|
+
open.push(null);
|
|
6969
|
+
}
|
|
6970
|
+
} else {
|
|
6971
|
+
open.splice(open.length + delta, -delta);
|
|
6972
|
+
}
|
|
6973
|
+
}
|
|
6974
|
+
return open.filter((name) => name !== null).reverse();
|
|
6975
|
+
}
|
|
6976
|
+
function removeEmptiedGroups(lines, groups) {
|
|
6977
|
+
for (const name of groups) {
|
|
6978
|
+
const masked = maskLines(lines);
|
|
6979
|
+
const start = masked?.findIndex((line) => line.match(GROUP_HEADER)?.[1] === name) ?? -1;
|
|
6980
|
+
if (!masked || start < 0) {
|
|
6981
|
+
return;
|
|
6982
|
+
}
|
|
6983
|
+
const end = blockEndLine(lines, start);
|
|
6984
|
+
if (masked.slice(start + 1, end).some((line) => CHILD_BLOCK.test(line))) {
|
|
6985
|
+
return;
|
|
6986
|
+
}
|
|
6987
|
+
lines.splice(start, end - start + 1);
|
|
6988
|
+
}
|
|
6989
|
+
}
|
|
6888
6990
|
function removeCanvasObject(sfl, id, options = {}) {
|
|
6889
6991
|
const lines = sfl.split("\n");
|
|
6890
6992
|
const canvasObjectRange = findOwnerBlock(lines, id);
|
|
@@ -6900,6 +7002,7 @@ function removeCanvasObject(sfl, id, options = {}) {
|
|
|
6900
7002
|
}
|
|
6901
7003
|
return sfl;
|
|
6902
7004
|
}
|
|
7005
|
+
const groups = enclosingGroups(lines, canvasObjectRange.start);
|
|
6903
7006
|
const ranges = [canvasObjectRange];
|
|
6904
7007
|
if (options.alsoRemoveLinks ?? true) {
|
|
6905
7008
|
ranges.push(...findReferencingLinkRanges(lines, id));
|
|
@@ -6908,6 +7011,7 @@ function removeCanvasObject(sfl, id, options = {}) {
|
|
|
6908
7011
|
for (const range of removalRanges) {
|
|
6909
7012
|
lines.splice(range.start, range.end - range.start + 1);
|
|
6910
7013
|
}
|
|
7014
|
+
removeEmptiedGroups(lines, groups);
|
|
6911
7015
|
return lines.join("\n");
|
|
6912
7016
|
}
|
|
6913
7017
|
|
|
@@ -7244,7 +7348,7 @@ function movePathPoints(lines, range, dx, dy) {
|
|
|
7244
7348
|
replacePropertyValue(lines, span, shifted);
|
|
7245
7349
|
}
|
|
7246
7350
|
function applyMoveChanges(sfl, events) {
|
|
7247
|
-
const state =
|
|
7351
|
+
const state = chunkSKGJXCAO_cjs.sflToCanvasState(sfl);
|
|
7248
7352
|
const lines = sfl.split("\n");
|
|
7249
7353
|
const parents = new Map(state.canvasObjects.map((candidate) => [candidate.id, candidate.parentFrameId]));
|
|
7250
7354
|
const moving = new Set(events.map((event) => event.owner.id));
|
|
@@ -7284,7 +7388,7 @@ function applyMoveChange(sfl, event) {
|
|
|
7284
7388
|
|
|
7285
7389
|
// src/runtime/interaction/sflPatch/changes/pathPointChange.ts
|
|
7286
7390
|
function applyPathPointChange(sfl, event) {
|
|
7287
|
-
const canvasObjects =
|
|
7391
|
+
const canvasObjects = chunkSKGJXCAO_cjs.sflToCanvasState(sfl).canvasObjects;
|
|
7288
7392
|
const canvasObject = canvasObjects.find((candidate) => candidate.id === event.owner.id);
|
|
7289
7393
|
if (!canvasObject) {
|
|
7290
7394
|
return sfl;
|
|
@@ -7438,7 +7542,7 @@ function resolveConnectionInsertionTarget(sfl, lines, options) {
|
|
|
7438
7542
|
if (!VALID_IDENT.test(options.id) || nameExists(lines, options.id)) {
|
|
7439
7543
|
return null;
|
|
7440
7544
|
}
|
|
7441
|
-
const canvasObjects =
|
|
7545
|
+
const canvasObjects = chunkSKGJXCAO_cjs.sflToCanvasState(sfl).canvasObjects;
|
|
7442
7546
|
const hasSource = canvasObjects.some((canvasObject) => canvasObject.id === options.fromId);
|
|
7443
7547
|
const hasTarget = canvasObjects.some((canvasObject) => canvasObject.id === options.toId);
|
|
7444
7548
|
if (!hasSource || !hasTarget) {
|
|
@@ -7502,13 +7606,13 @@ function isometricOffset(direction, object, gap) {
|
|
|
7502
7606
|
const { depth } = object.isometric;
|
|
7503
7607
|
switch (direction) {
|
|
7504
7608
|
case "iso-width-pos":
|
|
7505
|
-
return { dx: (width + gap) *
|
|
7609
|
+
return { dx: (width + gap) * chunkSKGJXCAO_cjs.AXIS_COS, dy: (width + gap) * chunkSKGJXCAO_cjs.AXIS_SIN };
|
|
7506
7610
|
case "iso-width-neg":
|
|
7507
|
-
return { dx: -(width + gap) *
|
|
7611
|
+
return { dx: -(width + gap) * chunkSKGJXCAO_cjs.AXIS_COS, dy: -(width + gap) * chunkSKGJXCAO_cjs.AXIS_SIN };
|
|
7508
7612
|
case "iso-depth-pos":
|
|
7509
|
-
return { dx: -(depth + gap) *
|
|
7613
|
+
return { dx: -(depth + gap) * chunkSKGJXCAO_cjs.AXIS_COS, dy: (depth + gap) * chunkSKGJXCAO_cjs.AXIS_SIN };
|
|
7510
7614
|
case "iso-depth-neg":
|
|
7511
|
-
return { dx: (depth + gap) *
|
|
7615
|
+
return { dx: (depth + gap) * chunkSKGJXCAO_cjs.AXIS_COS, dy: -(depth + gap) * chunkSKGJXCAO_cjs.AXIS_SIN };
|
|
7512
7616
|
case "iso-height-pos":
|
|
7513
7617
|
return { dx: 0, dy: height + gap };
|
|
7514
7618
|
case "iso-height-neg":
|
|
@@ -7571,7 +7675,7 @@ function resolveLinkInsertionTarget(sfl, lines, options) {
|
|
|
7571
7675
|
if (!VALID_IDENT.test(options.id) || nameExists(lines, options.id)) {
|
|
7572
7676
|
return null;
|
|
7573
7677
|
}
|
|
7574
|
-
const canvasObjects =
|
|
7678
|
+
const canvasObjects = chunkSKGJXCAO_cjs.sflToCanvasState(sfl).canvasObjects;
|
|
7575
7679
|
const hasSource = canvasObjects.some((canvasObject) => canvasObject.id === options.fromId);
|
|
7576
7680
|
const hasTarget = canvasObjects.some((canvasObject) => canvasObject.id === options.toId);
|
|
7577
7681
|
if (!hasSource || !hasTarget) {
|
|
@@ -7657,21 +7761,21 @@ function duplicateShape(sfl, input) {
|
|
|
7657
7761
|
|
|
7658
7762
|
// src/runtime/interaction/sflPatch/changes/quickDuplicateChange.ts
|
|
7659
7763
|
function applyQuickDuplicateChange(sfl, event, options) {
|
|
7660
|
-
const state =
|
|
7764
|
+
const state = chunkSKGJXCAO_cjs.sflToCanvasState(sfl);
|
|
7661
7765
|
const object = state.canvasObjects.find((candidate) => candidate.id === event.owner.id);
|
|
7662
7766
|
if (!object) {
|
|
7663
7767
|
return sfl;
|
|
7664
7768
|
}
|
|
7665
7769
|
const { direction } = event;
|
|
7666
7770
|
if (isIsometricDirection2(direction)) {
|
|
7667
|
-
return
|
|
7771
|
+
return chunkSKGJXCAO_cjs.isIsometricObject(object) ? duplicateIsometricObject(sfl, object, direction, options) : sfl;
|
|
7668
7772
|
}
|
|
7669
|
-
return
|
|
7773
|
+
return chunkSKGJXCAO_cjs.isIsometricObject(object) ? sfl : duplicateShape(sfl, { object, links: state.links, side: direction, options });
|
|
7670
7774
|
}
|
|
7671
7775
|
|
|
7672
7776
|
// src/runtime/interaction/sflPatch/changes/resizeChange.ts
|
|
7673
7777
|
function applyResizeChange(sfl, event) {
|
|
7674
|
-
const state =
|
|
7778
|
+
const state = chunkSKGJXCAO_cjs.sflToCanvasState(sfl);
|
|
7675
7779
|
const canvasObject = state.canvasObjects.find((candidate) => candidate.id === event.owner.id);
|
|
7676
7780
|
const parent = canvasObject?.parentFrameId ? state.canvasObjects.find((candidate) => candidate.id === canvasObject.parentFrameId) : void 0;
|
|
7677
7781
|
const originX = parent?.x ?? 0;
|