@linkurious/ogma-annotations 2.1.2 → 2.1.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/{Polygon-BsnVN6js.js → Polygon-BmJ_q7qz.js} +220 -197
- package/dist/index.js +9 -9
- package/dist/index.mjs +5002 -4516
- package/dist/types/Control-Cv1I3e3C.d.ts +1621 -0
- package/dist/types/index.d.ts +285 -1913
- package/dist/types/ui.d.ts +755 -1423
- package/dist/ui-styles.css +316 -46
- package/dist/ui.js +24 -24
- package/dist/ui.mjs +615 -175
- package/package.json +12 -7
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const
|
|
1
|
+
const it = -1, at = "dragging", ct = "dragstart", dt = "dragend", ut = "click", yt = "select", lt = "unselect", ft = "hover", gt = "unhover", pt = "remove", ht = "add", xt = "cancelDrawing", mt = "completeDrawing", Tt = "update", bt = "link", wt = "history", Et = "data-annotation", It = 5, St = 3, Nt = {
|
|
2
2
|
SHAPES: 1,
|
|
3
3
|
EDITOR: 2,
|
|
4
4
|
HANDLES: 3
|
|
5
|
-
},
|
|
5
|
+
}, b = "start", Ct = "end", At = {
|
|
6
6
|
default: "default",
|
|
7
7
|
move: "move",
|
|
8
8
|
pointer: "pointer",
|
|
@@ -21,7 +21,7 @@ const ot = -1, it = "dragging", at = "dragstart", ct = "dragend", dt = "click",
|
|
|
21
21
|
eResize: "e-resize",
|
|
22
22
|
sResize: "s-resize",
|
|
23
23
|
wResize: "w-resize"
|
|
24
|
-
}, w = "collapsed", B = "expanded",
|
|
24
|
+
}, w = "collapsed", B = "expanded", Mt = 1.2, F = 0.2, _t = {
|
|
25
25
|
TEXT: "text",
|
|
26
26
|
NODE: "node",
|
|
27
27
|
BOX: "box",
|
|
@@ -29,7 +29,7 @@ const ot = -1, it = "dragging", at = "dragstart", ct = "dragend", dt = "click",
|
|
|
29
29
|
POLYGON: "polygon",
|
|
30
30
|
ANNOTATION: "annotation",
|
|
31
31
|
EDGE: "edge"
|
|
32
|
-
},
|
|
32
|
+
}, Rt = `<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
33
33
|
<path d="M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
34
34
|
</svg>`, Pt = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
35
35
|
<path d="M12 6.00015H7.33333C6.97971 6.00015 6.64057 6.14063 6.39052 6.39068C6.14048 6.64072 6 6.97986 6 7.33348V16.6668C6 17.0204 6.14048 17.3596 6.39052 17.6096C6.64057 17.8597 6.97971 18.0002 7.33333 18.0002H16.6667C17.0203 18.0002 17.3594 17.8597 17.6095 17.6096C17.8595 17.3596 18 17.0204 18 16.6668V12.0002M16.25 5.75015C16.5152 5.48493 16.8749 5.33594 17.25 5.33594C17.6251 5.33594 17.9848 5.48493 18.25 5.75015C18.5152 6.01537 18.6642 6.37508 18.6642 6.75015C18.6642 7.12522 18.5152 7.48493 18.25 7.75015L12.2413 13.7595C12.083 13.9176 11.8875 14.0334 11.6727 14.0962L9.75733 14.6562C9.69997 14.6729 9.63916 14.6739 9.58127 14.6591C9.52339 14.6442 9.47055 14.6141 9.4283 14.5719C9.38604 14.5296 9.35593 14.4768 9.3411 14.4189C9.32627 14.361 9.32727 14.3002 9.344 14.2428L9.904 12.3275C9.96702 12.1129 10.083 11.9175 10.2413 11.7595L16.25 5.75015Z" stroke="#1A70E5" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
|
|
@@ -37,7 +37,7 @@ const ot = -1, it = "dragging", at = "dragstart", ct = "dragend", dt = "click",
|
|
|
37
37
|
`;
|
|
38
38
|
let g = (t = 21) => crypto.getRandomValues(new Uint8Array(t)).reduce((e, n) => (n &= 63, n < 36 ? e += n.toString(36) : n < 62 ? e += (n - 26).toString(36).toUpperCase() : n > 62 ? e += "-" : e += "_", e), "");
|
|
39
39
|
const G = "http://www.w3.org/2000/svg";
|
|
40
|
-
function
|
|
40
|
+
function Ft(t) {
|
|
41
41
|
return document.createElementNS(G, t);
|
|
42
42
|
}
|
|
43
43
|
function zt(t, e) {
|
|
@@ -46,7 +46,7 @@ function zt(t, e) {
|
|
|
46
46
|
function S(t) {
|
|
47
47
|
return t.geometry.bbox || H(t), t.geometry.bbox;
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function z(t) {
|
|
50
50
|
if ("width" in t.properties && "height" in t.properties)
|
|
51
51
|
return {
|
|
52
52
|
width: t.properties.width,
|
|
@@ -58,6 +58,11 @@ function D(t) {
|
|
|
58
58
|
height: e[3] - e[1]
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
+
const Ot = 0.4, Dt = 4;
|
|
62
|
+
function Lt(t, e) {
|
|
63
|
+
const n = parseFloat((t ?? "").toString());
|
|
64
|
+
return (Number.isFinite(n) ? n : 0) * (e ?? 1);
|
|
65
|
+
}
|
|
61
66
|
function Y(t, e = !1, n = 1) {
|
|
62
67
|
if (t.geometry.type === "Point" && "width" in t.properties && "height" in t.properties) {
|
|
63
68
|
const [s, o] = t.geometry.coordinates;
|
|
@@ -70,14 +75,14 @@ function Y(t, e = !1, n = 1) {
|
|
|
70
75
|
const r = S(t);
|
|
71
76
|
return { x: r[0], y: r[1] };
|
|
72
77
|
}
|
|
73
|
-
function
|
|
78
|
+
function kt(t) {
|
|
74
79
|
if (t.geometry.type === "Point")
|
|
75
80
|
return { x: t.geometry.coordinates[0], y: t.geometry.coordinates[1] };
|
|
76
81
|
const e = S(t);
|
|
77
82
|
return { x: (e[0] + e[2]) / 2, y: (e[1] + e[3]) / 2 };
|
|
78
83
|
}
|
|
79
84
|
function H(t) {
|
|
80
|
-
if (
|
|
85
|
+
if (tt(t)) {
|
|
81
86
|
const [e, n] = t.geometry.coordinates[0], [r, s] = t.geometry.coordinates[1];
|
|
82
87
|
t.geometry.bbox = [
|
|
83
88
|
Math.min(e, r),
|
|
@@ -98,36 +103,36 @@ function H(t) {
|
|
|
98
103
|
t.geometry.bbox = [n, r, s, o];
|
|
99
104
|
}
|
|
100
105
|
}
|
|
101
|
-
function
|
|
106
|
+
function Vt(t, e, n, r, s) {
|
|
102
107
|
t.geometry.coordinates = [e + r / 2, n + s / 2], t.geometry.bbox = [e, n, e + r, n + s], t.properties.width = r, t.properties.height = s;
|
|
103
108
|
}
|
|
104
109
|
function W(t) {
|
|
105
110
|
const [e, n] = t.geometry.coordinates[0];
|
|
106
111
|
return { x: e, y: n };
|
|
107
112
|
}
|
|
108
|
-
function
|
|
109
|
-
const [n, r] = t.geometry.coordinates[e ===
|
|
113
|
+
function Bt(t, e) {
|
|
114
|
+
const [n, r] = t.geometry.coordinates[e === b ? 0 : 1];
|
|
110
115
|
return { x: n, y: r };
|
|
111
116
|
}
|
|
112
117
|
function X(t) {
|
|
113
118
|
const [e, n] = t.geometry.coordinates[1];
|
|
114
119
|
return { x: e, y: n };
|
|
115
120
|
}
|
|
116
|
-
function
|
|
121
|
+
function v(t, e, n) {
|
|
117
122
|
t.geometry.coordinates[0] = [e, n];
|
|
118
123
|
}
|
|
119
|
-
function
|
|
124
|
+
function $(t, e, n) {
|
|
120
125
|
t.geometry.coordinates[1] = [e, n];
|
|
121
126
|
}
|
|
122
127
|
function U(t) {
|
|
123
128
|
return { start: W(t), end: X(t) };
|
|
124
129
|
}
|
|
125
|
-
function
|
|
126
|
-
e ===
|
|
130
|
+
function Gt(t, e, n, r) {
|
|
131
|
+
e === b ? v(t, n, r) : $(t, n, r);
|
|
127
132
|
}
|
|
128
|
-
const
|
|
129
|
-
function
|
|
130
|
-
return
|
|
133
|
+
const Yt = (t) => parseInt(t.getAttribute("data-handle-id") || "-1");
|
|
134
|
+
function Ht(t) {
|
|
135
|
+
return T(t).reduce(
|
|
131
136
|
(e, n) => (e[0] = Math.min(n[0], e[0]), e[1] = Math.min(n[1], e[1]), e[2] = Math.max(n[0], e[2]), e[3] = Math.max(n[1], e[3]), e),
|
|
132
137
|
[
|
|
133
138
|
Number.POSITIVE_INFINITY,
|
|
@@ -140,7 +145,7 @@ function kt(t) {
|
|
|
140
145
|
function q(t) {
|
|
141
146
|
return Array.isArray(t) && t.length === 2 && t.every(isFinite);
|
|
142
147
|
}
|
|
143
|
-
function
|
|
148
|
+
function Wt(t, e, n, r) {
|
|
144
149
|
for (let s = 0; s < t.coordinates.length; s++) {
|
|
145
150
|
const o = t.coordinates[s];
|
|
146
151
|
if (q(o))
|
|
@@ -153,7 +158,7 @@ function Bt(t, e, n, r) {
|
|
|
153
158
|
}
|
|
154
159
|
return t;
|
|
155
160
|
}
|
|
156
|
-
function
|
|
161
|
+
function T(t) {
|
|
157
162
|
let e = [];
|
|
158
163
|
if (t.type == "Point")
|
|
159
164
|
t.bbox ? e = [
|
|
@@ -172,30 +177,30 @@ function b(t) {
|
|
|
172
177
|
[]
|
|
173
178
|
);
|
|
174
179
|
else if (t.type == "Feature")
|
|
175
|
-
if (
|
|
180
|
+
if (k(t) || L(t)) {
|
|
176
181
|
const n = S(t);
|
|
177
182
|
e = [
|
|
178
183
|
[n[0], n[1]],
|
|
179
184
|
[n[2], n[3]]
|
|
180
185
|
];
|
|
181
|
-
} else e =
|
|
186
|
+
} else e = T(t.geometry);
|
|
182
187
|
else t.type == "GeometryCollection" ? e = t.geometries.reduce(
|
|
183
|
-
(n, r) => n.concat(
|
|
188
|
+
(n, r) => n.concat(T(r)),
|
|
184
189
|
[]
|
|
185
190
|
) : t.type == "FeatureCollection" && (e = t.features.reduce(
|
|
186
|
-
(n, r) => n.concat(
|
|
191
|
+
(n, r) => n.concat(T(r)),
|
|
187
192
|
[]
|
|
188
193
|
));
|
|
189
194
|
return e;
|
|
190
195
|
}
|
|
191
|
-
function
|
|
196
|
+
function Xt(t, e, n) {
|
|
192
197
|
const r = Math.atan2(t.y - e.y, t.x - e.x);
|
|
193
198
|
return {
|
|
194
199
|
x: e.x + n * Math.cos(r),
|
|
195
200
|
y: e.y + n * Math.sin(r)
|
|
196
201
|
};
|
|
197
202
|
}
|
|
198
|
-
function
|
|
203
|
+
function vt(t, e) {
|
|
199
204
|
if (!e) return { x: t.clientX, y: t.clientY };
|
|
200
205
|
const n = e.getBoundingClientRect();
|
|
201
206
|
return {
|
|
@@ -203,12 +208,22 @@ function Yt(t, e) {
|
|
|
203
208
|
y: t.clientY - n.top - e.clientTop
|
|
204
209
|
};
|
|
205
210
|
}
|
|
206
|
-
function
|
|
207
|
-
|
|
211
|
+
function $t(t, e) {
|
|
212
|
+
if (!e) return t;
|
|
213
|
+
const n = e.getBoundingClientRect();
|
|
214
|
+
return {
|
|
215
|
+
x: t.x + n.left + e.clientLeft,
|
|
216
|
+
y: t.y + n.top + e.clientTop
|
|
217
|
+
};
|
|
208
218
|
}
|
|
209
|
-
|
|
219
|
+
const Z = { r: 0, g: 0, b: 0, a: 0 };
|
|
220
|
+
function Ut(t, e) {
|
|
221
|
+
return t === "transparent" || t === "none" ? "rgba(0, 0, 0, 0)" : t.startsWith("#") ? K(t, e) : t.startsWith("rgb") ? Q(t, e) : t;
|
|
222
|
+
}
|
|
223
|
+
function qt(t) {
|
|
224
|
+
if (t === "transparent" || t === "none") return Z;
|
|
210
225
|
if (t.startsWith("#")) {
|
|
211
|
-
const e =
|
|
226
|
+
const e = A(t), n = parseInt(e.slice(1, 3), 16), r = parseInt(e.slice(3, 5), 16), s = parseInt(e.slice(5, 7), 16);
|
|
212
227
|
return { r: n, g: r, b: s, a: 1 };
|
|
213
228
|
} else {
|
|
214
229
|
const e = t.match(
|
|
@@ -223,21 +238,21 @@ function Wt(t) {
|
|
|
223
238
|
};
|
|
224
239
|
}
|
|
225
240
|
}
|
|
226
|
-
function
|
|
241
|
+
function A(t) {
|
|
227
242
|
return t.length === 4 ? t.split("").map((e) => e + e).join("") : t;
|
|
228
243
|
}
|
|
229
|
-
function
|
|
230
|
-
const [n, r, s] =
|
|
244
|
+
function K(t, e) {
|
|
245
|
+
const [n, r, s] = A(t).match(/\w\w/g).map((o) => parseInt(o, 16));
|
|
231
246
|
return `rgba(${n}, ${r}, ${s}, ${e})`;
|
|
232
247
|
}
|
|
233
|
-
function
|
|
248
|
+
function Q(t, e) {
|
|
234
249
|
const [n, r, s] = t.match(/\d+/g).map((o) => parseInt(o, 10));
|
|
235
250
|
return `rgba(${n}, ${r}, ${s}, ${e})`;
|
|
236
251
|
}
|
|
237
|
-
function
|
|
252
|
+
function Zt() {
|
|
238
253
|
return typeof window < "u" ? window : void 0;
|
|
239
254
|
}
|
|
240
|
-
const
|
|
255
|
+
const Kt = (t, e = 16, n = !1) => {
|
|
241
256
|
let r = !1, s = null;
|
|
242
257
|
const o = Math.max(1, Math.round(e * 60 / 1e3)), i = (a) => {
|
|
243
258
|
requestAnimationFrame(() => {
|
|
@@ -256,13 +271,13 @@ const $t = (t, e = 16, n = !1) => {
|
|
|
256
271
|
}
|
|
257
272
|
t(...a), r = !0, i(o);
|
|
258
273
|
};
|
|
259
|
-
},
|
|
274
|
+
}, Qt = (t, e) => {
|
|
260
275
|
let n;
|
|
261
276
|
return (...s) => {
|
|
262
277
|
clearTimeout(n), n = setTimeout(() => t(...s), e);
|
|
263
278
|
};
|
|
264
279
|
};
|
|
265
|
-
function
|
|
280
|
+
function Jt(t, e) {
|
|
266
281
|
let n;
|
|
267
282
|
return function(...r) {
|
|
268
283
|
clearTimeout(n), n = setTimeout(() => {
|
|
@@ -270,8 +285,8 @@ function Ut(t, e) {
|
|
|
270
285
|
}, e);
|
|
271
286
|
};
|
|
272
287
|
}
|
|
273
|
-
function
|
|
274
|
-
if ((L(t) ||
|
|
288
|
+
function jt(t) {
|
|
289
|
+
if ((L(t) || k(t)) && t.geometry.type === "Polygon") {
|
|
275
290
|
const e = t.geometry.coordinates[0], n = e[0][0], r = e[0][1], s = e[2][0], o = e[2][1], i = s - n, a = o - r, c = n + i / 2, d = r + a / 2;
|
|
276
291
|
return {
|
|
277
292
|
...t,
|
|
@@ -293,7 +308,7 @@ function O(t, e) {
|
|
|
293
308
|
let n, r, s, o = 1;
|
|
294
309
|
const i = t.trim();
|
|
295
310
|
if (i.startsWith("#")) {
|
|
296
|
-
const y = (i.length === 4 ?
|
|
311
|
+
const y = (i.length === 4 ? A(i) : i).match(/#?(\w{2})(\w{2})(\w{2})/);
|
|
297
312
|
if (!y) return t;
|
|
298
313
|
n = parseInt(y[1], 16), r = parseInt(y[2], 16), s = parseInt(y[3], 16);
|
|
299
314
|
} else {
|
|
@@ -306,34 +321,34 @@ function O(t, e) {
|
|
|
306
321
|
const a = e * 100, d = 0.299 * n + 0.587 * r + 0.114 * s > 186 ? -a / 2 : a;
|
|
307
322
|
return n = Math.max(0, Math.min(255, n + Math.round(2.55 * d))), r = Math.max(0, Math.min(255, r + Math.round(2.55 * d))), s = Math.max(0, Math.min(255, s + Math.round(2.55 * d))), `rgba(${n},${r},${s},${o})`;
|
|
308
323
|
}
|
|
309
|
-
const
|
|
324
|
+
const te = (t) => O(t, F), ee = (t) => O(t, -F), R = (t, e) => ({
|
|
310
325
|
x: t.x - e.x,
|
|
311
326
|
y: t.y - e.y
|
|
312
|
-
}),
|
|
327
|
+
}), D = (t) => Math.sqrt(t.x * t.x + t.y * t.y), ne = (t) => ({
|
|
313
328
|
x: -t.x,
|
|
314
329
|
y: -t.y
|
|
315
|
-
}),
|
|
316
|
-
const e =
|
|
330
|
+
}), P = (t) => {
|
|
331
|
+
const e = D(t);
|
|
317
332
|
return e === 0 ? { x: 0, y: 0 } : {
|
|
318
333
|
x: t.x / e,
|
|
319
334
|
y: t.y / e
|
|
320
335
|
};
|
|
321
|
-
},
|
|
336
|
+
}, re = (t, e) => ({
|
|
322
337
|
x: t.x + e.x,
|
|
323
338
|
y: t.y + e.y
|
|
324
|
-
}),
|
|
339
|
+
}), se = (t, e) => ({
|
|
325
340
|
x: t.x * e,
|
|
326
341
|
y: t.y * e
|
|
327
|
-
}),
|
|
342
|
+
}), oe = (t, e) => {
|
|
328
343
|
const n = Math.sin(e), r = Math.cos(e);
|
|
329
344
|
return {
|
|
330
345
|
x: t.x * r - t.y * n,
|
|
331
346
|
y: t.x * n + t.y * r
|
|
332
347
|
};
|
|
333
|
-
}, J = (t, e) => t.x * e.x + t.y * e.y,
|
|
334
|
-
function
|
|
335
|
-
const { start: r, end: s } = U(t), o =
|
|
336
|
-
return d > 0 && d < c && Math.abs(
|
|
348
|
+
}, J = (t, e) => t.x * e.x + t.y * e.y, j = (t, e) => t.x * e.y - t.y * e.x, tt = (t) => t.properties.type === "arrow";
|
|
349
|
+
function ie(t, e, n) {
|
|
350
|
+
const { start: r, end: s } = U(t), o = R(e, r), i = t.properties.style.strokeWidth, a = R(s, r), c = D(a), d = J(o, P(a));
|
|
351
|
+
return d > 0 && d < c && Math.abs(j(o, P(a))) < i / 2 + n;
|
|
337
352
|
}
|
|
338
353
|
const E = {
|
|
339
354
|
strokeType: "plain",
|
|
@@ -341,7 +356,7 @@ const E = {
|
|
|
341
356
|
strokeWidth: 1,
|
|
342
357
|
head: "none",
|
|
343
358
|
tail: "none"
|
|
344
|
-
},
|
|
359
|
+
}, ae = {
|
|
345
360
|
id: void 0,
|
|
346
361
|
// will be set by the editor
|
|
347
362
|
type: "Feature",
|
|
@@ -368,7 +383,7 @@ const E = {
|
|
|
368
383
|
// tail: 'arrow-plain',
|
|
369
384
|
// start: { x: 0, y: 0 },
|
|
370
385
|
// end: { x: 100, y: 100 }
|
|
371
|
-
},
|
|
386
|
+
}, et = (t = 0, e = 0, n = 0, r = 0, s = { ...E }) => ({
|
|
372
387
|
id: g(),
|
|
373
388
|
type: "Feature",
|
|
374
389
|
properties: {
|
|
@@ -386,8 +401,8 @@ const E = {
|
|
|
386
401
|
]
|
|
387
402
|
}
|
|
388
403
|
}), L = (t) => t.properties.type === "box";
|
|
389
|
-
function
|
|
390
|
-
const o = Y(t), { width: i, height: a } =
|
|
404
|
+
function ce(t, e, n = 0, r = 1, s = 0) {
|
|
405
|
+
const o = Y(t), { width: i, height: a } = z(t), c = e.x - o.x, d = e.y - o.y, u = c * r - d * n, y = c * n + d * r;
|
|
391
406
|
return u > -s && u < i + s && y > -s && y < a + s;
|
|
392
407
|
}
|
|
393
408
|
const I = {
|
|
@@ -397,7 +412,7 @@ const I = {
|
|
|
397
412
|
boxShadow: "",
|
|
398
413
|
padding: 16,
|
|
399
414
|
strokeType: "plain"
|
|
400
|
-
},
|
|
415
|
+
}, de = {
|
|
401
416
|
id: void 0,
|
|
402
417
|
// will be set by the editor
|
|
403
418
|
type: "Feature",
|
|
@@ -413,7 +428,7 @@ const I = {
|
|
|
413
428
|
// center of 100x50 box
|
|
414
429
|
bbox: [0, 0, 100, 50]
|
|
415
430
|
}
|
|
416
|
-
},
|
|
431
|
+
}, ue = (t = 0, e = 0, n = 100, r = 50, s = { ...I }) => ({
|
|
417
432
|
id: g(),
|
|
418
433
|
type: "Feature",
|
|
419
434
|
properties: {
|
|
@@ -427,7 +442,10 @@ const I = {
|
|
|
427
442
|
coordinates: [t + n / 2, e + r / 2]
|
|
428
443
|
// center
|
|
429
444
|
}
|
|
430
|
-
}),
|
|
445
|
+
}), k = (t) => t.properties.type === "text", ye = (t) => {
|
|
446
|
+
const e = t.properties.style;
|
|
447
|
+
return (e == null ? void 0 : e.scaleFontOnResize) === !0 && (e == null ? void 0 : e.placeholder) === "Quick note…";
|
|
448
|
+
}, C = {
|
|
431
449
|
font: "sans-serif",
|
|
432
450
|
fontSize: 18,
|
|
433
451
|
color: "#505050",
|
|
@@ -437,7 +455,7 @@ const I = {
|
|
|
437
455
|
padding: 16,
|
|
438
456
|
strokeType: "plain",
|
|
439
457
|
fixedSize: !1
|
|
440
|
-
},
|
|
458
|
+
}, le = {
|
|
441
459
|
id: g(),
|
|
442
460
|
type: "Feature",
|
|
443
461
|
properties: {
|
|
@@ -445,7 +463,7 @@ const I = {
|
|
|
445
463
|
content: "",
|
|
446
464
|
width: 100,
|
|
447
465
|
height: 50,
|
|
448
|
-
style: { ...
|
|
466
|
+
style: { ...C }
|
|
449
467
|
},
|
|
450
468
|
geometry: {
|
|
451
469
|
type: "Point",
|
|
@@ -453,7 +471,7 @@ const I = {
|
|
|
453
471
|
// center of 100x50 box
|
|
454
472
|
bbox: [0, 0, 100, 50]
|
|
455
473
|
}
|
|
456
|
-
},
|
|
474
|
+
}, fe = (t = 0, e = 0, n = 100, r = 50, s = "", o = { ...C }) => ({
|
|
457
475
|
id: g(),
|
|
458
476
|
type: "Feature",
|
|
459
477
|
properties: {
|
|
@@ -461,7 +479,7 @@ const I = {
|
|
|
461
479
|
content: s,
|
|
462
480
|
width: n,
|
|
463
481
|
height: r,
|
|
464
|
-
style: { ...
|
|
482
|
+
style: { ...C, ...o }
|
|
465
483
|
},
|
|
466
484
|
geometry: {
|
|
467
485
|
type: "Point",
|
|
@@ -470,15 +488,15 @@ const I = {
|
|
|
470
488
|
bbox: [t, e, t + n, e + r]
|
|
471
489
|
}
|
|
472
490
|
});
|
|
473
|
-
function
|
|
491
|
+
function nt(t, e, n = 0, r = 0, s = 1, o = 1) {
|
|
474
492
|
var m;
|
|
475
493
|
const [i, a] = t.geometry.coordinates;
|
|
476
|
-
let { width: c, height: d } =
|
|
494
|
+
let { width: c, height: d } = z(t);
|
|
477
495
|
(m = t.properties.style) != null && m.fixedSize && (c /= o, d /= o);
|
|
478
496
|
const u = c / 2, y = d / 2, l = e.x - i, f = e.y - a, h = l * s - f * r, x = l * r + f * s;
|
|
479
497
|
return h > -u - n && h < u + n && x > -y - n && x < y + n;
|
|
480
498
|
}
|
|
481
|
-
const
|
|
499
|
+
const ge = (t) => t.properties.type === "comment", p = {
|
|
482
500
|
// Box styling
|
|
483
501
|
background: "#FFFACD",
|
|
484
502
|
// Light yellow (sticky note color)
|
|
@@ -512,20 +530,20 @@ const ce = (t) => t.properties.type === "comment", p = {
|
|
|
512
530
|
fixedSize: !0,
|
|
513
531
|
// Connector line behavior
|
|
514
532
|
connectorMode: "rigid"
|
|
515
|
-
},
|
|
533
|
+
}, N = {
|
|
516
534
|
mode: "expanded",
|
|
517
535
|
width: 200,
|
|
518
536
|
height: 60,
|
|
519
537
|
// Initial height, will auto-grow
|
|
520
538
|
style: p
|
|
521
539
|
};
|
|
522
|
-
function
|
|
540
|
+
function rt(t, e, n, r) {
|
|
523
541
|
const s = {
|
|
524
542
|
type: "comment",
|
|
525
543
|
content: n,
|
|
526
|
-
mode: (r == null ? void 0 : r.mode) ??
|
|
527
|
-
width: (r == null ? void 0 : r.width) ??
|
|
528
|
-
height: (r == null ? void 0 : r.height) ??
|
|
544
|
+
mode: (r == null ? void 0 : r.mode) ?? N.mode,
|
|
545
|
+
width: (r == null ? void 0 : r.width) ?? N.width,
|
|
546
|
+
height: (r == null ? void 0 : r.height) ?? N.height,
|
|
529
547
|
author: r == null ? void 0 : r.author,
|
|
530
548
|
timestamp: r == null ? void 0 : r.timestamp,
|
|
531
549
|
style: {
|
|
@@ -543,7 +561,7 @@ function nt(t, e, n, r) {
|
|
|
543
561
|
}
|
|
544
562
|
};
|
|
545
563
|
}
|
|
546
|
-
function
|
|
564
|
+
function pe(t) {
|
|
547
565
|
return {
|
|
548
566
|
...t,
|
|
549
567
|
properties: {
|
|
@@ -552,9 +570,9 @@ function de(t) {
|
|
|
552
570
|
}
|
|
553
571
|
};
|
|
554
572
|
}
|
|
555
|
-
function
|
|
573
|
+
function he(t, e, n = 0, r, s, o = 1) {
|
|
556
574
|
if (t.properties.mode !== w)
|
|
557
|
-
return
|
|
575
|
+
return nt(
|
|
558
576
|
t,
|
|
559
577
|
e,
|
|
560
578
|
n,
|
|
@@ -568,27 +586,27 @@ function ue(t, e, n = 0, r, s, o = 1) {
|
|
|
568
586
|
const u = c / 2, y = d / 2, l = e.x - t.geometry.coordinates[0], f = e.y - t.geometry.coordinates[1];
|
|
569
587
|
return l >= -u - n && l <= u + n && f >= -y - n && f <= y + n;
|
|
570
588
|
}
|
|
571
|
-
function
|
|
589
|
+
function xe(t) {
|
|
572
590
|
const [e, n] = t.geometry.coordinates;
|
|
573
591
|
return { x: e, y: n };
|
|
574
592
|
}
|
|
575
|
-
function
|
|
593
|
+
function me(t) {
|
|
576
594
|
const e = t.properties, n = { ...p, ...e.style };
|
|
577
595
|
return e.mode === w ? { width: n.iconSize, height: n.iconSize } : { width: e.width, height: e.height };
|
|
578
596
|
}
|
|
579
|
-
function
|
|
597
|
+
function st(t, e = 80) {
|
|
580
598
|
const n = e / t.properties.width;
|
|
581
599
|
return Math.max(0.1, Math.min(1, n));
|
|
582
600
|
}
|
|
583
|
-
function
|
|
601
|
+
function Te(t) {
|
|
584
602
|
return ({ ...p, ...t.properties.style }.connectorMode ?? "rigid") !== "elastic";
|
|
585
603
|
}
|
|
586
|
-
function
|
|
604
|
+
function be(t) {
|
|
587
605
|
const e = { ...p, ...t.properties.style };
|
|
588
|
-
return e.collapseZoomThreshold !== void 0 ? e.collapseZoomThreshold :
|
|
606
|
+
return e.collapseZoomThreshold !== void 0 ? e.collapseZoomThreshold : st(t);
|
|
589
607
|
}
|
|
590
|
-
function
|
|
591
|
-
const i =
|
|
608
|
+
function we(t, e, n, r, s = "", o) {
|
|
609
|
+
const i = rt(
|
|
592
610
|
n,
|
|
593
611
|
r,
|
|
594
612
|
s,
|
|
@@ -598,21 +616,21 @@ function pe(t, e, n, r, s = "", o) {
|
|
|
598
616
|
head: "arrow",
|
|
599
617
|
// Default to arrow head
|
|
600
618
|
...o == null ? void 0 : o.arrowStyle
|
|
601
|
-
}, c =
|
|
619
|
+
}, c = et(n, r, t, e, a);
|
|
602
620
|
return c.properties.link = {
|
|
603
|
-
[
|
|
621
|
+
[b]: {
|
|
604
622
|
id: i.id,
|
|
605
|
-
side:
|
|
623
|
+
side: b,
|
|
606
624
|
type: "comment",
|
|
607
625
|
magnet: { x: 0, y: 0 }
|
|
608
626
|
}
|
|
609
627
|
}, { comment: i, arrow: c };
|
|
610
628
|
}
|
|
611
|
-
function
|
|
612
|
-
const d = t - i, u = e - a, y = i + d * o - u * s, l = a + d * s + u * o, f = i + (d + n) * o - u * s, h = a + (d + n) * s + u * o, x = i + (d + n) * o - (u + r) * s, m = a + (d + n) * s + (u + r) * o,
|
|
613
|
-
return c[0] = Math.min(y, f, x,
|
|
629
|
+
function Ee(t, e, n, r, s, o, i, a, c) {
|
|
630
|
+
const d = t - i, u = e - a, y = i + d * o - u * s, l = a + d * s + u * o, f = i + (d + n) * o - u * s, h = a + (d + n) * s + u * o, x = i + (d + n) * o - (u + r) * s, m = a + (d + n) * s + (u + r) * o, M = i + d * o - (u + r) * s, _ = a + d * s + (u + r) * o;
|
|
631
|
+
return c[0] = Math.min(y, f, x, M), c[1] = Math.min(l, h, m, _), c[2] = Math.max(y, f, x, M), c[3] = Math.max(l, h, m, _), c;
|
|
614
632
|
}
|
|
615
|
-
function
|
|
633
|
+
function ot(t, e, n) {
|
|
616
634
|
const r = n.x - e.x, s = n.y - e.y, o = r * r + s * s;
|
|
617
635
|
if (o === 0) {
|
|
618
636
|
const y = t.x - e.x, l = t.y - e.y;
|
|
@@ -623,8 +641,8 @@ function st(t, e, n) {
|
|
|
623
641
|
const a = e.x + i * r, c = e.y + i * s, d = t.x - a, u = t.y - c;
|
|
624
642
|
return Math.sqrt(d * d + u * u);
|
|
625
643
|
}
|
|
626
|
-
const
|
|
627
|
-
function
|
|
644
|
+
const Ie = (t) => t.properties.type === "polygon";
|
|
645
|
+
function Se(t, e, n = 0) {
|
|
628
646
|
const r = t.geometry.coordinates[0], s = t.geometry.bbox;
|
|
629
647
|
if (s) {
|
|
630
648
|
const [i, a, c, d] = s;
|
|
@@ -640,11 +658,11 @@ function me(t, e, n = 0) {
|
|
|
640
658
|
if (n > 0)
|
|
641
659
|
for (let i = 0; i < r.length - 1; i++) {
|
|
642
660
|
const [a, c] = r[i], [d, u] = r[i + 1];
|
|
643
|
-
if (
|
|
661
|
+
if (ot(e, { x: a, y: c }, { x: d, y: u }) <= n) return !0;
|
|
644
662
|
}
|
|
645
663
|
return !1;
|
|
646
664
|
}
|
|
647
|
-
function
|
|
665
|
+
function Ne(t, e) {
|
|
648
666
|
const n = t[0];
|
|
649
667
|
n.length > 0 && (n[0][0] !== n[n.length - 1][0] || n[0][1] !== n[n.length - 1][1]) && n.push([n[0][0], n[0][1]]);
|
|
650
668
|
let r = 1 / 0, s = 1 / 0, o = -1 / 0, i = -1 / 0;
|
|
@@ -662,129 +680,134 @@ function be(t, e) {
|
|
|
662
680
|
properties: {
|
|
663
681
|
type: "polygon",
|
|
664
682
|
style: {
|
|
665
|
-
...
|
|
683
|
+
...V,
|
|
666
684
|
...d
|
|
667
685
|
},
|
|
668
686
|
...u
|
|
669
687
|
}
|
|
670
688
|
};
|
|
671
689
|
}
|
|
672
|
-
const
|
|
690
|
+
const V = {
|
|
673
691
|
...I,
|
|
674
692
|
strokeColor: "#000000",
|
|
675
693
|
strokeWidth: 2,
|
|
676
694
|
background: "transparent"
|
|
677
|
-
},
|
|
695
|
+
}, Ce = {
|
|
678
696
|
type: "polygon",
|
|
679
697
|
style: {
|
|
680
|
-
...
|
|
698
|
+
...V
|
|
681
699
|
}
|
|
682
700
|
};
|
|
683
701
|
export {
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
702
|
+
me as $,
|
|
703
|
+
It as A,
|
|
704
|
+
Se as B,
|
|
687
705
|
w as C,
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
J,
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
706
|
+
H as D,
|
|
707
|
+
ct as E,
|
|
708
|
+
mt as F,
|
|
709
|
+
z as G,
|
|
710
|
+
I as H,
|
|
711
|
+
te as I,
|
|
712
|
+
Y as J,
|
|
713
|
+
Ft as K,
|
|
714
|
+
C as L,
|
|
715
|
+
Lt as M,
|
|
716
|
+
it as N,
|
|
717
|
+
Mt as O,
|
|
718
|
+
p as P,
|
|
719
|
+
Nt as Q,
|
|
720
|
+
J as R,
|
|
721
|
+
b as S,
|
|
722
|
+
_t as T,
|
|
723
|
+
Dt as U,
|
|
724
|
+
Ot as V,
|
|
725
|
+
St as W,
|
|
726
|
+
ce as X,
|
|
727
|
+
he as Y,
|
|
728
|
+
nt as Z,
|
|
729
|
+
Te as _,
|
|
712
730
|
B as a,
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
731
|
+
se as a0,
|
|
732
|
+
re as a1,
|
|
733
|
+
g as a2,
|
|
734
|
+
Kt as a3,
|
|
735
|
+
R as a4,
|
|
736
|
+
D as a5,
|
|
737
|
+
S as a6,
|
|
738
|
+
W as a7,
|
|
739
|
+
X as a8,
|
|
740
|
+
U as a9,
|
|
741
|
+
ae as aA,
|
|
742
|
+
de as aB,
|
|
743
|
+
N as aC,
|
|
744
|
+
Ce as aD,
|
|
745
|
+
le as aE,
|
|
746
|
+
Ht as aF,
|
|
747
|
+
Xt as aG,
|
|
748
|
+
xe as aH,
|
|
749
|
+
be as aI,
|
|
750
|
+
T as aJ,
|
|
751
|
+
Yt as aK,
|
|
752
|
+
A as aL,
|
|
753
|
+
K as aM,
|
|
754
|
+
ye as aN,
|
|
755
|
+
qt as aO,
|
|
756
|
+
Q as aP,
|
|
757
|
+
Wt as aQ,
|
|
758
|
+
$ as aR,
|
|
759
|
+
v as aS,
|
|
760
|
+
Vt as aT,
|
|
761
|
+
pe as aU,
|
|
762
|
+
P as aa,
|
|
763
|
+
ne as ab,
|
|
764
|
+
zt as ac,
|
|
765
|
+
oe as ad,
|
|
766
|
+
V as ae,
|
|
767
|
+
Pt as af,
|
|
768
|
+
Rt as ag,
|
|
769
|
+
Ee as ah,
|
|
770
|
+
bt as ai,
|
|
771
|
+
wt as aj,
|
|
772
|
+
yt as ak,
|
|
773
|
+
lt as al,
|
|
774
|
+
Tt as am,
|
|
775
|
+
pt as an,
|
|
776
|
+
xt as ao,
|
|
777
|
+
Et as ap,
|
|
778
|
+
ft as aq,
|
|
779
|
+
gt as ar,
|
|
780
|
+
F as as,
|
|
781
|
+
O as at,
|
|
782
|
+
st as au,
|
|
760
783
|
Ut as av,
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
784
|
+
we as aw,
|
|
785
|
+
ee as ax,
|
|
786
|
+
Qt as ay,
|
|
787
|
+
Jt as az,
|
|
788
|
+
dt as b,
|
|
789
|
+
At as c,
|
|
790
|
+
at as d,
|
|
791
|
+
vt as e,
|
|
792
|
+
et as f,
|
|
793
|
+
Zt as g,
|
|
771
794
|
E as h,
|
|
772
|
-
|
|
773
|
-
j,
|
|
795
|
+
ge as i,
|
|
796
|
+
tt as j,
|
|
774
797
|
Ct as k,
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
798
|
+
ut as l,
|
|
799
|
+
fe as m,
|
|
800
|
+
ue as n,
|
|
801
|
+
Ne as o,
|
|
802
|
+
rt as p,
|
|
803
|
+
ht as q,
|
|
804
|
+
jt as r,
|
|
805
|
+
k as s,
|
|
783
806
|
L as t,
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
807
|
+
kt as u,
|
|
808
|
+
Ie as v,
|
|
809
|
+
ie as w,
|
|
810
|
+
$t as x,
|
|
811
|
+
Bt as y,
|
|
812
|
+
Gt as z
|
|
790
813
|
};
|