geoiq-frontend-ui-kit 2.0.2 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/organisms/image-editor/components/line-session-bar.d.ts +20 -0
- package/dist/components/organisms/image-editor/components/line-session-bar.d.ts.map +1 -0
- package/dist/components/organisms/image-editor/components/panel-insert.d.ts.map +1 -1
- package/dist/components/organisms/image-editor/components/panel-selected.d.ts.map +1 -1
- package/dist/components/organisms/image-editor/components/panel.d.ts.map +1 -1
- package/dist/components/organisms/image-editor/components/saved-layers-list.d.ts +9 -0
- package/dist/components/organisms/image-editor/components/saved-layers-list.d.ts.map +1 -0
- package/dist/components/organisms/image-editor/image-editor-modal.d.ts.map +1 -1
- package/dist/components/organisms/image-editor/image-editor.types.d.ts +73 -0
- package/dist/components/organisms/image-editor/image-editor.types.d.ts.map +1 -1
- package/dist/components/organisms/image-editor/use-image-editor.d.ts.map +1 -1
- package/dist/components/ui/request-credits-view/component/request-credit-dialog.d.ts.map +1 -1
- package/dist/index.es100.js +147 -120
- package/dist/index.es100.js.map +1 -1
- package/dist/index.es101.js +16 -11
- package/dist/index.es101.js.map +1 -1
- package/dist/index.es102.js +7 -41
- package/dist/index.es102.js.map +1 -1
- package/dist/index.es103.js +21 -10
- package/dist/index.es103.js.map +1 -1
- package/dist/index.es104.js +7 -74
- package/dist/index.es104.js.map +1 -1
- package/dist/index.es105.js +177 -30
- package/dist/index.es105.js.map +1 -1
- package/dist/index.es106.js +45 -16
- package/dist/index.es106.js.map +1 -1
- package/dist/index.es107.js +42 -20
- package/dist/index.es107.js.map +1 -1
- package/dist/index.es108.js +22 -12
- package/dist/index.es108.js.map +1 -1
- package/dist/index.es109.js +122 -98
- package/dist/index.es109.js.map +1 -1
- package/dist/index.es11.js +1 -1
- package/dist/index.es110.js +33 -62
- package/dist/index.es110.js.map +1 -1
- package/dist/index.es111.js +60 -52
- package/dist/index.es111.js.map +1 -1
- package/dist/index.es112.js +10 -41
- package/dist/index.es112.js.map +1 -1
- package/dist/index.es113.js +21 -11
- package/dist/index.es113.js.map +1 -1
- package/dist/index.es114.js +42 -92
- package/dist/index.es114.js.map +1 -1
- package/dist/index.es115.js +37 -16
- package/dist/index.es115.js.map +1 -1
- package/dist/index.es116.js +12 -99
- package/dist/index.es116.js.map +1 -1
- package/dist/index.es117.js +92 -13
- package/dist/index.es117.js.map +1 -1
- package/dist/index.es118.js +13 -101
- package/dist/index.es118.js.map +1 -1
- package/dist/index.es119.js +71 -20
- package/dist/index.es119.js.map +1 -1
- package/dist/index.es12.js +1 -1
- package/dist/index.es120.js +34 -25
- package/dist/index.es120.js.map +1 -1
- package/dist/index.es121.js +20 -22
- package/dist/index.es121.js.map +1 -1
- package/dist/index.es122.js +16 -45
- package/dist/index.es122.js.map +1 -1
- package/dist/index.es123.js +11 -34
- package/dist/index.es123.js.map +1 -1
- package/dist/index.es124.js +96 -61
- package/dist/index.es124.js.map +1 -1
- package/dist/index.es125.js +57 -174
- package/dist/index.es125.js.map +1 -1
- package/dist/index.es126.js +50 -17
- package/dist/index.es126.js.map +1 -1
- package/dist/index.es127.js +2 -2
- package/dist/index.es128.js +2 -2
- package/dist/index.es129.js +1 -1
- package/dist/index.es130.js +1 -1
- package/dist/index.es131.js +2 -2
- package/dist/index.es132.js +35 -38
- package/dist/index.es132.js.map +1 -1
- package/dist/index.es133.js +41 -7
- package/dist/index.es133.js.map +1 -1
- package/dist/index.es134.js +88 -7
- package/dist/index.es134.js.map +1 -1
- package/dist/index.es135.js +14 -34
- package/dist/index.es135.js.map +1 -1
- package/dist/index.es136.js +269 -35
- package/dist/index.es136.js.map +1 -1
- package/dist/index.es137.js +7 -2
- package/dist/index.es137.js.map +1 -1
- package/dist/index.es138.js +23 -25
- package/dist/index.es138.js.map +1 -1
- package/dist/index.es139.js +169 -15
- package/dist/index.es139.js.map +1 -1
- package/dist/index.es140.js +82 -7
- package/dist/index.es140.js.map +1 -1
- package/dist/index.es141.js +73 -21
- package/dist/index.es141.js.map +1 -1
- package/dist/index.es142.js +3 -168
- package/dist/index.es142.js.map +1 -1
- package/dist/index.es143.js +56 -82
- package/dist/index.es143.js.map +1 -1
- package/dist/index.es144.js +119 -4
- package/dist/index.es144.js.map +1 -1
- package/dist/index.es145.js +405 -56
- package/dist/index.es145.js.map +1 -1
- package/dist/index.es146.js +25 -110
- package/dist/index.es146.js.map +1 -1
- package/dist/index.es147.js +60 -314
- package/dist/index.es147.js.map +1 -1
- package/dist/index.es148.js +29 -24
- package/dist/index.es148.js.map +1 -1
- package/dist/index.es149.js +21 -64
- package/dist/index.es149.js.map +1 -1
- package/dist/index.es150.js +36 -30
- package/dist/index.es150.js.map +1 -1
- package/dist/index.es151.js +211 -24
- package/dist/index.es151.js.map +1 -1
- package/dist/index.es152.js +141 -35
- package/dist/index.es152.js.map +1 -1
- package/dist/index.es153.js +141 -140
- package/dist/index.es153.js.map +1 -1
- package/dist/index.es154.js +45 -142
- package/dist/index.es154.js.map +1 -1
- package/dist/index.es155.js +353 -45
- package/dist/index.es155.js.map +1 -1
- package/dist/index.es156.js +14 -10
- package/dist/index.es156.js.map +1 -1
- package/dist/index.es157.js +10 -42
- package/dist/index.es157.js.map +1 -1
- package/dist/index.es158.js +44 -5
- package/dist/index.es158.js.map +1 -1
- package/dist/index.es159.js +5 -11
- package/dist/index.es159.js.map +1 -1
- package/dist/index.es16.js +1 -1
- package/dist/index.es160.js +10 -10
- package/dist/index.es160.js.map +1 -1
- package/dist/index.es161.js +11 -2
- package/dist/index.es161.js.map +1 -1
- package/dist/index.es162.js +2 -91
- package/dist/index.es162.js.map +1 -1
- package/dist/index.es163.js +2 -213
- package/dist/index.es163.js.map +1 -1
- package/dist/index.es164.js +23 -52
- package/dist/index.es164.js.map +1 -1
- package/dist/index.es165.js +88 -33
- package/dist/index.es165.js.map +1 -1
- package/dist/index.es166.js +52 -31
- package/dist/index.es166.js.map +1 -1
- package/dist/index.es167.js +32 -29
- package/dist/index.es167.js.map +1 -1
- package/dist/index.es168.js +26 -84
- package/dist/index.es168.js.map +1 -1
- package/dist/index.es169.js +27 -111
- package/dist/index.es169.js.map +1 -1
- package/dist/index.es170.js +97 -285
- package/dist/index.es170.js.map +1 -1
- package/dist/index.es171.js +251 -30
- package/dist/index.es171.js.map +1 -1
- package/dist/index.es172.js +63 -11
- package/dist/index.es172.js.map +1 -1
- package/dist/index.es173.js +284 -82
- package/dist/index.es173.js.map +1 -1
- package/dist/index.es174.js +29 -70
- package/dist/index.es174.js.map +1 -1
- package/dist/index.es175.js +10 -114
- package/dist/index.es175.js.map +1 -1
- package/dist/index.es176.js +23 -106
- package/dist/index.es176.js.map +1 -1
- package/dist/index.es177.js +19 -82
- package/dist/index.es177.js.map +1 -1
- package/dist/index.es178.js +63 -109
- package/dist/index.es178.js.map +1 -1
- package/dist/index.es179.js +63 -117
- package/dist/index.es179.js.map +1 -1
- package/dist/index.es180.js +112 -23
- package/dist/index.es180.js.map +1 -1
- package/dist/index.es181.js +103 -18
- package/dist/index.es181.js.map +1 -1
- package/dist/index.es182.js +86 -5
- package/dist/index.es182.js.map +1 -1
- package/dist/index.es183.js +133 -0
- package/dist/index.es183.js.map +1 -0
- package/dist/index.es184.js +133 -0
- package/dist/index.es184.js.map +1 -0
- package/dist/index.es185.js +9 -0
- package/dist/index.es185.js.map +1 -0
- package/dist/index.es19.js +1 -1
- package/dist/index.es2.js +21 -21
- package/dist/index.es2.js.map +1 -1
- package/dist/index.es20.js +1 -1
- package/dist/index.es21.js +3 -3
- package/dist/index.es22.js +1 -1
- package/dist/index.es25.js +1 -1
- package/dist/index.es27.js +1 -1
- package/dist/index.es28.js +2 -2
- package/dist/index.es30.js +1 -1
- package/dist/index.es32.js +1 -1
- package/dist/index.es33.js +1 -1
- package/dist/index.es45.js +48 -46
- package/dist/index.es45.js.map +1 -1
- package/dist/index.es46.js +2 -2
- package/dist/index.es47.js +1 -1
- package/dist/index.es48.js +1 -1
- package/dist/index.es53.js +1 -1
- package/dist/index.es54.js +1 -1
- package/dist/index.es57.js +1 -1
- package/dist/index.es59.js +1 -1
- package/dist/index.es67.js +2 -2
- package/dist/index.es68.js +1 -1
- package/dist/index.es71.js +1 -1
- package/dist/index.es72.js +7 -7
- package/dist/index.es73.js +2 -2
- package/dist/index.es85.js +1 -1
- package/dist/index.es97.js +16 -11
- package/dist/index.es97.js.map +1 -1
- package/dist/index.es98.js +89 -262
- package/dist/index.es98.js.map +1 -1
- package/dist/index.es99.js +13 -87
- package/dist/index.es99.js.map +1 -1
- package/dist/styles.css +55 -0
- package/package.json +2 -1
package/dist/index.es155.js
CHANGED
|
@@ -1,50 +1,358 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"lostpointercapture",
|
|
12
|
-
(r) => t(e, r)
|
|
13
|
-
), e.overlayEl.addEventListener("pointerdown", (r) => {
|
|
14
|
-
r.preventDefault(), r.isPrimary && e.panPointers?.size && c(e), !C(e, r) && u(e, r);
|
|
15
|
-
}), e.overlayEl.addEventListener("pointermove", (r) => {
|
|
16
|
-
r.preventDefault(), !h(e, r) && y(e, r);
|
|
17
|
-
}), e.overlayEl.addEventListener("pointerup", (r) => {
|
|
18
|
-
t(e, r), E(e, r);
|
|
19
|
-
}), e.overlayEl.addEventListener("pointercancel", (r) => {
|
|
20
|
-
c(e), E(e, r);
|
|
21
|
-
}), e.overlayEl.addEventListener("dblclick", (r) => f(e, r));
|
|
22
|
-
const d = () => {
|
|
23
|
-
e.editingLayer && (g(e), l(e, null));
|
|
1
|
+
import { pushHistory as f, popHistory as O } from "./index.es146.js";
|
|
2
|
+
import { emitChange as P } from "./index.es144.js";
|
|
3
|
+
import { MULTI_POINT_SHAPES as R, render as t, paintLayer as S, onRotateHandle as A, layerCenter as b, onResizeHandle as T, isMultiPoint as I, layerBounds as v, DIRECTIONAL_SHAPES as z, rotatePoint as C, clampBoxWidth as W, clampTextSize as _, renderOverlay as g, normRect as F, toLayerSpace as D } from "./index.es145.js";
|
|
4
|
+
import { setMode as k, selectLayer as x } from "./index.es148.js";
|
|
5
|
+
import { openTextEditor as N } from "./index.es149.js";
|
|
6
|
+
function a(n, l) {
|
|
7
|
+
const r = n.dragMode && n.dragRect ? n.dragRect : n.overlayEl.getBoundingClientRect(), o = (l.clientX - r.left) / r.width * n.sourceCanvas.width, e = (l.clientY - r.top) / r.height * n.sourceCanvas.height;
|
|
8
|
+
return {
|
|
9
|
+
x: Math.min(Math.max(o, 0), n.sourceCanvas.width),
|
|
10
|
+
y: Math.min(Math.max(e, 0), n.sourceCanvas.height)
|
|
24
11
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
),
|
|
36
|
-
r.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
12
|
+
}
|
|
13
|
+
function J(n, l) {
|
|
14
|
+
if (!l) return n;
|
|
15
|
+
const r = l * Math.PI / 180, o = Math.abs(Math.cos(r)), e = Math.abs(Math.sin(r)), d = n.w * o + n.h * e, i = n.w * e + n.h * o, c = n.x + n.w / 2, h = n.y + n.h / 2;
|
|
16
|
+
return { x: c - d / 2, y: h - i / 2, w: d, h: i };
|
|
17
|
+
}
|
|
18
|
+
function q(n) {
|
|
19
|
+
return n.type !== "shape" ? 0 : z.includes(n.shape) || n.fill !== "fill" ? (n.width || 0) / 2 : 0;
|
|
20
|
+
}
|
|
21
|
+
function K(n, l) {
|
|
22
|
+
const r = J(v(n, l), l.rotation), o = q(l), e = {
|
|
23
|
+
x: r.x - o,
|
|
24
|
+
y: r.y - o,
|
|
25
|
+
w: r.w + o * 2,
|
|
26
|
+
h: r.h + o * 2
|
|
27
|
+
}, d = Math.min(Math.max(e.x, 0), n.sourceCanvas.width - e.w) - e.x, i = Math.min(Math.max(e.y, 0), n.sourceCanvas.height - e.h) - e.y;
|
|
28
|
+
!d && !i || (l.type === "stroke" ? l.points = l.points.map((c) => ({ x: c.x + d, y: c.y + i })) : (l.x += d, l.y += i));
|
|
29
|
+
}
|
|
30
|
+
function m(n, l) {
|
|
31
|
+
const { layers: r } = n;
|
|
32
|
+
for (let o = r.length - 1; o >= 0; o--) {
|
|
33
|
+
const e = v(n, r[o]), d = D(n, r[o], l);
|
|
34
|
+
if (d.x >= e.x - 6 && d.x <= e.x + e.w + 6 && d.y >= e.y - 6 && d.y <= e.y + e.h + 6)
|
|
35
|
+
return r[o];
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
function H() {
|
|
40
|
+
return typeof window < "u" && window.matchMedia && window.matchMedia("(pointer: coarse)").matches ? 40 : 22;
|
|
41
|
+
}
|
|
42
|
+
const E = Math.PI / 8, B = 4;
|
|
43
|
+
function nn(n) {
|
|
44
|
+
const l = n.pendingPoly;
|
|
45
|
+
if (!l)
|
|
46
|
+
return { active: !1, pointCount: 0, canFinish: !1, canClose: !1 };
|
|
47
|
+
const r = l.layer.points.length;
|
|
48
|
+
return { active: !0, pointCount: r, canFinish: r >= 2, canClose: r >= 3 };
|
|
49
|
+
}
|
|
50
|
+
function L(n, l, r) {
|
|
51
|
+
if (!r || !n) return l;
|
|
52
|
+
const o = l.x - n.x, e = l.y - n.y, d = Math.hypot(o, e);
|
|
53
|
+
if (!d) return l;
|
|
54
|
+
const i = Math.round(Math.atan2(e, o) / E) * E;
|
|
55
|
+
return {
|
|
56
|
+
x: n.x + Math.cos(i) * d,
|
|
57
|
+
y: n.y + Math.sin(i) * d
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function on(n) {
|
|
61
|
+
const l = n.pendingPoly;
|
|
62
|
+
if (l) {
|
|
63
|
+
if (l.layer.points.length <= 1) {
|
|
64
|
+
Z(n);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
l.layer.points.pop(), n.statusText = `${l.layer.points.length} point${l.layer.points.length === 1 ? "" : "s"} — Backspace removes the last`, w(n), n.notify();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function U(n, l, r) {
|
|
71
|
+
n.pendingPoly = { layer: l, preview: r }, l.points = [{ x: r.x, y: r.y }], delete l.w, delete l.h, n.statusText = "Click to add points · double-click to finish · Esc cancels", w(n), n.notify();
|
|
72
|
+
}
|
|
73
|
+
function w(n) {
|
|
74
|
+
const l = n.pendingPoly;
|
|
75
|
+
if (!l) return;
|
|
76
|
+
const r = n.octx, o = l.layer.points;
|
|
77
|
+
r.clearRect(0, 0, n.overlayEl.width, n.overlayEl.height), n.layers.forEach((h) => S(n, r, h));
|
|
78
|
+
const e = {
|
|
79
|
+
...l.layer,
|
|
80
|
+
points: l.preview ? o.concat([l.preview]) : o
|
|
81
|
+
};
|
|
82
|
+
e.points.length >= 2 && S(n, r, e);
|
|
83
|
+
const d = 1 / (n.viewScale || 1), i = 5 * d;
|
|
84
|
+
r.save(), r.lineWidth = 2 * d, o.forEach((h, y) => {
|
|
85
|
+
y !== 0 && (r.beginPath(), r.arc(h.x, h.y, i, 0, Math.PI * 2), r.fillStyle = "#ffffff", r.strokeStyle = l.layer.color, r.fill(), r.stroke());
|
|
86
|
+
});
|
|
87
|
+
const c = o[0];
|
|
88
|
+
if (c) {
|
|
89
|
+
const h = o.length >= 3 && l.preview && Math.hypot(l.preview.x - c.x, l.preview.y - c.y) <= H();
|
|
90
|
+
r.beginPath(), r.arc(c.x, c.y, (h ? 11 : 7) * d, 0, Math.PI * 2), r.fillStyle = h ? l.layer.color : "#ffffff", r.strokeStyle = l.layer.color, r.lineWidth = (h ? 3 : 2) * d, r.fill(), r.stroke(), h && (r.beginPath(), r.arc(c.x, c.y, 4 * d, 0, Math.PI * 2), r.fillStyle = "#ffffff", r.fill());
|
|
91
|
+
}
|
|
92
|
+
r.restore(), V(n, o.length);
|
|
93
|
+
}
|
|
94
|
+
function V(n, l) {
|
|
95
|
+
const r = n.octx, o = 1 / (n.viewScale || 1), e = 10 * o, d = 13 * o, i = typeof window < "u" && window.matchMedia && window.matchMedia("(pointer: coarse)").matches, c = i ? "Tap" : "Click";
|
|
96
|
+
let h;
|
|
97
|
+
l < 2 ? h = `${c} to place the next point` : i ? h = l < 3 ? `${c} to add points · use the bar below to finish` : `${c} the first point to close · or finish below` : h = l < 3 ? "Double-click or Enter to finish · Backspace undoes · Esc cancels" : "Click the first point to close · Double-click to finish · Backspace undoes", r.save(), r.font = `${d}px Avenir Next, Segoe UI, sans-serif`, r.textBaseline = "top";
|
|
98
|
+
const y = r.measureText(h).width;
|
|
99
|
+
r.fillStyle = "rgba(17,17,17,.82)", r.beginPath();
|
|
100
|
+
const p = e, u = e, M = y + e * 2, s = d + e * 1.4;
|
|
101
|
+
r.roundRect ? r.roundRect(p, u, M, s, 6 * o) : r.rect(p, u, M, s), r.fill(), r.fillStyle = "#ffffff", r.fillText(h, p + e, u + e * 0.6), r.restore();
|
|
102
|
+
}
|
|
103
|
+
function rn(n, l) {
|
|
104
|
+
const r = n.layers.find((o) => o.id === n.selectedId);
|
|
105
|
+
!r || r.type !== "shape" || R.includes(r.shape) && (f(n), (!r.points || r.points.length < 2) && (r.points = [
|
|
106
|
+
{ x: r.x, y: r.y },
|
|
107
|
+
{ x: r.x + (r.w || 0), y: r.y + (r.h || 0) }
|
|
108
|
+
]), delete r.w, delete r.h, r.closed = !1, n.selectedId = null, n.mode = "shape", n.multiPointMode = !0, n.pendingPoly = { layer: r, preview: r.points[r.points.length - 1] }, n.statusText = "Continuing line — click to add points · double-click to finish", w(n), n.notify());
|
|
109
|
+
}
|
|
110
|
+
function $(n, l) {
|
|
111
|
+
const r = n.pendingPoly;
|
|
112
|
+
if (!r) return;
|
|
113
|
+
const o = r.layer;
|
|
114
|
+
if (n.pendingPoly = null, o.points.length < 2) {
|
|
115
|
+
n.layers = n.layers.filter((e) => e.id !== o.id), O(n), k(n, "select"), t(n), n.notify();
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
o.closed = !!l, n.layers.some((e) => e.id === o.id) || n.layers.push(o), n.mode = "shape", x(n, o.id), n.statusText = l ? "Shape closed — click to start another" : "Line added — click to start another", t(n), P(n);
|
|
119
|
+
}
|
|
120
|
+
function Z(n) {
|
|
121
|
+
const l = n.pendingPoly;
|
|
122
|
+
l && (n.pendingPoly = null, n.layers = n.layers.filter((r) => r.id !== l.layer.id), O(n), t(n), n.statusText = "Cancelled", n.notify());
|
|
123
|
+
}
|
|
124
|
+
function en(n, l) {
|
|
125
|
+
if (!n.sourceCanvas.width || n.dragMode) return;
|
|
126
|
+
n.overlayEl.setPointerCapture(l.pointerId), n.activePointerId = l.pointerId, n.dragRect = n.overlayEl.getBoundingClientRect();
|
|
127
|
+
const r = a(n, l);
|
|
128
|
+
if (n.pendingPoly) {
|
|
129
|
+
const o = n.pendingPoly.layer.points, e = o[0];
|
|
130
|
+
if (o.length >= 3 && Math.hypot(r.x - e.x, r.y - e.y) <= H()) {
|
|
131
|
+
$(n, !0);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const d = o[o.length - 1], i = L(d, r, l.shiftKey);
|
|
135
|
+
(!d || Math.hypot(i.x - d.x, i.y - d.y) > B) && o.push({ x: i.x, y: i.y }), n.pendingPoly.preview = i, w(n);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
if (n.mode === "select") {
|
|
139
|
+
const o = n.selectedId != null ? n.layers.find((i) => i.id === n.selectedId) : null;
|
|
140
|
+
if (o && A(n, r, o)) {
|
|
141
|
+
const i = b(n, o);
|
|
142
|
+
n.dragMode = "rotate", n.rotateStart = {
|
|
143
|
+
center: i,
|
|
144
|
+
angle: Math.atan2(r.y - i.y, r.x - i.x),
|
|
145
|
+
rotation: o.rotation || 0
|
|
146
|
+
}, f(n);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
const e = o ? T(n, r, o) : null;
|
|
150
|
+
if (e) {
|
|
151
|
+
if (n.dragMode = "resize", n.resizeCorner = e, n.dragStart = r, n.dragOrig = JSON.parse(JSON.stringify(o)), o.type === "shape" && I(o)) {
|
|
152
|
+
const i = v(n, o), c = e === "tl" || e === "bl", h = e === "tl" || e === "tr";
|
|
153
|
+
n.resizeAnchor = {
|
|
154
|
+
x: c ? i.x + i.w : i.x,
|
|
155
|
+
y: h ? i.y + i.h : i.y
|
|
156
|
+
}, n.dragOrig._bounds = {
|
|
157
|
+
w: c ? -i.w : i.w,
|
|
158
|
+
h: h ? -i.h : i.h
|
|
159
|
+
}, n.dragOrig._anchorPt = {
|
|
160
|
+
x: n.resizeAnchor.x,
|
|
161
|
+
y: n.resizeAnchor.y
|
|
162
|
+
};
|
|
163
|
+
} else if (o.type === "shape" && z.includes(o.shape))
|
|
164
|
+
n.resizeAnchor = e === "start" ? { x: o.x + o.w, y: o.y + o.h } : { x: o.x, y: o.y };
|
|
165
|
+
else {
|
|
166
|
+
const i = v(n, o), c = e === "tl" || e === "bl";
|
|
167
|
+
n.resizeAnchor = {
|
|
168
|
+
x: c ? i.x + i.w : i.x,
|
|
169
|
+
// Text keeps its top edge: its height follows the wrapping.
|
|
170
|
+
y: o.type === "text" ? i.y : e === "tl" || e === "tr" ? i.y + i.h : i.y
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
n.resizeCenter = b(n, o), n.resizeAnchorWorld = C(
|
|
174
|
+
n.resizeAnchor,
|
|
175
|
+
n.resizeCenter,
|
|
176
|
+
o.rotation || 0
|
|
177
|
+
), f(n);
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
const d = m(n, r);
|
|
181
|
+
d ? (x(n, d.id), n.dragMode = "move", n.dragStart = r, n.dragOrig = JSON.parse(JSON.stringify(d)), f(n)) : x(n, null);
|
|
182
|
+
} else if (n.mode === "text") {
|
|
183
|
+
f(n);
|
|
184
|
+
const o = {
|
|
185
|
+
id: n.nextId++,
|
|
186
|
+
type: "text",
|
|
187
|
+
text: "Text",
|
|
188
|
+
x: r.x,
|
|
189
|
+
y: r.y,
|
|
190
|
+
size: n.textSize,
|
|
191
|
+
font: n.textFont,
|
|
192
|
+
color: n.textColor,
|
|
193
|
+
rotation: 0,
|
|
194
|
+
flipH: !1,
|
|
195
|
+
flipV: !1,
|
|
196
|
+
boxWidth: 10
|
|
197
|
+
};
|
|
198
|
+
n.octx.font = `${o.size}px ${o.font}`;
|
|
199
|
+
const e = n.octx.measureText(o.text).width;
|
|
200
|
+
o.boxWidth = Math.round(Math.max(700, e + 40)), W(n, o), _(n, o), n.layers.push(o), k(n, "select"), x(n, o.id), N(n, o, !0);
|
|
201
|
+
} else n.mode === "draw" ? (f(n), n.pendingStroke = {
|
|
202
|
+
id: n.nextId++,
|
|
203
|
+
type: "stroke",
|
|
204
|
+
color: n.drawColor,
|
|
205
|
+
width: n.brushSize,
|
|
206
|
+
style: n.brushStyle,
|
|
207
|
+
points: [r]
|
|
208
|
+
}, n.dragMode = "draw") : n.mode === "shape" ? (f(n), n.pendingShape = {
|
|
209
|
+
id: n.nextId++,
|
|
210
|
+
type: "shape",
|
|
211
|
+
shape: n.selectedShapeType,
|
|
212
|
+
fill: n.shapeFill,
|
|
213
|
+
width: n.shapeWidth,
|
|
214
|
+
color: n.shapeColor,
|
|
215
|
+
x: r.x,
|
|
216
|
+
y: r.y,
|
|
217
|
+
w: 0,
|
|
218
|
+
h: 0,
|
|
219
|
+
rotation: 0,
|
|
220
|
+
flipH: !1,
|
|
221
|
+
flipV: !1
|
|
222
|
+
}, n.dragMode = "newshape", n.dragStart = r) : n.mode === "crop" && (n.dragMode = "crop", n.cropStart = r, n.cropRect = { x: r.x, y: r.y, w: 0, h: 0 });
|
|
223
|
+
}
|
|
224
|
+
function ln(n, l) {
|
|
225
|
+
if (n.pendingPoly) {
|
|
226
|
+
const o = n.pendingPoly.layer.points;
|
|
227
|
+
n.pendingPoly.preview = L(
|
|
228
|
+
o[o.length - 1],
|
|
229
|
+
a(n, l),
|
|
230
|
+
l.shiftKey
|
|
231
|
+
), w(n);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
if (n.dragMode && n.activePointerId != null && l.pointerId !== n.activePointerId)
|
|
235
|
+
return;
|
|
236
|
+
if (!n.dragMode) {
|
|
237
|
+
if (n.mode === "select") {
|
|
238
|
+
const o = a(n, l), e = n.selectedId != null ? n.layers.find((i) => i.id === n.selectedId) : null, d = e ? T(n, o, e) : null;
|
|
239
|
+
e && A(n, o, e) ? n.overlayEl.style.cursor = "grab" : d === "start" || d === "end" ? n.overlayEl.style.cursor = e.w >= 0 == e.h >= 0 ? "nwse-resize" : "nesw-resize" : d ? n.overlayEl.style.cursor = d === "tl" || d === "br" ? "nwse-resize" : "nesw-resize" : e && m(n, o) === e ? n.overlayEl.style.cursor = "move" : m(n, o) ? n.overlayEl.style.cursor = "pointer" : n.overlayEl.style.cursor = "default";
|
|
240
|
+
}
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
const r = a(n, l);
|
|
244
|
+
if (n.dragMode === "move") {
|
|
245
|
+
const o = r.x - n.dragStart.x, e = r.y - n.dragStart.y, d = n.layers.find((i) => i.id === n.selectedId);
|
|
246
|
+
d.type === "shape" && I(d) ? d.points = n.dragOrig.points.map((i) => ({
|
|
247
|
+
x: i.x + o,
|
|
248
|
+
y: i.y + e
|
|
249
|
+
})) : d.type === "text" || d.type === "shape" || d.type === "sticker" ? (d.x = n.dragOrig.x + o, d.y = n.dragOrig.y + e) : d.type === "stroke" && (d.points = n.dragOrig.points.map((i) => ({
|
|
250
|
+
x: i.x + o,
|
|
251
|
+
y: i.y + e
|
|
252
|
+
}))), K(n, d), g(n);
|
|
253
|
+
} else if (n.dragMode === "resize") {
|
|
254
|
+
const o = n.layers.find((i) => i.id === n.selectedId), e = o.rotation || 0, d = e ? C(r, n.resizeCenter, -e) : r;
|
|
255
|
+
if (o.type === "text") {
|
|
256
|
+
const i = n.resizeCorner === "tl" || n.resizeCorner === "bl";
|
|
257
|
+
if (o.y = n.dragOrig.y, o.size = n.dragOrig.size, i) {
|
|
258
|
+
const c = n.dragOrig.x + n.dragOrig.boxWidth;
|
|
259
|
+
o.boxWidth = Math.max(20, c - d.x), o.x = c - o.boxWidth;
|
|
260
|
+
} else
|
|
261
|
+
o.x = n.dragOrig.x, o.boxWidth = Math.max(20, d.x - n.dragOrig.x);
|
|
262
|
+
W(n, o), _(n, o), n.notify();
|
|
263
|
+
} else if (o.type === "shape" && I(o)) {
|
|
264
|
+
const i = n.resizeAnchor, c = n.dragOrig._bounds, h = 8, y = c.w > 0 ? (d.x - i.x) / (c.w || 1) : 1, p = c.h > 0 ? (d.y - i.y) / (c.h || 1) : 1, u = Math.abs(c.w * y) < h ? h / (c.w || 1) : y, M = Math.abs(c.h * p) < h ? h / (c.h || 1) : p;
|
|
265
|
+
o.points = n.dragOrig.points.map((s) => ({
|
|
266
|
+
x: i.x + (s.x - n.dragOrig._anchorPt.x) * u,
|
|
267
|
+
y: i.y + (s.y - n.dragOrig._anchorPt.y) * M
|
|
268
|
+
}));
|
|
269
|
+
} else if (o.type === "shape" && z.includes(o.shape)) {
|
|
270
|
+
const i = n.resizeAnchor, c = 8;
|
|
271
|
+
let h = d.x - i.x, y = d.y - i.y;
|
|
272
|
+
if (Math.hypot(h, y) < c) {
|
|
273
|
+
const p = Math.atan2(y || 1, h || 1);
|
|
274
|
+
h = c * Math.cos(p), y = c * Math.sin(p);
|
|
275
|
+
}
|
|
276
|
+
n.resizeCorner === "start" ? (o.x = i.x + h, o.y = i.y + y, o.w = -h, o.h = -y) : (o.x = i.x, o.y = i.y, o.w = h, o.h = y);
|
|
277
|
+
} else if (o.type === "shape" || o.type === "sticker") {
|
|
278
|
+
const i = n.resizeAnchor, c = 8;
|
|
279
|
+
let h = d.x - i.x, y = d.y - i.y;
|
|
280
|
+
Math.abs(h) < c && (h = i.x + c <= n.sourceCanvas.width ? c : -c), Math.abs(y) < c && (y = i.y + c <= n.sourceCanvas.height ? c : -c), o.x = Math.min(i.x, i.x + h), o.y = Math.min(i.y, i.y + y), o.w = Math.abs(h), o.h = Math.abs(y);
|
|
281
|
+
}
|
|
282
|
+
if (e) {
|
|
283
|
+
const i = C(n.resizeAnchor, b(n, o), e);
|
|
284
|
+
o.x += n.resizeAnchorWorld.x - i.x, o.y += n.resizeAnchorWorld.y - i.y;
|
|
285
|
+
}
|
|
286
|
+
g(n);
|
|
287
|
+
} else if (n.dragMode === "rotate") {
|
|
288
|
+
const o = n.layers.find((y) => y.id === n.selectedId), { center: e, angle: d, rotation: i } = n.rotateStart, c = Math.atan2(r.y - e.y, r.x - e.x) - d, h = i + c * 180 / Math.PI;
|
|
289
|
+
o.rotation = (h % 360 + 360) % 360, g(n);
|
|
290
|
+
} else if (n.dragMode === "draw")
|
|
291
|
+
n.pendingStroke.points.push(r), n.octx.clearRect(0, 0, n.overlayEl.width, n.overlayEl.height), n.layers.forEach((o) => S(n, n.octx, o)), S(n, n.octx, n.pendingStroke);
|
|
292
|
+
else if (n.dragMode === "newshape")
|
|
293
|
+
n.pendingShape.w = r.x - n.dragStart.x, n.pendingShape.h = r.y - n.dragStart.y, g(n);
|
|
294
|
+
else if (n.dragMode === "crop") {
|
|
295
|
+
let o = r.x - n.cropStart.x, e = r.y - n.cropStart.y;
|
|
296
|
+
if (n.cropRatio !== "free") {
|
|
297
|
+
const d = parseFloat(n.cropRatio);
|
|
298
|
+
e = Math.sign(e || 1) * Math.abs(o) / d;
|
|
299
|
+
const i = e >= 0 ? n.sourceCanvas.height - n.cropStart.y : n.cropStart.y;
|
|
300
|
+
Math.abs(e) > i && (e = Math.sign(e) * i, o = Math.sign(o || 1) * Math.abs(e) * d);
|
|
301
|
+
}
|
|
302
|
+
n.cropRect = { x: n.cropStart.x, y: n.cropStart.y, w: o, h: e }, g(n);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
function dn(n, l) {
|
|
306
|
+
if (!(l && n.dragMode && n.activePointerId != null && l.pointerId !== n.activePointerId)) {
|
|
307
|
+
if (n.dragMode === "draw" && n.pendingStroke)
|
|
308
|
+
n.pendingStroke.points.length >= 1 && (n.layers.push(n.pendingStroke), x(n, n.pendingStroke.id)), n.pendingStroke = null, t(n), n.statusText = "Stroke added", P(n);
|
|
309
|
+
else if (n.dragMode === "newshape" && n.pendingShape) {
|
|
310
|
+
const r = Math.hypot(
|
|
311
|
+
n.pendingShape.w || 0,
|
|
312
|
+
n.pendingShape.h || 0
|
|
313
|
+
);
|
|
314
|
+
if (n.multiPointMode && R.includes(n.pendingShape.shape)) {
|
|
315
|
+
const o = n.pendingShape, e = { x: o.x + (o.w || 0), y: o.y + (o.h || 0) };
|
|
316
|
+
n.pendingShape = null, U(n, o, { x: o.x, y: o.y }), r > B && (o.points.push(e), n.pendingPoly.preview = e);
|
|
317
|
+
} else if (Math.abs(n.pendingShape.w) > 3 || Math.abs(n.pendingShape.h) > 3) {
|
|
318
|
+
n.layers.push(n.pendingShape);
|
|
319
|
+
const o = n.pendingShape.id;
|
|
320
|
+
n.pendingShape = null, k(n, "select"), x(n, o), n.statusText = "Shape added", P(n);
|
|
321
|
+
} else
|
|
322
|
+
n.pendingShape = null, g(n), n.notify();
|
|
323
|
+
} else if (n.dragMode === "crop")
|
|
324
|
+
n.cropRect && (n.cropRect = F(n.cropRect)), g(n), n.notify();
|
|
325
|
+
else if (n.dragMode === "move" || n.dragMode === "resize" || n.dragMode === "rotate") {
|
|
326
|
+
if (n.dragMode === "rotate") {
|
|
327
|
+
const r = n.layers.find((o) => o.id === n.selectedId);
|
|
328
|
+
r && (n.statusText = `Rotated to ${Math.round(r.rotation)}°`);
|
|
329
|
+
}
|
|
330
|
+
t(n), n.notify();
|
|
331
|
+
}
|
|
332
|
+
n.activePointerId != null && (n.overlayEl.hasPointerCapture(n.activePointerId) && n.overlayEl.releasePointerCapture(n.activePointerId), n.activePointerId = null), n.dragMode = null, n.dragStart = null, n.dragOrig = null, n.dragRect = null, n.resizeAnchor = null, n.resizeCenter = null, n.resizeAnchorWorld = null, n.rotateStart = null;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
function cn(n, l) {
|
|
336
|
+
if (n.pendingPoly) {
|
|
337
|
+
$(n, !1);
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
if (n.mode !== "select") return;
|
|
341
|
+
const r = a(n, l), o = m(n, r);
|
|
342
|
+
o && o.type === "text" && (x(n, o.id), N(n, o, !1));
|
|
46
343
|
}
|
|
47
344
|
export {
|
|
48
|
-
|
|
345
|
+
B as CLICK_SLOP,
|
|
346
|
+
Z as cancelPoly,
|
|
347
|
+
$ as finishPoly,
|
|
348
|
+
m as hitLayer,
|
|
349
|
+
cn as onDbl,
|
|
350
|
+
en as onDown,
|
|
351
|
+
ln as onMove,
|
|
352
|
+
dn as onUp,
|
|
353
|
+
nn as polyStatus,
|
|
354
|
+
rn as resumePoly,
|
|
355
|
+
a as toSource,
|
|
356
|
+
on as undoPolyPoint
|
|
49
357
|
};
|
|
50
358
|
//# sourceMappingURL=index.es155.js.map
|
package/dist/index.es155.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es155.js","sources":["../src/components/organisms/image-editor/engine/mount.js"],"sourcesContent":["import { onDown, onMove, onUp, onDbl } from './pointer.js'\nimport {\n autoGrowTextEditor,\n blurTextEditor,\n commitTextEdit,\n} from './text-editor.js'\nimport { undo, redo } from './history.js'\nimport { setMode, selectLayer, applyModeCursor } from './mode.js'\nimport { fitStage, render, syncCanvasSize } from './rendering.js'\nimport { normalizeSource, doLoadImage } from './save-export.js'\nimport { deleteLayer } from './layer-actions.js'\nimport {\n panPointerDown,\n panPointerMove,\n panPointerUp,\n resetPan,\n} from './touch-pan.js'\n\nexport function mount(state, self, refs) {\n state.canvasEl = refs.canvas\n state.overlayEl = refs.overlay\n state.textEditorEl = refs.textEditor\n state.stageEl = refs.stage\n state.ctx = state.canvasEl.getContext('2d')\n state.octx = state.overlayEl.getContext('2d')\n state.mounted = true\n applyModeCursor(state)\n\n state.overlayEl.addEventListener('lostpointercapture', (e) =>\n panPointerUp(state, e)\n )\n state.overlayEl.addEventListener('pointerdown', (e) => {\n e.preventDefault()\n if (e.isPrimary && state.panPointers?.size) resetPan(state)\n if (panPointerDown(state, e)) return\n onDown(state, e)\n })\n state.overlayEl.addEventListener('pointermove', (e) => {\n e.preventDefault()\n if (panPointerMove(state, e)) return\n onMove(state, e)\n })\n state.overlayEl.addEventListener('pointerup', (e) => {\n panPointerUp(state, e)\n onUp(state, e)\n })\n state.overlayEl.addEventListener('pointercancel', (e) => {\n resetPan(state)\n onUp(state, e)\n })\n state.overlayEl.addEventListener('dblclick', (e) => onDbl(state, e))\n\n // Commit, unfocus, deselect — guarded so an ordinary drag never deselects.\n const endTextEdit = () => {\n if (!state.editingLayer) return\n blurTextEditor(state)\n selectLayer(state, null)\n }\n\n state.textEditorEl.addEventListener('keydown', (e) => {\n if (e.key === 'Enter') {\n // Enter inserts a newline; stopped so no parent form reads it as submit.\n e.stopPropagation()\n if (e.metaKey || e.ctrlKey) {\n e.preventDefault()\n endTextEdit()\n }\n } else if (e.key === 'Escape') {\n // Escape discards the edit, so restore nothing — just let go.\n e.stopPropagation()\n if (state.editingLayer) state.editingLayer._editing = false\n state.editingLayer = null\n state.textEditorEl.blur()\n selectLayer(state, null)\n }\n })\n state.textEditorEl.addEventListener('input', () => autoGrowTextEditor(state))\n state.textEditorEl.addEventListener('blur', () => commitTextEdit(state))\n\n // Capture phase: the overlay preventDefaults away the implicit blur.\n state.stageEl.addEventListener(\n 'pointerdown',\n (e) => {\n if (e.target === state.textEditorEl) return\n endTextEdit()\n // Presses on the padding deselect; presses on the image are onDown's.\n if (e.target !== state.overlayEl && state.selectedId != null) {\n selectLayer(state, null)\n }\n },\n true\n )\n\n ;['dragover', 'dragenter'].forEach((ev) =>\n state.stageEl.addEventListener(ev, (e) => e.preventDefault())\n )\n state.stageEl.addEventListener('drop', (e) => {\n e.preventDefault()\n const f = e.dataTransfer.files[0]\n if (f && f.type.startsWith('image/'))\n normalizeSource(state, f, (d) => doLoadImage(state, d))\n })\n\n self._keyHandler = (e) => {\n if (!self.isOpen()) return\n const tag = document.activeElement && document.activeElement.tagName\n if (tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT') return\n if ((e.metaKey || e.ctrlKey) && e.key === 'z' && !e.shiftKey) {\n e.preventDefault()\n undo(state)\n } else if (\n (e.metaKey || e.ctrlKey) &&\n (e.key === 'y' || (e.shiftKey && e.key === 'z'))\n ) {\n e.preventDefault()\n redo(state)\n } else if (e.key === 'Escape') {\n if (state.mode !== 'select' || state.selectedId != null) {\n setMode(state, 'select')\n selectLayer(state, null)\n } else if (state.config.closeOnEscape !== false) self.close()\n } else if (\n (e.key === 'Delete' || e.key === 'Backspace') &&\n state.selectedId != null &&\n state.mode === 'select'\n ) {\n e.preventDefault()\n deleteLayer(state, state.selectedId)\n }\n }\n document.addEventListener('keydown', self._keyHandler)\n\n self._resizeHandler = () => {\n if (state.sourceCanvas.width && self.isOpen()) {\n fitStage(state)\n render(state)\n }\n }\n window.addEventListener('resize', self._resizeHandler)\n\n if (state.sourceCanvas.width) {\n syncCanvasSize(state)\n render(state)\n }\n}\n"],"names":["mount","state","self","refs","applyModeCursor","e","panPointerUp","resetPan","panPointerDown","onDown","panPointerMove","onMove","onUp","onDbl","endTextEdit","blurTextEditor","selectLayer","autoGrowTextEditor","commitTextEdit","ev","f","normalizeSource","d","doLoadImage","tag","undo","redo","setMode","deleteLayer","fitStage","render","syncCanvasSize"],"mappings":";;;;;;;;AAkBO,SAASA,EAAMC,GAAOC,GAAMC,GAAM;AACvC,EAAAF,EAAM,WAAWE,EAAK,QACtBF,EAAM,YAAYE,EAAK,SACvBF,EAAM,eAAeE,EAAK,YAC1BF,EAAM,UAAUE,EAAK,OACrBF,EAAM,MAAMA,EAAM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,EAAM,cAAc,QACjD0B,EAAQ1B,GAAO,QAAQ,GACvBe,EAAYf,GAAO,IAAI,KACdA,EAAM,OAAO,kBAAkB,MAAOC,EAAK,MAAK,KAE1DG,EAAE,QAAQ,YAAYA,EAAE,QAAQ,gBACjCJ,EAAM,cAAc,QACpBA,EAAM,SAAS,aAEfI,EAAE,eAAc,GAChBuB,EAAY3B,GAAOA,EAAM,UAAU;AAAA,EAEvC,GACA,SAAS,iBAAiB,WAAWC,EAAK,WAAW,GAErDA,EAAK,iBAAiB,MAAM;AAC1B,IAAID,EAAM,aAAa,SAASC,EAAK,OAAM,MACzC2B,EAAS5B,CAAK,GACd6B,EAAO7B,CAAK;AAAA,EAEhB,GACA,OAAO,iBAAiB,UAAUC,EAAK,cAAc,GAEjDD,EAAM,aAAa,UACrB8B,EAAe9B,CAAK,GACpB6B,EAAO7B,CAAK;AAEhB;"}
|
|
1
|
+
{"version":3,"file":"index.es155.js","sources":["../src/components/organisms/image-editor/engine/pointer.js"],"sourcesContent":["import { pushHistory, popHistory } from './history.js'\nimport { emitChange } from './state.js'\nimport {\n render,\n renderOverlay,\n paintLayer,\n layerBounds,\n onResizeHandle,\n normRect,\n clampTextSize,\n clampBoxWidth,\n onRotateHandle,\n layerCenter,\n rotatePoint,\n toLayerSpace,\n DIRECTIONAL_SHAPES,\n MULTI_POINT_SHAPES,\n isMultiPoint,\n} from './rendering.js'\nimport { setMode, selectLayer } from './mode.js'\nimport { openTextEditor } from './text-editor.js'\n\nexport function toSource(state, e) {\n // While actively dragging, use the rect captured at pointerdown instead of\n // re-querying live — on mobile the browser's address-bar/toolbar chrome\n // can collapse mid-gesture (typically ~1s in) and reflow the canvas out\n // from under the drag. Since this is (pointer position - element origin),\n // a rect that shifts mid-drag snaps the result toward 0 (leftmost/\n // smallest), which is exactly what re-querying every move would do.\n const r =\n state.dragMode && state.dragRect\n ? state.dragRect\n : state.overlayEl.getBoundingClientRect()\n const x = ((e.clientX - r.left) / r.width) * state.sourceCanvas.width\n const y = ((e.clientY - r.top) / r.height) * state.sourceCanvas.height\n return {\n x: Math.min(Math.max(x, 0), state.sourceCanvas.width),\n y: Math.min(Math.max(y, 0), state.sourceCanvas.height),\n }\n}\n\nfunction rotatedAABB(b, rotationDeg) {\n if (!rotationDeg) return b\n const rad = (rotationDeg * Math.PI) / 180\n const cos = Math.abs(Math.cos(rad)),\n sin = Math.abs(Math.sin(rad))\n const w = b.w * cos + b.h * sin,\n h = b.w * sin + b.h * cos\n const cx = b.x + b.w / 2,\n cy = b.y + b.h / 2\n return { x: cx - w / 2, y: cy - h / 2, w, h }\n}\n\nfunction strokeMargin(L) {\n if (L.type !== 'shape') return 0\n const alwaysStroked = DIRECTIONAL_SHAPES.includes(L.shape)\n return alwaysStroked || L.fill !== 'fill' ? (L.width || 0) / 2 : 0\n}\n\nfunction clampLayerToCanvas(state, L) {\n const rotated = rotatedAABB(layerBounds(state, L), L.rotation)\n const margin = strokeMargin(L)\n const b = {\n x: rotated.x - margin,\n y: rotated.y - margin,\n w: rotated.w + margin * 2,\n h: rotated.h + margin * 2,\n }\n const dx = Math.min(Math.max(b.x, 0), state.sourceCanvas.width - b.w) - b.x\n const dy = Math.min(Math.max(b.y, 0), state.sourceCanvas.height - b.h) - b.y\n if (!dx && !dy) return\n if (L.type === 'stroke') {\n L.points = L.points.map((pt) => ({ x: pt.x + dx, y: pt.y + dy }))\n } else {\n L.x += dx\n L.y += dy\n }\n}\n\nexport function hitLayer(state, p) {\n const { layers } = state\n for (let i = layers.length - 1; i >= 0; i--) {\n const b = layerBounds(state, layers[i])\n const q = toLayerSpace(state, layers[i], p)\n if (\n q.x >= b.x - 6 &&\n q.x <= b.x + b.w + 6 &&\n q.y >= b.y - 6 &&\n q.y <= b.y + b.h + 6\n )\n return layers[i]\n }\n return null\n}\n\n// --- multi-point (\"extended\") line sessions -------------------------------\n\n// Fingers are far less precise than a cursor, so coarse pointers get a target\n// near the 44px accessibility minimum.\nfunction closeHitRadius() {\n const coarse =\n typeof window !== 'undefined' &&\n window.matchMedia &&\n window.matchMedia('(pointer: coarse)').matches\n return coarse ? 40 : 22\n}\nconst SNAP_STEP = Math.PI / 8\n// Below this drag distance a pointer gesture counts as a click, not a drag.\nexport const CLICK_SLOP = 4\n\nexport function isPolyActive(state) {\n return !!state.pendingPoly\n}\n\nexport function polyStatus(state) {\n const poly = state.pendingPoly\n if (!poly)\n return { active: false, pointCount: 0, canFinish: false, canClose: false }\n const n = poly.layer.points.length\n return { active: true, pointCount: n, canFinish: n >= 2, canClose: n >= 3 }\n}\n\n// With Shift held, lock the next segment to a fixed angle from the last point\n// -- the usual way drawing tools make clean horizontals, verticals and 45s.\nfunction snapPreview(anchor, p, shift) {\n if (!shift || !anchor) return p\n const dx = p.x - anchor.x\n const dy = p.y - anchor.y\n const len = Math.hypot(dx, dy)\n if (!len) return p\n const ang = Math.round(Math.atan2(dy, dx) / SNAP_STEP) * SNAP_STEP\n return {\n x: anchor.x + Math.cos(ang) * len,\n y: anchor.y + Math.sin(ang) * len,\n }\n}\n\nexport function undoPolyPoint(state) {\n const poly = state.pendingPoly\n if (!poly) return\n if (poly.layer.points.length <= 1) {\n cancelPoly(state)\n return\n }\n poly.layer.points.pop()\n state.statusText = `${poly.layer.points.length} point${\n poly.layer.points.length === 1 ? '' : 's'\n } — Backspace removes the last`\n drawPolyPreview(state)\n state.notify()\n}\n\nfunction startPoly(state, shapeLayer, p) {\n state.pendingPoly = { layer: shapeLayer, preview: p }\n shapeLayer.points = [{ x: p.x, y: p.y }]\n delete shapeLayer.w\n delete shapeLayer.h\n state.statusText =\n 'Click to add points · double-click to finish · Esc cancels'\n drawPolyPreview(state)\n state.notify()\n}\n\nfunction drawPolyPreview(state) {\n const poly = state.pendingPoly\n if (!poly) return\n const c = state.octx\n const pts = poly.layer.points\n c.clearRect(0, 0, state.overlayEl.width, state.overlayEl.height)\n state.layers.forEach((L) => paintLayer(state, c, L))\n\n const ghost = {\n ...poly.layer,\n points: poly.preview ? pts.concat([poly.preview]) : pts,\n }\n if (ghost.points.length >= 2) paintLayer(state, c, ghost)\n\n const k = 1 / (state.viewScale || 1)\n const r = 5 * k\n\n c.save()\n c.lineWidth = 2 * k\n pts.forEach((pt, i) => {\n if (i === 0) return\n c.beginPath()\n c.arc(pt.x, pt.y, r, 0, Math.PI * 2)\n c.fillStyle = '#ffffff'\n c.strokeStyle = poly.layer.color\n c.fill()\n c.stroke()\n })\n\n // The first point is the close target: it grows and fills once the cursor is\n // near enough that a click would actually close the path.\n const first = pts[0]\n if (first) {\n const near =\n pts.length >= 3 &&\n poly.preview &&\n Math.hypot(poly.preview.x - first.x, poly.preview.y - first.y) <=\n closeHitRadius()\n c.beginPath()\n c.arc(first.x, first.y, (near ? 11 : 7) * k, 0, Math.PI * 2)\n c.fillStyle = near ? poly.layer.color : '#ffffff'\n c.strokeStyle = poly.layer.color\n c.lineWidth = (near ? 3 : 2) * k\n c.fill()\n c.stroke()\n if (near) {\n c.beginPath()\n c.arc(first.x, first.y, 4 * k, 0, Math.PI * 2)\n c.fillStyle = '#ffffff'\n c.fill()\n }\n }\n c.restore()\n\n drawPolyHint(state, pts.length)\n}\n\n// Pinned to the canvas so the rules are where the eyes are. On touch the button\n// bar carries the actions, so the hint only explains what a tap does.\nfunction drawPolyHint(state, count) {\n const c = state.octx\n const k = 1 / (state.viewScale || 1)\n const pad = 10 * k\n const size = 13 * k\n const coarse =\n typeof window !== 'undefined' &&\n window.matchMedia &&\n window.matchMedia('(pointer: coarse)').matches\n const verb = coarse ? 'Tap' : 'Click'\n let msg\n if (count < 2) msg = `${verb} to place the next point`\n else if (coarse)\n msg =\n count < 3\n ? `${verb} to add points · use the bar below to finish`\n : `${verb} the first point to close · or finish below`\n else\n msg =\n count < 3\n ? 'Double-click or Enter to finish · Backspace undoes · Esc cancels'\n : 'Click the first point to close · Double-click to finish · Backspace undoes'\n\n c.save()\n c.font = `${size}px Avenir Next, Segoe UI, sans-serif`\n c.textBaseline = 'top'\n const w = c.measureText(msg).width\n c.fillStyle = 'rgba(17,17,17,.82)'\n c.beginPath()\n const bx = pad,\n by = pad,\n bw = w + pad * 2,\n bh = size + pad * 1.4\n if (c.roundRect) c.roundRect(bx, by, bw, bh, 6 * k)\n else c.rect(bx, by, bw, bh)\n c.fill()\n c.fillStyle = '#ffffff'\n c.fillText(msg, bx + pad, by + pad * 0.6)\n c.restore()\n}\n\n// Without this, continuing a finished line means clicking near its end -- which\n// lands on the rotate/resize handle and spins the layer instead.\nexport function resumePoly(state, id) {\n const L = state.layers.find((l) => l.id === (id ?? state.selectedId))\n if (!L || L.type !== 'shape') return\n if (!MULTI_POINT_SHAPES.includes(L.shape)) return\n pushHistory(state)\n if (!L.points || L.points.length < 2) {\n L.points = [\n { x: L.x, y: L.y },\n { x: L.x + (L.w || 0), y: L.y + (L.h || 0) },\n ]\n }\n delete L.w\n delete L.h\n L.closed = false\n state.selectedId = null\n state.mode = 'shape'\n state.multiPointMode = true\n state.pendingPoly = { layer: L, preview: L.points[L.points.length - 1] }\n state.statusText =\n 'Continuing line — click to add points · double-click to finish'\n drawPolyPreview(state)\n state.notify()\n}\n\nexport function finishPoly(state, close) {\n const poly = state.pendingPoly\n if (!poly) return\n const L = poly.layer\n state.pendingPoly = null\n if (L.points.length < 2) {\n // A lone click never became a line -- drop it and undo the history entry.\n state.layers = state.layers.filter((l) => l.id !== L.id)\n popHistory(state)\n setMode(state, 'select')\n render(state)\n state.notify()\n return\n }\n L.closed = !!close\n if (!state.layers.some((l) => l.id === L.id)) state.layers.push(L)\n // Stay on the shape tool: drawing one line usually means drawing another.\n // The layer is still selected, so its options are immediately editable.\n state.mode = 'shape'\n selectLayer(state, L.id)\n state.statusText = close\n ? 'Shape closed — click to start another'\n : 'Line added — click to start another'\n render(state)\n emitChange(state)\n}\n\nexport function cancelPoly(state) {\n const poly = state.pendingPoly\n if (!poly) return\n state.pendingPoly = null\n state.layers = state.layers.filter((l) => l.id !== poly.layer.id)\n popHistory(state)\n render(state)\n state.statusText = 'Cancelled'\n state.notify()\n}\n\nexport function onDown(state, e) {\n if (!state.sourceCanvas.width) return\n if (state.dragMode) return\n state.overlayEl.setPointerCapture(e.pointerId)\n state.activePointerId = e.pointerId\n state.dragRect = state.overlayEl.getBoundingClientRect()\n const p = toSource(state, e)\n if (state.pendingPoly) {\n const pts = state.pendingPoly.layer.points\n const first = pts[0]\n if (\n pts.length >= 3 &&\n Math.hypot(p.x - first.x, p.y - first.y) <= closeHitRadius()\n ) {\n finishPoly(state, true)\n return\n }\n const last = pts[pts.length - 1]\n const q = snapPreview(last, p, e.shiftKey)\n // Ignore a double-click's second down: it would add a zero-length segment.\n if (!last || Math.hypot(q.x - last.x, q.y - last.y) > CLICK_SLOP) {\n pts.push({ x: q.x, y: q.y })\n }\n state.pendingPoly.preview = q\n drawPolyPreview(state)\n return\n }\n if (state.mode === 'select') {\n const sel =\n state.selectedId != null\n ? state.layers.find((l) => l.id === state.selectedId)\n : null\n if (sel && onRotateHandle(state, p, sel)) {\n const c = layerCenter(state, sel)\n state.dragMode = 'rotate'\n state.rotateStart = {\n center: c,\n angle: Math.atan2(p.y - c.y, p.x - c.x),\n rotation: sel.rotation || 0,\n }\n pushHistory(state)\n return\n }\n const corner = sel ? onResizeHandle(state, p, sel) : null\n if (corner) {\n state.dragMode = 'resize'\n state.resizeCorner = corner\n state.dragStart = p\n state.dragOrig = JSON.parse(JSON.stringify(sel))\n if (sel.type === 'shape' && isMultiPoint(sel)) {\n const b = layerBounds(state, sel)\n const isLeft = corner === 'tl' || corner === 'bl'\n const isTop = corner === 'tl' || corner === 'tr'\n state.resizeAnchor = {\n x: isLeft ? b.x + b.w : b.x,\n y: isTop ? b.y + b.h : b.y,\n }\n // Stash the untouched geometry so scaling stays absolute and cannot\n // accumulate drift across move events.\n state.dragOrig._bounds = {\n w: isLeft ? -b.w : b.w,\n h: isTop ? -b.h : b.h,\n }\n state.dragOrig._anchorPt = {\n x: state.resizeAnchor.x,\n y: state.resizeAnchor.y,\n }\n } else if (\n sel.type === 'shape' &&\n DIRECTIONAL_SHAPES.includes(sel.shape)\n ) {\n state.resizeAnchor =\n corner === 'start'\n ? { x: sel.x + sel.w, y: sel.y + sel.h }\n : { x: sel.x, y: sel.y }\n } else {\n const b = layerBounds(state, sel)\n const isLeft = corner === 'tl' || corner === 'bl'\n state.resizeAnchor = {\n x: isLeft ? b.x + b.w : b.x,\n // Text keeps its top edge: its height follows the wrapping.\n y:\n sel.type === 'text'\n ? b.y\n : corner === 'tl' || corner === 'tr'\n ? b.y + b.h\n : b.y,\n }\n }\n state.resizeCenter = layerCenter(state, sel)\n state.resizeAnchorWorld = rotatePoint(\n state.resizeAnchor,\n state.resizeCenter,\n sel.rotation || 0\n )\n pushHistory(state)\n return\n }\n const hit = hitLayer(state, p)\n if (hit) {\n selectLayer(state, hit.id)\n state.dragMode = 'move'\n state.dragStart = p\n state.dragOrig = JSON.parse(JSON.stringify(hit))\n pushHistory(state)\n } else selectLayer(state, null)\n } else if (state.mode === 'text') {\n pushHistory(state)\n const L = {\n id: state.nextId++,\n type: 'text',\n text: 'Text',\n x: p.x,\n y: p.y,\n size: state.textSize,\n font: state.textFont,\n color: state.textColor,\n rotation: 0,\n flipH: false,\n flipV: false,\n boxWidth: 10,\n }\n state.octx.font = `${L.size}px ${L.font}`\n const placeholderWidth = state.octx.measureText(L.text).width\n L.boxWidth = Math.round(Math.max(700, placeholderWidth + 40))\n clampBoxWidth(state, L)\n clampTextSize(state, L)\n state.layers.push(L)\n setMode(state, 'select')\n selectLayer(state, L.id)\n openTextEditor(state, L, true)\n } else if (state.mode === 'draw') {\n pushHistory(state)\n state.pendingStroke = {\n id: state.nextId++,\n type: 'stroke',\n color: state.drawColor,\n width: state.brushSize,\n style: state.brushStyle,\n points: [p],\n }\n state.dragMode = 'draw'\n } else if (state.mode === 'shape') {\n pushHistory(state)\n state.pendingShape = {\n id: state.nextId++,\n type: 'shape',\n shape: state.selectedShapeType,\n fill: state.shapeFill,\n width: state.shapeWidth,\n color: state.shapeColor,\n x: p.x,\n y: p.y,\n w: 0,\n h: 0,\n rotation: 0,\n flipH: false,\n flipV: false,\n }\n state.dragMode = 'newshape'\n state.dragStart = p\n } else if (state.mode === 'crop') {\n state.dragMode = 'crop'\n state.cropStart = p\n state.cropRect = { x: p.x, y: p.y, w: 0, h: 0 }\n }\n}\n\nexport function onMove(state, e) {\n if (state.pendingPoly) {\n const pts = state.pendingPoly.layer.points\n state.pendingPoly.preview = snapPreview(\n pts[pts.length - 1],\n toSource(state, e),\n e.shiftKey\n )\n drawPolyPreview(state)\n return\n }\n if (\n state.dragMode &&\n state.activePointerId != null &&\n e.pointerId !== state.activePointerId\n ) {\n return\n }\n if (!state.dragMode) {\n if (state.mode === 'select') {\n const p = toSource(state, e),\n sel =\n state.selectedId != null\n ? state.layers.find((l) => l.id === state.selectedId)\n : null\n const corner = sel ? onResizeHandle(state, p, sel) : null\n if (sel && onRotateHandle(state, p, sel)) {\n state.overlayEl.style.cursor = 'grab'\n } else if (corner === 'start' || corner === 'end') {\n state.overlayEl.style.cursor =\n sel.w >= 0 === sel.h >= 0 ? 'nwse-resize' : 'nesw-resize'\n } else if (corner) {\n state.overlayEl.style.cursor =\n corner === 'tl' || corner === 'br' ? 'nwse-resize' : 'nesw-resize'\n } else if (sel && hitLayer(state, p) === sel) {\n state.overlayEl.style.cursor = 'move'\n } else if (hitLayer(state, p)) {\n state.overlayEl.style.cursor = 'pointer'\n } else {\n state.overlayEl.style.cursor = 'default'\n }\n }\n return\n }\n const p = toSource(state, e)\n if (state.dragMode === 'move') {\n const dx = p.x - state.dragStart.x,\n dy = p.y - state.dragStart.y,\n L = state.layers.find((l) => l.id === state.selectedId)\n if (L.type === 'shape' && isMultiPoint(L)) {\n L.points = state.dragOrig.points.map((pt) => ({\n x: pt.x + dx,\n y: pt.y + dy,\n }))\n } else if (\n L.type === 'text' ||\n L.type === 'shape' ||\n L.type === 'sticker'\n ) {\n L.x = state.dragOrig.x + dx\n L.y = state.dragOrig.y + dy\n } else if (L.type === 'stroke') {\n L.points = state.dragOrig.points.map((pt) => ({\n x: pt.x + dx,\n y: pt.y + dy,\n }))\n }\n clampLayerToCanvas(state, L)\n renderOverlay(state)\n } else if (state.dragMode === 'resize') {\n const L = state.layers.find((l) => l.id === state.selectedId)\n const rot = L.rotation || 0\n // Resize along the layer's own axes, so a tilted box grows the way it looks.\n const q = rot ? rotatePoint(p, state.resizeCenter, -rot) : p\n if (L.type === 'text') {\n const isLeft = state.resizeCorner === 'tl' || state.resizeCorner === 'bl'\n // Absolute from drag start, so the fix-up below cannot accumulate.\n L.y = state.dragOrig.y\n L.size = state.dragOrig.size\n if (isLeft) {\n const rightEdge = state.dragOrig.x + state.dragOrig.boxWidth\n L.boxWidth = Math.max(20, rightEdge - q.x)\n L.x = rightEdge - L.boxWidth\n } else {\n L.x = state.dragOrig.x\n L.boxWidth = Math.max(20, q.x - state.dragOrig.x)\n }\n clampBoxWidth(state, L)\n clampTextSize(state, L)\n state.notify()\n } else if (L.type === 'shape' && isMultiPoint(L)) {\n // Multi-point paths have no single \"end\" to drag, so scale every point\n // about the opposite corner instead.\n const anchor = state.resizeAnchor\n const ob = state.dragOrig._bounds\n const MIN_SIZE = 8\n const sx = ob.w > 0 ? (q.x - anchor.x) / (ob.w || 1) : 1\n const sy = ob.h > 0 ? (q.y - anchor.y) / (ob.h || 1) : 1\n const kx = Math.abs(ob.w * sx) < MIN_SIZE ? MIN_SIZE / (ob.w || 1) : sx\n const ky = Math.abs(ob.h * sy) < MIN_SIZE ? MIN_SIZE / (ob.h || 1) : sy\n L.points = state.dragOrig.points.map((pt) => ({\n x: anchor.x + (pt.x - state.dragOrig._anchorPt.x) * kx,\n y: anchor.y + (pt.y - state.dragOrig._anchorPt.y) * ky,\n }))\n } else if (L.type === 'shape' && DIRECTIONAL_SHAPES.includes(L.shape)) {\n const anchor = state.resizeAnchor\n const MIN_LEN = 8\n let w = q.x - anchor.x\n let h = q.y - anchor.y\n if (Math.hypot(w, h) < MIN_LEN) {\n const ang = Math.atan2(h || 1, w || 1)\n w = MIN_LEN * Math.cos(ang)\n h = MIN_LEN * Math.sin(ang)\n }\n if (state.resizeCorner === 'start') {\n L.x = anchor.x + w\n L.y = anchor.y + h\n L.w = -w\n L.h = -h\n } else {\n L.x = anchor.x\n L.y = anchor.y\n L.w = w\n L.h = h\n }\n } else if (L.type === 'shape' || L.type === 'sticker') {\n const anchor = state.resizeAnchor\n const MIN_SIZE = 8\n let w = q.x - anchor.x\n let h = q.y - anchor.y\n if (Math.abs(w) < MIN_SIZE) {\n w =\n anchor.x + MIN_SIZE <= state.sourceCanvas.width ? MIN_SIZE : -MIN_SIZE\n }\n if (Math.abs(h) < MIN_SIZE) {\n h =\n anchor.y + MIN_SIZE <= state.sourceCanvas.height\n ? MIN_SIZE\n : -MIN_SIZE\n }\n L.x = Math.min(anchor.x, anchor.x + w)\n L.y = Math.min(anchor.y, anchor.y + h)\n L.w = Math.abs(w)\n L.h = Math.abs(h)\n }\n // Resizing moves the centre it spins about; pin the anchor back down.\n if (rot) {\n const moved = rotatePoint(state.resizeAnchor, layerCenter(state, L), rot)\n L.x += state.resizeAnchorWorld.x - moved.x\n L.y += state.resizeAnchorWorld.y - moved.y\n }\n renderOverlay(state)\n } else if (state.dragMode === 'rotate') {\n const L = state.layers.find((l) => l.id === state.selectedId)\n const { center, angle, rotation } = state.rotateStart\n const swept = Math.atan2(p.y - center.y, p.x - center.x) - angle\n const deg = rotation + (swept * 180) / Math.PI\n L.rotation = ((deg % 360) + 360) % 360\n renderOverlay(state)\n } else if (state.dragMode === 'draw') {\n state.pendingStroke.points.push(p)\n state.octx.clearRect(0, 0, state.overlayEl.width, state.overlayEl.height)\n state.layers.forEach((L) => paintLayer(state, state.octx, L))\n paintLayer(state, state.octx, state.pendingStroke)\n } else if (state.dragMode === 'newshape') {\n state.pendingShape.w = p.x - state.dragStart.x\n state.pendingShape.h = p.y - state.dragStart.y\n renderOverlay(state)\n } else if (state.dragMode === 'crop') {\n let w = p.x - state.cropStart.x,\n h = p.y - state.cropStart.y\n if (state.cropRatio !== 'free') {\n const rr = parseFloat(state.cropRatio)\n h = (Math.sign(h || 1) * Math.abs(w)) / rr\n const maxH =\n h >= 0\n ? state.sourceCanvas.height - state.cropStart.y\n : state.cropStart.y\n if (Math.abs(h) > maxH) {\n h = Math.sign(h) * maxH\n w = Math.sign(w || 1) * Math.abs(h) * rr\n }\n }\n state.cropRect = { x: state.cropStart.x, y: state.cropStart.y, w, h }\n renderOverlay(state)\n }\n}\n\nexport function onUp(state, e) {\n if (\n e &&\n state.dragMode &&\n state.activePointerId != null &&\n e.pointerId !== state.activePointerId\n ) {\n return\n }\n if (state.dragMode === 'draw' && state.pendingStroke) {\n if (state.pendingStroke.points.length >= 1) {\n state.layers.push(state.pendingStroke)\n selectLayer(state, state.pendingStroke.id)\n }\n state.pendingStroke = null\n render(state)\n state.statusText = 'Stroke added'\n emitChange(state)\n } else if (state.dragMode === 'newshape' && state.pendingShape) {\n const dragged = Math.hypot(\n state.pendingShape.w || 0,\n state.pendingShape.h || 0\n )\n if (\n state.multiPointMode &&\n MULTI_POINT_SHAPES.includes(state.pendingShape.shape)\n ) {\n // Multi-point is an explicit mode, so it opens a session either way:\n // a drag lays down the first segment, a click just the first corner.\n const L = state.pendingShape\n const end = { x: L.x + (L.w || 0), y: L.y + (L.h || 0) }\n state.pendingShape = null\n startPoly(state, L, { x: L.x, y: L.y })\n if (dragged > CLICK_SLOP) {\n L.points.push(end)\n state.pendingPoly.preview = end\n }\n } else if (\n Math.abs(state.pendingShape.w) > 3 ||\n Math.abs(state.pendingShape.h) > 3\n ) {\n state.layers.push(state.pendingShape)\n const id = state.pendingShape.id\n state.pendingShape = null\n setMode(state, 'select')\n selectLayer(state, id)\n state.statusText = 'Shape added'\n emitChange(state)\n } else {\n state.pendingShape = null\n renderOverlay(state)\n state.notify()\n }\n } else if (state.dragMode === 'crop') {\n if (state.cropRect) state.cropRect = normRect(state.cropRect)\n renderOverlay(state)\n state.notify()\n } else if (\n state.dragMode === 'move' ||\n state.dragMode === 'resize' ||\n state.dragMode === 'rotate'\n ) {\n if (state.dragMode === 'rotate') {\n const L = state.layers.find((l) => l.id === state.selectedId)\n if (L) state.statusText = `Rotated to ${Math.round(L.rotation)}°`\n }\n render(state)\n state.notify()\n }\n if (state.activePointerId != null) {\n if (state.overlayEl.hasPointerCapture(state.activePointerId)) {\n state.overlayEl.releasePointerCapture(state.activePointerId)\n }\n state.activePointerId = null\n }\n state.dragMode = null\n state.dragStart = null\n state.dragOrig = null\n state.dragRect = null\n state.resizeAnchor = null\n state.resizeCenter = null\n state.resizeAnchorWorld = null\n state.rotateStart = null\n}\n\nexport function onDbl(state, e) {\n if (state.pendingPoly) {\n finishPoly(state, false)\n return\n }\n if (state.mode !== 'select') return\n const p = toSource(state, e),\n hit = hitLayer(state, p)\n if (hit && hit.type === 'text') {\n selectLayer(state, hit.id)\n openTextEditor(state, hit, false)\n }\n}\n"],"names":["toSource","state","e","x","y","rotatedAABB","b","rotationDeg","rad","cos","sin","w","h","cx","cy","strokeMargin","L","DIRECTIONAL_SHAPES","clampLayerToCanvas","rotated","layerBounds","margin","dx","dy","pt","hitLayer","p","layers","i","q","toLayerSpace","closeHitRadius","SNAP_STEP","CLICK_SLOP","polyStatus","poly","n","snapPreview","anchor","shift","len","ang","undoPolyPoint","cancelPoly","drawPolyPreview","startPoly","shapeLayer","c","pts","paintLayer","ghost","k","r","first","near","drawPolyHint","count","pad","size","coarse","verb","msg","bx","by","bw","bh","resumePoly","id","l","MULTI_POINT_SHAPES","pushHistory","finishPoly","close","popHistory","setMode","render","selectLayer","emitChange","onDown","last","sel","onRotateHandle","layerCenter","corner","onResizeHandle","isMultiPoint","isLeft","isTop","rotatePoint","hit","placeholderWidth","clampBoxWidth","clampTextSize","openTextEditor","onMove","renderOverlay","rot","rightEdge","ob","MIN_SIZE","sx","sy","kx","ky","MIN_LEN","moved","center","angle","rotation","swept","deg","rr","maxH","onUp","dragged","end","normRect","onDbl"],"mappings":";;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AOC,GAAG;AAC9B,MAAID,EAAM,aAAa;AACrB,IAAAsE,EAAWtE,GAAO,EAAK;AACvB;AAAA,EACF;AACA,MAAIA,EAAM,SAAS,SAAU;AAC7B,QAAMyB,IAAI1B,EAASC,GAAOC,CAAC,GACzBuF,IAAMhE,EAASxB,GAAOyB,CAAC;AACzB,EAAI+D,KAAOA,EAAI,SAAS,WACtBb,EAAY3E,GAAOwF,EAAI,EAAE,GACzBI,EAAe5F,GAAOwF,GAAK,EAAK;AAEpC;"}
|
package/dist/index.es156.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import { cva as
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { cva as r } from "class-variance-authority";
|
|
2
|
+
import { StepItemStatus as e } from "./index.es31.js";
|
|
3
|
+
const o = r(
|
|
4
|
+
"h-8 w-8 border-2 flex items-center justify-center rounded-full cursor-pointer trasnition-all",
|
|
5
|
+
{
|
|
4
6
|
variants: {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
variant: {
|
|
8
|
+
pending: "border-neutral-2 ",
|
|
9
|
+
current: "bg-primary-1 border-primary-2 hover:bg-hover-t1 active:bg-click-t1",
|
|
10
|
+
completed: "bg-rest-p1 hover:bg-hover-p1 active:bg-click-p1 border-none"
|
|
8
11
|
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: { variant: e.PENDING }
|
|
14
|
+
}
|
|
15
|
+
);
|
|
12
16
|
export {
|
|
13
|
-
|
|
17
|
+
o as StepItemVariants
|
|
14
18
|
};
|
|
15
19
|
//# sourceMappingURL=index.es156.js.map
|
package/dist/index.es156.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es156.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"index.es156.js","sources":["../src/components/molecules/stepper/stepper.styles.ts"],"sourcesContent":["import { cva } from 'class-variance-authority'\nimport { StepItemStatus } from './stepper.type'\nexport const StepItemVariants = cva(\n 'h-8 w-8 border-2 flex items-center justify-center rounded-full cursor-pointer trasnition-all',\n {\n variants: {\n variant: {\n pending: 'border-neutral-2 ',\n current:\n 'bg-primary-1 border-primary-2 hover:bg-hover-t1 active:bg-click-t1',\n completed:\n 'bg-rest-p1 hover:bg-hover-p1 active:bg-click-p1 border-none',\n },\n },\n defaultVariants: { variant: StepItemStatus.PENDING },\n }\n)\n"],"names":["StepItemVariants","cva","StepItemStatus"],"mappings":";;AAEO,MAAMA,IAAmBC;AAAA,EAC9B;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,SACE;AAAA,QACF,WACE;AAAA,MAAA;AAAA,IACJ;AAAA,IAEF,iBAAiB,EAAE,SAASC,EAAe,QAAA;AAAA,EAAQ;AAEvD;"}
|
package/dist/index.es157.js
CHANGED
|
@@ -1,47 +1,15 @@
|
|
|
1
|
-
import { cva as
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
first:rounded-l-md first:border-l last:rounded-r-md`,
|
|
5
|
-
{
|
|
1
|
+
import { cva as a } from "class-variance-authority";
|
|
2
|
+
const t = {
|
|
3
|
+
img: a("", {
|
|
6
4
|
variants: {
|
|
7
|
-
|
|
8
|
-
true: "",
|
|
9
|
-
false: ""
|
|
10
|
-
},
|
|
11
|
-
isFocused: {
|
|
12
|
-
true: "",
|
|
13
|
-
false: ""
|
|
5
|
+
hasIcon: {
|
|
6
|
+
true: "w-12 h-12",
|
|
7
|
+
false: "h-5 w-5"
|
|
14
8
|
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
isFocused: !1
|
|
19
|
-
},
|
|
20
|
-
compoundVariants: [
|
|
21
|
-
{
|
|
22
|
-
isError: !0,
|
|
23
|
-
isFocused: !0,
|
|
24
|
-
className: "border-danger-2 ring-4 ring-danger-1"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
isError: !1,
|
|
28
|
-
isFocused: !0,
|
|
29
|
-
className: "border-primary-2 ring-4 ring-primary-1"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
isError: !0,
|
|
33
|
-
isFocused: !1,
|
|
34
|
-
className: "border-danger-2"
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
isError: !1,
|
|
38
|
-
isFocused: !1,
|
|
39
|
-
className: "border-neutral-2"
|
|
40
|
-
}
|
|
41
|
-
]
|
|
42
|
-
}
|
|
43
|
-
);
|
|
9
|
+
}
|
|
10
|
+
})
|
|
11
|
+
};
|
|
44
12
|
export {
|
|
45
|
-
|
|
13
|
+
t as hoverDetailCardStyles
|
|
46
14
|
};
|
|
47
15
|
//# sourceMappingURL=index.es157.js.map
|