@linkurious/ogma-annotations 1.1.23 → 1.1.25
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/index.js +8 -8
- package/dist/index.mjs +207 -206
- package/dist/types/index.d.ts +3 -0
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Fn = Object.defineProperty;
|
|
2
2
|
var Rn = (a, h, t) => h in a ? Fn(a, h, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[h] = t;
|
|
3
3
|
var m = (a, h, t) => Rn(a, typeof h != "symbol" ? h + "" : h, t);
|
|
4
|
-
let
|
|
4
|
+
let te = (a = 21) => crypto.getRandomValues(new Uint8Array(a)).reduce((h, t) => (t &= 63, t < 36 ? h += t.toString(36) : t < 62 ? h += (t - 26).toString(36).toUpperCase() : t > 62 ? h += "-" : h += "_", h), "");
|
|
5
5
|
const Nt = {
|
|
6
6
|
strokeType: "plain",
|
|
7
7
|
strokeColor: "#202020",
|
|
@@ -35,7 +35,7 @@ const Nt = {
|
|
|
35
35
|
// start: { x: 0, y: 0 },
|
|
36
36
|
// end: { x: 100, y: 100 }
|
|
37
37
|
}, qn = (a = 0, h = 0, t = 0, r = 0, o = { ...Nt }) => ({
|
|
38
|
-
id:
|
|
38
|
+
id: te(),
|
|
39
39
|
type: "Feature",
|
|
40
40
|
properties: {
|
|
41
41
|
type: "arrow",
|
|
@@ -158,7 +158,7 @@ function Ut(a, h, t) {
|
|
|
158
158
|
y: h.y + t * Math.sin(r)
|
|
159
159
|
};
|
|
160
160
|
}
|
|
161
|
-
function
|
|
161
|
+
function Kt(a, h) {
|
|
162
162
|
if (!h) return { x: a.clientX, y: a.clientY };
|
|
163
163
|
const t = h.getBoundingClientRect();
|
|
164
164
|
return {
|
|
@@ -216,7 +216,7 @@ function tn(a, h = 5, t = 30) {
|
|
|
216
216
|
const { start: r, end: o } = Zt(a), l = wt(o, r), u = a.properties.style && a.properties.style.strokeWidth ? (d = a.properties.style) == null ? void 0 : d.strokeWidth : 0;
|
|
217
217
|
return Math.min(t, Math.max(3 * u, Tt(l) * 0.01, h));
|
|
218
218
|
}
|
|
219
|
-
function
|
|
219
|
+
function Ce(a, h, t, r) {
|
|
220
220
|
const o = Qe(Ke(Je(h)), r);
|
|
221
221
|
if (!t || t !== "arrow" && t !== "arrow-plain") return "";
|
|
222
222
|
const l = St(a, rt(o, Math.PI / 10)), u = St(a, rt(o, -Math.PI / 10)), d = `${a.x} ${a.y}`;
|
|
@@ -225,17 +225,17 @@ function $e(a, h, t, r) {
|
|
|
225
225
|
function Jn(a, h, t, r, o) {
|
|
226
226
|
const { start: l, end: u } = Zt(a), {
|
|
227
227
|
tail: d,
|
|
228
|
-
head:
|
|
228
|
+
head: y,
|
|
229
229
|
strokeColor: f,
|
|
230
|
-
strokeWidth:
|
|
230
|
+
strokeWidth: g = 0
|
|
231
231
|
} = a.properties.style || t, v = wt(u, l), k = tn(a, r, o), b = xt("g"), w = xt("path");
|
|
232
232
|
b.setAttribute("data-annotation", `${a.id}`), b.setAttribute("data-annotation-type", "arrow");
|
|
233
|
-
const
|
|
234
|
-
w.setAttribute("stroke", E), w.setAttribute("stroke-width", `${
|
|
235
|
-
const
|
|
236
|
-
w.setAttribute("d", D), b.appendChild(w),
|
|
233
|
+
const $ = y === "arrow-plain" || d === "arrow", E = f || "none";
|
|
234
|
+
w.setAttribute("stroke", E), w.setAttribute("stroke-width", `${g}`), w.setAttribute("fill", $ ? f || "" : "none"), w.setAttribute("stroke-linecap", "round"), w.setAttribute("stroke-linejoin", "round");
|
|
235
|
+
const C = Ce(l, Ke(v), d, k), N = Ce(u, v, y, k), D = C + `M ${l.x} ${l.y} ${u.x} ${u.y}` + N;
|
|
236
|
+
w.setAttribute("d", D), b.appendChild(w), $e(b, l, E, d, g), $e(b, u, E, y, g), h.appendChild(b);
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function $e(a, h, t, r, o) {
|
|
239
239
|
r === "halo-dot" && Pe(
|
|
240
240
|
a,
|
|
241
241
|
h,
|
|
@@ -251,116 +251,116 @@ function Pe(a, h, t, r, o) {
|
|
|
251
251
|
const l = xt("circle");
|
|
252
252
|
l.setAttribute("cx", `${h.x}`), l.setAttribute("cy", `${h.y}`), l.setAttribute("r", `${o}`), l.setAttribute("fill-opacity", `${r}`), l.setAttribute("fill", t), a.appendChild(l);
|
|
253
253
|
}
|
|
254
|
-
const W = -1,
|
|
254
|
+
const W = -1, Jt = "dragging", Qt = "dragstart", It = "dragend", pe = "select", ge = "unselect", tr = "hover", er = "unhover", ye = "remove", me = "add", nr = "cancelDrawing", ve = "update", rr = "link";
|
|
255
255
|
function en(a) {
|
|
256
256
|
return a && a.__esModule && Object.prototype.hasOwnProperty.call(a, "default") ? a.default : a;
|
|
257
257
|
}
|
|
258
|
-
var
|
|
258
|
+
var ce = { exports: {} }, ze;
|
|
259
259
|
function ir() {
|
|
260
260
|
return ze || (ze = 1, function(a) {
|
|
261
261
|
var h = Object.prototype.hasOwnProperty, t = "~";
|
|
262
262
|
function r() {
|
|
263
263
|
}
|
|
264
264
|
Object.create && (r.prototype = /* @__PURE__ */ Object.create(null), new r().__proto__ || (t = !1));
|
|
265
|
-
function o(
|
|
266
|
-
this.fn =
|
|
265
|
+
function o(y, f, g) {
|
|
266
|
+
this.fn = y, this.context = f, this.once = g || !1;
|
|
267
267
|
}
|
|
268
|
-
function l(
|
|
269
|
-
if (typeof
|
|
268
|
+
function l(y, f, g, v, k) {
|
|
269
|
+
if (typeof g != "function")
|
|
270
270
|
throw new TypeError("The listener must be a function");
|
|
271
|
-
var b = new o(
|
|
272
|
-
return
|
|
271
|
+
var b = new o(g, v || y, k), w = t ? t + f : f;
|
|
272
|
+
return y._events[w] ? y._events[w].fn ? y._events[w] = [y._events[w], b] : y._events[w].push(b) : (y._events[w] = b, y._eventsCount++), y;
|
|
273
273
|
}
|
|
274
|
-
function u(
|
|
275
|
-
--
|
|
274
|
+
function u(y, f) {
|
|
275
|
+
--y._eventsCount === 0 ? y._events = new r() : delete y._events[f];
|
|
276
276
|
}
|
|
277
277
|
function d() {
|
|
278
278
|
this._events = new r(), this._eventsCount = 0;
|
|
279
279
|
}
|
|
280
280
|
d.prototype.eventNames = function() {
|
|
281
|
-
var f = [],
|
|
281
|
+
var f = [], g, v;
|
|
282
282
|
if (this._eventsCount === 0) return f;
|
|
283
|
-
for (v in
|
|
284
|
-
h.call(
|
|
285
|
-
return Object.getOwnPropertySymbols ? f.concat(Object.getOwnPropertySymbols(
|
|
283
|
+
for (v in g = this._events)
|
|
284
|
+
h.call(g, v) && f.push(t ? v.slice(1) : v);
|
|
285
|
+
return Object.getOwnPropertySymbols ? f.concat(Object.getOwnPropertySymbols(g)) : f;
|
|
286
286
|
}, d.prototype.listeners = function(f) {
|
|
287
|
-
var
|
|
287
|
+
var g = t ? t + f : f, v = this._events[g];
|
|
288
288
|
if (!v) return [];
|
|
289
289
|
if (v.fn) return [v.fn];
|
|
290
290
|
for (var k = 0, b = v.length, w = new Array(b); k < b; k++)
|
|
291
291
|
w[k] = v[k].fn;
|
|
292
292
|
return w;
|
|
293
293
|
}, d.prototype.listenerCount = function(f) {
|
|
294
|
-
var
|
|
294
|
+
var g = t ? t + f : f, v = this._events[g];
|
|
295
295
|
return v ? v.fn ? 1 : v.length : 0;
|
|
296
|
-
}, d.prototype.emit = function(f,
|
|
297
|
-
var
|
|
298
|
-
if (!this._events[
|
|
299
|
-
var E = this._events[
|
|
296
|
+
}, d.prototype.emit = function(f, g, v, k, b, w) {
|
|
297
|
+
var $ = t ? t + f : f;
|
|
298
|
+
if (!this._events[$]) return !1;
|
|
299
|
+
var E = this._events[$], C = arguments.length, N, D;
|
|
300
300
|
if (E.fn) {
|
|
301
|
-
switch (E.once && this.removeListener(f, E.fn, void 0, !0),
|
|
301
|
+
switch (E.once && this.removeListener(f, E.fn, void 0, !0), C) {
|
|
302
302
|
case 1:
|
|
303
303
|
return E.fn.call(E.context), !0;
|
|
304
304
|
case 2:
|
|
305
|
-
return E.fn.call(E.context,
|
|
305
|
+
return E.fn.call(E.context, g), !0;
|
|
306
306
|
case 3:
|
|
307
|
-
return E.fn.call(E.context,
|
|
307
|
+
return E.fn.call(E.context, g, v), !0;
|
|
308
308
|
case 4:
|
|
309
|
-
return E.fn.call(E.context,
|
|
309
|
+
return E.fn.call(E.context, g, v, k), !0;
|
|
310
310
|
case 5:
|
|
311
|
-
return E.fn.call(E.context,
|
|
311
|
+
return E.fn.call(E.context, g, v, k, b), !0;
|
|
312
312
|
case 6:
|
|
313
|
-
return E.fn.call(E.context,
|
|
313
|
+
return E.fn.call(E.context, g, v, k, b, w), !0;
|
|
314
314
|
}
|
|
315
|
-
for (D = 1, N = new Array(
|
|
315
|
+
for (D = 1, N = new Array(C - 1); D < C; D++)
|
|
316
316
|
N[D - 1] = arguments[D];
|
|
317
317
|
E.fn.apply(E.context, N);
|
|
318
318
|
} else {
|
|
319
319
|
var z = E.length, R;
|
|
320
320
|
for (D = 0; D < z; D++)
|
|
321
|
-
switch (E[D].once && this.removeListener(f, E[D].fn, void 0, !0),
|
|
321
|
+
switch (E[D].once && this.removeListener(f, E[D].fn, void 0, !0), C) {
|
|
322
322
|
case 1:
|
|
323
323
|
E[D].fn.call(E[D].context);
|
|
324
324
|
break;
|
|
325
325
|
case 2:
|
|
326
|
-
E[D].fn.call(E[D].context,
|
|
326
|
+
E[D].fn.call(E[D].context, g);
|
|
327
327
|
break;
|
|
328
328
|
case 3:
|
|
329
|
-
E[D].fn.call(E[D].context,
|
|
329
|
+
E[D].fn.call(E[D].context, g, v);
|
|
330
330
|
break;
|
|
331
331
|
case 4:
|
|
332
|
-
E[D].fn.call(E[D].context,
|
|
332
|
+
E[D].fn.call(E[D].context, g, v, k);
|
|
333
333
|
break;
|
|
334
334
|
default:
|
|
335
|
-
if (!N) for (R = 1, N = new Array(
|
|
335
|
+
if (!N) for (R = 1, N = new Array(C - 1); R < C; R++)
|
|
336
336
|
N[R - 1] = arguments[R];
|
|
337
337
|
E[D].fn.apply(E[D].context, N);
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
340
|
return !0;
|
|
341
|
-
}, d.prototype.on = function(f,
|
|
342
|
-
return l(this, f,
|
|
343
|
-
}, d.prototype.once = function(f,
|
|
344
|
-
return l(this, f,
|
|
345
|
-
}, d.prototype.removeListener = function(f,
|
|
341
|
+
}, d.prototype.on = function(f, g, v) {
|
|
342
|
+
return l(this, f, g, v, !1);
|
|
343
|
+
}, d.prototype.once = function(f, g, v) {
|
|
344
|
+
return l(this, f, g, v, !0);
|
|
345
|
+
}, d.prototype.removeListener = function(f, g, v, k) {
|
|
346
346
|
var b = t ? t + f : f;
|
|
347
347
|
if (!this._events[b]) return this;
|
|
348
|
-
if (!
|
|
348
|
+
if (!g)
|
|
349
349
|
return u(this, b), this;
|
|
350
350
|
var w = this._events[b];
|
|
351
351
|
if (w.fn)
|
|
352
|
-
w.fn ===
|
|
352
|
+
w.fn === g && (!k || w.once) && (!v || w.context === v) && u(this, b);
|
|
353
353
|
else {
|
|
354
|
-
for (var
|
|
355
|
-
(w[
|
|
354
|
+
for (var $ = 0, E = [], C = w.length; $ < C; $++)
|
|
355
|
+
(w[$].fn !== g || k && !w[$].once || v && w[$].context !== v) && E.push(w[$]);
|
|
356
356
|
E.length ? this._events[b] = E.length === 1 ? E[0] : E : u(this, b);
|
|
357
357
|
}
|
|
358
358
|
return this;
|
|
359
359
|
}, d.prototype.removeAllListeners = function(f) {
|
|
360
|
-
var
|
|
361
|
-
return f ? (
|
|
360
|
+
var g;
|
|
361
|
+
return f ? (g = t ? t + f : f, this._events[g] && u(this, g)) : (this._events = new r(), this._eventsCount = 0), this;
|
|
362
362
|
}, d.prototype.off = d.prototype.removeListener, d.prototype.addListener = d.prototype.on, d.prefixed = t, d.EventEmitter = d, a.exports = d;
|
|
363
|
-
}(
|
|
363
|
+
}(ce)), ce.exports;
|
|
364
364
|
}
|
|
365
365
|
var sr = ir();
|
|
366
366
|
const nn = /* @__PURE__ */ en(sr);
|
|
@@ -404,7 +404,7 @@ class rn extends nn {
|
|
|
404
404
|
*/
|
|
405
405
|
add(t) {
|
|
406
406
|
const r = this.getDefaultOptions(), o = Object.assign(t, {
|
|
407
|
-
id: t.id === void 0 ?
|
|
407
|
+
id: t.id === void 0 ? te() : t.id,
|
|
408
408
|
type: t.type,
|
|
409
409
|
properties: {
|
|
410
410
|
...r.properties,
|
|
@@ -583,7 +583,7 @@ class or extends rn {
|
|
|
583
583
|
m(this, "onHandleMouseDown", (t) => {
|
|
584
584
|
const r = this.getById(this.selectedId) || this.getById(this.hoveredId);
|
|
585
585
|
if (!r) return;
|
|
586
|
-
const { x: o, y: l } =
|
|
586
|
+
const { x: o, y: l } = Kt(t, this.ogma.getContainer());
|
|
587
587
|
this.startDragging(r, o, l), this.draggedHandle = Ze(t.target);
|
|
588
588
|
});
|
|
589
589
|
m(this, "onMouseUp", () => {
|
|
@@ -591,17 +591,17 @@ class or extends rn {
|
|
|
591
591
|
});
|
|
592
592
|
m(this, "onMouseMove", (t) => {
|
|
593
593
|
if (!this.isDragging || this.draggedHandle === W) return;
|
|
594
|
-
const r = this.handles[this.draggedHandle],
|
|
594
|
+
const { x: r, y: o } = Kt(t, this.ogma.getContainer()), l = this.handles[this.draggedHandle], u = this.ogma.view.getAngle(), { x: d, y } = rt(
|
|
595
595
|
Zn(
|
|
596
|
-
{ x:
|
|
596
|
+
{ x: r - this.startX, y: o - this.startY },
|
|
597
597
|
this.ogma.view.getZoom()
|
|
598
598
|
),
|
|
599
|
-
|
|
600
|
-
),
|
|
601
|
-
(
|
|
602
|
-
|
|
599
|
+
u
|
|
600
|
+
), f = l.id === Ne, g = l.id === He, v = l.id === Fe;
|
|
601
|
+
(f || g) && Ye(this.arrow, this.start.x + d, this.start.y + y), (f || v) && Xe(this.arrow, this.end.x + d, this.end.y + y), this.emit(
|
|
602
|
+
Jt,
|
|
603
603
|
this.arrow,
|
|
604
|
-
|
|
604
|
+
f ? "line" : g ? "start" : "end"
|
|
605
605
|
), this.refreshEditor(), this.layer.refresh();
|
|
606
606
|
});
|
|
607
607
|
this.minArrowHeight = r.minArrowHeight || 0, this.maxArrowHeight = r.maxArrowHeight || 1e6, this.handles = Array.prototype.slice.call(
|
|
@@ -633,28 +633,28 @@ class or extends rn {
|
|
|
633
633
|
this.isDragging && (this.remove(this.arrow.id), this.emit(It, this.arrow), this.restoreDragging(), this.isDragging = !1, this.draggedHandle = W);
|
|
634
634
|
}
|
|
635
635
|
startDragging(t, r, o) {
|
|
636
|
-
this.selectedId !== t.id && this.select(this.hoveredId), this.arrow = t, this.startX = r, this.startY = o, this.start = zt(this.arrow), this.end = Xt(this.arrow), this.disableDragging(), this.emit(
|
|
636
|
+
this.selectedId !== t.id && this.select(this.hoveredId), this.arrow = t, this.startX = r, this.startY = o, this.start = zt(this.arrow), this.end = Xt(this.arrow), this.disableDragging(), this.emit(Qt, this.arrow), this.isDragging = !0;
|
|
637
637
|
}
|
|
638
638
|
detect(t, r = 0) {
|
|
639
639
|
return this.elements.find((o) => {
|
|
640
640
|
const { start: l, end: u } = Zt(o), d = wt(t, {
|
|
641
641
|
x: (l.x + u.x) / 2,
|
|
642
642
|
y: (l.y + u.y) / 2
|
|
643
|
-
}),
|
|
644
|
-
return Math.abs(Le(
|
|
643
|
+
}), y = wt(u, l), f = Tt(y), g = Je(y), v = tn(o);
|
|
644
|
+
return Math.abs(Le(g, d)) < f / 2 + r && Math.abs(Le(rt(g, Math.PI / 2), d)) < v / 2 + r;
|
|
645
645
|
});
|
|
646
646
|
}
|
|
647
647
|
refreshEditor() {
|
|
648
648
|
if (+this.selectedId < 0 && +this.hoveredId < 0) return;
|
|
649
|
-
const t = this.selectedId !== W ? this.getById(this.selectedId) : this.getById(this.hoveredId), r = Zt(t), o = this.ogma.view.graphToScreenCoordinates(r.start), l = this.ogma.view.graphToScreenCoordinates(r.end), [u, d,
|
|
649
|
+
const t = this.selectedId !== W ? this.getById(this.selectedId) : this.getById(this.hoveredId), r = Zt(t), o = this.ogma.view.graphToScreenCoordinates(r.start), l = this.ogma.view.graphToScreenCoordinates(r.end), [u, d, y] = Array.prototype.slice.call(
|
|
650
650
|
this.editor.element.querySelectorAll(".handle")
|
|
651
651
|
);
|
|
652
|
-
d.style.transform = `translate(${o.x}px, ${o.y}px) translate(-50%, -50%)`,
|
|
652
|
+
d.style.transform = `translate(${o.x}px, ${o.y}px) translate(-50%, -50%)`, y.style.transform = `translate(${l.x}px, ${l.y}px) translate(-50%, -50%)`;
|
|
653
653
|
const f = {
|
|
654
654
|
x: (l.x + o.x) / 2,
|
|
655
655
|
y: (l.y + o.y) / 2
|
|
656
|
-
},
|
|
657
|
-
u.style.width = `${Tt(
|
|
656
|
+
}, g = wt(l, o), v = Qe(g, 1 / Tt(g)), k = Math.atan2(v.y, v.x);
|
|
657
|
+
u.style.width = `${Tt(g)}px`, u.style.left = `${f.x}px`, u.style.top = `${f.y}px`, u.style.transform = `translate(-50%, -50%) rotate(${k}rad)`;
|
|
658
658
|
}
|
|
659
659
|
getDefaultOptions() {
|
|
660
660
|
return Oe;
|
|
@@ -686,7 +686,7 @@ const _t = {
|
|
|
686
686
|
borderRadius: 8,
|
|
687
687
|
padding: 16,
|
|
688
688
|
strokeType: "plain"
|
|
689
|
-
},
|
|
689
|
+
}, ue = {
|
|
690
690
|
id: 0,
|
|
691
691
|
type: "Feature",
|
|
692
692
|
properties: {
|
|
@@ -712,7 +712,7 @@ const _t = {
|
|
|
712
712
|
handleSize: 3.5,
|
|
713
713
|
placeholder: "Your text..."
|
|
714
714
|
}, ar = (a = 0, h = 0, t = 100, r = 50, o = "", l = { ..._t }) => ({
|
|
715
|
-
id:
|
|
715
|
+
id: te(),
|
|
716
716
|
type: "Feature",
|
|
717
717
|
properties: {
|
|
718
718
|
type: "text",
|
|
@@ -749,7 +749,7 @@ function hr() {
|
|
|
749
749
|
}, o(e);
|
|
750
750
|
}
|
|
751
751
|
t.d(r, { default: () => Nn });
|
|
752
|
-
var l = /^((?:[a-z\d-]+\s+)*)([\d.]+(%|em|px)|(?:x+-)?large|(?:x+-)?small|medium)(?:\s*\/\s*(normal|[\d.]+(%|px|em)?))?(\s.+)?$/, u = /\bsmall-caps\b/, d = /\b(?:italic|oblique)\b/,
|
|
752
|
+
var l = /^((?:[a-z\d-]+\s+)*)([\d.]+(%|em|px)|(?:x+-)?large|(?:x+-)?small|medium)(?:\s*\/\s*(normal|[\d.]+(%|px|em)?))?(\s.+)?$/, u = /\bsmall-caps\b/, d = /\b(?:italic|oblique)\b/, y = /\bbold(?:er)?\b/, f = 13.3333333, g = { "xx-small": 9, "x-small": 10, smaller: 13.3333, small: 13, medium: 16, large: 18, larger: 19.2, "x-large": 24, "xx-large": 32 };
|
|
753
753
|
function v(e) {
|
|
754
754
|
var n = "", s = this;
|
|
755
755
|
return s.style && s.style !== "normal" && (n += s.style), s.variant && s.variant !== "normal" && (n += (n ? " " : "") + s.variant), s.weight && s.weight !== "normal" && (n += (n ? " " : "") + s.weight), s.size && (n += (n ? " " : "") + s.size + "px", s.height !== s.size && (n += "/" + s.height + "px")), s.family && (n += (n ? " " : "") + s.family), e && (n += "::" + s.baseline), e && (n += "::" + s.color), n;
|
|
@@ -758,10 +758,10 @@ function hr() {
|
|
|
758
758
|
function b(e) {
|
|
759
759
|
var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, s = l.exec(e);
|
|
760
760
|
n.family = (s[6] || "").trim();
|
|
761
|
-
var i =
|
|
761
|
+
var i = g[s[2]] || parseFloat(s[2]);
|
|
762
762
|
s[3] === "%" ? i *= 0.16 : s[3] === "em" ? i *= 16 : s[3] === "pt" && (i *= f), n.size = i;
|
|
763
763
|
var c = parseFloat(s[4]);
|
|
764
|
-
if (c !== "normal" && c !== "inherit" && c ? s[5] && s[5] !== "em" ? s[5] === "pt" ? n.height = c * f : s[5] === "%" ? n.height = 0.01 * i : n.height = c : n.height = c * i : n.height = Math.round(i * (7 / 6)), u.test(s[1]) && (n.variant = "small-caps"), d.test(s[1]) && (n.style = "italic"),
|
|
764
|
+
if (c !== "normal" && c !== "inherit" && c ? s[5] && s[5] !== "em" ? s[5] === "pt" ? n.height = c * f : s[5] === "%" ? n.height = 0.01 * i : n.height = c : n.height = c * i : n.height = Math.round(i * (7 / 6)), u.test(s[1]) && (n.variant = "small-caps"), d.test(s[1]) && (n.style = "italic"), y.test(s[1])) n.weight = "bold";
|
|
765
765
|
else {
|
|
766
766
|
var p = parseInt(/\b(\d+)\b/.exec(s[1]), 10);
|
|
767
767
|
p >= 100 && p !== 400 && (n.weight = p);
|
|
@@ -781,8 +781,8 @@ function hr() {
|
|
|
781
781
|
var L = Object.create(k);
|
|
782
782
|
return L.family = c.family || e || "sans-serif", L.height = p ?? 14, L.size = A ?? 12, L.variant = c.variant || T || "", L.style = c.style || S || "", L.weight = c.weight || x || "", L.baseline = n || 0, c.baseline != null && (L.baseline = c.baseline), L.color = c.color || s || "", L.id = v.call(L, !0), L;
|
|
783
783
|
}
|
|
784
|
-
const
|
|
785
|
-
var E,
|
|
784
|
+
const $ = { "\n": 0.28, "\r": 0.28, " ": 0.28, " ": 0.28, " ": 0.28, "": 0, " ": 0.5, " ": 1, " ": 0.5, " ": 1, " ": 0.33, " ": 0.25, " ": 0.16, " ": 0.56, " ": 0.28, " ": 0.2, " ": 0.15, "": 0, " ": 0.16, " ": 0.22, " ": 1, "\uFEFF": 0 };
|
|
785
|
+
var E, C = function(e) {
|
|
786
786
|
var n = typeof OffscreenCanvas < "u" && new OffscreenCanvas(100, 100) || e && e.createElement("canvas");
|
|
787
787
|
if (n && n.getContext) {
|
|
788
788
|
var s = n.getContext("2d");
|
|
@@ -800,11 +800,11 @@ function hr() {
|
|
|
800
800
|
function z(e, n, s) {
|
|
801
801
|
var i = Object.assign({}, D, s), c = String(e);
|
|
802
802
|
if (!c) return 0;
|
|
803
|
-
if (c in
|
|
803
|
+
if (c in $) {
|
|
804
804
|
var p = n.id + "/" + c;
|
|
805
|
-
return p in N || (N[p] =
|
|
805
|
+
return p in N || (N[p] = C("_".concat(c, "_"), n) - C("__", n)), N[p];
|
|
806
806
|
}
|
|
807
|
-
return i.trim && i.collapse ? i.trim ? c = c.trim() : i.collapse && (c = c.replace(/\s+/g, " ")) : c = c.replace(/\n/g, " "),
|
|
807
|
+
return i.trim && i.collapse ? i.trim ? c = c.trim() : i.collapse && (c = c.replace(/\s+/g, " ")) : c = c.replace(/\n/g, " "), C(c, n) + n.size * (e.tracking || 0);
|
|
808
808
|
}
|
|
809
809
|
function R(e) {
|
|
810
810
|
return R = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
|
|
@@ -911,13 +911,13 @@ function hr() {
|
|
|
911
911
|
return Ft(this, s), n.apply(this, arguments);
|
|
912
912
|
}
|
|
913
913
|
return Rt(s);
|
|
914
|
-
}(q),
|
|
914
|
+
}(q), ee = /^[\n\r\t\x20\xA0\u2000-\u200B\u205F\u3000]/, an = /^[^\n\r\t\u0020\u2000-\u200B\u205F\u3000]{2,}/, xe = /^[\xA0\u2011\u202F\u2060\uFEFF]/, ln = /^(?:[;\xAD%?…]|,(?!\d))/, hn = /^[´±°¢£¤$¥\u2212]/;
|
|
915
915
|
function qt(e, n) {
|
|
916
916
|
n !== !1 && (e = e.trim());
|
|
917
917
|
for (var s, i, c = [], p = e.charAt(0), A = 0, x = 1, S = e.length; x < S; x++) {
|
|
918
918
|
s = e.charAt(x), i = e.charAt(x + 1);
|
|
919
|
-
var T =
|
|
920
|
-
if ((hn.test(s) && !xe.test(p) || ln.test(p + i) && !xe.test(s)) && (O = !0), p !== "-" && p !== "‐" && p !== "–" && p !== "—" || ((_ =
|
|
919
|
+
var T = ee.test(p), M = ee.test(s), O = M || T, _ = void 0;
|
|
920
|
+
if ((hn.test(s) && !xe.test(p) || ln.test(p + i) && !xe.test(s)) && (O = !0), p !== "-" && p !== "‐" && p !== "–" && p !== "—" || ((_ = ee.test(e.charAt(x - 2))) && !M && (O = !1), !_ && an.test(s + i) && (O = !0)), O) {
|
|
921
921
|
var L = e.slice(A, x);
|
|
922
922
|
/\u00AD$/.test(L) ? (c.push(new q(L.slice(0, -1))), c.push(new yt())) : (c.push(new q(L)), c.push(new Ot())), A = x;
|
|
923
923
|
}
|
|
@@ -1017,26 +1017,26 @@ function hr() {
|
|
|
1017
1017
|
}
|
|
1018
1018
|
function Se(e) {
|
|
1019
1019
|
return function(n) {
|
|
1020
|
-
if (Array.isArray(n)) return
|
|
1020
|
+
if (Array.isArray(n)) return ne(n);
|
|
1021
1021
|
}(e) || function(n) {
|
|
1022
1022
|
if (typeof Symbol < "u" && n[Symbol.iterator] != null || n["@@iterator"] != null) return Array.from(n);
|
|
1023
1023
|
}(e) || function(n, s) {
|
|
1024
1024
|
if (n) {
|
|
1025
|
-
if (typeof n == "string") return
|
|
1025
|
+
if (typeof n == "string") return ne(n, s);
|
|
1026
1026
|
var i = Object.prototype.toString.call(n).slice(8, -1);
|
|
1027
|
-
return i === "Object" && n.constructor && (i = n.constructor.name), i === "Map" || i === "Set" ? Array.from(n) : i === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i) ?
|
|
1027
|
+
return i === "Object" && n.constructor && (i = n.constructor.name), i === "Map" || i === "Set" ? Array.from(n) : i === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i) ? ne(n, s) : void 0;
|
|
1028
1028
|
}
|
|
1029
1029
|
}(e) || function() {
|
|
1030
1030
|
throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
1031
1031
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
1032
1032
|
}();
|
|
1033
1033
|
}
|
|
1034
|
-
function
|
|
1034
|
+
function ne(e, n) {
|
|
1035
1035
|
(n == null || n > e.length) && (n = e.length);
|
|
1036
1036
|
for (var s = 0, i = new Array(n); s < n; s++) i[s] = e[s];
|
|
1037
1037
|
return i;
|
|
1038
1038
|
}
|
|
1039
|
-
var _n = { center: "middle", right: "end" }, In = { middle: 0.5, center: 0.5, bottom: 1, end: 1 },
|
|
1039
|
+
var _n = { center: "middle", right: "end" }, In = { middle: 0.5, center: 0.5, bottom: 1, end: 1 }, re = function(e, n) {
|
|
1040
1040
|
return !e && !n || e === n;
|
|
1041
1041
|
};
|
|
1042
1042
|
function Dn(e, n) {
|
|
@@ -1059,14 +1059,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1059
1059
|
var at = "", ft = "", ot = 0, lt = e[nt];
|
|
1060
1060
|
if (lt.length) {
|
|
1061
1061
|
F = [];
|
|
1062
|
-
for (var At = 0,
|
|
1062
|
+
for (var At = 0, $t = 0, ht = void 0, X = 0, Bt = lt.length; X < Bt; X++) {
|
|
1063
1063
|
var U = lt[X], Z = U.font;
|
|
1064
|
-
U.whitespace && At++,
|
|
1064
|
+
U.whitespace && At++, $t += U.width, X && !U.tracking && !ot && re(Z.id, at) && re(U.class, ft) && re(ht, U.href) ? V += U.value : (I(), V = U.value, Y = { fontFamily: Z.family !== p ? Z.family : null, fontSize: Z.size !== c ? Z.size : null, fontWeight: Z.weight || null, fontStyle: Z.style || null, fontVariant: Z.variant !== "normal" && Z.variant || null, fill: Z.color || null, baselineShift: Z.baseline ? 100 * Z.baseline + "%" : null, className: U.class || null }, ot && (Y.dx = bt(ot), ot = 0), U.tracking && (ot = Z.size * U.tracking), U.href && !ht ? (ht = U.href, Q = "a", Y.href = ht, Y.rel = U.rel, Y.target = U.target) : ht = null, at = Z.id, ft = U.class);
|
|
1065
1065
|
}
|
|
1066
1066
|
if (I(), _) s.push.apply(s, Se(F));
|
|
1067
1067
|
else {
|
|
1068
1068
|
var jt = null, Pt = nt === tt - 1 || lt[lt.length - 1] instanceof et;
|
|
1069
|
-
P && lt.length > 1 && !Pt && (jt = bt((O -
|
|
1069
|
+
P && lt.length > 1 && !Pt && (jt = bt((O - $t) / At)), s.push(x.apply(void 0, ["tspan", { wordSpacing: jt, x: L(nt) + j, dy: bt(nt ? B : J) + "em" }].concat(Se(F))));
|
|
1070
1070
|
}
|
|
1071
1071
|
} else s.push(x("tspan", { x: L(nt), dy: bt(nt ? B : J) + "em" }, " "));
|
|
1072
1072
|
}
|
|
@@ -1105,17 +1105,17 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1105
1105
|
});
|
|
1106
1106
|
}
|
|
1107
1107
|
}
|
|
1108
|
-
function
|
|
1109
|
-
return
|
|
1108
|
+
function ie(e) {
|
|
1109
|
+
return ie = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
|
|
1110
1110
|
return typeof n;
|
|
1111
1111
|
} : function(n) {
|
|
1112
1112
|
return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
|
|
1113
|
-
},
|
|
1113
|
+
}, ie(e);
|
|
1114
1114
|
}
|
|
1115
1115
|
function Te(e) {
|
|
1116
1116
|
for (var n = {}, s = 0; s < e.length; s++) {
|
|
1117
1117
|
var i = e[s];
|
|
1118
|
-
typeof i != "number" && i != null && (typeof i == "string" ? n.text = i : typeof i == "function" ? n.fn = i :
|
|
1118
|
+
typeof i != "number" && i != null && (typeof i == "string" ? n.text = i : typeof i == "function" ? n.fn = i : ie(i) === "object" && i._groups ? n.d3 = i : i && i.nodeType && i.getContext ? n.ctx = i.getContext("2d") : i && i.fillText && i.beginPath ? n.ctx = i : i && (n.text = i));
|
|
1119
1119
|
}
|
|
1120
1120
|
return n;
|
|
1121
1121
|
}
|
|
@@ -1142,7 +1142,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1142
1142
|
}
|
|
1143
1143
|
var c;
|
|
1144
1144
|
}
|
|
1145
|
-
var
|
|
1145
|
+
var Cn = w(), se = function(e) {
|
|
1146
1146
|
return typeof e == "function" ? e : function() {
|
|
1147
1147
|
return e;
|
|
1148
1148
|
};
|
|
@@ -1166,7 +1166,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1166
1166
|
if (!O() && !_(0) || !H) return [];
|
|
1167
1167
|
for (var P = 0, j = 0, F = 0, Q = [], Y = [], V = !1; P < S.length && j < H; ) {
|
|
1168
1168
|
var I = S[P], nt = Tn(I, M);
|
|
1169
|
-
if (I.width = z(I, nt), I.font = nt, I.line = j, I.whitespace = I.value in
|
|
1169
|
+
if (I.width = z(I, nt), I.font = nt, I.line = j, I.whitespace = I.value in $, I.value && (I.value = I.value.replace(Sn, " ")), !(!F && I.whitespace || V && I.whitespace)) if (I instanceof et) F = 0, Y = [], Q.push(P + 1), j++;
|
|
1170
1170
|
else if (I instanceof Ot || I instanceof yt) Y.push({ index: P, width: F });
|
|
1171
1171
|
else if (I.whitespace || F + I.width < _(j)) F += I.width;
|
|
1172
1172
|
else if (Y.length) {
|
|
@@ -1191,15 +1191,15 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1191
1191
|
P++, V = I.whitespace;
|
|
1192
1192
|
}
|
|
1193
1193
|
P !== Q[Q.length - 1] && Q.push(P);
|
|
1194
|
-
var
|
|
1195
|
-
for (var K, vt =
|
|
1196
|
-
for (var pt = mt,
|
|
1197
|
-
K instanceof yt && (K.value = "-", K.width = z("-", K.font)),
|
|
1198
|
-
var Et = S.slice(vt, pt).filter(function(
|
|
1199
|
-
return
|
|
1194
|
+
var $t = 0, ht = 0, X = Q.map(function(mt) {
|
|
1195
|
+
for (var K, vt = $t; (K = S[vt]) && (K.whitespace || !K.value); ) vt++;
|
|
1196
|
+
for (var pt = mt, le = null; pt > vt && (K = S[pt - 1]) && (K.whitespace || !(K.value || K instanceof yt)); ) K instanceof et && (le = K), pt--;
|
|
1197
|
+
K instanceof yt && (K.value = "-", K.width = z("-", K.font)), $t = mt;
|
|
1198
|
+
var Et = S.slice(vt, pt).filter(function(he) {
|
|
1199
|
+
return he.value;
|
|
1200
1200
|
});
|
|
1201
|
-
return
|
|
1202
|
-
return
|
|
1201
|
+
return le && Et.push(le), Et.width = Et.reduce(function(he, Hn) {
|
|
1202
|
+
return he + Hn.width;
|
|
1203
1203
|
}, 0), Et.width > ht && (ht = Et.width), Et;
|
|
1204
1204
|
});
|
|
1205
1205
|
if (X.hasLineOverflow = !1, L) {
|
|
@@ -1223,7 +1223,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1223
1223
|
return c.render(x, S);
|
|
1224
1224
|
}, x.svg = x.render, x.draw = x.render, x;
|
|
1225
1225
|
} }, { key: "font", value: function(i) {
|
|
1226
|
-
return arguments.length ? (this.props.font = w(i), this) : this.props.font || w(
|
|
1226
|
+
return arguments.length ? (this.props.font = w(i), this) : this.props.font || w(Cn);
|
|
1227
1227
|
} }, { key: "overflow", value: function(i) {
|
|
1228
1228
|
return arguments.length ? (this.props.overflow = String(i), this) : this.props.overflow;
|
|
1229
1229
|
} }, { key: "overflowLine", value: function(i) {
|
|
@@ -1239,11 +1239,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1239
1239
|
var c = String(i).toLowerCase();
|
|
1240
1240
|
return c === "break-word" ? this.props.overflowWrap = "break-word" : c !== "normal" && i != null || (this.props.overflowWrap = null), this;
|
|
1241
1241
|
} }, { key: "width", value: function(i) {
|
|
1242
|
-
return arguments.length ? (this.props.width =
|
|
1242
|
+
return arguments.length ? (this.props.width = se(i), this) : this.props.width;
|
|
1243
1243
|
} }, { key: "height", value: function(i) {
|
|
1244
|
-
return arguments.length ? (this.props.height =
|
|
1244
|
+
return arguments.length ? (this.props.height = se(i), this) : this.props.height;
|
|
1245
1245
|
} }, { key: "x", value: function(i) {
|
|
1246
|
-
return arguments.length ? (this.props.x =
|
|
1246
|
+
return arguments.length ? (this.props.x = se(i), this) : this.props.x;
|
|
1247
1247
|
} }, { key: "parser", value: function(i) {
|
|
1248
1248
|
if (!arguments.length) return this.props.parser;
|
|
1249
1249
|
if (typeof i == "string") {
|
|
@@ -1259,31 +1259,31 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1259
1259
|
return typeof i.text == "string" && (i.text = this.linebreak(i.text)), i.ctx ? On(i.text, this, i.ctx) : Dn(i.text, this);
|
|
1260
1260
|
} }], s && Ln(n.prototype, s), Object.defineProperty(n, "prototype", { writable: !1 }), e;
|
|
1261
1261
|
}();
|
|
1262
|
-
function
|
|
1263
|
-
return
|
|
1262
|
+
function Ct(e) {
|
|
1263
|
+
return Ct = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
|
|
1264
1264
|
return typeof n;
|
|
1265
1265
|
} : function(n) {
|
|
1266
1266
|
return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
|
|
1267
|
-
},
|
|
1267
|
+
}, Ct(e);
|
|
1268
1268
|
}
|
|
1269
|
-
function
|
|
1269
|
+
function oe(e, n) {
|
|
1270
1270
|
(n == null || n > e.length) && (n = e.length);
|
|
1271
1271
|
for (var s = 0, i = new Array(n); s < n; s++) i[s] = e[s];
|
|
1272
1272
|
return i;
|
|
1273
1273
|
}
|
|
1274
|
-
function
|
|
1274
|
+
function $n(e, n) {
|
|
1275
1275
|
for (var s = 0; s < n.length; s++) {
|
|
1276
1276
|
var i = n[s];
|
|
1277
1277
|
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(p, A) {
|
|
1278
|
-
if (
|
|
1278
|
+
if (Ct(p) !== "object" || p === null) return p;
|
|
1279
1279
|
var x = p[Symbol.toPrimitive];
|
|
1280
1280
|
if (x !== void 0) {
|
|
1281
1281
|
var S = x.call(p, A);
|
|
1282
|
-
if (
|
|
1282
|
+
if (Ct(S) !== "object") return S;
|
|
1283
1283
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1284
1284
|
}
|
|
1285
1285
|
return String(p);
|
|
1286
|
-
}(i.key, "string"),
|
|
1286
|
+
}(i.key, "string"), Ct(c) === "symbol" ? c : String(c)), i);
|
|
1287
1287
|
}
|
|
1288
1288
|
var c;
|
|
1289
1289
|
}
|
|
@@ -1324,14 +1324,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1324
1324
|
} }, { key: "canvas", value: function(i, c) {
|
|
1325
1325
|
var p, A = i.getContext ? i.getContext("2d") : i;
|
|
1326
1326
|
return A.save(), A.rotate(this.rotate() * Math.PI / 180), A.translate.apply(A, function(x) {
|
|
1327
|
-
if (Array.isArray(x)) return
|
|
1327
|
+
if (Array.isArray(x)) return oe(x);
|
|
1328
1328
|
}(p = this.anchor()) || function(x) {
|
|
1329
1329
|
if (typeof Symbol < "u" && x[Symbol.iterator] != null || x["@@iterator"] != null) return Array.from(x);
|
|
1330
1330
|
}(p) || function(x, S) {
|
|
1331
1331
|
if (x) {
|
|
1332
|
-
if (typeof x == "string") return
|
|
1332
|
+
if (typeof x == "string") return oe(x, S);
|
|
1333
1333
|
var T = Object.prototype.toString.call(x).slice(8, -1);
|
|
1334
|
-
return T === "Object" && x.constructor && (T = x.constructor.name), T === "Map" || T === "Set" ? Array.from(x) : T === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(T) ?
|
|
1334
|
+
return T === "Object" && x.constructor && (T = x.constructor.name), T === "Map" || T === "Set" ? Array.from(x) : T === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(T) ? oe(x, S) : void 0;
|
|
1335
1335
|
}
|
|
1336
1336
|
}(p) || function() {
|
|
1337
1337
|
throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
@@ -1345,12 +1345,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1345
1345
|
var c = typeof i.text.render == "function" ? i.text.render() : i.text;
|
|
1346
1346
|
return this.createElement()("g", { transform: "rotate(".concat(this.rotate(), ") translate(").concat(this.anchor(), ")") }, c);
|
|
1347
1347
|
}
|
|
1348
|
-
} }], s &&
|
|
1349
|
-
}(), Pn = Object.prototype.hasOwnProperty,
|
|
1348
|
+
} }], s && $n(n.prototype, s), Object.defineProperty(n, "prototype", { writable: !1 }), e;
|
|
1349
|
+
}(), Pn = Object.prototype.hasOwnProperty, ae = {};
|
|
1350
1350
|
function zn(e) {
|
|
1351
|
-
return
|
|
1351
|
+
return ae[e] || (ae[e] = e.replace(/([a-z])([A-Z])/g, function(n, s, i) {
|
|
1352
1352
|
return s + "-" + i.toLowerCase();
|
|
1353
|
-
})),
|
|
1353
|
+
})), ae[e];
|
|
1354
1354
|
}
|
|
1355
1355
|
function De(e, n) {
|
|
1356
1356
|
if (Array.isArray(n)) return n.forEach(function(s) {
|
|
@@ -1459,10 +1459,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1459
1459
|
}
|
|
1460
1460
|
var cr = hr();
|
|
1461
1461
|
const Be = /* @__PURE__ */ en(cr);
|
|
1462
|
-
function
|
|
1462
|
+
function de(a) {
|
|
1463
1463
|
return a.replace(/…$/, "");
|
|
1464
1464
|
}
|
|
1465
|
-
function
|
|
1465
|
+
function fe(a) {
|
|
1466
1466
|
return a.children[0].innerHTML;
|
|
1467
1467
|
}
|
|
1468
1468
|
function ur(a, h) {
|
|
@@ -1480,44 +1480,44 @@ function ur(a, h) {
|
|
|
1480
1480
|
createElement: Be.createElement
|
|
1481
1481
|
});
|
|
1482
1482
|
u.overflowWrap("break-word");
|
|
1483
|
-
const
|
|
1483
|
+
const y = u.linebreak(
|
|
1484
1484
|
a.properties.content.replaceAll(`
|
|
1485
1485
|
`, "<br>")
|
|
1486
|
-
).render(), f = [...
|
|
1487
|
-
let
|
|
1486
|
+
).render(), f = [...y.children];
|
|
1487
|
+
let g = 0;
|
|
1488
1488
|
const v = [];
|
|
1489
1489
|
a.properties.content.split(`
|
|
1490
1490
|
`).forEach((w) => {
|
|
1491
|
-
let
|
|
1492
|
-
for (;
|
|
1493
|
-
if (f[
|
|
1494
|
-
|
|
1495
|
-
`) || v.push(
|
|
1491
|
+
let $ = w;
|
|
1492
|
+
for (; $.length && g < f.length; ) {
|
|
1493
|
+
if (f[g].innerHTML === " ") {
|
|
1494
|
+
$.startsWith(`
|
|
1495
|
+
`) || v.push(g), g++;
|
|
1496
1496
|
break;
|
|
1497
1497
|
}
|
|
1498
|
-
const E =
|
|
1499
|
-
|
|
1498
|
+
const E = de(fe(f[g]));
|
|
1499
|
+
$.startsWith(E) && ($ = $.slice(E.length).trim()), g++;
|
|
1500
1500
|
}
|
|
1501
|
-
}), v.forEach((w) =>
|
|
1501
|
+
}), v.forEach((w) => y.removeChild(f[w]));
|
|
1502
1502
|
const k = a.properties.content.match(/(https?:\/\/.*)/gm), b = k ? k.map((w) => w.split(" ")[0]) : [];
|
|
1503
|
-
|
|
1504
|
-
let
|
|
1503
|
+
y.setAttribute("transform", `translate(${l}, ${l})`), b.forEach((w) => {
|
|
1504
|
+
let $ = w;
|
|
1505
1505
|
const E = [];
|
|
1506
|
-
for (;
|
|
1507
|
-
const
|
|
1508
|
-
(D) => !!D.children[0] && D.children[0].tagName === "tspan" &&
|
|
1506
|
+
for (; $.length > 0; ) {
|
|
1507
|
+
const C = f.find(
|
|
1508
|
+
(D) => !!D.children[0] && D.children[0].tagName === "tspan" && $.startsWith(de(fe(D)))
|
|
1509
1509
|
);
|
|
1510
|
-
if (
|
|
1511
|
-
E.push(
|
|
1512
|
-
const N =
|
|
1510
|
+
if (!C) break;
|
|
1511
|
+
E.push(C);
|
|
1512
|
+
const N = de(C.children[0].innerHTML).length;
|
|
1513
1513
|
if (!N) break;
|
|
1514
|
-
|
|
1514
|
+
$ = $.slice(N);
|
|
1515
1515
|
}
|
|
1516
|
-
E.forEach((
|
|
1516
|
+
E.forEach((C) => {
|
|
1517
1517
|
const N = document.createElementNS("http://www.w3.org/2000/svg", "a");
|
|
1518
|
-
N.setAttribute("href", w), N.setAttribute("target", "_blank"), N.innerHTML =
|
|
1518
|
+
N.setAttribute("href", w), N.setAttribute("target", "_blank"), N.innerHTML = fe(C), C.children[0].innerHTML = "", C.children[0].appendChild(N);
|
|
1519
1519
|
});
|
|
1520
|
-
}), h.appendChild(
|
|
1520
|
+
}), h.appendChild(y);
|
|
1521
1521
|
}
|
|
1522
1522
|
const je = 20;
|
|
1523
1523
|
class dr extends rn {
|
|
@@ -1541,7 +1541,7 @@ class dr extends rn {
|
|
|
1541
1541
|
m(this, "textArea");
|
|
1542
1542
|
m(this, "handleSize");
|
|
1543
1543
|
m(this, "rect", { x: 0, y: 0, width: 0, height: 0 });
|
|
1544
|
-
m(this, "annotation", { ...
|
|
1544
|
+
m(this, "annotation", { ...ue });
|
|
1545
1545
|
m(this, "startX", 0);
|
|
1546
1546
|
m(this, "startY", 0);
|
|
1547
1547
|
m(this, "handles", []);
|
|
@@ -1560,18 +1560,18 @@ class dr extends rn {
|
|
|
1560
1560
|
this.select(o.id), this.startDragging(this.getById(o.id), l.x, l.y), this.draggedHandle = 6;
|
|
1561
1561
|
});
|
|
1562
1562
|
m(this, "cancelDrawing", () => {
|
|
1563
|
-
this.isDragging && (this.remove(this.annotation.id), this.annotation = { ...
|
|
1563
|
+
this.isDragging && (this.remove(this.annotation.id), this.annotation = { ...ue }, this.draggedHandle = W, this.isDragging = !1, this.emit(It, this.annotation));
|
|
1564
1564
|
});
|
|
1565
1565
|
m(this, "startDragging", (t, r, o) => {
|
|
1566
1566
|
this.annotation = t;
|
|
1567
1567
|
const l = ct(this.annotation), u = ut(this.annotation);
|
|
1568
|
-
this.rect.x = l.x, this.rect.y = l.y, this.rect.width = u.width, this.rect.height = u.height, this.startX = r, this.startY = o, this.disableDragging(), this.textArea.classList.add("noevents"), this.textArea.setAttribute("disabled", "disabled"), this.emit(
|
|
1568
|
+
this.rect.x = l.x, this.rect.y = l.y, this.rect.width = u.width, this.rect.height = u.height, this.startX = r, this.startY = o, this.disableDragging(), this.textArea.classList.add("noevents"), this.textArea.setAttribute("disabled", "disabled"), this.emit(Qt, this.annotation), this.isDragging = !0;
|
|
1569
1569
|
});
|
|
1570
1570
|
m(this, "onHandleMouseDown", (t) => {
|
|
1571
1571
|
const r = this.getById(this.selectedId) || this.getById(this.hoveredId);
|
|
1572
1572
|
if (!r) return;
|
|
1573
1573
|
this.selectedId !== r.id && this.select(this.hoveredId);
|
|
1574
|
-
const { x: o, y: l } =
|
|
1574
|
+
const { x: o, y: l } = Kt(t, this.ogma.getContainer());
|
|
1575
1575
|
this.startDragging(r, o, l), this.draggedHandle = Ze(t.target);
|
|
1576
1576
|
});
|
|
1577
1577
|
m(this, "onMouseMove", (t) => {
|
|
@@ -1583,15 +1583,15 @@ class dr extends rn {
|
|
|
1583
1583
|
const r = this.handles[this.draggedHandle];
|
|
1584
1584
|
let o = r.classList.contains("top");
|
|
1585
1585
|
const l = r.classList.contains("left"), u = r.classList.contains("right"), d = r.classList.contains("bottom");
|
|
1586
|
-
let
|
|
1587
|
-
!
|
|
1588
|
-
const { x: f, y } =
|
|
1586
|
+
let y = r.classList.contains("line-handle");
|
|
1587
|
+
!y && !o && !d && !l && !u && (o = !0, y = !0);
|
|
1588
|
+
const { x: f, y: g } = Kt(
|
|
1589
1589
|
t,
|
|
1590
1590
|
this.ogma.getContainer()
|
|
1591
1591
|
);
|
|
1592
1592
|
let v = this.rect.x, k = this.rect.y, b = Math.max(this.rect.width, je), w = Math.max(this.rect.height, je);
|
|
1593
|
-
const
|
|
1594
|
-
|
|
1593
|
+
const $ = this.ogma.view.getZoom(), E = (f - this.startX) / $, C = (g - this.startY) / $, N = this.ogma.view.getAngle(), D = rt({ x: E, y: C }, N), z = rt({ x: E, y: C }, -N);
|
|
1594
|
+
y ? (v = this.rect.x + D.x, k = this.rect.y + D.y) : l && o ? (v += D.x, k += D.y, b -= E, w -= C) : u && d ? (b += E, w += C) : l && d ? (v += z.x, b -= z.x, w += z.y) : u && o && (k += z.y, b += z.x, w -= z.y), Vn(this.annotation, v, k, b, w), this.emit(Jt, this.annotation, "text"), this.refreshEditor(), this.layer.refresh();
|
|
1595
1595
|
});
|
|
1596
1596
|
m(this, "onMouseUp", () => {
|
|
1597
1597
|
!this.isDragging || this.draggedHandle === W || (this.restoreDragging(), this.textArea.classList.remove("noevents"), this.textArea.removeAttribute("disabled"), this.emit(It, this.annotation), this.isDragging = !1, this.draggedHandle = W);
|
|
@@ -1621,23 +1621,23 @@ class dr extends rn {
|
|
|
1621
1621
|
detect({ x: t, y: r }, o = 0) {
|
|
1622
1622
|
const l = { x: t, y: r }, u = this.ogma.view.getAngle();
|
|
1623
1623
|
return this.elements.find((d) => {
|
|
1624
|
-
const { x:
|
|
1625
|
-
return b > -o && b <
|
|
1624
|
+
const { x: y, y: f } = ct(d), { width: g, height: v } = ut(d), k = { x: y, y: f }, { x: b, y: w } = rt(wt(l, k), -u);
|
|
1625
|
+
return b > -o && b < g + o && w > -o && w < v + o;
|
|
1626
1626
|
});
|
|
1627
1627
|
}
|
|
1628
1628
|
draw(t) {
|
|
1629
1629
|
t.innerHTML = "";
|
|
1630
1630
|
const r = "", o = this.ogma.view.getAngle();
|
|
1631
1631
|
for (let u = 0; u < this.elements.length; u++) {
|
|
1632
|
-
const d = this.elements[u],
|
|
1632
|
+
const d = this.elements[u], y = `class${u}`, f = ut(d), g = ct(d);
|
|
1633
1633
|
if (d.id === this.selectedId) continue;
|
|
1634
1634
|
const {
|
|
1635
1635
|
color: k,
|
|
1636
1636
|
fontSize: b,
|
|
1637
1637
|
font: w,
|
|
1638
|
-
strokeColor:
|
|
1638
|
+
strokeColor: $,
|
|
1639
1639
|
strokeWidth: E,
|
|
1640
|
-
strokeType:
|
|
1640
|
+
strokeType: C,
|
|
1641
1641
|
background: N,
|
|
1642
1642
|
borderRadius: D
|
|
1643
1643
|
} = d.properties.style || _t, z = xt("g");
|
|
@@ -1645,9 +1645,9 @@ class dr extends rn {
|
|
|
1645
1645
|
const R = xt("rect");
|
|
1646
1646
|
D && (R.setAttribute("rx", `${D}`), R.setAttribute("ry", `${D}`));
|
|
1647
1647
|
let dt = !1;
|
|
1648
|
-
|
|
1649
|
-
const { x: Dt, y: Mt } = rt(
|
|
1650
|
-
z.setAttribute("transform", `translate(${Dt},${Mt})`), z.classList.add(
|
|
1648
|
+
C && C !== "none" && (dt = !0, R.setAttribute("stroke", $ || "black"), R.setAttribute("stroke-width", `${E}`), C === "dashed" && R.setAttribute("stroke-dasharray", "5,5")), (N && N.length || dt) && (dt = !0, R.setAttribute("fill", N || "transparent")), dt && (R.setAttribute("width", `${f.width}`), R.setAttribute("height", `${f.height}`)), z.appendChild(R), ur(d, z);
|
|
1649
|
+
const { x: Dt, y: Mt } = rt(g, -o);
|
|
1650
|
+
z.setAttribute("transform", `translate(${Dt},${Mt})`), z.classList.add(y), z.setAttribute("data-annotation", `${d.id}`), z.setAttribute("data-annotation-type", "text"), t.appendChild(z);
|
|
1651
1651
|
}
|
|
1652
1652
|
const l = xt("style");
|
|
1653
1653
|
l.innerHTML = r, t.firstChild && t.insertBefore(l, t.firstChild);
|
|
@@ -1657,12 +1657,12 @@ class dr extends rn {
|
|
|
1657
1657
|
for (let o = 0; o < r.length; o++) {
|
|
1658
1658
|
const l = r[o];
|
|
1659
1659
|
if (!l.hasAttribute("data-annotation")) continue;
|
|
1660
|
-
const u = l.getAttribute("data-annotation"), d = ct(this.getById(u)), { x:
|
|
1661
|
-
l.setAttribute("transform", `translate(${
|
|
1660
|
+
const u = l.getAttribute("data-annotation"), d = ct(this.getById(u)), { x: y, y: f } = rt(d, -t);
|
|
1661
|
+
l.setAttribute("transform", `translate(${y},${f})`);
|
|
1662
1662
|
}
|
|
1663
1663
|
}
|
|
1664
1664
|
getDefaultOptions() {
|
|
1665
|
-
return
|
|
1665
|
+
return ue;
|
|
1666
1666
|
}
|
|
1667
1667
|
refreshEditor() {
|
|
1668
1668
|
if (+this.selectedId < 0 && +this.hoveredId < 0) return;
|
|
@@ -1671,15 +1671,15 @@ class dr extends rn {
|
|
|
1671
1671
|
), l = this.ogma.view.getZoom(), {
|
|
1672
1672
|
font: u,
|
|
1673
1673
|
fontSize: d,
|
|
1674
|
-
color:
|
|
1674
|
+
color: y,
|
|
1675
1675
|
background: f,
|
|
1676
|
-
padding:
|
|
1676
|
+
padding: g = 0
|
|
1677
1677
|
} = t.properties.style || _t, v = (d || 1) * l;
|
|
1678
1678
|
this.textArea.value = t.properties.content;
|
|
1679
1679
|
const k = this.editor.element.style;
|
|
1680
1680
|
k.transform = `translate(${o.x}px, ${o.y}px)translate(-50%, -50%)translate(${r.width / 2 * l}px, ${r.height / 2 * l}px)`, k.width = `${r.width * l}px`, k.height = `${r.height * l}px`;
|
|
1681
1681
|
const b = this.textArea.style;
|
|
1682
|
-
b.font = `${v} ${u}`, b.fontFamily = u || "sans-serif", b.fontSize = `${v}px`, b.padding = `${l *
|
|
1682
|
+
b.font = `${v} ${u}`, b.fontFamily = u || "sans-serif", b.fontSize = `${v}px`, b.padding = `${l * g}px`, b.lineHeight = `${v}px`, b.boxSizing = "border-box", b.color = y || "black", b.background = f || "transparent", this.textArea.placeholder = this.placeholder, this.layer.refresh();
|
|
1683
1683
|
}
|
|
1684
1684
|
select(t) {
|
|
1685
1685
|
super.select(t), this.textArea.classList.add("noevents");
|
|
@@ -1695,7 +1695,7 @@ class fr {
|
|
|
1695
1695
|
m(this, "linksByArrowId", {});
|
|
1696
1696
|
}
|
|
1697
1697
|
add(h, t, r, o, l) {
|
|
1698
|
-
const u =
|
|
1698
|
+
const u = te(), d = h.id, y = {
|
|
1699
1699
|
id: u,
|
|
1700
1700
|
arrow: d,
|
|
1701
1701
|
target: r,
|
|
@@ -1703,7 +1703,7 @@ class fr {
|
|
|
1703
1703
|
connectionPoint: l,
|
|
1704
1704
|
side: t
|
|
1705
1705
|
};
|
|
1706
|
-
return this.links[u] =
|
|
1706
|
+
return this.links[u] = y, this.linksByTargetId[r] || (this.linksByTargetId[r] = []), this.linksByTargetId[r].push(u), this.linksByArrowId[d] || (this.linksByArrowId[d] = {}), this.linksByArrowId[d][t] = u, h.properties.link = h.properties.link || {}, h.properties.link[t] = {
|
|
1707
1707
|
id: r,
|
|
1708
1708
|
side: t,
|
|
1709
1709
|
type: o,
|
|
@@ -1716,9 +1716,9 @@ class fr {
|
|
|
1716
1716
|
}
|
|
1717
1717
|
// remove the link between the arrow and the target by arrow id and side
|
|
1718
1718
|
remove(h, t) {
|
|
1719
|
-
var d,
|
|
1719
|
+
var d, y;
|
|
1720
1720
|
const r = h.id, o = (d = this.linksByArrowId[r]) == null ? void 0 : d[t];
|
|
1721
|
-
if ((
|
|
1721
|
+
if ((y = h.properties.link) == null || delete y[t], !o) return this;
|
|
1722
1722
|
const l = this.links[o];
|
|
1723
1723
|
delete this.links[o];
|
|
1724
1724
|
const u = this.linksByTargetId[l.target];
|
|
@@ -1784,8 +1784,8 @@ class vr extends nn {
|
|
|
1784
1784
|
const r = this.ogma.view.getZoom();
|
|
1785
1785
|
We.forEach((o) => {
|
|
1786
1786
|
if (!this.textToMagnet) return;
|
|
1787
|
-
const l = ut(this.textToMagnet), u = ct(this.textToMagnet), d = Wt(o, { x: l.width, y: l.height }),
|
|
1788
|
-
t.moveTo(f,
|
|
1787
|
+
const l = ut(this.textToMagnet), u = ct(this.textToMagnet), d = Wt(o, { x: l.width, y: l.height }), y = rt(d, this.ogma.view.getAngle()), { x: f, y: g } = St(y, u);
|
|
1788
|
+
t.moveTo(f, g), t.arc(f, g, this.options.magnetHandleRadius / r, 0, Math.PI * 2);
|
|
1789
1789
|
}), t.fill(), t.closePath();
|
|
1790
1790
|
});
|
|
1791
1791
|
m(this, "_onFeatureDrag", (t, r) => {
|
|
@@ -1799,10 +1799,10 @@ class vr extends nn {
|
|
|
1799
1799
|
const l = o === "start" ? zt(t) : Xt(t);
|
|
1800
1800
|
this._snapToText(t, o, l) || this._findAndSnapToNode(t, o, l);
|
|
1801
1801
|
} else gt(t) && (this.activeLinks.forEach(({ arrow: l, side: u, connectionPoint: d }) => {
|
|
1802
|
-
const
|
|
1803
|
-
|
|
1802
|
+
const y = this.getAnnotation(l), f = ut(t), g = ct(t), v = Wt(d, { x: f.width, y: f.height }), k = rt(v, this.ogma.view.getAngle()), b = St(k, g);
|
|
1803
|
+
y.geometry.coordinates[u === "start" ? 0 : 1] = [b.x, b.y];
|
|
1804
1804
|
}), this.activeLinks.length && this.arrows.refreshLayer());
|
|
1805
|
-
this.layer.refresh(), this.emit(
|
|
1805
|
+
this.layer.refresh(), this.emit(Jt, t, r);
|
|
1806
1806
|
});
|
|
1807
1807
|
m(this, "_onFeatureDragEnd", (t) => {
|
|
1808
1808
|
this.dragged !== null && st(t) && zt(this.dragged) && Ue.forEach((r) => {
|
|
@@ -1816,7 +1816,7 @@ class vr extends nn {
|
|
|
1816
1816
|
this.textToMagnet = void 0, st(t) ? this.dragged = t : gt(t) && this.activeLinks.push(...this.links.getTargetLinks(t.id, "text")), this.annotations.forEach((r) => {
|
|
1817
1817
|
const o = r.getSelectedFeature();
|
|
1818
1818
|
o && o !== t && r.unhover().unselect(), r.disableDetection();
|
|
1819
|
-
}), this.emit(
|
|
1819
|
+
}), this.emit(Qt, t);
|
|
1820
1820
|
});
|
|
1821
1821
|
m(this, "_onNodesDragStart", () => {
|
|
1822
1822
|
this.arrows.unhover().unselect(), this.texts.unhover().unselect();
|
|
@@ -1828,11 +1828,11 @@ class vr extends nn {
|
|
|
1828
1828
|
m(this, "_onLayoutEnd", (t) => {
|
|
1829
1829
|
t.ids.forEach((r, o) => {
|
|
1830
1830
|
this.links.getTargetLinks(r, "node").forEach((u) => {
|
|
1831
|
-
const d = this.getAnnotation(u.arrow),
|
|
1831
|
+
const d = this.getAnnotation(u.arrow), y = u.side, f = Vt(
|
|
1832
1832
|
d,
|
|
1833
|
-
|
|
1834
|
-
),
|
|
1835
|
-
kt(d,
|
|
1833
|
+
y === "start" ? "end" : "start"
|
|
1834
|
+
), g = t.positions.current[o], v = this.ogma.getNode(r).getAttribute("radius"), k = Ut(f, g, +v);
|
|
1835
|
+
kt(d, y, k.x, k.y);
|
|
1836
1836
|
});
|
|
1837
1837
|
}), this.arrows.refreshLayer(), this.texts.refreshLayer();
|
|
1838
1838
|
});
|
|
@@ -1861,7 +1861,7 @@ class vr extends nn {
|
|
|
1861
1861
|
this.emit(ve, t);
|
|
1862
1862
|
});
|
|
1863
1863
|
this.options = this.setOptions({ ...pr, ...r }), this.ogma = t, this.arrows = new or(t, this.options), this.texts = new dr(t, this.options), this.annotations = [this.arrows, this.texts], this.annotations.forEach((o) => {
|
|
1864
|
-
o.on(
|
|
1864
|
+
o.on(Qt, this._onFeatureDragStart).on(Jt, this._onFeatureDrag).on(It, this._onFeatureDragEnd).on(ve, this.onUpdate).on(ge, this._onUnselect).on(pe, this._onSelect).on(me, this._onAdded).on(ye, this._onRemoved);
|
|
1865
1865
|
}), this.ogma.events.on("nodesDragStart", this._onNodesDragStart).on("nodesDragProgress", this._onNodesDrag).on("layoutEnd", this._onLayoutEnd).on(["viewChanged", "rotate"], () => {
|
|
1866
1866
|
this.refreshTextLinks();
|
|
1867
1867
|
}), this.layer = t.layers.addCanvasLayer(this._render), this.layer.moveToBottom();
|
|
@@ -1869,14 +1869,14 @@ class vr extends nn {
|
|
|
1869
1869
|
_moveNodes(t, r, o) {
|
|
1870
1870
|
t.forEach((l) => {
|
|
1871
1871
|
const u = this.links.getTargetLinks(l.getId(), "node"), d = l.getPosition();
|
|
1872
|
-
u.forEach((
|
|
1873
|
-
const f = this.getAnnotation(
|
|
1872
|
+
u.forEach((y) => {
|
|
1873
|
+
const f = this.getAnnotation(y.arrow), g = y.side, v = Vt(
|
|
1874
1874
|
f,
|
|
1875
|
-
|
|
1875
|
+
g === "start" ? "end" : "start"
|
|
1876
1876
|
);
|
|
1877
1877
|
let k = d;
|
|
1878
1878
|
const b = +l.getAttribute("radius"), w = 1e-6;
|
|
1879
|
-
(
|
|
1879
|
+
(y.connectionPoint.x - (d.x - r) > w || y.connectionPoint.y - (d.y - o) > w) && (k = Ut(v, d, b)), kt(f, g, k.x, k.y);
|
|
1880
1880
|
});
|
|
1881
1881
|
}), this.arrows.refreshLayer();
|
|
1882
1882
|
}
|
|
@@ -1888,15 +1888,15 @@ class vr extends nn {
|
|
|
1888
1888
|
return u ? (kt(t, r, u.point.x, u.point.y), this.links.add(t, r, l.id, "text", u.magnet), !0) : !1;
|
|
1889
1889
|
}
|
|
1890
1890
|
_findAndSnapToNode(t, r, o) {
|
|
1891
|
-
var d,
|
|
1891
|
+
var d, y;
|
|
1892
1892
|
const l = this.ogma.view.graphToScreenCoordinates(o), u = this.ogma.view.getElementAt(l);
|
|
1893
|
-
this.links.remove(t, r), u && u.isNode ? ((d = this.hoveredNode) == null || d.setSelected(!1), this.hoveredNode = u, u.setSelected(!0), this._snapToNode(t, r, u, l)) : ((
|
|
1893
|
+
this.links.remove(t, r), u && u.isNode ? ((d = this.hoveredNode) == null || d.setSelected(!1), this.hoveredNode = u, u.setSelected(!0), this._snapToNode(t, r, u, l)) : ((y = this.hoveredNode) == null || y.setSelected(!1), this.hoveredNode = null);
|
|
1894
1894
|
}
|
|
1895
1895
|
_snapToNode(t, r, o, l) {
|
|
1896
|
-
const u = o.getPositionOnScreen(), d = +o.getAttribute("radius"),
|
|
1897
|
-
if (v <
|
|
1896
|
+
const u = o.getPositionOnScreen(), d = +o.getAttribute("radius"), y = d * this.ogma.view.getZoom(), f = l.x - u.x, g = l.y - u.y, v = Math.sqrt(f * f + g * g), k = o.getPosition();
|
|
1897
|
+
if (v < y + this.options.detectMargin) {
|
|
1898
1898
|
let b = k;
|
|
1899
|
-
if (v >
|
|
1899
|
+
if (v > y / 2) {
|
|
1900
1900
|
const w = Vt(t, r === "end" ? "start" : "end");
|
|
1901
1901
|
b = Ut(w, b, d);
|
|
1902
1902
|
}
|
|
@@ -1909,7 +1909,7 @@ class vr extends nn {
|
|
|
1909
1909
|
({ connectionPoint: r, targetType: o, target: l, arrow: u, side: d }) => {
|
|
1910
1910
|
if (o !== "text") return;
|
|
1911
1911
|
t = !0;
|
|
1912
|
-
const
|
|
1912
|
+
const y = this.getAnnotation(l), f = this.getAnnotation(u), g = ut(y), v = ct(y), k = Wt(r, { x: g.width, y: g.height }), b = rt(k, this.ogma.view.getAngle()), w = St(b, v);
|
|
1913
1913
|
kt(f, d, w.x, w.y);
|
|
1914
1914
|
}
|
|
1915
1915
|
), t && this.arrows.refreshLayer();
|
|
@@ -1923,7 +1923,7 @@ class vr extends nn {
|
|
|
1923
1923
|
findMagnetPoint(t, r, o) {
|
|
1924
1924
|
let l;
|
|
1925
1925
|
for (const u of t) {
|
|
1926
|
-
const d = ut(r),
|
|
1926
|
+
const d = ut(r), y = ct(r), f = Wt(u, { x: d.width, y: d.height }), g = rt(f, this.ogma.view.getAngle()), v = St(g, y), k = Tt(wt(v, o)), b = Math.min(
|
|
1927
1927
|
this.options.magnetRadius * this.ogma.view.getZoom(),
|
|
1928
1928
|
// when really zoomed in: avoid to snap on too far away magnets
|
|
1929
1929
|
d.width / 2,
|
|
@@ -2008,11 +2008,11 @@ class vr extends nn {
|
|
|
2008
2008
|
const u = this.ogma.getNode(o.id);
|
|
2009
2009
|
if (!u) continue;
|
|
2010
2010
|
this.links.add(t, r, o.id, o.type, o.magnet);
|
|
2011
|
-
const d = u.getPosition(),
|
|
2011
|
+
const d = u.getPosition(), y = u.getAttribute("radius") || 0, f = Vt(
|
|
2012
2012
|
t,
|
|
2013
2013
|
r === "start" ? "end" : "start"
|
|
2014
|
-
),
|
|
2015
|
-
kt(t, r,
|
|
2014
|
+
), g = Ut(f, d, +y);
|
|
2015
|
+
kt(t, r, g.x, g.y);
|
|
2016
2016
|
}
|
|
2017
2017
|
}
|
|
2018
2018
|
}
|
|
@@ -2085,9 +2085,9 @@ export {
|
|
|
2085
2085
|
vr as Control,
|
|
2086
2086
|
me as EVT_ADD,
|
|
2087
2087
|
nr as EVT_CANCEL_DRAWING,
|
|
2088
|
-
|
|
2088
|
+
Jt as EVT_DRAG,
|
|
2089
2089
|
It as EVT_DRAG_END,
|
|
2090
|
-
|
|
2090
|
+
Qt as EVT_DRAG_START,
|
|
2091
2091
|
tr as EVT_HOVER,
|
|
2092
2092
|
rr as EVT_LINK,
|
|
2093
2093
|
ye as EVT_REMOVE,
|
|
@@ -2097,7 +2097,7 @@ export {
|
|
|
2097
2097
|
ve as EVT_UPDATE,
|
|
2098
2098
|
W as NONE,
|
|
2099
2099
|
dr as Texts,
|
|
2100
|
-
|
|
2100
|
+
Kt as clientToContainerPosition,
|
|
2101
2101
|
mr as colorToRgba,
|
|
2102
2102
|
qn as createArrow,
|
|
2103
2103
|
xt as createSVGElement,
|
|
@@ -2105,7 +2105,7 @@ export {
|
|
|
2105
2105
|
Oe as defaultArrowOptions,
|
|
2106
2106
|
Nt as defaultArrowStyle,
|
|
2107
2107
|
Re as defaultControllerOptions,
|
|
2108
|
-
|
|
2108
|
+
ue as defaultTextOptions,
|
|
2109
2109
|
_t as defaultTextStyle,
|
|
2110
2110
|
yr as getAnnotationsBounds,
|
|
2111
2111
|
Xt as getArrowEnd,
|
|
@@ -2113,6 +2113,7 @@ export {
|
|
|
2113
2113
|
Vt as getArrowSide,
|
|
2114
2114
|
zt as getArrowStart,
|
|
2115
2115
|
Ut as getAttachmentPointOnNode,
|
|
2116
|
+
Gt as getCoordinates,
|
|
2116
2117
|
Ze as getHandleId,
|
|
2117
2118
|
Ge as getTextBbox,
|
|
2118
2119
|
ct as getTextPosition,
|