@linkurious/ogma-annotations 2.1.2 → 2.1.3
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-C9ZkyU-t.js} +210 -196
- package/dist/index.js +9 -9
- package/dist/index.mjs +4980 -4528
- package/dist/types/Control-BiYdzv0K.d.ts +1609 -0
- package/dist/types/index.d.ts +271 -1913
- package/dist/types/ui.d.ts +742 -1423
- package/dist/ui-styles.css +308 -46
- package/dist/ui.js +17 -17
- package/dist/ui.mjs +572 -166
- package/package.json +10 -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", At = "end", Ct = {
|
|
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,14 @@ function Yt(t, e) {
|
|
|
203
208
|
y: t.clientY - n.top - e.clientTop
|
|
204
209
|
};
|
|
205
210
|
}
|
|
206
|
-
|
|
207
|
-
|
|
211
|
+
const Z = { r: 0, g: 0, b: 0, a: 0 };
|
|
212
|
+
function $t(t, e) {
|
|
213
|
+
return t === "transparent" || t === "none" ? "rgba(0, 0, 0, 0)" : t.startsWith("#") ? K(t, e) : t.startsWith("rgb") ? Q(t, e) : t;
|
|
208
214
|
}
|
|
209
|
-
function
|
|
215
|
+
function Ut(t) {
|
|
216
|
+
if (t === "transparent" || t === "none") return Z;
|
|
210
217
|
if (t.startsWith("#")) {
|
|
211
|
-
const e =
|
|
218
|
+
const e = C(t), n = parseInt(e.slice(1, 3), 16), r = parseInt(e.slice(3, 5), 16), s = parseInt(e.slice(5, 7), 16);
|
|
212
219
|
return { r: n, g: r, b: s, a: 1 };
|
|
213
220
|
} else {
|
|
214
221
|
const e = t.match(
|
|
@@ -223,21 +230,21 @@ function Wt(t) {
|
|
|
223
230
|
};
|
|
224
231
|
}
|
|
225
232
|
}
|
|
226
|
-
function
|
|
233
|
+
function C(t) {
|
|
227
234
|
return t.length === 4 ? t.split("").map((e) => e + e).join("") : t;
|
|
228
235
|
}
|
|
229
|
-
function
|
|
230
|
-
const [n, r, s] =
|
|
236
|
+
function K(t, e) {
|
|
237
|
+
const [n, r, s] = C(t).match(/\w\w/g).map((o) => parseInt(o, 16));
|
|
231
238
|
return `rgba(${n}, ${r}, ${s}, ${e})`;
|
|
232
239
|
}
|
|
233
|
-
function
|
|
240
|
+
function Q(t, e) {
|
|
234
241
|
const [n, r, s] = t.match(/\d+/g).map((o) => parseInt(o, 10));
|
|
235
242
|
return `rgba(${n}, ${r}, ${s}, ${e})`;
|
|
236
243
|
}
|
|
237
|
-
function
|
|
244
|
+
function qt() {
|
|
238
245
|
return typeof window < "u" ? window : void 0;
|
|
239
246
|
}
|
|
240
|
-
const
|
|
247
|
+
const Zt = (t, e = 16, n = !1) => {
|
|
241
248
|
let r = !1, s = null;
|
|
242
249
|
const o = Math.max(1, Math.round(e * 60 / 1e3)), i = (a) => {
|
|
243
250
|
requestAnimationFrame(() => {
|
|
@@ -256,13 +263,13 @@ const $t = (t, e = 16, n = !1) => {
|
|
|
256
263
|
}
|
|
257
264
|
t(...a), r = !0, i(o);
|
|
258
265
|
};
|
|
259
|
-
},
|
|
266
|
+
}, Kt = (t, e) => {
|
|
260
267
|
let n;
|
|
261
268
|
return (...s) => {
|
|
262
269
|
clearTimeout(n), n = setTimeout(() => t(...s), e);
|
|
263
270
|
};
|
|
264
271
|
};
|
|
265
|
-
function
|
|
272
|
+
function Qt(t, e) {
|
|
266
273
|
let n;
|
|
267
274
|
return function(...r) {
|
|
268
275
|
clearTimeout(n), n = setTimeout(() => {
|
|
@@ -270,8 +277,8 @@ function Ut(t, e) {
|
|
|
270
277
|
}, e);
|
|
271
278
|
};
|
|
272
279
|
}
|
|
273
|
-
function
|
|
274
|
-
if ((L(t) ||
|
|
280
|
+
function Jt(t) {
|
|
281
|
+
if ((L(t) || k(t)) && t.geometry.type === "Polygon") {
|
|
275
282
|
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
283
|
return {
|
|
277
284
|
...t,
|
|
@@ -293,7 +300,7 @@ function O(t, e) {
|
|
|
293
300
|
let n, r, s, o = 1;
|
|
294
301
|
const i = t.trim();
|
|
295
302
|
if (i.startsWith("#")) {
|
|
296
|
-
const y = (i.length === 4 ?
|
|
303
|
+
const y = (i.length === 4 ? C(i) : i).match(/#?(\w{2})(\w{2})(\w{2})/);
|
|
297
304
|
if (!y) return t;
|
|
298
305
|
n = parseInt(y[1], 16), r = parseInt(y[2], 16), s = parseInt(y[3], 16);
|
|
299
306
|
} else {
|
|
@@ -306,34 +313,34 @@ function O(t, e) {
|
|
|
306
313
|
const a = e * 100, d = 0.299 * n + 0.587 * r + 0.114 * s > 186 ? -a / 2 : a;
|
|
307
314
|
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
315
|
}
|
|
309
|
-
const
|
|
316
|
+
const jt = (t) => O(t, F), te = (t) => O(t, -F), R = (t, e) => ({
|
|
310
317
|
x: t.x - e.x,
|
|
311
318
|
y: t.y - e.y
|
|
312
|
-
}),
|
|
319
|
+
}), D = (t) => Math.sqrt(t.x * t.x + t.y * t.y), ee = (t) => ({
|
|
313
320
|
x: -t.x,
|
|
314
321
|
y: -t.y
|
|
315
|
-
}),
|
|
316
|
-
const e =
|
|
322
|
+
}), P = (t) => {
|
|
323
|
+
const e = D(t);
|
|
317
324
|
return e === 0 ? { x: 0, y: 0 } : {
|
|
318
325
|
x: t.x / e,
|
|
319
326
|
y: t.y / e
|
|
320
327
|
};
|
|
321
|
-
},
|
|
328
|
+
}, ne = (t, e) => ({
|
|
322
329
|
x: t.x + e.x,
|
|
323
330
|
y: t.y + e.y
|
|
324
|
-
}),
|
|
331
|
+
}), re = (t, e) => ({
|
|
325
332
|
x: t.x * e,
|
|
326
333
|
y: t.y * e
|
|
327
|
-
}),
|
|
334
|
+
}), se = (t, e) => {
|
|
328
335
|
const n = Math.sin(e), r = Math.cos(e);
|
|
329
336
|
return {
|
|
330
337
|
x: t.x * r - t.y * n,
|
|
331
338
|
y: t.x * n + t.y * r
|
|
332
339
|
};
|
|
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(
|
|
340
|
+
}, 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";
|
|
341
|
+
function oe(t, e, n) {
|
|
342
|
+
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));
|
|
343
|
+
return d > 0 && d < c && Math.abs(j(o, P(a))) < i / 2 + n;
|
|
337
344
|
}
|
|
338
345
|
const E = {
|
|
339
346
|
strokeType: "plain",
|
|
@@ -341,7 +348,7 @@ const E = {
|
|
|
341
348
|
strokeWidth: 1,
|
|
342
349
|
head: "none",
|
|
343
350
|
tail: "none"
|
|
344
|
-
},
|
|
351
|
+
}, ie = {
|
|
345
352
|
id: void 0,
|
|
346
353
|
// will be set by the editor
|
|
347
354
|
type: "Feature",
|
|
@@ -368,7 +375,7 @@ const E = {
|
|
|
368
375
|
// tail: 'arrow-plain',
|
|
369
376
|
// start: { x: 0, y: 0 },
|
|
370
377
|
// end: { x: 100, y: 100 }
|
|
371
|
-
},
|
|
378
|
+
}, et = (t = 0, e = 0, n = 0, r = 0, s = { ...E }) => ({
|
|
372
379
|
id: g(),
|
|
373
380
|
type: "Feature",
|
|
374
381
|
properties: {
|
|
@@ -386,8 +393,8 @@ const E = {
|
|
|
386
393
|
]
|
|
387
394
|
}
|
|
388
395
|
}), L = (t) => t.properties.type === "box";
|
|
389
|
-
function
|
|
390
|
-
const o = Y(t), { width: i, height: a } =
|
|
396
|
+
function ae(t, e, n = 0, r = 1, s = 0) {
|
|
397
|
+
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
398
|
return u > -s && u < i + s && y > -s && y < a + s;
|
|
392
399
|
}
|
|
393
400
|
const I = {
|
|
@@ -397,7 +404,7 @@ const I = {
|
|
|
397
404
|
boxShadow: "",
|
|
398
405
|
padding: 16,
|
|
399
406
|
strokeType: "plain"
|
|
400
|
-
},
|
|
407
|
+
}, ce = {
|
|
401
408
|
id: void 0,
|
|
402
409
|
// will be set by the editor
|
|
403
410
|
type: "Feature",
|
|
@@ -413,7 +420,7 @@ const I = {
|
|
|
413
420
|
// center of 100x50 box
|
|
414
421
|
bbox: [0, 0, 100, 50]
|
|
415
422
|
}
|
|
416
|
-
},
|
|
423
|
+
}, de = (t = 0, e = 0, n = 100, r = 50, s = { ...I }) => ({
|
|
417
424
|
id: g(),
|
|
418
425
|
type: "Feature",
|
|
419
426
|
properties: {
|
|
@@ -427,7 +434,10 @@ const I = {
|
|
|
427
434
|
coordinates: [t + n / 2, e + r / 2]
|
|
428
435
|
// center
|
|
429
436
|
}
|
|
430
|
-
}),
|
|
437
|
+
}), k = (t) => t.properties.type === "text", ue = (t) => {
|
|
438
|
+
const e = t.properties.style;
|
|
439
|
+
return (e == null ? void 0 : e.scaleFontOnResize) === !0 && (e == null ? void 0 : e.placeholder) === "Quick note…";
|
|
440
|
+
}, A = {
|
|
431
441
|
font: "sans-serif",
|
|
432
442
|
fontSize: 18,
|
|
433
443
|
color: "#505050",
|
|
@@ -437,7 +447,7 @@ const I = {
|
|
|
437
447
|
padding: 16,
|
|
438
448
|
strokeType: "plain",
|
|
439
449
|
fixedSize: !1
|
|
440
|
-
},
|
|
450
|
+
}, ye = {
|
|
441
451
|
id: g(),
|
|
442
452
|
type: "Feature",
|
|
443
453
|
properties: {
|
|
@@ -445,7 +455,7 @@ const I = {
|
|
|
445
455
|
content: "",
|
|
446
456
|
width: 100,
|
|
447
457
|
height: 50,
|
|
448
|
-
style: { ...
|
|
458
|
+
style: { ...A }
|
|
449
459
|
},
|
|
450
460
|
geometry: {
|
|
451
461
|
type: "Point",
|
|
@@ -453,7 +463,7 @@ const I = {
|
|
|
453
463
|
// center of 100x50 box
|
|
454
464
|
bbox: [0, 0, 100, 50]
|
|
455
465
|
}
|
|
456
|
-
},
|
|
466
|
+
}, le = (t = 0, e = 0, n = 100, r = 50, s = "", o = { ...A }) => ({
|
|
457
467
|
id: g(),
|
|
458
468
|
type: "Feature",
|
|
459
469
|
properties: {
|
|
@@ -461,7 +471,7 @@ const I = {
|
|
|
461
471
|
content: s,
|
|
462
472
|
width: n,
|
|
463
473
|
height: r,
|
|
464
|
-
style: { ...
|
|
474
|
+
style: { ...A, ...o }
|
|
465
475
|
},
|
|
466
476
|
geometry: {
|
|
467
477
|
type: "Point",
|
|
@@ -470,15 +480,15 @@ const I = {
|
|
|
470
480
|
bbox: [t, e, t + n, e + r]
|
|
471
481
|
}
|
|
472
482
|
});
|
|
473
|
-
function
|
|
483
|
+
function nt(t, e, n = 0, r = 0, s = 1, o = 1) {
|
|
474
484
|
var m;
|
|
475
485
|
const [i, a] = t.geometry.coordinates;
|
|
476
|
-
let { width: c, height: d } =
|
|
486
|
+
let { width: c, height: d } = z(t);
|
|
477
487
|
(m = t.properties.style) != null && m.fixedSize && (c /= o, d /= o);
|
|
478
488
|
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
489
|
return h > -u - n && h < u + n && x > -y - n && x < y + n;
|
|
480
490
|
}
|
|
481
|
-
const
|
|
491
|
+
const fe = (t) => t.properties.type === "comment", p = {
|
|
482
492
|
// Box styling
|
|
483
493
|
background: "#FFFACD",
|
|
484
494
|
// Light yellow (sticky note color)
|
|
@@ -512,20 +522,20 @@ const ce = (t) => t.properties.type === "comment", p = {
|
|
|
512
522
|
fixedSize: !0,
|
|
513
523
|
// Connector line behavior
|
|
514
524
|
connectorMode: "rigid"
|
|
515
|
-
},
|
|
525
|
+
}, N = {
|
|
516
526
|
mode: "expanded",
|
|
517
527
|
width: 200,
|
|
518
528
|
height: 60,
|
|
519
529
|
// Initial height, will auto-grow
|
|
520
530
|
style: p
|
|
521
531
|
};
|
|
522
|
-
function
|
|
532
|
+
function rt(t, e, n, r) {
|
|
523
533
|
const s = {
|
|
524
534
|
type: "comment",
|
|
525
535
|
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) ??
|
|
536
|
+
mode: (r == null ? void 0 : r.mode) ?? N.mode,
|
|
537
|
+
width: (r == null ? void 0 : r.width) ?? N.width,
|
|
538
|
+
height: (r == null ? void 0 : r.height) ?? N.height,
|
|
529
539
|
author: r == null ? void 0 : r.author,
|
|
530
540
|
timestamp: r == null ? void 0 : r.timestamp,
|
|
531
541
|
style: {
|
|
@@ -543,7 +553,7 @@ function nt(t, e, n, r) {
|
|
|
543
553
|
}
|
|
544
554
|
};
|
|
545
555
|
}
|
|
546
|
-
function
|
|
556
|
+
function ge(t) {
|
|
547
557
|
return {
|
|
548
558
|
...t,
|
|
549
559
|
properties: {
|
|
@@ -552,9 +562,9 @@ function de(t) {
|
|
|
552
562
|
}
|
|
553
563
|
};
|
|
554
564
|
}
|
|
555
|
-
function
|
|
565
|
+
function pe(t, e, n = 0, r, s, o = 1) {
|
|
556
566
|
if (t.properties.mode !== w)
|
|
557
|
-
return
|
|
567
|
+
return nt(
|
|
558
568
|
t,
|
|
559
569
|
e,
|
|
560
570
|
n,
|
|
@@ -568,27 +578,27 @@ function ue(t, e, n = 0, r, s, o = 1) {
|
|
|
568
578
|
const u = c / 2, y = d / 2, l = e.x - t.geometry.coordinates[0], f = e.y - t.geometry.coordinates[1];
|
|
569
579
|
return l >= -u - n && l <= u + n && f >= -y - n && f <= y + n;
|
|
570
580
|
}
|
|
571
|
-
function
|
|
581
|
+
function he(t) {
|
|
572
582
|
const [e, n] = t.geometry.coordinates;
|
|
573
583
|
return { x: e, y: n };
|
|
574
584
|
}
|
|
575
|
-
function
|
|
585
|
+
function xe(t) {
|
|
576
586
|
const e = t.properties, n = { ...p, ...e.style };
|
|
577
587
|
return e.mode === w ? { width: n.iconSize, height: n.iconSize } : { width: e.width, height: e.height };
|
|
578
588
|
}
|
|
579
|
-
function
|
|
589
|
+
function st(t, e = 80) {
|
|
580
590
|
const n = e / t.properties.width;
|
|
581
591
|
return Math.max(0.1, Math.min(1, n));
|
|
582
592
|
}
|
|
583
|
-
function
|
|
593
|
+
function me(t) {
|
|
584
594
|
return ({ ...p, ...t.properties.style }.connectorMode ?? "rigid") !== "elastic";
|
|
585
595
|
}
|
|
586
|
-
function
|
|
596
|
+
function Te(t) {
|
|
587
597
|
const e = { ...p, ...t.properties.style };
|
|
588
|
-
return e.collapseZoomThreshold !== void 0 ? e.collapseZoomThreshold :
|
|
598
|
+
return e.collapseZoomThreshold !== void 0 ? e.collapseZoomThreshold : st(t);
|
|
589
599
|
}
|
|
590
|
-
function
|
|
591
|
-
const i =
|
|
600
|
+
function be(t, e, n, r, s = "", o) {
|
|
601
|
+
const i = rt(
|
|
592
602
|
n,
|
|
593
603
|
r,
|
|
594
604
|
s,
|
|
@@ -598,21 +608,21 @@ function pe(t, e, n, r, s = "", o) {
|
|
|
598
608
|
head: "arrow",
|
|
599
609
|
// Default to arrow head
|
|
600
610
|
...o == null ? void 0 : o.arrowStyle
|
|
601
|
-
}, c =
|
|
611
|
+
}, c = et(n, r, t, e, a);
|
|
602
612
|
return c.properties.link = {
|
|
603
|
-
[
|
|
613
|
+
[b]: {
|
|
604
614
|
id: i.id,
|
|
605
|
-
side:
|
|
615
|
+
side: b,
|
|
606
616
|
type: "comment",
|
|
607
617
|
magnet: { x: 0, y: 0 }
|
|
608
618
|
}
|
|
609
619
|
}, { comment: i, arrow: c };
|
|
610
620
|
}
|
|
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,
|
|
621
|
+
function we(t, e, n, r, s, o, i, a, c) {
|
|
622
|
+
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;
|
|
623
|
+
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
624
|
}
|
|
615
|
-
function
|
|
625
|
+
function ot(t, e, n) {
|
|
616
626
|
const r = n.x - e.x, s = n.y - e.y, o = r * r + s * s;
|
|
617
627
|
if (o === 0) {
|
|
618
628
|
const y = t.x - e.x, l = t.y - e.y;
|
|
@@ -623,8 +633,8 @@ function st(t, e, n) {
|
|
|
623
633
|
const a = e.x + i * r, c = e.y + i * s, d = t.x - a, u = t.y - c;
|
|
624
634
|
return Math.sqrt(d * d + u * u);
|
|
625
635
|
}
|
|
626
|
-
const
|
|
627
|
-
function
|
|
636
|
+
const Ee = (t) => t.properties.type === "polygon";
|
|
637
|
+
function Ie(t, e, n = 0) {
|
|
628
638
|
const r = t.geometry.coordinates[0], s = t.geometry.bbox;
|
|
629
639
|
if (s) {
|
|
630
640
|
const [i, a, c, d] = s;
|
|
@@ -640,11 +650,11 @@ function me(t, e, n = 0) {
|
|
|
640
650
|
if (n > 0)
|
|
641
651
|
for (let i = 0; i < r.length - 1; i++) {
|
|
642
652
|
const [a, c] = r[i], [d, u] = r[i + 1];
|
|
643
|
-
if (
|
|
653
|
+
if (ot(e, { x: a, y: c }, { x: d, y: u }) <= n) return !0;
|
|
644
654
|
}
|
|
645
655
|
return !1;
|
|
646
656
|
}
|
|
647
|
-
function
|
|
657
|
+
function Se(t, e) {
|
|
648
658
|
const n = t[0];
|
|
649
659
|
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
660
|
let r = 1 / 0, s = 1 / 0, o = -1 / 0, i = -1 / 0;
|
|
@@ -662,129 +672,133 @@ function be(t, e) {
|
|
|
662
672
|
properties: {
|
|
663
673
|
type: "polygon",
|
|
664
674
|
style: {
|
|
665
|
-
...
|
|
675
|
+
...V,
|
|
666
676
|
...d
|
|
667
677
|
},
|
|
668
678
|
...u
|
|
669
679
|
}
|
|
670
680
|
};
|
|
671
681
|
}
|
|
672
|
-
const
|
|
682
|
+
const V = {
|
|
673
683
|
...I,
|
|
674
684
|
strokeColor: "#000000",
|
|
675
685
|
strokeWidth: 2,
|
|
676
686
|
background: "transparent"
|
|
677
|
-
},
|
|
687
|
+
}, Ne = {
|
|
678
688
|
type: "polygon",
|
|
679
689
|
style: {
|
|
680
|
-
...
|
|
690
|
+
...V
|
|
681
691
|
}
|
|
682
692
|
};
|
|
683
693
|
export {
|
|
684
|
-
|
|
685
|
-
|
|
694
|
+
re as $,
|
|
695
|
+
Ie as A,
|
|
686
696
|
H as B,
|
|
687
697
|
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
|
-
|
|
698
|
+
mt as D,
|
|
699
|
+
ct as E,
|
|
700
|
+
z as F,
|
|
701
|
+
I as G,
|
|
702
|
+
jt as H,
|
|
703
|
+
Y as I,
|
|
704
|
+
Ft as J,
|
|
705
|
+
A as K,
|
|
706
|
+
Lt as L,
|
|
707
|
+
Mt as M,
|
|
708
|
+
it as N,
|
|
709
|
+
p as O,
|
|
710
|
+
Nt as P,
|
|
711
|
+
J as Q,
|
|
712
|
+
Dt as R,
|
|
713
|
+
b as S,
|
|
714
|
+
_t as T,
|
|
715
|
+
Ot as U,
|
|
716
|
+
St as V,
|
|
717
|
+
ae as W,
|
|
718
|
+
pe as X,
|
|
719
|
+
nt as Y,
|
|
720
|
+
me as Z,
|
|
721
|
+
xe as _,
|
|
712
722
|
B as a,
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
723
|
+
ne as a0,
|
|
724
|
+
g as a1,
|
|
725
|
+
Zt as a2,
|
|
716
726
|
R as a3,
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
727
|
+
D as a4,
|
|
728
|
+
S as a5,
|
|
729
|
+
W as a6,
|
|
730
|
+
X as a7,
|
|
731
|
+
U as a8,
|
|
732
|
+
P as a9,
|
|
733
|
+
ce as aA,
|
|
734
|
+
N as aB,
|
|
735
|
+
Ne as aC,
|
|
726
736
|
ye as aD,
|
|
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
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
737
|
+
Ht as aE,
|
|
738
|
+
Xt as aF,
|
|
739
|
+
he as aG,
|
|
740
|
+
Te as aH,
|
|
741
|
+
T as aI,
|
|
742
|
+
Yt as aJ,
|
|
743
|
+
C as aK,
|
|
744
|
+
K as aL,
|
|
745
|
+
ue as aM,
|
|
746
|
+
Ut as aN,
|
|
747
|
+
Q as aO,
|
|
748
|
+
Wt as aP,
|
|
749
|
+
$ as aQ,
|
|
750
|
+
v as aR,
|
|
751
|
+
Vt as aS,
|
|
752
|
+
ge as aT,
|
|
753
|
+
ee as aa,
|
|
754
|
+
zt as ab,
|
|
755
|
+
se as ac,
|
|
756
|
+
V as ad,
|
|
757
|
+
Pt as ae,
|
|
758
|
+
Rt as af,
|
|
759
|
+
we as ag,
|
|
760
|
+
bt as ah,
|
|
761
|
+
wt as ai,
|
|
762
|
+
yt as aj,
|
|
763
|
+
lt as ak,
|
|
764
|
+
Tt as al,
|
|
765
|
+
pt as am,
|
|
766
|
+
xt as an,
|
|
767
|
+
Et as ao,
|
|
768
|
+
ft as ap,
|
|
769
|
+
gt as aq,
|
|
770
|
+
F as ar,
|
|
771
|
+
O as as,
|
|
772
|
+
st as at,
|
|
773
|
+
$t as au,
|
|
774
|
+
be as av,
|
|
775
|
+
te as aw,
|
|
776
|
+
Kt as ax,
|
|
777
|
+
Qt as ay,
|
|
778
|
+
ie as az,
|
|
779
|
+
dt as b,
|
|
780
|
+
Ct as c,
|
|
781
|
+
at as d,
|
|
782
|
+
vt as e,
|
|
783
|
+
et as f,
|
|
784
|
+
qt as g,
|
|
771
785
|
E as h,
|
|
772
|
-
|
|
773
|
-
j,
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
786
|
+
fe as i,
|
|
787
|
+
tt as j,
|
|
788
|
+
At as k,
|
|
789
|
+
ut as l,
|
|
790
|
+
le as m,
|
|
791
|
+
de as n,
|
|
792
|
+
Se as o,
|
|
793
|
+
rt as p,
|
|
794
|
+
ht as q,
|
|
795
|
+
Jt as r,
|
|
796
|
+
k as s,
|
|
783
797
|
L as t,
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
798
|
+
kt as u,
|
|
799
|
+
Ee as v,
|
|
800
|
+
oe as w,
|
|
801
|
+
Bt as x,
|
|
802
|
+
Gt as y,
|
|
803
|
+
It as z
|
|
790
804
|
};
|