@linkurious/ogma-annotations 1.1.16 → 1.1.18
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 +5 -5
- package/dist/index.mjs +169 -166
- package/dist/types/index.d.ts +615 -7
- package/package.json +7 -4
- package/dist/types/Control.d.ts +0 -112
- package/dist/types/Editor/Arrows/defaults.d.ts +0 -10
- package/dist/types/Editor/Arrows/index.d.ts +0 -39
- package/dist/types/Editor/Arrows/render.d.ts +0 -13
- package/dist/types/Editor/Texts/defaults.d.ts +0 -5
- package/dist/types/Editor/Texts/index.d.ts +0 -42
- package/dist/types/Editor/Texts/render.d.ts +0 -7
- package/dist/types/Editor/base.d.ts +0 -84
- package/dist/types/constants.d.ts +0 -13
- package/dist/types/links.d.ts +0 -21
- package/dist/types/types.d.ts +0 -191
- package/dist/types/utils.d.ts +0 -56
- package/dist/types/vec.d.ts +0 -15
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
var $n = Object.defineProperty;
|
|
2
2
|
var zn = (a, h, t) => h in a ? $n(a, h, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[h] = t;
|
|
3
3
|
var m = (a, h, t) => (zn(a, typeof h != "symbol" ? h + "" : h, t), t);
|
|
4
|
-
let
|
|
4
|
+
let Jt = (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 zt = {
|
|
6
6
|
strokeType: "plain",
|
|
7
7
|
strokeColor: "black",
|
|
8
8
|
strokeWidth: 1,
|
|
9
9
|
head: "none",
|
|
10
10
|
tail: "none"
|
|
11
|
-
},
|
|
11
|
+
}, De = {
|
|
12
12
|
id: 0,
|
|
13
13
|
type: "Feature",
|
|
14
14
|
properties: {
|
|
@@ -35,7 +35,7 @@ const zt = {
|
|
|
35
35
|
// start: { x: 0, y: 0 },
|
|
36
36
|
// end: { x: 100, y: 100 }
|
|
37
37
|
}, Nn = (a = 0, h = 0, t = 0, r = 0, o = { ...zt }) => ({
|
|
38
|
-
id:
|
|
38
|
+
id: Jt(),
|
|
39
39
|
type: "Feature",
|
|
40
40
|
properties: {
|
|
41
41
|
type: "arrow",
|
|
@@ -55,18 +55,18 @@ const zt = {
|
|
|
55
55
|
function Pt(a) {
|
|
56
56
|
return document.createElementNS(Hn, a);
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function je(a) {
|
|
59
59
|
return a.geometry.bbox || Fn(a), a.geometry.bbox;
|
|
60
60
|
}
|
|
61
61
|
function ut(a) {
|
|
62
|
-
const h =
|
|
62
|
+
const h = je(a);
|
|
63
63
|
return {
|
|
64
64
|
width: h[2] - h[0],
|
|
65
65
|
height: h[3] - h[1]
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
function ct(a) {
|
|
69
|
-
const h =
|
|
69
|
+
const h = je(a);
|
|
70
70
|
return { x: h[0], y: h[1] };
|
|
71
71
|
}
|
|
72
72
|
function Fn(a) {
|
|
@@ -96,19 +96,19 @@ function Wt(a) {
|
|
|
96
96
|
const [h, t] = a.geometry.coordinates[1];
|
|
97
97
|
return { x: h, y: t };
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function qe(a, h, t) {
|
|
100
100
|
a.geometry.coordinates[0] = [h, t];
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function Re(a, h, t) {
|
|
103
103
|
a.geometry.coordinates[1] = [h, t];
|
|
104
104
|
}
|
|
105
105
|
function Yt(a) {
|
|
106
106
|
return { start: $t(a), end: Wt(a) };
|
|
107
107
|
}
|
|
108
108
|
function At(a, h, t, r) {
|
|
109
|
-
h === "start" ?
|
|
109
|
+
h === "start" ? qe(a, t, r) : Re(a, t, r);
|
|
110
110
|
}
|
|
111
|
-
const
|
|
111
|
+
const Ve = (a) => parseInt(a.getAttribute("data-handle-id") || "-1");
|
|
112
112
|
function si(a) {
|
|
113
113
|
return Gt(a).reduce(
|
|
114
114
|
(h, t) => (h[0] = Math.min(t[0], h[0]), h[1] = Math.min(t[1], h[1]), h[2] = Math.max(t[0], h[2]), h[3] = Math.max(t[1], h[3]), h),
|
|
@@ -158,7 +158,7 @@ function Vt(a, h, t) {
|
|
|
158
158
|
y: h.y + t * Math.sin(r)
|
|
159
159
|
};
|
|
160
160
|
}
|
|
161
|
-
function
|
|
161
|
+
function Xt(a, h) {
|
|
162
162
|
if (!h)
|
|
163
163
|
return { x: a.clientX, y: a.clientY };
|
|
164
164
|
const t = h.getBoundingClientRect();
|
|
@@ -170,10 +170,10 @@ function ue(a, h) {
|
|
|
170
170
|
const vt = (a, h) => ({
|
|
171
171
|
x: a.x - h.x,
|
|
172
172
|
y: a.y - h.y
|
|
173
|
-
}), kt = (a) => Math.sqrt(a.x * a.x + a.y * a.y),
|
|
173
|
+
}), kt = (a) => Math.sqrt(a.x * a.x + a.y * a.y), Ue = (a) => ({
|
|
174
174
|
x: -a.x,
|
|
175
175
|
y: -a.y
|
|
176
|
-
}),
|
|
176
|
+
}), Ge = (a) => {
|
|
177
177
|
const h = kt(a);
|
|
178
178
|
return h === 0 ? { x: 0, y: 0 } : {
|
|
179
179
|
x: a.x / h,
|
|
@@ -182,7 +182,7 @@ const vt = (a, h) => ({
|
|
|
182
182
|
}, Et = (a, h) => ({
|
|
183
183
|
x: a.x + h.x,
|
|
184
184
|
y: a.y + h.y
|
|
185
|
-
}),
|
|
185
|
+
}), We = (a, h) => ({
|
|
186
186
|
x: a.x * h,
|
|
187
187
|
y: a.y * h
|
|
188
188
|
}), Ut = (a, h) => ({
|
|
@@ -197,33 +197,33 @@ const vt = (a, h) => ({
|
|
|
197
197
|
}, Rn = (a, h) => ({
|
|
198
198
|
x: a.x / h,
|
|
199
199
|
y: a.y / h
|
|
200
|
-
}),
|
|
201
|
-
function
|
|
200
|
+
}), Me = (a, h) => a.x * h.x + a.y * h.y;
|
|
201
|
+
function Ye(a, h = 5, t = 30) {
|
|
202
202
|
var d;
|
|
203
203
|
const { start: r, end: o } = Yt(a), l = vt(o, r), u = a.properties.style && a.properties.style.strokeWidth ? (d = a.properties.style) == null ? void 0 : d.strokeWidth : 0;
|
|
204
204
|
return Math.min(t, Math.max(3 * u, kt(l) * 0.1, h));
|
|
205
205
|
}
|
|
206
|
-
function
|
|
207
|
-
const o =
|
|
206
|
+
function Oe(a, h, t, r) {
|
|
207
|
+
const o = We(Ue(Ge(h)), r);
|
|
208
208
|
if (!t || t === "none")
|
|
209
209
|
return "";
|
|
210
210
|
const l = Et(a, rt(o, Math.PI / 8)), u = Et(a, rt(o, -Math.PI / 8)), d = `${a.x} ${a.y}`;
|
|
211
211
|
return `M ${l.x} ${l.y} L ${d} ${u.x} ${u.y} ${t === "arrow" ? "" : `${l.x} ${l.y}`}`;
|
|
212
212
|
}
|
|
213
213
|
function Vn(a, h, t, r, o) {
|
|
214
|
-
const { start: l, end: u } = Yt(a), { tail: d, head: g, strokeColor: f, strokeWidth: y } = a.properties.style || t, v = vt(u, l), T =
|
|
214
|
+
const { start: l, end: u } = Yt(a), { tail: d, head: g, strokeColor: f, strokeWidth: y } = a.properties.style || t, v = vt(u, l), T = Ye(a, r, o), A = Pt("path");
|
|
215
215
|
A.setAttribute("data-annotation", `${a.id}`), A.setAttribute("data-annotation-type", "arrow");
|
|
216
216
|
const b = g === "arrow-plain" || d === "arrow";
|
|
217
217
|
A.setAttribute("stroke", f || "none"), A.setAttribute("stroke-width", `${y}`), A.setAttribute("fill", b ? f || "" : "none"), A.setAttribute("stroke-linecap", "round"), A.setAttribute("stroke-linejoin", "round");
|
|
218
|
-
const C =
|
|
218
|
+
const C = Oe(l, Ue(v), d, T), E = Oe(u, v, g, T), $ = C + `M ${l.x} ${l.y} ${u.x} ${u.y}` + E;
|
|
219
219
|
A.setAttribute("d", $), h.appendChild(A);
|
|
220
220
|
}
|
|
221
|
-
const V = -1,
|
|
221
|
+
const V = -1, Zt = "dragging", Kt = "dragstart", Tt = "dragend", de = "select", fe = "unselect", Un = "hover", Gn = "unhover", pe = "remove", ge = "add", Wn = "cancelDrawing", ye = "update", Yn = "link";
|
|
222
222
|
var Xn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
223
|
-
function
|
|
223
|
+
function Xe(a) {
|
|
224
224
|
return a && a.__esModule && Object.prototype.hasOwnProperty.call(a, "default") ? a.default : a;
|
|
225
225
|
}
|
|
226
|
-
var
|
|
226
|
+
var Ze = { exports: {} };
|
|
227
227
|
(function(a) {
|
|
228
228
|
var h = Object.prototype.hasOwnProperty, t = "~";
|
|
229
229
|
function r() {
|
|
@@ -333,10 +333,10 @@ var Ke = { exports: {} };
|
|
|
333
333
|
var y;
|
|
334
334
|
return f ? (y = t ? t + f : f, this._events[y] && u(this, y)) : (this._events = new r(), this._eventsCount = 0), this;
|
|
335
335
|
}, d.prototype.off = d.prototype.removeListener, d.prototype.addListener = d.prototype.on, d.prefixed = t, d.EventEmitter = d, a.exports = d;
|
|
336
|
-
})(
|
|
337
|
-
var Zn =
|
|
338
|
-
const
|
|
339
|
-
class
|
|
336
|
+
})(Ze);
|
|
337
|
+
var Zn = Ze.exports;
|
|
338
|
+
const Ke = /* @__PURE__ */ Xe(Zn);
|
|
339
|
+
class Je extends Ke {
|
|
340
340
|
constructor(t, r) {
|
|
341
341
|
super();
|
|
342
342
|
m(this, "ogma");
|
|
@@ -376,7 +376,7 @@ class Qe extends Je {
|
|
|
376
376
|
*/
|
|
377
377
|
add(t) {
|
|
378
378
|
const r = this.getDefaultOptions(), o = Object.assign(t, {
|
|
379
|
-
id: t.id === void 0 ?
|
|
379
|
+
id: t.id === void 0 ? Jt() : t.id,
|
|
380
380
|
type: t.type,
|
|
381
381
|
properties: {
|
|
382
382
|
...r.properties,
|
|
@@ -531,16 +531,16 @@ class Qe extends Je {
|
|
|
531
531
|
this.ogma.events.off(this._onClickMouseMove).off(this._onKeyUp), this.layer.destroy();
|
|
532
532
|
}
|
|
533
533
|
}
|
|
534
|
-
const
|
|
535
|
-
class Kn extends
|
|
534
|
+
const Le = "handle-line", Ce = "handle-start", Pe = "handle-end";
|
|
535
|
+
class Kn extends Je {
|
|
536
536
|
constructor(t, r = {}) {
|
|
537
537
|
super(
|
|
538
538
|
t,
|
|
539
539
|
`
|
|
540
540
|
<div class="arrow-handle">
|
|
541
|
-
<div id="${
|
|
542
|
-
<div id="${
|
|
543
|
-
<div id="${
|
|
541
|
+
<div id="${Le}" data-handle-id="0" class="handle line"></div>
|
|
542
|
+
<div id="${Ce}" data-handle-id="1" class="handle point"></div>
|
|
543
|
+
<div id="${Pe}" data-handle-id="2" class="handle point"></div>
|
|
544
544
|
</div>
|
|
545
545
|
`
|
|
546
546
|
);
|
|
@@ -548,7 +548,7 @@ class Kn extends Qe {
|
|
|
548
548
|
m(this, "draggedHandle", V);
|
|
549
549
|
m(this, "start", { x: 0, y: 0 });
|
|
550
550
|
m(this, "end", { x: 0, y: 0 });
|
|
551
|
-
m(this, "arrow", { ...
|
|
551
|
+
m(this, "arrow", { ...De });
|
|
552
552
|
m(this, "startX", 0);
|
|
553
553
|
m(this, "startY", 0);
|
|
554
554
|
m(this, "minArrowHeight", 0);
|
|
@@ -558,8 +558,8 @@ class Kn extends Qe {
|
|
|
558
558
|
const r = this.getById(this.selectedId) || this.getById(this.hoveredId);
|
|
559
559
|
if (!r)
|
|
560
560
|
return;
|
|
561
|
-
const { x: o, y: l } =
|
|
562
|
-
this.startDragging(r, o, l), this.draggedHandle =
|
|
561
|
+
const { x: o, y: l } = Xt(t, this.ogma.getContainer());
|
|
562
|
+
this.startDragging(r, o, l), this.draggedHandle = Ve(t.target);
|
|
563
563
|
});
|
|
564
564
|
m(this, "onMouseUp", () => {
|
|
565
565
|
this.draggedHandle !== -1 && (this.restoreDragging(), this.isDragging = !1, this.draggedHandle = V, this.emit(Tt, this.arrow));
|
|
@@ -567,17 +567,20 @@ class Kn extends Qe {
|
|
|
567
567
|
m(this, "onMouseMove", (t) => {
|
|
568
568
|
if (!this.isDragging || this.draggedHandle === V)
|
|
569
569
|
return;
|
|
570
|
-
const r = this.handles[this.draggedHandle], o = this.ogma.view.getAngle(),
|
|
570
|
+
const r = this.handles[this.draggedHandle], o = this.ogma.view.getAngle(), l = Xt(
|
|
571
|
+
t,
|
|
572
|
+
this.ogma.getContainer()
|
|
573
|
+
), { x: u, y: d } = rt(
|
|
571
574
|
Rn(
|
|
572
|
-
{ x:
|
|
575
|
+
{ x: l.x - this.startX, y: l.y - this.startY },
|
|
573
576
|
this.ogma.view.getZoom()
|
|
574
577
|
),
|
|
575
578
|
o
|
|
576
|
-
),
|
|
577
|
-
(
|
|
578
|
-
|
|
579
|
+
), g = r.id === Le, f = r.id === Ce, y = r.id === Pe;
|
|
580
|
+
(g || f) && qe(this.arrow, this.start.x + u, this.start.y + d), (g || y) && Re(this.arrow, this.end.x + u, this.end.y + d), this.emit(
|
|
581
|
+
Zt,
|
|
579
582
|
this.arrow,
|
|
580
|
-
|
|
583
|
+
g ? "line" : f ? "start" : "end"
|
|
581
584
|
), this.refreshEditor(), this.layer.refresh();
|
|
582
585
|
});
|
|
583
586
|
this.minArrowHeight = r.minArrowHeight || 0, this.maxArrowHeight = r.maxArrowHeight || 1e6, this.handles = Array.prototype.slice.call(
|
|
@@ -609,15 +612,15 @@ class Kn extends Qe {
|
|
|
609
612
|
this.isDragging && (this.remove(this.arrow.id), this.emit(Tt, this.arrow), this.restoreDragging(), this.isDragging = !1, this.draggedHandle = V);
|
|
610
613
|
}
|
|
611
614
|
startDragging(t, r, o) {
|
|
612
|
-
this.selectedId !== t.id && this.select(this.hoveredId), this.arrow = t, this.startX = r, this.startY = o, this.start = $t(this.arrow), this.end = Wt(this.arrow), this.disableDragging(), this.emit(
|
|
615
|
+
this.selectedId !== t.id && this.select(this.hoveredId), this.arrow = t, this.startX = r, this.startY = o, this.start = $t(this.arrow), this.end = Wt(this.arrow), this.disableDragging(), this.emit(Kt, this.arrow), this.isDragging = !0;
|
|
613
616
|
}
|
|
614
617
|
detect(t, r = 0) {
|
|
615
618
|
return this.elements.find((o) => {
|
|
616
619
|
const { start: l, end: u } = Yt(o), d = vt(t, {
|
|
617
620
|
x: (l.x + u.x) / 2,
|
|
618
621
|
y: (l.y + u.y) / 2
|
|
619
|
-
}), g = vt(u, l), f = kt(g), y =
|
|
620
|
-
return Math.abs(
|
|
622
|
+
}), g = vt(u, l), f = kt(g), y = Ge(g), v = Ye(o);
|
|
623
|
+
return Math.abs(Me(y, d)) < f / 2 + r && Math.abs(Me(rt(y, Math.PI / 2), d)) < v / 2 + r;
|
|
621
624
|
});
|
|
622
625
|
}
|
|
623
626
|
refreshEditor() {
|
|
@@ -630,11 +633,11 @@ class Kn extends Qe {
|
|
|
630
633
|
const f = {
|
|
631
634
|
x: (l.x + o.x) / 2,
|
|
632
635
|
y: (l.y + o.y) / 2
|
|
633
|
-
}, y = vt(l, o), v =
|
|
636
|
+
}, y = vt(l, o), v = We(y, 1 / kt(y)), T = Math.atan2(v.y, v.x);
|
|
634
637
|
u.style.width = `${kt(y)}px`, u.style.left = `${f.x}px`, u.style.top = `${f.y}px`, u.style.transform = `translate(-50%, -50%) rotate(${T}rad)`;
|
|
635
638
|
}
|
|
636
639
|
getDefaultOptions() {
|
|
637
|
-
return
|
|
640
|
+
return De;
|
|
638
641
|
}
|
|
639
642
|
draw(t) {
|
|
640
643
|
t.innerHTML = "";
|
|
@@ -662,7 +665,7 @@ const St = {
|
|
|
662
665
|
strokeWidth: 1,
|
|
663
666
|
strokeColor: "#000",
|
|
664
667
|
strokeType: "plain"
|
|
665
|
-
},
|
|
668
|
+
}, he = {
|
|
666
669
|
id: 0,
|
|
667
670
|
type: "Feature",
|
|
668
671
|
properties: {
|
|
@@ -684,11 +687,11 @@ const St = {
|
|
|
684
687
|
}
|
|
685
688
|
// position: { x: 0, y: 0 },
|
|
686
689
|
// size: { width: 100, height: 50 }
|
|
687
|
-
},
|
|
690
|
+
}, $e = {
|
|
688
691
|
handleSize: 3.5,
|
|
689
692
|
placeholder: "Your text..."
|
|
690
693
|
}, Jn = (a = 0, h = 0, t = 100, r = 50, o = "", l = { ...St }) => ({
|
|
691
|
-
id:
|
|
694
|
+
id: Jt(),
|
|
692
695
|
type: "Feature",
|
|
693
696
|
properties: {
|
|
694
697
|
type: "text",
|
|
@@ -708,7 +711,7 @@ const St = {
|
|
|
708
711
|
]
|
|
709
712
|
}
|
|
710
713
|
});
|
|
711
|
-
var
|
|
714
|
+
var Qe = { exports: {} };
|
|
712
715
|
(function(a, h) {
|
|
713
716
|
(function(t, r) {
|
|
714
717
|
a.exports = r();
|
|
@@ -803,7 +806,7 @@ var tn = { exports: {} };
|
|
|
803
806
|
return s.__proto__ = i, s;
|
|
804
807
|
}, It(e, n);
|
|
805
808
|
}
|
|
806
|
-
function
|
|
809
|
+
function Qt(e) {
|
|
807
810
|
var n = function() {
|
|
808
811
|
if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
|
|
809
812
|
return !1;
|
|
@@ -823,10 +826,10 @@ var tn = { exports: {} };
|
|
|
823
826
|
s = Reflect.construct(i, arguments, c);
|
|
824
827
|
} else
|
|
825
828
|
s = i.apply(this, arguments);
|
|
826
|
-
return
|
|
829
|
+
return tn(this, s);
|
|
827
830
|
};
|
|
828
831
|
}
|
|
829
|
-
function
|
|
832
|
+
function tn(e, n) {
|
|
830
833
|
if (n && (W(n) === "object" || typeof n == "function"))
|
|
831
834
|
return n;
|
|
832
835
|
if (n !== void 0)
|
|
@@ -846,7 +849,7 @@ var tn = { exports: {} };
|
|
|
846
849
|
if (!(e instanceof n))
|
|
847
850
|
throw new TypeError("Cannot call a class as a function");
|
|
848
851
|
}
|
|
849
|
-
function
|
|
852
|
+
function en(e, n) {
|
|
850
853
|
for (var s = 0; s < n.length; s++) {
|
|
851
854
|
var i = n[s];
|
|
852
855
|
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, (c = function(p, w) {
|
|
@@ -865,7 +868,7 @@ var tn = { exports: {} };
|
|
|
865
868
|
var c;
|
|
866
869
|
}
|
|
867
870
|
function Ft(e, n, s) {
|
|
868
|
-
return n &&
|
|
871
|
+
return n && en(e.prototype, n), Object.defineProperty(e, "prototype", { writable: !1 }), e;
|
|
869
872
|
}
|
|
870
873
|
var F = function() {
|
|
871
874
|
function e() {
|
|
@@ -882,32 +885,32 @@ var tn = { exports: {} };
|
|
|
882
885
|
} }]), e;
|
|
883
886
|
}(), Dt = function(e) {
|
|
884
887
|
_t(s, e);
|
|
885
|
-
var n =
|
|
888
|
+
var n = Qt(s);
|
|
886
889
|
function s() {
|
|
887
890
|
return Ht(this, s), n.apply(this, arguments);
|
|
888
891
|
}
|
|
889
892
|
return Ft(s);
|
|
890
893
|
}(F), et = function(e) {
|
|
891
894
|
_t(s, e);
|
|
892
|
-
var n =
|
|
895
|
+
var n = Qt(s);
|
|
893
896
|
function s() {
|
|
894
897
|
return Ht(this, s), n.apply(this, arguments);
|
|
895
898
|
}
|
|
896
899
|
return Ft(s);
|
|
897
900
|
}(F), gt = function(e) {
|
|
898
901
|
_t(s, e);
|
|
899
|
-
var n =
|
|
902
|
+
var n = Qt(s);
|
|
900
903
|
function s() {
|
|
901
904
|
return Ht(this, s), n.apply(this, arguments);
|
|
902
905
|
}
|
|
903
906
|
return Ft(s);
|
|
904
|
-
}(F),
|
|
907
|
+
}(F), te = /^[\n\r\t\x20\xA0\u2000-\u200B\u205F\u3000]/, nn = /^[^\n\r\t\u0020\u2000-\u200B\u205F\u3000]{2,}/, me = /^[\xA0\u2011\u202F\u2060\uFEFF]/, rn = /^(?:[;\xAD%?…]|,(?!\d))/, sn = /^[´±°¢£¤$¥\u2212]/;
|
|
905
908
|
function Bt(e, n) {
|
|
906
909
|
n !== !1 && (e = e.trim());
|
|
907
910
|
for (var s, i, c = [], p = e.charAt(0), w = 0, x = 1, k = e.length; x < k; x++) {
|
|
908
911
|
s = e.charAt(x), i = e.charAt(x + 1);
|
|
909
|
-
var S =
|
|
910
|
-
if ((sn.test(s) && !
|
|
912
|
+
var S = te.test(p), M = te.test(s), O = M || S, I = void 0;
|
|
913
|
+
if ((sn.test(s) && !me.test(p) || rn.test(p + i) && !me.test(s)) && (O = !0), p !== "-" && p !== "‐" && p !== "–" && p !== "—" || ((I = te.test(e.charAt(x - 2))) && !M && (O = !1), !I && nn.test(s + i) && (O = !0)), O) {
|
|
911
914
|
var L = e.slice(w, x);
|
|
912
915
|
/\u00AD$/.test(L) ? (c.push(new F(L.slice(0, -1))), c.push(new gt())) : (c.push(new F(L)), c.push(new Dt())), w = x;
|
|
913
916
|
}
|
|
@@ -915,8 +918,8 @@ var tn = { exports: {} };
|
|
|
915
918
|
}
|
|
916
919
|
return c.push(new F(e.slice(w))), c;
|
|
917
920
|
}
|
|
918
|
-
const
|
|
919
|
-
var on = /^[\n\r\x20\u2000-\u200B\u205F\u3000]/, an = /^<\/([a-zA-Z0-9]+)([^>]*)>/, ln = /^<([a-zA-Z0-9]+)((?:\s[^=\s/]+(?:\s*=\s*(?:"[^"]+"|'[^']+'|[^>\\s]+))?)+)?\s*(\/?)>(\n*)/, hn = /^<!--(.+?)-->/, cn = /&(?:#(\d\d{2,})|#x([\da-fA-F]{2,})|([a-zA-Z][a-zA-Z1-4]{1,8}));/g,
|
|
921
|
+
const ve = { nbsp: " ", iexcl: "¡", cent: "¢", pound: "£", curren: "¤", yen: "¥", brvbar: "¦", sect: "§", uml: "¨", copy: "©", ordf: "ª", laquo: "«", not: "¬", shy: "", reg: "®", macr: "¯", deg: "°", plusmn: "±", sup2: "²", sup3: "³", acute: "´", micro: "µ", para: "¶", middot: "·", cedil: "¸", sup1: "¹", ordm: "º", raquo: "»", frac14: "¼", frac12: "½", frac34: "¾", iquest: "¿", Agrave: "À", Aacute: "Á", Acirc: "Â", Atilde: "Ã", Auml: "Ä", Aring: "Å", AElig: "Æ", Ccedil: "Ç", Egrave: "È", Eacute: "É", Ecirc: "Ê", Euml: "Ë", Igrave: "Ì", Iacute: "Í", Icirc: "Î", Iuml: "Ï", ETH: "Ð", Ntilde: "Ñ", Ograve: "Ò", Oacute: "Ó", Ocirc: "Ô", Otilde: "Õ", Ouml: "Ö", times: "×", Oslash: "Ø", Ugrave: "Ù", Uacute: "Ú", Ucirc: "Û", Uuml: "Ü", Yacute: "Ý", THORN: "Þ", szlig: "ß", agrave: "à", aacute: "á", acirc: "â", atilde: "ã", auml: "ä", aring: "å", aelig: "æ", ccedil: "ç", egrave: "è", eacute: "é", ecirc: "ê", euml: "ë", igrave: "ì", iacute: "í", icirc: "î", iuml: "ï", eth: "ð", ntilde: "ñ", ograve: "ò", oacute: "ó", ocirc: "ô", otilde: "õ", ouml: "ö", divide: "÷", oslash: "ø", ugrave: "ù", uacute: "ú", ucirc: "û", uuml: "ü", yacute: "ý", thorn: "þ", yuml: "ÿ", fnof: "ƒ", Alpha: "Α", Beta: "Β", Gamma: "Γ", Delta: "Δ", Epsilon: "Ε", Zeta: "Ζ", Eta: "Η", Theta: "Θ", Iota: "Ι", Kappa: "Κ", Lambda: "Λ", Mu: "Μ", Nu: "Ν", Xi: "Ξ", Omicron: "Ο", Pi: "Π", Rho: "Ρ", Sigma: "Σ", Tau: "Τ", Upsilon: "Υ", Phi: "Φ", Chi: "Χ", Psi: "Ψ", Omega: "Ω", alpha: "α", beta: "β", gamma: "γ", delta: "δ", epsilon: "ε", zeta: "ζ", eta: "η", theta: "θ", iota: "ι", kappa: "κ", lambda: "λ", mu: "μ", nu: "ν", xi: "ξ", omicron: "ο", pi: "π", rho: "ρ", sigmaf: "ς", sigma: "σ", tau: "τ", upsilon: "υ", phi: "φ", chi: "χ", psi: "ψ", omega: "ω", thetasym: "ϑ", upsih: "ϒ", piv: "ϖ", bull: "•", hellip: "…", prime: "′", Prime: "″", oline: "‾", frasl: "⁄", weierp: "℘", image: "ℑ", real: "ℜ", trade: "™", alefsym: "ℵ", larr: "←", uarr: "↑", rarr: "→", darr: "↓", harr: "↔", crarr: "↵", lArr: "⇐", uArr: "⇑", rArr: "⇒", dArr: "⇓", hArr: "⇔", forall: "∀", part: "∂", exist: "∃", empty: "∅", nabla: "∇", isin: "∈", notin: "∉", ni: "∋", prod: "∏", sum: "∑", minus: "−", lowast: "∗", radic: "√", prop: "∝", infin: "∞", ang: "∠", and: "⊥", or: "⊦", cap: "∩", cup: "∪", int: "∫", there4: "∴", sim: "∼", cong: "≅", asymp: "≈", ne: "≠", equiv: "≡", le: "≤", ge: "≥", sub: "⊂", sup: "⊃", nsub: "⊄", sube: "⊆", supe: "⊇", oplus: "⊕", otimes: "⊗", perp: "⊥", sdot: "⋅", lceil: "⌈", rceil: "⌉", lfloor: "⌊", rfloor: "⌋", lang: "〈", rang: "〉", loz: "◊", spades: "♠", clubs: "♣", hearts: "♥", diams: "♦", quot: '"', amp: "&", lt: "<", gt: ">", OElig: "Œ", oelig: "œ", Scaron: "Š", scaron: "š", Yuml: "Ÿ", circ: "ˆ", tilde: "˜", ensp: " ", emsp: " ", thinsp: " ", zwnj: "", zwj: "", lrm: "", rlm: "", ndash: "–", mdash: "—", lsquo: "‘", rsquo: "’", sbquo: "‚", ldquo: "“", rdquo: "”", bdquo: "„", dagger: "†", Dagger: "‡", permil: "‰", lsaquo: "‹", rsaquo: "›" };
|
|
922
|
+
var on = /^[\n\r\x20\u2000-\u200B\u205F\u3000]/, an = /^<\/([a-zA-Z0-9]+)([^>]*)>/, ln = /^<([a-zA-Z0-9]+)((?:\s[^=\s/]+(?:\s*=\s*(?:"[^"]+"|'[^']+'|[^>\\s]+))?)+)?\s*(\/?)>(\n*)/, hn = /^<!--(.+?)-->/, cn = /&(?:#(\d\d{2,})|#x([\da-fA-F]{2,})|([a-zA-Z][a-zA-Z1-4]{1,8}));/g, xe = { b: function(e) {
|
|
920
923
|
e.weight = "bold";
|
|
921
924
|
}, strong: function(e) {
|
|
922
925
|
e.weight = "bold";
|
|
@@ -943,13 +946,13 @@ var tn = { exports: {} };
|
|
|
943
946
|
}, sup: function(e) {
|
|
944
947
|
e.sup = !0;
|
|
945
948
|
} }, un = { div: 1, li: 1, blockquote: 2, h1: 2, h2: 2, h3: 2, h4: 2, h5: 2, h6: 2, ul: 2, ol: 2, hr: 2, p: 2 };
|
|
946
|
-
function
|
|
949
|
+
function we(e) {
|
|
947
950
|
return e.replace(cn, function(n, s, i, c) {
|
|
948
951
|
if (s || i) {
|
|
949
952
|
var p = s ? 10 : 16;
|
|
950
953
|
return String.fromCharCode(parseInt(s || i, p));
|
|
951
954
|
}
|
|
952
|
-
return c in
|
|
955
|
+
return c in ve ? ve[c] : n;
|
|
953
956
|
});
|
|
954
957
|
}
|
|
955
958
|
function dn(e) {
|
|
@@ -961,7 +964,7 @@ var tn = { exports: {} };
|
|
|
961
964
|
if (e) {
|
|
962
965
|
do
|
|
963
966
|
if (n = fn.exec(e)) {
|
|
964
|
-
var i =
|
|
967
|
+
var i = we(dn(n[2] || "")).replace(/[ \r\n\t]+/g, " ").trim();
|
|
965
968
|
if (s[n[1]] = i, (e = e.slice(n[0].length)).length && /^\S/.test(e[0]))
|
|
966
969
|
throw new Error("Attribute error");
|
|
967
970
|
}
|
|
@@ -971,7 +974,7 @@ var tn = { exports: {} };
|
|
|
971
974
|
}
|
|
972
975
|
return s;
|
|
973
976
|
}
|
|
974
|
-
const
|
|
977
|
+
const be = { copyright: "©", textcopyright: "©", dag: "†", textdagger: "†", ddag: "‡", textdaggerdbl: "‡", guillemotleft: "«", guillemotright: "»", guilsinglleft: "‹", guilsinglright: "›", ldots: "…", dots: "…", textellipsis: "…", lq: "‘", P: "¶", textparagraph: "¶", pounds: "£", textsterling: "£", quotedblbase: "„", quotesinglbase: "‚", rq: "’", S: "§", sim: "~", textasciicircum: "^", textasciitilde: "˜", texttildelow: "~", textasteriskcentered: "*", textbackslash: "'", textbar: "|", textbardbl: "╎", textbigcircle: "◯", textbraceleft: "{", textbraceright: "}", textbullet: "•", textdollar: "$", textemdash: "—", textendash: "—", texteuro: "€", eurosym: "€", euro: "€", textexclamdown: "¡", textgreater: ">", textless: "<", textordfeminine: "ª", textordmasculine: "º", textperiodcentered: "·", cdot: "·", textquestiondown: "¿", textquotedblleft: "“", textquotedblright: "”", textquoteleft: "‘", textquoteright: "’", textquotestraightbase: "‚", textquotestraightdblbase: "„", textregistered: "®", textthreequartersemdash: "-", texttrademark: "™", texttwelveudash: "-", textunderscore: "_", textvisiblespace: "␣", gets: "←", textleftarrow: "←", to: "→", textrightarrow: "→", textdegree: "°", infty: "∞", triangle: "△", triangledown: "▽", blacktriangle: "▲", blacktriangledown: "▼", angle: "∠", sphericalangle: "∢", aleph: "ℵ", hbar: "ħ", imath: "𝚤", jmath: "𝚥", ell: "ℓ", wp: "℘", Re: "ℜ", Im: "ℑ", mho: "℧", prime: "′", emptyset: "∅", nabla: "∇", surd: "√", partial: "∂", top: "⟙", bot: "⟂", vdash: "⟝", dashv: "⟞", forall: "∀", exists: "∃", nexists: "∄", neg: "¬", lnot: "¬", flat: "♭", natural: "♮", sharp: "♯", backslash: "\\", Box: "□", Diamond: "♢", clubsuit: "♣", diamondsuit: "♦", heartsuit: "♥", spadesuit: "♠", Join: "⨝", blacksquare: "■", bigstar: "★", diagdown: "╲", diagup: "╱", blacklozenge: "⧫", rfloor: "⌋", lfloor: "⌊", rceil: "⌉", lceil: "⌈", rangle: "⟩", langle: "⟨", sum: "∑", int: "∫", oint: "∮", prod: "∏", coprod: "∏", bigcap: "∩", bigcup: "∪", bigsqcup: "⊔", bigvee: "∨", bigwedge: "∧", bigodot: "⊙", bigotimes: "⊗", bigoplus: "⊕", biguplus: "⊎", alpha: "α", beta: "β", chi: "χ", delta: "δ", epsilon: "ε", eta: "η", gamma: "γ", iota: "ι", kappa: "κ", lambda: "λ", mu: "μ", nu: "ν", omega: "ω", phi: "φ", pi: "π", psi: "ψ", rho: "ρ", sigma: "σ", tau: "τ", theta: "θ", upsilon: "υ", xi: "ξ", zeta: "ζ", Alpha: "Α", Beta: "Β", Chi: "Χ", Delta: "Δ", Epsilon: "Ε", Eta: "Η", Gamma: "Γ", Iota: "Ι", Kappa: "Κ", Lambda: "Λ", Mu: "Μ", Nu: "Ν", Omega: "Ω", Phi: "Φ", Pi: "Π", Psi: "Ψ", Rho: "Ρ", Sigma: "Σ", Tau: "Τ", Theta: "Θ", Upsilon: "Υ", Xi: "Ξ", Zeta: "Ζ", aa: "å", AA: "Å", ae: "æ", AE: "Æ", dh: "ð", DH: "Ð", dj: "đ", DJ: "Đ", ij: "ij", IJ: "IJ", l: "ł", L: "Ł", ng: "ŋ", NG: "Ŋ", o: "ø", O: "Ø", oe: "œ", OE: "Œ", ss: "ß", SS: "SS", th: "þ", TH: "Þ" };
|
|
975
978
|
var gn = /^(\^|_|\\[^#$%&~_^\\{}()\s]+)(\{)?/, yn = /^%[^\n]+(?:\n|$)/, mn = /^[^#$%&~_^\\{}]+/, vn = /^\\([&{}$%#_])/, xn = /(?:\\[\\@,!:;-]|-{2,3}|[!?]`|``?|,,|''?|~|<<|>>)/g, wn = { "---": "—", "--": "–", "!`": "¡", "?`": "¿", "``": "“", ",,": "„", "''": "”", "`": "‘", "'": "’", "<<": "«", ">>": "»", "~": " ", "\\-": "", "\\,": " ", "\\;": " ", "\\:": " ", "\\!": " ", "\\@": "\uFEFF", "\\\\": "\\newline{}" }, U = { bf: function(e) {
|
|
976
979
|
e.weight = "bold";
|
|
977
980
|
}, it: function(e) {
|
|
@@ -1000,7 +1003,7 @@ var tn = { exports: {} };
|
|
|
1000
1003
|
var s = n;
|
|
1001
1004
|
return (e.style || e.weight || e.baseline || e.color || e.size || e.family) && (s = b(n, e)), s;
|
|
1002
1005
|
}
|
|
1003
|
-
function
|
|
1006
|
+
function Ae(e, n, s) {
|
|
1004
1007
|
for (var i, c, p = e.width; p + s.width > n && e.length; )
|
|
1005
1008
|
c = (i = e[e.length - 1]).width, i.width > s.width ? (i.value = i.value.slice(0, -1), i.width = G(i, i.font), p += i.width) : e.pop(), p -= c;
|
|
1006
1009
|
e[e.length - 1] instanceof gt && e.pop(), i = e[e.length - 1] || i || {}, s.font = b(s.font, i.bold, i.italic, ""), s.href = e.length ? i.href : null, s.rel = e.length ? i.rel : null, s.target = e.length ? i.target : null, e.push(s);
|
|
@@ -1008,32 +1011,32 @@ var tn = { exports: {} };
|
|
|
1008
1011
|
function xt(e) {
|
|
1009
1012
|
return Math.round(1e6 * e) / 1e6;
|
|
1010
1013
|
}
|
|
1011
|
-
function
|
|
1014
|
+
function Ee(e) {
|
|
1012
1015
|
return function(n) {
|
|
1013
1016
|
if (Array.isArray(n))
|
|
1014
|
-
return
|
|
1017
|
+
return ee(n);
|
|
1015
1018
|
}(e) || function(n) {
|
|
1016
1019
|
if (typeof Symbol < "u" && n[Symbol.iterator] != null || n["@@iterator"] != null)
|
|
1017
1020
|
return Array.from(n);
|
|
1018
1021
|
}(e) || function(n, s) {
|
|
1019
1022
|
if (n) {
|
|
1020
1023
|
if (typeof n == "string")
|
|
1021
|
-
return
|
|
1024
|
+
return ee(n, s);
|
|
1022
1025
|
var i = Object.prototype.toString.call(n).slice(8, -1);
|
|
1023
|
-
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) ?
|
|
1026
|
+
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) ? ee(n, s) : void 0;
|
|
1024
1027
|
}
|
|
1025
1028
|
}(e) || function() {
|
|
1026
1029
|
throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
1027
1030
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
1028
1031
|
}();
|
|
1029
1032
|
}
|
|
1030
|
-
function
|
|
1033
|
+
function ee(e, n) {
|
|
1031
1034
|
(n == null || n > e.length) && (n = e.length);
|
|
1032
1035
|
for (var s = 0, i = new Array(n); s < n; s++)
|
|
1033
1036
|
i[s] = e[s];
|
|
1034
1037
|
return i;
|
|
1035
1038
|
}
|
|
1036
|
-
var En = { center: "middle", right: "end" }, kn = { middle: 0.5, center: 0.5, bottom: 1, end: 1 },
|
|
1039
|
+
var En = { center: "middle", right: "end" }, kn = { middle: 0.5, center: 0.5, bottom: 1, end: 1 }, ne = function(e, n) {
|
|
1037
1040
|
return !e && !n || e === n;
|
|
1038
1041
|
};
|
|
1039
1042
|
function Sn(e, n) {
|
|
@@ -1058,13 +1061,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1058
1061
|
H = [];
|
|
1059
1062
|
for (var wt = 0, Lt = 0, ht = void 0, X = 0, jt = lt.length; X < jt; X++) {
|
|
1060
1063
|
var R = lt[X], Z = R.font;
|
|
1061
|
-
R.whitespace && wt++, Lt += R.width, X && !R.tracking && !ot &&
|
|
1064
|
+
R.whitespace && wt++, Lt += R.width, X && !R.tracking && !ot && ne(Z.id, at) && ne(R.class, dt) && ne(ht, R.href) ? q += R.value : (D(), q = R.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: R.class || null }, ot && (Y.dx = xt(ot), ot = 0), R.tracking && (ot = Z.size * R.tracking), R.href && !ht ? (ht = R.href, Q = "a", Y.href = ht, Y.rel = R.rel, Y.target = R.target) : ht = null, at = Z.id, dt = R.class);
|
|
1062
1065
|
}
|
|
1063
1066
|
if (D(), I)
|
|
1064
|
-
s.push.apply(s,
|
|
1067
|
+
s.push.apply(s, Ee(H));
|
|
1065
1068
|
else {
|
|
1066
1069
|
var qt = null, Ct = nt === tt - 1 || lt[lt.length - 1] instanceof et;
|
|
1067
|
-
P && lt.length > 1 && !Ct && (qt = xt((O - Lt) / wt)), s.push(x.apply(void 0, ["tspan", { wordSpacing: qt, x: L(nt) + j, dy: xt(nt ? B : J) + "em" }].concat(
|
|
1070
|
+
P && lt.length > 1 && !Ct && (qt = xt((O - Lt) / wt)), s.push(x.apply(void 0, ["tspan", { wordSpacing: qt, x: L(nt) + j, dy: xt(nt ? B : J) + "em" }].concat(Ee(H))));
|
|
1068
1071
|
}
|
|
1069
1072
|
} else
|
|
1070
1073
|
s.push(x("tspan", { x: L(nt), dy: xt(nt ? B : J) + "em" }, " "));
|
|
@@ -1104,17 +1107,17 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1104
1107
|
});
|
|
1105
1108
|
}
|
|
1106
1109
|
}
|
|
1107
|
-
function
|
|
1108
|
-
return
|
|
1110
|
+
function ie(e) {
|
|
1111
|
+
return ie = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
|
|
1109
1112
|
return typeof n;
|
|
1110
1113
|
} : function(n) {
|
|
1111
1114
|
return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
|
|
1112
|
-
},
|
|
1115
|
+
}, ie(e);
|
|
1113
1116
|
}
|
|
1114
|
-
function
|
|
1117
|
+
function ke(e) {
|
|
1115
1118
|
for (var n = {}, s = 0; s < e.length; s++) {
|
|
1116
1119
|
var i = e[s];
|
|
1117
|
-
typeof i != "number" && i != null && (typeof i == "string" ? n.text = i : typeof i == "function" ? n.fn = i :
|
|
1120
|
+
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));
|
|
1118
1121
|
}
|
|
1119
1122
|
return n;
|
|
1120
1123
|
}
|
|
@@ -1143,7 +1146,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1143
1146
|
}
|
|
1144
1147
|
var c;
|
|
1145
1148
|
}
|
|
1146
|
-
var Dn = b(),
|
|
1149
|
+
var Dn = b(), re = function(e) {
|
|
1147
1150
|
return typeof e == "function" ? e : function() {
|
|
1148
1151
|
return e;
|
|
1149
1152
|
};
|
|
@@ -1205,14 +1208,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1205
1208
|
var Lt = 0, ht = 0, X = Q.map(function(yt) {
|
|
1206
1209
|
for (var K, mt = Lt; (K = k[mt]) && (K.whitespace || !K.value); )
|
|
1207
1210
|
mt++;
|
|
1208
|
-
for (var ft = yt,
|
|
1209
|
-
K instanceof et && (
|
|
1211
|
+
for (var ft = yt, ae = null; ft > mt && (K = k[ft - 1]) && (K.whitespace || !(K.value || K instanceof gt)); )
|
|
1212
|
+
K instanceof et && (ae = K), ft--;
|
|
1210
1213
|
K instanceof gt && (K.value = "-", K.width = G("-", K.font)), Lt = yt;
|
|
1211
|
-
var bt = k.slice(mt, ft).filter(function(
|
|
1212
|
-
return
|
|
1214
|
+
var bt = k.slice(mt, ft).filter(function(le) {
|
|
1215
|
+
return le.value;
|
|
1213
1216
|
});
|
|
1214
|
-
return
|
|
1215
|
-
return
|
|
1217
|
+
return ae && bt.push(ae), bt.width = bt.reduce(function(le, Pn) {
|
|
1218
|
+
return le + Pn.width;
|
|
1216
1219
|
}, 0), bt.width > ht && (ht = bt.width), bt;
|
|
1217
1220
|
});
|
|
1218
1221
|
if (X.hasLineOverflow = !1, L) {
|
|
@@ -1221,14 +1224,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1221
1224
|
var mt = I(K);
|
|
1222
1225
|
if (yt.width > mt) {
|
|
1223
1226
|
var ft = new F(jt);
|
|
1224
|
-
ft.font = M, ft.width = G(jt, J),
|
|
1227
|
+
ft.font = M, ft.width = G(jt, J), Ae(yt, mt, ft), X.hasLineOverflow = !0;
|
|
1225
1228
|
}
|
|
1226
1229
|
});
|
|
1227
1230
|
}
|
|
1228
1231
|
var R = S.overflow() === "ellipsis" ? "…" : S.overflow();
|
|
1229
1232
|
if (R && P !== k.length) {
|
|
1230
1233
|
var Z = I(X.length - 1), qt = X[X.length - 1], Ct = new F(R);
|
|
1231
|
-
Ct.font = M, Ct.width = G(R, J),
|
|
1234
|
+
Ct.font = M, Ct.width = G(R, J), Ae(qt, Z, Ct), X.hasOverflow = !0;
|
|
1232
1235
|
} else
|
|
1233
1236
|
X.hasOverflow = !1;
|
|
1234
1237
|
return X.font = M, X.width = ht, X;
|
|
@@ -1255,11 +1258,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1255
1258
|
var c = String(i).toLowerCase();
|
|
1256
1259
|
return c === "break-word" ? this.props.overflowWrap = "break-word" : c !== "normal" && i != null || (this.props.overflowWrap = null), this;
|
|
1257
1260
|
} }, { key: "width", value: function(i) {
|
|
1258
|
-
return arguments.length ? (this.props.width =
|
|
1261
|
+
return arguments.length ? (this.props.width = re(i), this) : this.props.width;
|
|
1259
1262
|
} }, { key: "height", value: function(i) {
|
|
1260
|
-
return arguments.length ? (this.props.height =
|
|
1263
|
+
return arguments.length ? (this.props.height = re(i), this) : this.props.height;
|
|
1261
1264
|
} }, { key: "x", value: function(i) {
|
|
1262
|
-
return arguments.length ? (this.props.x =
|
|
1265
|
+
return arguments.length ? (this.props.x = re(i), this) : this.props.x;
|
|
1263
1266
|
} }, { key: "parser", value: function(i) {
|
|
1264
1267
|
if (!arguments.length)
|
|
1265
1268
|
return this.props.parser;
|
|
@@ -1273,7 +1276,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1273
1276
|
} }, { key: "createElement", value: function(i) {
|
|
1274
1277
|
return arguments.length ? (this.props.createElement = i, this) : this.props.createElement || e.createElement;
|
|
1275
1278
|
} }, { key: "render", value: function() {
|
|
1276
|
-
var i =
|
|
1279
|
+
var i = ke(arguments);
|
|
1277
1280
|
return typeof i.text == "string" && (i.text = this.linebreak(i.text)), i.ctx ? _n(i.text, this, i.ctx) : Sn(i.text, this);
|
|
1278
1281
|
} }], s && In(n.prototype, s), Object.defineProperty(n, "prototype", { writable: !1 }), e;
|
|
1279
1282
|
}();
|
|
@@ -1284,7 +1287,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1284
1287
|
return n && typeof Symbol == "function" && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n;
|
|
1285
1288
|
}, Ot(e);
|
|
1286
1289
|
}
|
|
1287
|
-
function
|
|
1290
|
+
function se(e, n) {
|
|
1288
1291
|
(n == null || n > e.length) && (n = e.length);
|
|
1289
1292
|
for (var s = 0, i = new Array(n); s < n; s++)
|
|
1290
1293
|
i[s] = e[s];
|
|
@@ -1308,11 +1311,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1308
1311
|
}
|
|
1309
1312
|
var c;
|
|
1310
1313
|
}
|
|
1311
|
-
var
|
|
1314
|
+
var Se = function(e) {
|
|
1312
1315
|
return typeof e == "function" ? e : function() {
|
|
1313
1316
|
return e;
|
|
1314
1317
|
};
|
|
1315
|
-
},
|
|
1318
|
+
}, Te = function() {
|
|
1316
1319
|
function e(i) {
|
|
1317
1320
|
if (function(p, w) {
|
|
1318
1321
|
if (!(p instanceof w))
|
|
@@ -1339,9 +1342,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1339
1342
|
}
|
|
1340
1343
|
return this;
|
|
1341
1344
|
} }, { key: "width", value: function(i) {
|
|
1342
|
-
return arguments.length ? (this.props.width =
|
|
1345
|
+
return arguments.length ? (this.props.width = Se(i), this) : this.props.width;
|
|
1343
1346
|
} }, { key: "height", value: function(i) {
|
|
1344
|
-
return arguments.length ? (this.props.height =
|
|
1347
|
+
return arguments.length ? (this.props.height = Se(i), this) : this.props.height;
|
|
1345
1348
|
} }, { key: "rotate", value: function(i) {
|
|
1346
1349
|
return arguments.length ? (this.props.rotation = i, this) : this.props.rotation;
|
|
1347
1350
|
} }, { key: "createElement", value: function(i) {
|
|
@@ -1350,23 +1353,23 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1350
1353
|
var p, w = i.getContext ? i.getContext("2d") : i;
|
|
1351
1354
|
return w.save(), w.rotate(this.rotate() * Math.PI / 180), w.translate.apply(w, function(x) {
|
|
1352
1355
|
if (Array.isArray(x))
|
|
1353
|
-
return
|
|
1356
|
+
return se(x);
|
|
1354
1357
|
}(p = this.anchor()) || function(x) {
|
|
1355
1358
|
if (typeof Symbol < "u" && x[Symbol.iterator] != null || x["@@iterator"] != null)
|
|
1356
1359
|
return Array.from(x);
|
|
1357
1360
|
}(p) || function(x, k) {
|
|
1358
1361
|
if (x) {
|
|
1359
1362
|
if (typeof x == "string")
|
|
1360
|
-
return
|
|
1363
|
+
return se(x, k);
|
|
1361
1364
|
var S = Object.prototype.toString.call(x).slice(8, -1);
|
|
1362
|
-
return S === "Object" && x.constructor && (S = x.constructor.name), S === "Map" || S === "Set" ? Array.from(x) : S === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(S) ?
|
|
1365
|
+
return S === "Object" && x.constructor && (S = x.constructor.name), S === "Map" || S === "Set" ? Array.from(x) : S === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(S) ? se(x, k) : void 0;
|
|
1363
1366
|
}
|
|
1364
1367
|
}(p) || function() {
|
|
1365
1368
|
throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
1366
1369
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
1367
1370
|
}()), c(w), w.restore(), w;
|
|
1368
1371
|
} }, { key: "render", value: function() {
|
|
1369
|
-
var i =
|
|
1372
|
+
var i = ke(arguments);
|
|
1370
1373
|
if (i.d3)
|
|
1371
1374
|
return i.d3.attr("transform", "rotate(".concat(this.rotate(), ") translate(").concat(this.anchor(), ")"));
|
|
1372
1375
|
if (i.ctx)
|
|
@@ -1376,20 +1379,20 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1376
1379
|
return this.createElement()("g", { transform: "rotate(".concat(this.rotate(), ") translate(").concat(this.anchor(), ")") }, c);
|
|
1377
1380
|
}
|
|
1378
1381
|
} }], s && Mn(n.prototype, s), Object.defineProperty(n, "prototype", { writable: !1 }), e;
|
|
1379
|
-
}(), On = Object.prototype.hasOwnProperty,
|
|
1382
|
+
}(), On = Object.prototype.hasOwnProperty, oe = {};
|
|
1380
1383
|
function Ln(e) {
|
|
1381
|
-
return
|
|
1384
|
+
return oe[e] || (oe[e] = e.replace(/([a-z])([A-Z])/g, function(n, s, i) {
|
|
1382
1385
|
return s + "-" + i.toLowerCase();
|
|
1383
|
-
})),
|
|
1386
|
+
})), oe[e];
|
|
1384
1387
|
}
|
|
1385
|
-
function
|
|
1388
|
+
function _e(e, n) {
|
|
1386
1389
|
if (Array.isArray(n))
|
|
1387
1390
|
return n.forEach(function(s) {
|
|
1388
|
-
return
|
|
1391
|
+
return _e(e, s);
|
|
1389
1392
|
});
|
|
1390
1393
|
typeof n == "string" && (n = document.createTextNode(n)), e.appendChild(n);
|
|
1391
1394
|
}
|
|
1392
|
-
function
|
|
1395
|
+
function Ie(e, n) {
|
|
1393
1396
|
if (typeof document < "u") {
|
|
1394
1397
|
var s = typeof e == "string" ? document.createElementNS("http://www.w3.org/2000/svg", e) : e;
|
|
1395
1398
|
if (n && s.setAttribute)
|
|
@@ -1398,11 +1401,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1398
1401
|
for (var c = arguments.length, p = new Array(c > 2 ? c - 2 : 0), w = 2; w < c; w++)
|
|
1399
1402
|
p[w - 2] = arguments[w];
|
|
1400
1403
|
return p != null && p.length && p.forEach(function(x) {
|
|
1401
|
-
|
|
1404
|
+
_e(s, x);
|
|
1402
1405
|
}), s;
|
|
1403
1406
|
}
|
|
1404
1407
|
}
|
|
1405
|
-
it.createElement =
|
|
1408
|
+
it.createElement = Ie, it.textparser = Bt, it.defaultparser = Bt, it.htmlparser = function(e) {
|
|
1406
1409
|
e = String(e || "").trim();
|
|
1407
1410
|
for (var n, s, i = { weight: null, style: null, sub: !1, sup: !1, href: null, color: null, rel: null, target: null }, c = [], p = [], w = function(O) {
|
|
1408
1411
|
for (var I in i)
|
|
@@ -1420,13 +1423,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1420
1423
|
}
|
|
1421
1424
|
}; e.length; ) {
|
|
1422
1425
|
if (n = /^[^<]+/.exec(e))
|
|
1423
|
-
Bt(
|
|
1426
|
+
Bt(we(n[0]), !1).forEach(w);
|
|
1424
1427
|
else if (!(n = hn.exec(e)))
|
|
1425
1428
|
if (n = an.exec(e))
|
|
1426
1429
|
p.length && (i = p.pop()), x(n[1]);
|
|
1427
1430
|
else if (n = ln.exec(e)) {
|
|
1428
1431
|
var k = n[1];
|
|
1429
|
-
x(k), p.push(i), i = Object.create(i),
|
|
1432
|
+
x(k), p.push(i), i = Object.create(i), xe[k] && xe[k](i, "");
|
|
1430
1433
|
var S = pn(n[2]);
|
|
1431
1434
|
k === "a" && (S.href && (i.href = S.href), S.rel && (i.rel = S.rel), S.target && (i.target = S.target)), S.class && (i.class = i.class ? i.class + " " + S.class : S.class), S.style && (s = /(?:^|\s|;)color\s*:\s*([^;\s"']+)/.exec(S.style)) && s[1] && (i.color = s[1]), k === "br" && c.push(new et());
|
|
1432
1435
|
} else
|
|
@@ -1483,8 +1486,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1483
1486
|
x(), i.family = "serif";
|
|
1484
1487
|
var I = void 0;
|
|
1485
1488
|
M === "LaTeX" && ((I = w(new F("L"))).tracking = -0.25, (I = w(new F("A"))).size = 0.7, I.baseline = 0.3, I.tracking = -0.1), (I = w(new F("T"))).tracking = -0.17, (I = w(new F("E"))).baseline = -0.22, I.tracking = -0.13, I = w(new F("X")), k();
|
|
1486
|
-
} else if (M in
|
|
1487
|
-
w(new F(
|
|
1489
|
+
} else if (M in be)
|
|
1490
|
+
w(new F(be[M])), O && x();
|
|
1488
1491
|
else if (M in U) {
|
|
1489
1492
|
var L = [], B = U[M].length - 1, J = void 0;
|
|
1490
1493
|
if (B) {
|
|
@@ -1506,24 +1509,24 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1506
1509
|
return c;
|
|
1507
1510
|
}, it.measureText = function(e, n, s) {
|
|
1508
1511
|
return G(e, b(n), s);
|
|
1509
|
-
}, it.Token = F, it.Break = Dt, it.LineBreak = et, it.SoftHyphen = gt, it.Rotator =
|
|
1512
|
+
}, it.Token = F, it.Break = Dt, it.LineBreak = et, it.SoftHyphen = gt, it.Rotator = Te, Te.createElement = Ie;
|
|
1510
1513
|
const Cn = it;
|
|
1511
1514
|
return r.default;
|
|
1512
1515
|
})());
|
|
1513
|
-
})(
|
|
1514
|
-
var Qn =
|
|
1515
|
-
const
|
|
1516
|
-
function
|
|
1516
|
+
})(Qe);
|
|
1517
|
+
var Qn = Qe.exports;
|
|
1518
|
+
const ze = /* @__PURE__ */ Xe(Qn);
|
|
1519
|
+
function ce(a) {
|
|
1517
1520
|
return a.replace(/…$/, "");
|
|
1518
1521
|
}
|
|
1519
|
-
function
|
|
1522
|
+
function ue(a) {
|
|
1520
1523
|
return a.children[0].innerHTML;
|
|
1521
1524
|
}
|
|
1522
1525
|
function ti(a, h) {
|
|
1523
1526
|
const t = ut(a), { fontSize: r, font: o, padding: l = 0 } = a.properties.style || {};
|
|
1524
1527
|
if (t.width === t.height && t.width === 0)
|
|
1525
1528
|
return;
|
|
1526
|
-
const u = new
|
|
1529
|
+
const u = new ze({
|
|
1527
1530
|
font: `${r}px/${r}px ${o}`.replace(/(px)+/g, "px"),
|
|
1528
1531
|
width: t.width - l * 2,
|
|
1529
1532
|
height: t.height - l * 2,
|
|
@@ -1532,7 +1535,7 @@ function ti(a, h) {
|
|
|
1532
1535
|
x: 0,
|
|
1533
1536
|
overflow: "ellipsis",
|
|
1534
1537
|
parser: "html",
|
|
1535
|
-
createElement:
|
|
1538
|
+
createElement: ze.createElement
|
|
1536
1539
|
});
|
|
1537
1540
|
u.overflowWrap("break-word");
|
|
1538
1541
|
const g = u.linebreak(
|
|
@@ -1550,7 +1553,7 @@ function ti(a, h) {
|
|
|
1550
1553
|
`) || v.push(y), y++;
|
|
1551
1554
|
break;
|
|
1552
1555
|
}
|
|
1553
|
-
const E =
|
|
1556
|
+
const E = ce(ue(f[y]));
|
|
1554
1557
|
C.startsWith(E) && (C = C.slice(E.length).trim()), y++;
|
|
1555
1558
|
}
|
|
1556
1559
|
}), v.forEach((b) => g.removeChild(f[b]));
|
|
@@ -1559,23 +1562,23 @@ function ti(a, h) {
|
|
|
1559
1562
|
let C = b;
|
|
1560
1563
|
const E = [];
|
|
1561
1564
|
for (; C.length > 0; ) {
|
|
1562
|
-
const $ = f.find((_) => !!_.children[0] && _.children[0].tagName === "tspan" && C.startsWith(
|
|
1565
|
+
const $ = f.find((_) => !!_.children[0] && _.children[0].tagName === "tspan" && C.startsWith(ce(ue(_))));
|
|
1563
1566
|
if (!$)
|
|
1564
1567
|
break;
|
|
1565
1568
|
E.push($);
|
|
1566
|
-
const N =
|
|
1569
|
+
const N = ce($.children[0].innerHTML).length;
|
|
1567
1570
|
if (!N)
|
|
1568
1571
|
break;
|
|
1569
1572
|
C = C.slice(N);
|
|
1570
1573
|
}
|
|
1571
1574
|
E.forEach(($) => {
|
|
1572
1575
|
const N = document.createElementNS("http://www.w3.org/2000/svg", "a");
|
|
1573
|
-
N.setAttribute("href", b), N.setAttribute("target", "_blank"), N.innerHTML =
|
|
1576
|
+
N.setAttribute("href", b), N.setAttribute("target", "_blank"), N.innerHTML = ue($), $.children[0].innerHTML = "", $.children[0].appendChild(N);
|
|
1574
1577
|
});
|
|
1575
1578
|
}), h.appendChild(g);
|
|
1576
1579
|
}
|
|
1577
|
-
const
|
|
1578
|
-
class ei extends
|
|
1580
|
+
const Ne = 20;
|
|
1581
|
+
class ei extends Je {
|
|
1579
1582
|
constructor(t, r = {}) {
|
|
1580
1583
|
super(
|
|
1581
1584
|
t,
|
|
@@ -1596,7 +1599,7 @@ class ei extends Qe {
|
|
|
1596
1599
|
m(this, "textArea");
|
|
1597
1600
|
m(this, "handleSize");
|
|
1598
1601
|
m(this, "rect", { x: 0, y: 0, width: 0, height: 0 });
|
|
1599
|
-
m(this, "annotation", { ...
|
|
1602
|
+
m(this, "annotation", { ...he });
|
|
1600
1603
|
m(this, "startX", 0);
|
|
1601
1604
|
m(this, "startY", 0);
|
|
1602
1605
|
m(this, "handles", []);
|
|
@@ -1615,20 +1618,20 @@ class ei extends Qe {
|
|
|
1615
1618
|
this.select(o.id), this.startDragging(this.getById(o.id), l.x, l.y), this.draggedHandle = 6;
|
|
1616
1619
|
});
|
|
1617
1620
|
m(this, "cancelDrawing", () => {
|
|
1618
|
-
this.isDragging && (this.remove(this.annotation.id), this.annotation = { ...
|
|
1621
|
+
this.isDragging && (this.remove(this.annotation.id), this.annotation = { ...he }, this.draggedHandle = V, this.isDragging = !1, this.emit(Tt, this.annotation));
|
|
1619
1622
|
});
|
|
1620
1623
|
m(this, "startDragging", (t, r, o) => {
|
|
1621
1624
|
this.annotation = t;
|
|
1622
1625
|
const l = ct(this.annotation), u = ut(this.annotation);
|
|
1623
|
-
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(
|
|
1626
|
+
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(Kt, this.annotation), this.isDragging = !0;
|
|
1624
1627
|
});
|
|
1625
1628
|
m(this, "onHandleMouseDown", (t) => {
|
|
1626
1629
|
const r = this.getById(this.selectedId) || this.getById(this.hoveredId);
|
|
1627
1630
|
if (!r)
|
|
1628
1631
|
return;
|
|
1629
1632
|
this.selectedId !== r.id && this.select(this.hoveredId);
|
|
1630
|
-
const { x: o, y: l } =
|
|
1631
|
-
this.startDragging(r, o, l), this.draggedHandle =
|
|
1633
|
+
const { x: o, y: l } = Xt(t, this.ogma.getContainer());
|
|
1634
|
+
this.startDragging(r, o, l), this.draggedHandle = Ve(t.target);
|
|
1632
1635
|
});
|
|
1633
1636
|
m(this, "onMouseMove", (t) => {
|
|
1634
1637
|
requestAnimationFrame(() => this._onMouseMove(t));
|
|
@@ -1637,19 +1640,19 @@ class ei extends Qe {
|
|
|
1637
1640
|
if (!this.isDragging)
|
|
1638
1641
|
return;
|
|
1639
1642
|
t.stopPropagation(), t.preventDefault();
|
|
1640
|
-
const r = this.handles[this.draggedHandle], o = r.classList.contains("top"), l = r.classList.contains("left"), u = r.classList.contains("right"), d = r.classList.contains("bottom"), g = r.classList.contains("line-handle"), { x: f, y } =
|
|
1643
|
+
const r = this.handles[this.draggedHandle], o = r.classList.contains("top"), l = r.classList.contains("left"), u = r.classList.contains("right"), d = r.classList.contains("bottom"), g = r.classList.contains("line-handle"), { x: f, y } = Xt(
|
|
1641
1644
|
t,
|
|
1642
1645
|
this.ogma.getContainer()
|
|
1643
1646
|
), v = this.ogma.view.getZoom(), T = (f - this.startX) / v, A = (y - this.startY) / v, b = this.ogma.view.getAngle(), C = rt({ x: T, y: A }, b);
|
|
1644
1647
|
(d && l || o && u) && (C.y = 0, C.x = 0);
|
|
1645
1648
|
const E = l || g ? this.rect.x + C.x : this.rect.x, $ = o || g ? this.rect.y + C.y : this.rect.y, N = Math.max(
|
|
1646
1649
|
this.rect.width + T * (g || l ? 0 : 1),
|
|
1647
|
-
|
|
1650
|
+
Ne
|
|
1648
1651
|
), _ = Math.max(
|
|
1649
1652
|
this.rect.height + A * (g || o ? 0 : 1),
|
|
1650
|
-
|
|
1653
|
+
Ne
|
|
1651
1654
|
);
|
|
1652
|
-
Bn(this.annotation, E, $, N, _), this.emit(
|
|
1655
|
+
Bn(this.annotation, E, $, N, _), this.emit(Zt, this.annotation, "text"), this.refreshEditor(), this.layer.refresh();
|
|
1653
1656
|
});
|
|
1654
1657
|
m(this, "onMouseUp", () => {
|
|
1655
1658
|
!this.isDragging || this.draggedHandle === V || (this.restoreDragging(), this.textArea.classList.remove("noevents"), this.textArea.removeAttribute("disabled"), this.emit(Tt, this.annotation), this.isDragging = !1, this.draggedHandle = V);
|
|
@@ -1665,7 +1668,7 @@ class ei extends Qe {
|
|
|
1665
1668
|
const t = this.getById(this.selectedId);
|
|
1666
1669
|
t && (this.textArea.value = this.textArea.value.replace(/ +(?= )/g, ""), this.textArea.focus(), t.properties.content = this.textArea.value, this.emit(ye, t), this.layer.refresh());
|
|
1667
1670
|
});
|
|
1668
|
-
this.showeditorOnHover = !1, this.handleSize =
|
|
1671
|
+
this.showeditorOnHover = !1, this.handleSize = $e.handleSize || r.textHandleSize, this.placeholder = $e.placeholder || r.textPlaceholder || "";
|
|
1669
1672
|
const o = this.textArea = this.editor.element.querySelector("textarea");
|
|
1670
1673
|
o.addEventListener("input", this._onInput), o.addEventListener("focus", this._onFocus), o.addEventListener("blur", this._onBlur), o.addEventListener("mousedown", this._onMousedown), o.spellcheck = !1, this.handles = Array.prototype.slice.call(
|
|
1671
1674
|
this.editor.element.querySelectorAll(".annotation-text-handle > .handle")
|
|
@@ -1720,7 +1723,7 @@ class ei extends Qe {
|
|
|
1720
1723
|
});
|
|
1721
1724
|
}
|
|
1722
1725
|
getDefaultOptions() {
|
|
1723
|
-
return
|
|
1726
|
+
return he;
|
|
1724
1727
|
}
|
|
1725
1728
|
refreshEditor() {
|
|
1726
1729
|
if (+this.selectedId < 0 && +this.hoveredId < 0)
|
|
@@ -1750,7 +1753,7 @@ class ni {
|
|
|
1750
1753
|
m(this, "linksByArrowId", {});
|
|
1751
1754
|
}
|
|
1752
1755
|
add(h, t, r, o, l) {
|
|
1753
|
-
const u =
|
|
1756
|
+
const u = Jt(), d = h.id, g = {
|
|
1754
1757
|
id: u,
|
|
1755
1758
|
arrow: d,
|
|
1756
1759
|
target: r,
|
|
@@ -1798,7 +1801,7 @@ class ni {
|
|
|
1798
1801
|
Object.values(this.links).forEach(h);
|
|
1799
1802
|
}
|
|
1800
1803
|
}
|
|
1801
|
-
const st = (a) => a.properties.type === "arrow", pt = (a) => a.properties.type === "text",
|
|
1804
|
+
const st = (a) => a.properties.type === "arrow", pt = (a) => a.properties.type === "text", He = (a) => a.type === "FeatureCollection", ii = {
|
|
1802
1805
|
magnetColor: "#3e8",
|
|
1803
1806
|
detectMargin: 20,
|
|
1804
1807
|
magnetHandleRadius: 5,
|
|
@@ -1808,7 +1811,7 @@ const st = (a) => a.properties.type === "arrow", pt = (a) => a.properties.type =
|
|
|
1808
1811
|
textHandleSize: 3.5,
|
|
1809
1812
|
minArrowHeight: 20,
|
|
1810
1813
|
maxArrowHeight: 30
|
|
1811
|
-
},
|
|
1814
|
+
}, Fe = ["start", "end"], Be = [
|
|
1812
1815
|
{ x: 0, y: 0 },
|
|
1813
1816
|
{ x: 0.5, y: 0 },
|
|
1814
1817
|
{ x: 1, y: 0 },
|
|
@@ -1818,7 +1821,7 @@ const st = (a) => a.properties.type === "arrow", pt = (a) => a.properties.type =
|
|
|
1818
1821
|
{ x: 0.5, y: 1 },
|
|
1819
1822
|
{ x: 1, y: 1 }
|
|
1820
1823
|
];
|
|
1821
|
-
class oi extends
|
|
1824
|
+
class oi extends Ke {
|
|
1822
1825
|
constructor(t, r = {}) {
|
|
1823
1826
|
super();
|
|
1824
1827
|
m(this, "arrows");
|
|
@@ -1839,7 +1842,7 @@ class oi extends Je {
|
|
|
1839
1842
|
return;
|
|
1840
1843
|
t.beginPath(), t.fillStyle = "green";
|
|
1841
1844
|
const r = this.ogma.view.getZoom();
|
|
1842
|
-
|
|
1845
|
+
Be.forEach((o) => {
|
|
1843
1846
|
if (!this.textToMagnet)
|
|
1844
1847
|
return;
|
|
1845
1848
|
const l = ut(this.textToMagnet), u = ct(this.textToMagnet), d = Ut(o, { x: l.width, y: l.height }), g = rt(d, this.ogma.view.getAngle()), { x: f, y } = Et(g, u);
|
|
@@ -1861,10 +1864,10 @@ class oi extends Je {
|
|
|
1861
1864
|
const g = this.getAnnotation(l), f = ut(t), y = ct(t), v = Ut(d, { x: f.width, y: f.height }), T = rt(v, this.ogma.view.getAngle()), A = Et(T, y);
|
|
1862
1865
|
g.geometry.coordinates[u === "start" ? 0 : 1] = [A.x, A.y];
|
|
1863
1866
|
}), this.activeLinks.length && this.arrows.refreshLayer());
|
|
1864
|
-
this.layer.refresh(), this.emit(
|
|
1867
|
+
this.layer.refresh(), this.emit(Zt, t, r);
|
|
1865
1868
|
});
|
|
1866
1869
|
m(this, "_onFeatureDragEnd", (t) => {
|
|
1867
|
-
this.dragged !== null && st(t) && $t(this.dragged) &&
|
|
1870
|
+
this.dragged !== null && st(t) && $t(this.dragged) && Fe.forEach((r) => {
|
|
1868
1871
|
this.links.getArrowLink(t.id, r) && this.emit(Yn, {
|
|
1869
1872
|
arrow: t,
|
|
1870
1873
|
link: this.links.getArrowLink(t.id, r)
|
|
@@ -1875,7 +1878,7 @@ class oi extends Je {
|
|
|
1875
1878
|
this.textToMagnet = void 0, st(t) ? this.dragged = t : pt(t) && this.activeLinks.push(...this.links.getTargetLinks(t.id, "text")), this.annotations.forEach((r) => {
|
|
1876
1879
|
const o = r.getSelectedFeature();
|
|
1877
1880
|
o && o !== t && r.unhover().unselect(), r.disableDetection();
|
|
1878
|
-
}), this.emit(
|
|
1881
|
+
}), this.emit(Kt, t);
|
|
1879
1882
|
});
|
|
1880
1883
|
m(this, "_onNodesDragStart", () => {
|
|
1881
1884
|
this.arrows.unhover().unselect(), this.texts.unhover().unselect();
|
|
@@ -1920,7 +1923,7 @@ class oi extends Je {
|
|
|
1920
1923
|
this.emit(ye, t);
|
|
1921
1924
|
});
|
|
1922
1925
|
this.options = this.setOptions({ ...ii, ...r }), this.ogma = t, this.arrows = new Kn(t, this.options), this.texts = new ei(t, this.options), this.annotations = [this.arrows, this.texts], this.annotations.forEach((o) => {
|
|
1923
|
-
o.on(
|
|
1926
|
+
o.on(Kt, this._onFeatureDragStart).on(Zt, this._onFeatureDrag).on(Tt, this._onFeatureDragEnd).on(ye, this.onUpdate).on(fe, this._onUnselect).on(de, this._onSelect).on(ge, this._onAdded).on(pe, this._onRemoved);
|
|
1924
1927
|
}), this.ogma.events.on("nodesDragStart", this._onNodesDragStart).on("nodesDragProgress", this._onNodesDrag).on("layoutEnd", this._onLayoutEnd).on(["viewChanged", "rotate"], () => {
|
|
1925
1928
|
this.refreshTextLinks();
|
|
1926
1929
|
}), this.layer = t.layers.addCanvasLayer(this._render), this.layer.moveToBottom();
|
|
@@ -1944,7 +1947,7 @@ class oi extends Je {
|
|
|
1944
1947
|
if (this.links.remove(t, r), !l)
|
|
1945
1948
|
return !1;
|
|
1946
1949
|
this.textToMagnet = l;
|
|
1947
|
-
const u = this.findMagnetPoint(
|
|
1950
|
+
const u = this.findMagnetPoint(Be, l, o);
|
|
1948
1951
|
return u ? (At(t, r, u.point.x, u.point.y), this.links.add(t, r, l.id, "text", u.magnet), !0) : !1;
|
|
1949
1952
|
}
|
|
1950
1953
|
_findAndSnapToNode(t, r, o) {
|
|
@@ -2030,7 +2033,7 @@ class oi extends Je {
|
|
|
2030
2033
|
* @param annotation The annotation to add
|
|
2031
2034
|
*/
|
|
2032
2035
|
add(t) {
|
|
2033
|
-
if (
|
|
2036
|
+
if (He(t)) {
|
|
2034
2037
|
const [r, o] = t.features.reduce(
|
|
2035
2038
|
(l, u) => (st(u) ? l[1].push(u) : pt(u) && l[0].push(u), l),
|
|
2036
2039
|
[[], []]
|
|
@@ -2052,13 +2055,13 @@ class oi extends Je {
|
|
|
2052
2055
|
* @param annotation The annotation(s) to remove
|
|
2053
2056
|
*/
|
|
2054
2057
|
remove(t) {
|
|
2055
|
-
return
|
|
2058
|
+
return He(t) ? (t.features.forEach(
|
|
2056
2059
|
(r) => this.remove(r)
|
|
2057
2060
|
), this) : (st(t) ? (this.links.remove(t, "start"), this.links.remove(t, "end"), this.arrows.remove(t.id)) : this.texts.remove(t.id), this);
|
|
2058
2061
|
}
|
|
2059
2062
|
loadLink(t) {
|
|
2060
2063
|
if (t.properties.link)
|
|
2061
|
-
for (const r of
|
|
2064
|
+
for (const r of Fe) {
|
|
2062
2065
|
const o = t.properties.link[r];
|
|
2063
2066
|
if (!o)
|
|
2064
2067
|
continue;
|
|
@@ -2148,9 +2151,9 @@ export {
|
|
|
2148
2151
|
oi as Control,
|
|
2149
2152
|
ge as EVT_ADD,
|
|
2150
2153
|
Wn as EVT_CANCEL_DRAWING,
|
|
2151
|
-
|
|
2154
|
+
Zt as EVT_DRAG,
|
|
2152
2155
|
Tt as EVT_DRAG_END,
|
|
2153
|
-
|
|
2156
|
+
Kt as EVT_DRAG_START,
|
|
2154
2157
|
Un as EVT_HOVER,
|
|
2155
2158
|
Yn as EVT_LINK,
|
|
2156
2159
|
pe as EVT_REMOVE,
|
|
@@ -2160,14 +2163,14 @@ export {
|
|
|
2160
2163
|
ye as EVT_UPDATE,
|
|
2161
2164
|
V as NONE,
|
|
2162
2165
|
ei as Texts,
|
|
2163
|
-
|
|
2166
|
+
Xt as clientToContainerPosition,
|
|
2164
2167
|
Nn as createArrow,
|
|
2165
2168
|
Pt as createSVGElement,
|
|
2166
2169
|
Jn as createText,
|
|
2167
|
-
|
|
2170
|
+
De as defaultArrowOptions,
|
|
2168
2171
|
zt as defaultArrowStyle,
|
|
2169
|
-
|
|
2170
|
-
|
|
2172
|
+
$e as defaultControllerOptions,
|
|
2173
|
+
he as defaultTextOptions,
|
|
2171
2174
|
St as defaultTextStyle,
|
|
2172
2175
|
si as getAnnotationsBounds,
|
|
2173
2176
|
Wt as getArrowEnd,
|
|
@@ -2175,17 +2178,17 @@ export {
|
|
|
2175
2178
|
Rt as getArrowSide,
|
|
2176
2179
|
$t as getArrowStart,
|
|
2177
2180
|
Vt as getAttachmentPointOnNode,
|
|
2178
|
-
|
|
2179
|
-
|
|
2181
|
+
Ve as getHandleId,
|
|
2182
|
+
je as getTextBbox,
|
|
2180
2183
|
ct as getTextPosition,
|
|
2181
2184
|
ut as getTextSize,
|
|
2182
|
-
|
|
2185
|
+
He as isAnnotationCollection,
|
|
2183
2186
|
st as isArrow,
|
|
2184
2187
|
pt as isText,
|
|
2185
2188
|
qn as scaleGeometry,
|
|
2186
|
-
|
|
2189
|
+
Re as setArrowEnd,
|
|
2187
2190
|
At as setArrowEndPoint,
|
|
2188
|
-
|
|
2191
|
+
qe as setArrowStart,
|
|
2189
2192
|
Bn as setTextBbox,
|
|
2190
2193
|
Fn as updateTextBbox
|
|
2191
2194
|
};
|