@annotorious/annotorious 3.3.5 → 3.3.6
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/annotorious.es.js +183 -179
- package/dist/annotorious.es.js.map +1 -1
- package/dist/annotorious.js +2 -2
- package/dist/annotorious.js.map +1 -1
- package/dist/state/ImageAnnotationStore.d.ts +3 -4
- package/dist/state/spatialTree.d.ts +2 -2
- package/package.json +2 -2
- package/src/state/ImageAnnotationStore.ts +3 -4
- package/src/state/ImageAnnotatorState.ts +16 -4
- package/src/state/spatialTree.ts +6 -3
package/dist/annotorious.es.js
CHANGED
|
@@ -581,7 +581,7 @@ function Ai(e, t, n) {
|
|
|
581
581
|
return [e.cX + g, e.cY + y];
|
|
582
582
|
};
|
|
583
583
|
for (let d = 0; d < a; d++) {
|
|
584
|
-
const p = Yt(e.phi1, e.phi2, d / a), g = Yt(e.phi1, e.phi2, (d + 1) / a), y = g - p,
|
|
584
|
+
const p = Yt(e.phi1, e.phi2, d / a), g = Yt(e.phi1, e.phi2, (d + 1) / a), y = g - p, T = 4 / 3 * Math.tan(y * ve / 4), _ = Math.cos(p * ve) - T * Math.sin(p * ve), m = Math.sin(p * ve) + T * Math.cos(p * ve), w = Math.cos(g * ve), b = Math.sin(g * ve), C = w + T * b, P = b - T * w, k = f(_, m), x = f(C, P), G = f(w, b), q = {
|
|
585
585
|
relative: e.relative,
|
|
586
586
|
type: E.CURVE_TO,
|
|
587
587
|
x: G[0],
|
|
@@ -744,8 +744,8 @@ function Ni(e = 0) {
|
|
|
744
744
|
if (r.type & E.SMOOTH_CURVE_TO && (d = isNaN(t) ? 0 : s - t, p = isNaN(n) ? 0 : a - n), r.type & (E.CURVE_TO | E.SMOOTH_CURVE_TO) ? (t = r.relative ? s + r.x2 : r.x2, n = r.relative ? a + r.y2 : r.y2) : (t = NaN, n = NaN), r.type & E.SMOOTH_QUAD_TO ? (i = isNaN(i) ? s : 2 * s - i, o = isNaN(o) ? a : 2 * a - o) : r.type & E.QUAD_TO ? (i = r.relative ? s + r.x1 : r.x1, o = r.relative ? a + r.y1 : r.y2) : (i = NaN, o = NaN), r.type & E.LINE_COMMANDS || r.type & E.ARC && (r.rX === 0 || r.rY === 0 || !r.lArcFlag) || r.type & E.CURVE_TO || r.type & E.SMOOTH_CURVE_TO || r.type & E.QUAD_TO || r.type & E.SMOOTH_QUAD_TO) {
|
|
745
745
|
const g = typeof r.x > "u" ? 0 : r.relative ? r.x : r.x - s, y = typeof r.y > "u" ? 0 : r.relative ? r.y : r.y - a;
|
|
746
746
|
d = isNaN(i) ? typeof r.x1 > "u" ? d : r.relative ? r.x : r.x1 - s : i - s, p = isNaN(o) ? typeof r.y1 > "u" ? p : r.relative ? r.y : r.y1 - a : o - a;
|
|
747
|
-
const
|
|
748
|
-
c(g) <= e && c(y) <= e && c(d) <= e && c(p) <= e && c(
|
|
747
|
+
const T = typeof r.x2 > "u" ? 0 : r.relative ? r.x : r.x2 - s, _ = typeof r.y2 > "u" ? 0 : r.relative ? r.y : r.y2 - a;
|
|
748
|
+
c(g) <= e && c(y) <= e && c(d) <= e && c(p) <= e && c(T) <= e && c(_) <= e && (f = !0);
|
|
749
749
|
}
|
|
750
750
|
return r.type & E.CLOSE_PATH && c(s - l) <= e && c(a - u) <= e && (f = !0), f ? [] : r;
|
|
751
751
|
});
|
|
@@ -757,15 +757,15 @@ function Re(e, t, n, i, o, r) {
|
|
|
757
757
|
function y(_) {
|
|
758
758
|
return _ * _;
|
|
759
759
|
}
|
|
760
|
-
const
|
|
760
|
+
const T = e * i - t * n;
|
|
761
761
|
if (typeof s.xRot < "u" && (e !== 1 || t !== 0 || n !== 0 || i !== 1))
|
|
762
|
-
if (
|
|
762
|
+
if (T === 0)
|
|
763
763
|
delete s.rX, delete s.rY, delete s.xRot, delete s.lArcFlag, delete s.sweepFlag, s.type = E.LINE_TO;
|
|
764
764
|
else {
|
|
765
|
-
const _ = s.xRot * Math.PI / 180, m = Math.sin(_), w = Math.cos(_), b = 1 / y(s.rX), C = 1 / y(s.rY), P = y(w) * b + y(m) * C, k = 2 * m * w * (b - C), x = y(m) * b + y(w) * C, G = P * i * i - k * t * i + x * t * t, q = k * (e * i + t * n) - 2 * (P * n * i + x * e * t), oe = P * n * n - k * e * n + x * e * e,
|
|
766
|
-
s.rX = Math.abs(
|
|
765
|
+
const _ = s.xRot * Math.PI / 180, m = Math.sin(_), w = Math.cos(_), b = 1 / y(s.rX), C = 1 / y(s.rY), P = y(w) * b + y(m) * C, k = 2 * m * w * (b - C), x = y(m) * b + y(w) * C, G = P * i * i - k * t * i + x * t * t, q = k * (e * i + t * n) - 2 * (P * n * i + x * e * t), oe = P * n * n - k * e * n + x * e * e, A = (Math.atan2(q, G - oe) + Math.PI) % Math.PI / 2, O = Math.sin(A), M = Math.cos(A);
|
|
766
|
+
s.rX = Math.abs(T) / Math.sqrt(G * y(M) + q * O * M + oe * y(O)), s.rY = Math.abs(T) / Math.sqrt(G * y(O) - q * O * M + oe * y(M)), s.xRot = A * 180 / Math.PI;
|
|
767
767
|
}
|
|
768
|
-
return typeof s.sweepFlag < "u" && 0 >
|
|
768
|
+
return typeof s.sweepFlag < "u" && 0 > T && (s.sweepFlag = +!s.sweepFlag), s;
|
|
769
769
|
});
|
|
770
770
|
}
|
|
771
771
|
function Ci(e, t = 0, n = 0) {
|
|
@@ -820,15 +820,15 @@ function xi() {
|
|
|
820
820
|
}
|
|
821
821
|
if (l.type & E.ARC) {
|
|
822
822
|
u(l.x), c(l.y), It(l, s, a);
|
|
823
|
-
const f = l.xRot / 180 * Math.PI, d = Math.cos(f) * l.rX, p = Math.sin(f) * l.rX, g = -Math.sin(f) * l.rY, y = Math.cos(f) * l.rY, [
|
|
823
|
+
const f = l.xRot / 180 * Math.PI, d = Math.cos(f) * l.rX, p = Math.sin(f) * l.rX, g = -Math.sin(f) * l.rY, y = Math.cos(f) * l.rY, [T, _] = l.phi1 < l.phi2 ? [l.phi1, l.phi2] : -180 > l.phi2 ? [l.phi2 + 360, l.phi1 + 360] : [l.phi2, l.phi1], m = ([C, P]) => {
|
|
824
824
|
const x = Math.atan2(P, C) * 180 / Math.PI;
|
|
825
|
-
return x <
|
|
825
|
+
return x < T ? x + 360 : x;
|
|
826
826
|
}, w = Bt(g, -d, 0).map(m);
|
|
827
827
|
for (const C of w)
|
|
828
|
-
C >
|
|
828
|
+
C > T && C < _ && u(Xt(l.cX, d, g, C));
|
|
829
829
|
const b = Bt(y, -p, 0).map(m);
|
|
830
830
|
for (const C of b)
|
|
831
|
-
C >
|
|
831
|
+
C > T && C < _ && c(Xt(l.cY, p, y, C));
|
|
832
832
|
}
|
|
833
833
|
return r;
|
|
834
834
|
});
|
|
@@ -1331,12 +1331,12 @@ const nt = { selected: [] }, eo = (e, t, n) => {
|
|
|
1331
1331
|
if (l())
|
|
1332
1332
|
return !1;
|
|
1333
1333
|
const y = typeof g == "string" ? g : g.id;
|
|
1334
|
-
return s.selected.some((
|
|
1334
|
+
return s.selected.some((T) => T.id === y);
|
|
1335
1335
|
}, c = (g, y) => {
|
|
1336
|
-
let
|
|
1336
|
+
let T;
|
|
1337
1337
|
if (Array.isArray(g)) {
|
|
1338
|
-
if (
|
|
1339
|
-
console.warn("Invalid selection: " + g.filter((m) => !
|
|
1338
|
+
if (T = g.map((m) => e.getAnnotation(m)).filter(Boolean), T.length < g.length) {
|
|
1339
|
+
console.warn("Invalid selection: " + g.filter((m) => !T.some((w) => w.id === m)));
|
|
1340
1340
|
return;
|
|
1341
1341
|
}
|
|
1342
1342
|
} else {
|
|
@@ -1345,26 +1345,26 @@ const nt = { selected: [] }, eo = (e, t, n) => {
|
|
|
1345
1345
|
console.warn("Invalid selection: " + g);
|
|
1346
1346
|
return;
|
|
1347
1347
|
}
|
|
1348
|
-
|
|
1348
|
+
T = [m];
|
|
1349
1349
|
}
|
|
1350
|
-
const _ =
|
|
1350
|
+
const _ = T.reduce((m, w) => {
|
|
1351
1351
|
const b = qt(w, r, n);
|
|
1352
1352
|
return b === "EDIT" ? [...m, { id: w.id, editable: !0 }] : b === "SELECT" ? [...m, { id: w.id }] : m;
|
|
1353
1353
|
}, []);
|
|
1354
1354
|
o({ selected: _, event: y });
|
|
1355
1355
|
}, f = (g, y) => {
|
|
1356
|
-
const
|
|
1356
|
+
const T = Array.isArray(g) ? g : [g], _ = T.map((m) => e.getAnnotation(m)).filter((m) => !!m);
|
|
1357
1357
|
o({
|
|
1358
1358
|
selected: _.map((m) => {
|
|
1359
1359
|
const w = y === void 0 ? qt(m, r, n) === "EDIT" : y;
|
|
1360
1360
|
return { id: m.id, editable: w };
|
|
1361
1361
|
})
|
|
1362
|
-
}), _.length !==
|
|
1362
|
+
}), _.length !== T.length && console.warn("Invalid selection", g);
|
|
1363
1363
|
}, d = (g) => {
|
|
1364
1364
|
if (l())
|
|
1365
1365
|
return !1;
|
|
1366
1366
|
const { selected: y } = s;
|
|
1367
|
-
y.some(({ id:
|
|
1367
|
+
y.some(({ id: T }) => g.includes(T)) && o({ selected: y.filter(({ id: T }) => !g.includes(T)) });
|
|
1368
1368
|
}, p = (g) => {
|
|
1369
1369
|
r = g, f(s.selected.map(({ id: y }) => y));
|
|
1370
1370
|
};
|
|
@@ -1511,14 +1511,14 @@ const uo = (e, t) => {
|
|
|
1511
1511
|
}
|
|
1512
1512
|
};
|
|
1513
1513
|
}, co = (e) => e.id !== void 0, ho = () => {
|
|
1514
|
-
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = [], i = (
|
|
1515
|
-
n.push({ onChange:
|
|
1516
|
-
}, o = (
|
|
1517
|
-
const O = n.findIndex((M) => M.onChange ==
|
|
1514
|
+
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = [], i = (A, O = {}) => {
|
|
1515
|
+
n.push({ onChange: A, options: O });
|
|
1516
|
+
}, o = (A) => {
|
|
1517
|
+
const O = n.findIndex((M) => M.onChange == A);
|
|
1518
1518
|
O > -1 && n.splice(O, 1);
|
|
1519
|
-
}, r = (
|
|
1519
|
+
}, r = (A, O) => {
|
|
1520
1520
|
const M = {
|
|
1521
|
-
origin:
|
|
1521
|
+
origin: A,
|
|
1522
1522
|
changes: {
|
|
1523
1523
|
created: O.created || [],
|
|
1524
1524
|
updated: O.updated || [],
|
|
@@ -1529,62 +1529,62 @@ const uo = (e, t) => {
|
|
|
1529
1529
|
n.forEach((R) => {
|
|
1530
1530
|
uo(R, M) && R.onChange(M);
|
|
1531
1531
|
});
|
|
1532
|
-
}, s = (
|
|
1533
|
-
if (
|
|
1534
|
-
throw Error(`Cannot add annotation ${
|
|
1532
|
+
}, s = (A, O = z.LOCAL) => {
|
|
1533
|
+
if (A.id && e.get(A.id))
|
|
1534
|
+
throw Error(`Cannot add annotation ${A.id} - exists already`);
|
|
1535
1535
|
{
|
|
1536
|
-
const M = it(
|
|
1536
|
+
const M = it(A);
|
|
1537
1537
|
e.set(M.id, M), M.bodies.forEach((R) => t.set(R.id, M.id)), r(O, { created: [M] });
|
|
1538
1538
|
}
|
|
1539
|
-
}, a = (
|
|
1540
|
-
const M = it(typeof
|
|
1539
|
+
}, a = (A, O) => {
|
|
1540
|
+
const M = it(typeof A == "string" ? O : A), R = typeof A == "string" ? A : A.id, B = R && e.get(R);
|
|
1541
1541
|
if (B) {
|
|
1542
1542
|
const D = Xn(B, M);
|
|
1543
1543
|
return R === M.id ? e.set(R, M) : (e.delete(R), e.set(M.id, M)), B.bodies.forEach((H) => t.delete(H.id)), M.bodies.forEach((H) => t.set(H.id, M.id)), D;
|
|
1544
1544
|
} else
|
|
1545
1545
|
console.warn(`Cannot update annotation ${R} - does not exist`);
|
|
1546
|
-
}, l = (
|
|
1547
|
-
const R = co(O) ? M : O, B = a(
|
|
1546
|
+
}, l = (A, O = z.LOCAL, M = z.LOCAL) => {
|
|
1547
|
+
const R = co(O) ? M : O, B = a(A, O);
|
|
1548
1548
|
B && r(R, { updated: [B] });
|
|
1549
|
-
}, u = (
|
|
1550
|
-
e.get(
|
|
1551
|
-
}, c = (
|
|
1552
|
-
const M =
|
|
1549
|
+
}, u = (A, O = z.LOCAL) => {
|
|
1550
|
+
e.get(A.id) ? l(A, O) : s(A, O);
|
|
1551
|
+
}, c = (A, O = z.LOCAL) => {
|
|
1552
|
+
const M = A.reduce((R, B) => {
|
|
1553
1553
|
const D = a(B);
|
|
1554
1554
|
return D ? [...R, D] : R;
|
|
1555
1555
|
}, []);
|
|
1556
1556
|
M.length > 0 && r(O, { updated: M });
|
|
1557
|
-
}, f = (
|
|
1558
|
-
const M =
|
|
1557
|
+
}, f = (A, O = z.LOCAL) => {
|
|
1558
|
+
const M = A.map(it), { toAdd: R, toUpdate: B } = M.reduce((H, te) => e.get(te.id) ? { ...H, toUpdate: [...H.toUpdate, te] } : { ...H, toAdd: [...H.toAdd, te] }, { toAdd: [], toUpdate: [] }), D = B.map((H) => a(H, O)).filter(Boolean);
|
|
1559
1559
|
R.forEach((H) => {
|
|
1560
1560
|
e.set(H.id, H), H.bodies.forEach((te) => t.set(te.id, H.id));
|
|
1561
1561
|
}), r(O, { created: R, updated: D });
|
|
1562
|
-
}, d = (
|
|
1563
|
-
const M = e.get(
|
|
1562
|
+
}, d = (A, O = z.LOCAL) => {
|
|
1563
|
+
const M = e.get(A.annotation);
|
|
1564
1564
|
if (M) {
|
|
1565
1565
|
const R = {
|
|
1566
1566
|
...M,
|
|
1567
|
-
bodies: [...M.bodies,
|
|
1567
|
+
bodies: [...M.bodies, A]
|
|
1568
1568
|
};
|
|
1569
|
-
e.set(M.id, R), t.set(
|
|
1569
|
+
e.set(M.id, R), t.set(A.id, R.id), r(O, { updated: [{
|
|
1570
1570
|
oldValue: M,
|
|
1571
1571
|
newValue: R,
|
|
1572
|
-
bodiesCreated: [
|
|
1572
|
+
bodiesCreated: [A]
|
|
1573
1573
|
}] });
|
|
1574
1574
|
} else
|
|
1575
|
-
console.warn(`Attempt to add body to missing annotation: ${
|
|
1576
|
-
}, p = () => [...e.values()], g = (
|
|
1575
|
+
console.warn(`Attempt to add body to missing annotation: ${A.annotation}`);
|
|
1576
|
+
}, p = () => [...e.values()], g = (A = z.LOCAL) => {
|
|
1577
1577
|
const O = [...e.values()];
|
|
1578
|
-
e.clear(), t.clear(), r(
|
|
1579
|
-
}, y = (
|
|
1580
|
-
const R =
|
|
1578
|
+
e.clear(), t.clear(), r(A, { deleted: O });
|
|
1579
|
+
}, y = (A, O = !0, M = z.LOCAL) => {
|
|
1580
|
+
const R = A.map(it);
|
|
1581
1581
|
if (O) {
|
|
1582
1582
|
const B = [...e.values()];
|
|
1583
1583
|
e.clear(), t.clear(), R.forEach((D) => {
|
|
1584
1584
|
e.set(D.id, D), D.bodies.forEach((H) => t.set(H.id, D.id));
|
|
1585
1585
|
}), r(M, { created: R, deleted: B });
|
|
1586
1586
|
} else {
|
|
1587
|
-
const B =
|
|
1587
|
+
const B = A.reduce((D, H) => {
|
|
1588
1588
|
const te = H.id && e.get(H.id);
|
|
1589
1589
|
return te ? [...D, te] : D;
|
|
1590
1590
|
}, []);
|
|
@@ -1594,29 +1594,29 @@ const uo = (e, t) => {
|
|
|
1594
1594
|
e.set(D.id, D), D.bodies.forEach((H) => t.set(H.id, D.id));
|
|
1595
1595
|
}), r(M, { created: R });
|
|
1596
1596
|
}
|
|
1597
|
-
},
|
|
1598
|
-
const O = typeof
|
|
1597
|
+
}, T = (A) => {
|
|
1598
|
+
const O = typeof A == "string" ? A : A.id, M = e.get(O);
|
|
1599
1599
|
if (M)
|
|
1600
1600
|
return e.delete(O), M.bodies.forEach((R) => t.delete(R.id)), M;
|
|
1601
1601
|
console.warn(`Attempt to delete missing annotation: ${O}`);
|
|
1602
|
-
}, _ = (
|
|
1603
|
-
const M = A
|
|
1602
|
+
}, _ = (A, O = z.LOCAL) => {
|
|
1603
|
+
const M = T(A);
|
|
1604
1604
|
M && r(O, { deleted: [M] });
|
|
1605
|
-
}, m = (
|
|
1606
|
-
const M =
|
|
1607
|
-
const D =
|
|
1605
|
+
}, m = (A, O = z.LOCAL) => {
|
|
1606
|
+
const M = A.reduce((R, B) => {
|
|
1607
|
+
const D = T(B);
|
|
1608
1608
|
return D ? [...R, D] : R;
|
|
1609
1609
|
}, []);
|
|
1610
1610
|
M.length > 0 && r(O, { deleted: M });
|
|
1611
|
-
}, w = (
|
|
1612
|
-
const O = e.get(
|
|
1611
|
+
}, w = (A) => {
|
|
1612
|
+
const O = e.get(A.annotation);
|
|
1613
1613
|
if (O) {
|
|
1614
|
-
const M = O.bodies.find((R) => R.id ===
|
|
1614
|
+
const M = O.bodies.find((R) => R.id === A.id);
|
|
1615
1615
|
if (M) {
|
|
1616
1616
|
t.delete(M.id);
|
|
1617
1617
|
const R = {
|
|
1618
1618
|
...O,
|
|
1619
|
-
bodies: O.bodies.filter((B) => B.id !==
|
|
1619
|
+
bodies: O.bodies.filter((B) => B.id !== A.id)
|
|
1620
1620
|
};
|
|
1621
1621
|
return e.set(O.id, R), {
|
|
1622
1622
|
oldValue: O,
|
|
@@ -1624,33 +1624,33 @@ const uo = (e, t) => {
|
|
|
1624
1624
|
bodiesDeleted: [M]
|
|
1625
1625
|
};
|
|
1626
1626
|
} else
|
|
1627
|
-
console.warn(`Attempt to delete missing body ${
|
|
1627
|
+
console.warn(`Attempt to delete missing body ${A.id} from annotation ${A.annotation}`);
|
|
1628
1628
|
} else
|
|
1629
|
-
console.warn(`Attempt to delete body from missing annotation ${
|
|
1630
|
-
}, b = (
|
|
1631
|
-
const M = w(
|
|
1629
|
+
console.warn(`Attempt to delete body from missing annotation ${A.annotation}`);
|
|
1630
|
+
}, b = (A, O = z.LOCAL) => {
|
|
1631
|
+
const M = w(A);
|
|
1632
1632
|
M && r(O, { updated: [M] });
|
|
1633
|
-
}, C = (
|
|
1634
|
-
const M =
|
|
1633
|
+
}, C = (A, O = z.LOCAL) => {
|
|
1634
|
+
const M = A.map((R) => w(R)).filter(Boolean);
|
|
1635
1635
|
M.length > 0 && r(O, { updated: M });
|
|
1636
|
-
}, P = (
|
|
1637
|
-
const O = e.get(
|
|
1636
|
+
}, P = (A) => {
|
|
1637
|
+
const O = e.get(A);
|
|
1638
1638
|
return O ? { ...O } : void 0;
|
|
1639
|
-
}, k = (
|
|
1640
|
-
const O = t.get(
|
|
1639
|
+
}, k = (A) => {
|
|
1640
|
+
const O = t.get(A);
|
|
1641
1641
|
if (O) {
|
|
1642
|
-
const M = P(O).bodies.find((R) => R.id ===
|
|
1642
|
+
const M = P(O).bodies.find((R) => R.id === A);
|
|
1643
1643
|
if (M)
|
|
1644
1644
|
return M;
|
|
1645
|
-
console.error(`Store integrity error: body ${
|
|
1645
|
+
console.error(`Store integrity error: body ${A} in index, but not in annotation`);
|
|
1646
1646
|
} else
|
|
1647
|
-
console.warn(`Attempt to retrieve missing body: ${
|
|
1648
|
-
}, x = (
|
|
1649
|
-
if (
|
|
1647
|
+
console.warn(`Attempt to retrieve missing body: ${A}`);
|
|
1648
|
+
}, x = (A, O) => {
|
|
1649
|
+
if (A.annotation !== O.annotation)
|
|
1650
1650
|
throw "Annotation integrity violation: annotation ID must be the same when updating bodies";
|
|
1651
|
-
const M = e.get(
|
|
1651
|
+
const M = e.get(A.annotation);
|
|
1652
1652
|
if (M) {
|
|
1653
|
-
const R = M.bodies.find((D) => D.id ===
|
|
1653
|
+
const R = M.bodies.find((D) => D.id === A.id), B = {
|
|
1654
1654
|
...M,
|
|
1655
1655
|
bodies: M.bodies.map((D) => D.id === R.id ? O : D)
|
|
1656
1656
|
};
|
|
@@ -1660,21 +1660,21 @@ const uo = (e, t) => {
|
|
|
1660
1660
|
bodiesUpdated: [{ oldBody: R, newBody: O }]
|
|
1661
1661
|
};
|
|
1662
1662
|
} else
|
|
1663
|
-
console.warn(`Attempt to add body to missing annotation ${
|
|
1664
|
-
}, G = (
|
|
1665
|
-
const R = x(
|
|
1663
|
+
console.warn(`Attempt to add body to missing annotation ${A.annotation}`);
|
|
1664
|
+
}, G = (A, O, M = z.LOCAL) => {
|
|
1665
|
+
const R = x(A, O);
|
|
1666
1666
|
R && r(M, { updated: [R] });
|
|
1667
|
-
}, q = (
|
|
1668
|
-
const M =
|
|
1667
|
+
}, q = (A, O = z.LOCAL) => {
|
|
1668
|
+
const M = A.map((R) => x({ id: R.id, annotation: R.annotation }, R)).filter(Boolean);
|
|
1669
1669
|
r(O, { updated: M });
|
|
1670
|
-
}, oe = (
|
|
1671
|
-
const O = e.get(
|
|
1670
|
+
}, oe = (A) => {
|
|
1671
|
+
const O = e.get(A.annotation);
|
|
1672
1672
|
if (O) {
|
|
1673
1673
|
const M = {
|
|
1674
1674
|
...O,
|
|
1675
1675
|
target: {
|
|
1676
1676
|
...O.target,
|
|
1677
|
-
...
|
|
1677
|
+
...A
|
|
1678
1678
|
}
|
|
1679
1679
|
};
|
|
1680
1680
|
return e.set(O.id, M), {
|
|
@@ -1682,11 +1682,11 @@ const uo = (e, t) => {
|
|
|
1682
1682
|
newValue: M,
|
|
1683
1683
|
targetUpdated: {
|
|
1684
1684
|
oldTarget: O.target,
|
|
1685
|
-
newTarget:
|
|
1685
|
+
newTarget: A
|
|
1686
1686
|
}
|
|
1687
1687
|
};
|
|
1688
1688
|
} else
|
|
1689
|
-
console.warn(`Attempt to update target on missing annotation: ${
|
|
1689
|
+
console.warn(`Attempt to update target on missing annotation: ${A.annotation}`);
|
|
1690
1690
|
};
|
|
1691
1691
|
return {
|
|
1692
1692
|
addAnnotation: s,
|
|
@@ -1697,8 +1697,8 @@ const uo = (e, t) => {
|
|
|
1697
1697
|
bulkDeleteBodies: C,
|
|
1698
1698
|
bulkUpdateAnnotations: c,
|
|
1699
1699
|
bulkUpdateBodies: q,
|
|
1700
|
-
bulkUpdateTargets: (
|
|
1701
|
-
const M =
|
|
1700
|
+
bulkUpdateTargets: (A, O = z.LOCAL) => {
|
|
1701
|
+
const M = A.map((R) => oe(R)).filter(Boolean);
|
|
1702
1702
|
M.length > 0 && r(O, { updated: M });
|
|
1703
1703
|
},
|
|
1704
1704
|
bulkUpsertAnnotations: f,
|
|
@@ -1711,8 +1711,8 @@ const uo = (e, t) => {
|
|
|
1711
1711
|
unobserve: o,
|
|
1712
1712
|
updateAnnotation: l,
|
|
1713
1713
|
updateBody: G,
|
|
1714
|
-
updateTarget: (
|
|
1715
|
-
const M = oe(
|
|
1714
|
+
updateTarget: (A, O = z.LOCAL) => {
|
|
1715
|
+
const M = oe(A);
|
|
1716
1716
|
M && r(O, { updated: [M] });
|
|
1717
1717
|
},
|
|
1718
1718
|
upsertAnnotation: u
|
|
@@ -1743,14 +1743,14 @@ const yo = 250, _o = (e, t) => {
|
|
|
1743
1743
|
let o = t ? t.pointer : -1, r = !1, s = 0;
|
|
1744
1744
|
const a = (g) => {
|
|
1745
1745
|
if (!r) {
|
|
1746
|
-
const { changes: y } = g,
|
|
1747
|
-
if (
|
|
1746
|
+
const { changes: y } = g, T = performance.now();
|
|
1747
|
+
if (T - s > yo)
|
|
1748
1748
|
i.splice(o + 1), i.push(y), o = i.length - 1;
|
|
1749
1749
|
else {
|
|
1750
1750
|
const _ = i.length - 1;
|
|
1751
1751
|
i[_] = fo(i[_], y);
|
|
1752
1752
|
}
|
|
1753
|
-
s =
|
|
1753
|
+
s = T;
|
|
1754
1754
|
}
|
|
1755
1755
|
r = !1;
|
|
1756
1756
|
};
|
|
@@ -1765,15 +1765,15 @@ const yo = 250, _o = (e, t) => {
|
|
|
1765
1765
|
redo: () => {
|
|
1766
1766
|
if (i.length - 1 > o) {
|
|
1767
1767
|
r = !0;
|
|
1768
|
-
const { created: g, updated: y, deleted:
|
|
1769
|
-
u(g), f(y), p(
|
|
1768
|
+
const { created: g, updated: y, deleted: T } = i[o + 1];
|
|
1769
|
+
u(g), f(y), p(T), n.emit("redo", i[o + 1]), o += 1;
|
|
1770
1770
|
}
|
|
1771
1771
|
},
|
|
1772
1772
|
undo: () => {
|
|
1773
1773
|
if (o > -1) {
|
|
1774
1774
|
r = !0;
|
|
1775
|
-
const { created: g, updated: y, deleted:
|
|
1776
|
-
l(g), c(y), d(
|
|
1775
|
+
const { created: g, updated: y, deleted: T } = i[o];
|
|
1776
|
+
l(g), c(y), d(T), n.emit("undo", i[o]), o -= 1;
|
|
1777
1777
|
}
|
|
1778
1778
|
}
|
|
1779
1779
|
};
|
|
@@ -1853,11 +1853,11 @@ const yo = 250, _o = (e, t) => {
|
|
|
1853
1853
|
w.length > 0 && (u = u.map((b) => w.find((P) => P.id === b.id) || b));
|
|
1854
1854
|
}
|
|
1855
1855
|
}, { origin: z.REMOTE });
|
|
1856
|
-
const
|
|
1856
|
+
const T = (_) => (m) => {
|
|
1857
1857
|
const { updated: w } = m;
|
|
1858
1858
|
_ ? (w || []).forEach((b) => g("updateAnnotation", b.oldValue, b.newValue)) : (w || []).forEach((b) => g("updateAnnotation", b.newValue, b.oldValue));
|
|
1859
1859
|
};
|
|
1860
|
-
return t.on("undo",
|
|
1860
|
+
return t.on("undo", T(!0)), t.on("redo", T(!1)), { on: d, off: p, emit: g };
|
|
1861
1861
|
}, Eo = (e) => (t) => t.reduce((n, i) => {
|
|
1862
1862
|
const { parsed: o, error: r } = e.parse(i);
|
|
1863
1863
|
return r ? {
|
|
@@ -1903,7 +1903,7 @@ const yo = 250, _o = (e, t) => {
|
|
|
1903
1903
|
_ ? o.setSelected(_, m) : o.clear();
|
|
1904
1904
|
}, y = (_) => {
|
|
1905
1905
|
o.clear(), o.setUserSelectAction(_);
|
|
1906
|
-
},
|
|
1906
|
+
}, T = (_) => {
|
|
1907
1907
|
if (n) {
|
|
1908
1908
|
const m = n.parse(_).parsed, w = n.serialize(i.getAnnotation(m.id));
|
|
1909
1909
|
return i.updateAnnotation(m), w;
|
|
@@ -1929,7 +1929,7 @@ const yo = 250, _o = (e, t) => {
|
|
|
1929
1929
|
setSelected: g,
|
|
1930
1930
|
setUserSelectAction: y,
|
|
1931
1931
|
undo: t.undo,
|
|
1932
|
-
updateAnnotation:
|
|
1932
|
+
updateAnnotation: T
|
|
1933
1933
|
};
|
|
1934
1934
|
}, ss = (e, t, n) => typeof t == "function" ? t(e, n) : t, ls = (e, t) => typeof e != "function" && typeof t != "function" ? {
|
|
1935
1935
|
...e || {},
|
|
@@ -2157,11 +2157,11 @@ function Do(e) {
|
|
|
2157
2157
|
), h(r, "points", s = /*geom*/
|
|
2158
2158
|
e[4].points.map($t).join(" "));
|
|
2159
2159
|
},
|
|
2160
|
-
m(y,
|
|
2161
|
-
I(y, t,
|
|
2160
|
+
m(y, T) {
|
|
2161
|
+
I(y, t, T), I(y, o, T), I(y, r, T), I(y, a, T);
|
|
2162
2162
|
for (let _ = 0; _ < p.length; _ += 1)
|
|
2163
|
-
p[_] && p[_].m(y,
|
|
2164
|
-
I(y, l,
|
|
2163
|
+
p[_] && p[_].m(y, T);
|
|
2164
|
+
I(y, l, T), u = !0, c || (f = [
|
|
2165
2165
|
W(t, "pointerdown", function() {
|
|
2166
2166
|
K(
|
|
2167
2167
|
/*grab*/
|
|
@@ -2176,20 +2176,20 @@ function Do(e) {
|
|
|
2176
2176
|
})
|
|
2177
2177
|
], c = !0);
|
|
2178
2178
|
},
|
|
2179
|
-
p(y,
|
|
2180
|
-
if (e = y, (!u ||
|
|
2179
|
+
p(y, T) {
|
|
2180
|
+
if (e = y, (!u || T & /*computedStyle*/
|
|
2181
2181
|
2 && n !== (n = /*computedStyle*/
|
|
2182
|
-
e[1] ? "display:none;" : void 0)) && h(t, "style", n), (!u ||
|
|
2182
|
+
e[1] ? "display:none;" : void 0)) && h(t, "style", n), (!u || T & /*geom*/
|
|
2183
2183
|
16 && i !== (i = /*geom*/
|
|
2184
|
-
e[4].points.map(Jt).join(" "))) && h(t, "points", i), (!u ||
|
|
2184
|
+
e[4].points.map(Jt).join(" "))) && h(t, "points", i), (!u || T & /*computedStyle*/
|
|
2185
2185
|
2) && h(
|
|
2186
2186
|
r,
|
|
2187
2187
|
"style",
|
|
2188
2188
|
/*computedStyle*/
|
|
2189
2189
|
e[1]
|
|
2190
|
-
), (!u ||
|
|
2190
|
+
), (!u || T & /*geom*/
|
|
2191
2191
|
16 && s !== (s = /*geom*/
|
|
2192
|
-
e[4].points.map($t).join(" "))) && h(r, "points", s),
|
|
2192
|
+
e[4].points.map($t).join(" "))) && h(r, "points", s), T & /*geom, viewportScale, grab*/
|
|
2193
2193
|
536) {
|
|
2194
2194
|
d = ce(
|
|
2195
2195
|
/*geom*/
|
|
@@ -2198,7 +2198,7 @@ function Do(e) {
|
|
|
2198
2198
|
let _;
|
|
2199
2199
|
for (_ = 0; _ < d.length; _ += 1) {
|
|
2200
2200
|
const m = Wt(e, d, _);
|
|
2201
|
-
p[_] ? (p[_].p(m,
|
|
2201
|
+
p[_] ? (p[_].p(m, T), L(p[_], 1)) : (p[_] = Kt(m), p[_].c(), L(p[_], 1), p[_].m(l.parentNode, l));
|
|
2202
2202
|
}
|
|
2203
2203
|
for (ue(), _ = d.length; _ < p.length; _ += 1)
|
|
2204
2204
|
g(_);
|
|
@@ -2207,15 +2207,15 @@ function Do(e) {
|
|
|
2207
2207
|
},
|
|
2208
2208
|
i(y) {
|
|
2209
2209
|
if (!u) {
|
|
2210
|
-
for (let
|
|
2211
|
-
L(p[
|
|
2210
|
+
for (let T = 0; T < d.length; T += 1)
|
|
2211
|
+
L(p[T]);
|
|
2212
2212
|
u = !0;
|
|
2213
2213
|
}
|
|
2214
2214
|
},
|
|
2215
2215
|
o(y) {
|
|
2216
2216
|
p = p.filter(Boolean);
|
|
2217
|
-
for (let
|
|
2218
|
-
U(p[
|
|
2217
|
+
for (let T = 0; T < p.length; T += 1)
|
|
2218
|
+
U(p[T]);
|
|
2219
2219
|
u = !1;
|
|
2220
2220
|
},
|
|
2221
2221
|
d(y) {
|
|
@@ -2292,8 +2292,8 @@ function ko(e, t, n) {
|
|
|
2292
2292
|
let i, { shape: o } = t, { computedStyle: r } = t, { transform: s } = t, { viewportScale: a = 1 } = t;
|
|
2293
2293
|
const l = (d, p, g) => {
|
|
2294
2294
|
let y;
|
|
2295
|
-
const
|
|
2296
|
-
p === "SHAPE" ? y =
|
|
2295
|
+
const T = d.geometry;
|
|
2296
|
+
p === "SHAPE" ? y = T.points.map(([m, w]) => [m + g[0], w + g[1]]) : y = T.points.map(([m, w], b) => p === `HANDLE-${b}` ? [m + g[0], w + g[1]] : [m, w]);
|
|
2297
2297
|
const _ = Me(y);
|
|
2298
2298
|
return { ...d, geometry: { points: y, bounds: _ } };
|
|
2299
2299
|
};
|
|
@@ -2635,7 +2635,7 @@ class Ye extends he {
|
|
|
2635
2635
|
}
|
|
2636
2636
|
}
|
|
2637
2637
|
function jo(e) {
|
|
2638
|
-
let t, n, i, o, r, s, a, l, u, c, f, d, p, g, y,
|
|
2638
|
+
let t, n, i, o, r, s, a, l, u, c, f, d, p, g, y, T, _, m, w, b, C, P, k, x, G, q, oe, A, O, M, R, B, D, H, te, Te, Ge, Ae, ze, be, Y, je, et;
|
|
2639
2639
|
return H = new Ye({
|
|
2640
2640
|
props: {
|
|
2641
2641
|
class: "a9s-corner-handle-topleft",
|
|
@@ -2726,7 +2726,7 @@ function jo(e) {
|
|
|
2726
2726
|
) && e[9]("BOTTOM_LEFT").apply(this, arguments);
|
|
2727
2727
|
}), {
|
|
2728
2728
|
c() {
|
|
2729
|
-
t = V("rect"), a = _e(), l = V("rect"), p = _e(), g = V("rect"), m = _e(), w = V("rect"), k = _e(), x = V("rect"),
|
|
2729
|
+
t = V("rect"), a = _e(), l = V("rect"), p = _e(), g = V("rect"), m = _e(), w = V("rect"), k = _e(), x = V("rect"), A = _e(), O = V("rect"), D = _e(), le(H.$$.fragment), te = _e(), le(Te.$$.fragment), Ge = _e(), le(Ae.$$.fragment), ze = _e(), le(be.$$.fragment), h(t, "class", "a9s-outer"), h(t, "style", n = /*computedStyle*/
|
|
2730
2730
|
e[1] ? "display:none;" : void 0), h(t, "x", i = /*geom*/
|
|
2731
2731
|
e[4].x), h(t, "y", o = /*geom*/
|
|
2732
2732
|
e[4].y), h(t, "width", r = /*geom*/
|
|
@@ -2741,7 +2741,7 @@ function jo(e) {
|
|
|
2741
2741
|
e[4].y), h(l, "width", f = /*geom*/
|
|
2742
2742
|
e[4].w), h(l, "height", d = /*geom*/
|
|
2743
2743
|
e[4].h), h(g, "class", "a9s-edge-handle a9s-edge-handle-top"), h(g, "x", y = /*geom*/
|
|
2744
|
-
e[4].x), h(g, "y",
|
|
2744
|
+
e[4].x), h(g, "y", T = /*geom*/
|
|
2745
2745
|
e[4].y), h(g, "height", 1), h(g, "width", _ = /*geom*/
|
|
2746
2746
|
e[4].w), h(w, "class", "a9s-edge-handle a9s-edge-handle-right"), h(w, "x", b = /*geom*/
|
|
2747
2747
|
e[4].x + /*geom*/
|
|
@@ -2757,7 +2757,7 @@ function jo(e) {
|
|
|
2757
2757
|
e[4].h), h(O, "width", 1);
|
|
2758
2758
|
},
|
|
2759
2759
|
m(S, N) {
|
|
2760
|
-
I(S, t, N), I(S, a, N), I(S, l, N), I(S, p, N), I(S, g, N), I(S, m, N), I(S, w, N), I(S, k, N), I(S, x, N), I(S,
|
|
2760
|
+
I(S, t, N), I(S, a, N), I(S, l, N), I(S, p, N), I(S, g, N), I(S, m, N), I(S, w, N), I(S, k, N), I(S, x, N), I(S, A, N), I(S, O, N), I(S, D, N), re(H, S, N), I(S, te, N), re(Te, S, N), I(S, Ge, N), re(Ae, S, N), I(S, ze, N), re(be, S, N), Y = !0, je || (et = [
|
|
2761
2761
|
W(t, "pointerdown", function() {
|
|
2762
2762
|
K(
|
|
2763
2763
|
/*grab*/
|
|
@@ -2824,8 +2824,8 @@ function jo(e) {
|
|
|
2824
2824
|
e[4].h)) && h(l, "height", d), (!Y || N & /*geom*/
|
|
2825
2825
|
16 && y !== (y = /*geom*/
|
|
2826
2826
|
e[4].x)) && h(g, "x", y), (!Y || N & /*geom*/
|
|
2827
|
-
16 &&
|
|
2828
|
-
e[4].y)) && h(g, "y",
|
|
2827
|
+
16 && T !== (T = /*geom*/
|
|
2828
|
+
e[4].y)) && h(g, "y", T), (!Y || N & /*geom*/
|
|
2829
2829
|
16 && _ !== (_ = /*geom*/
|
|
2830
2830
|
e[4].w)) && h(g, "width", _), (!Y || N & /*geom*/
|
|
2831
2831
|
16 && b !== (b = /*geom*/
|
|
@@ -2892,7 +2892,7 @@ function jo(e) {
|
|
|
2892
2892
|
U(H.$$.fragment, S), U(Te.$$.fragment, S), U(Ae.$$.fragment, S), U(be.$$.fragment, S), Y = !1;
|
|
2893
2893
|
},
|
|
2894
2894
|
d(S) {
|
|
2895
|
-
S && (v(t), v(a), v(l), v(p), v(g), v(m), v(w), v(k), v(x), v(
|
|
2895
|
+
S && (v(t), v(a), v(l), v(p), v(g), v(m), v(w), v(k), v(x), v(A), v(O), v(D), v(te), v(Ge), v(ze)), se(H, S), se(Te, S), se(Ae, S), se(be, S), je = !1, me(et);
|
|
2896
2896
|
}
|
|
2897
2897
|
};
|
|
2898
2898
|
}
|
|
@@ -2964,10 +2964,10 @@ function qo(e, t, n) {
|
|
|
2964
2964
|
let i, { shape: o } = t, { computedStyle: r } = t, { transform: s } = t, { viewportScale: a = 1 } = t;
|
|
2965
2965
|
const l = (d, p, g) => {
|
|
2966
2966
|
const y = d.geometry.bounds;
|
|
2967
|
-
let [
|
|
2967
|
+
let [T, _] = [y.minX, y.minY], [m, w] = [y.maxX, y.maxY];
|
|
2968
2968
|
const [b, C] = g;
|
|
2969
2969
|
if (p === "SHAPE")
|
|
2970
|
-
|
|
2970
|
+
T += b, m += b, _ += C, w += C;
|
|
2971
2971
|
else {
|
|
2972
2972
|
switch (p) {
|
|
2973
2973
|
case "TOP":
|
|
@@ -2987,7 +2987,7 @@ function qo(e, t, n) {
|
|
|
2987
2987
|
case "LEFT":
|
|
2988
2988
|
case "TOP_LEFT":
|
|
2989
2989
|
case "BOTTOM_LEFT": {
|
|
2990
|
-
|
|
2990
|
+
T += b;
|
|
2991
2991
|
break;
|
|
2992
2992
|
}
|
|
2993
2993
|
case "RIGHT":
|
|
@@ -2998,7 +2998,7 @@ function qo(e, t, n) {
|
|
|
2998
2998
|
}
|
|
2999
2999
|
}
|
|
3000
3000
|
}
|
|
3001
|
-
const P = Math.min(
|
|
3001
|
+
const P = Math.min(T, m), k = Math.min(_, w), x = Math.abs(m - T), G = Math.abs(w - _);
|
|
3002
3002
|
return {
|
|
3003
3003
|
...d,
|
|
3004
3004
|
geometry: {
|
|
@@ -3249,8 +3249,8 @@ function sn(e) {
|
|
|
3249
3249
|
);
|
|
3250
3250
|
let y;
|
|
3251
3251
|
for (y = 0; y < c.length; y += 1) {
|
|
3252
|
-
const
|
|
3253
|
-
f[y] ? (f[y].p(
|
|
3252
|
+
const T = tn(e, c, y);
|
|
3253
|
+
f[y] ? (f[y].p(T, g), L(f[y], 1)) : (f[y] = rn(T), f[y].c(), L(f[y], 1), f[y].m(t, null));
|
|
3254
3254
|
}
|
|
3255
3255
|
for (ue(), y = c.length; y < f.length; y += 1)
|
|
3256
3256
|
d(y);
|
|
@@ -3399,17 +3399,17 @@ function Jo(e, t, n) {
|
|
|
3399
3399
|
let i, { shape: o } = t, { computedStyle: r } = t, { transform: s } = t, { viewportScale: a = 1 } = t;
|
|
3400
3400
|
const l = (d, p, g) => {
|
|
3401
3401
|
const y = d.geometry.polygons;
|
|
3402
|
-
let
|
|
3402
|
+
let T;
|
|
3403
3403
|
if (p === "SHAPE")
|
|
3404
|
-
|
|
3404
|
+
T = y.map((_) => {
|
|
3405
3405
|
const m = _.rings.map((b, C) => ({ points: b.points.map((k, x) => [k[0] + g[0], k[1] + g[1]]) })), w = Me(m[0].points);
|
|
3406
3406
|
return { rings: m, bounds: w };
|
|
3407
3407
|
});
|
|
3408
3408
|
else {
|
|
3409
3409
|
const [_, m, w, b] = p.split("-").map((C) => parseInt(C));
|
|
3410
|
-
|
|
3410
|
+
T = y.map((C, P) => {
|
|
3411
3411
|
if (P === m) {
|
|
3412
|
-
const k = C.rings.map((G, q) => q === w ? { points: G.points.map((
|
|
3412
|
+
const k = C.rings.map((G, q) => q === w ? { points: G.points.map((A, O) => O === b ? [A[0] + g[0], A[1] + g[1]] : A) } : G), x = Me(k[0].points);
|
|
3413
3413
|
return { rings: k, bounds: x };
|
|
3414
3414
|
} else
|
|
3415
3415
|
return C;
|
|
@@ -3418,8 +3418,8 @@ function Jo(e, t, n) {
|
|
|
3418
3418
|
return {
|
|
3419
3419
|
...d,
|
|
3420
3420
|
geometry: {
|
|
3421
|
-
polygons:
|
|
3422
|
-
bounds: gi(
|
|
3421
|
+
polygons: T,
|
|
3422
|
+
bounds: gi(T)
|
|
3423
3423
|
}
|
|
3424
3424
|
};
|
|
3425
3425
|
};
|
|
@@ -3535,11 +3535,11 @@ function or(e, t, n) {
|
|
|
3535
3535
|
let { $$slots: i = {}, $$scope: o } = t;
|
|
3536
3536
|
const r = Fe();
|
|
3537
3537
|
let { shape: s } = t, { editor: a } = t, { transform: l } = t, u, c, f;
|
|
3538
|
-
const d = (y) => (
|
|
3539
|
-
u = y, c = l.elementToImage(
|
|
3538
|
+
const d = (y) => (T) => {
|
|
3539
|
+
u = y, c = l.elementToImage(T.offsetX, T.offsetY), f = s, T.target.setPointerCapture(T.pointerId), r("grab", T);
|
|
3540
3540
|
}, p = (y) => {
|
|
3541
3541
|
if (u) {
|
|
3542
|
-
const [
|
|
3542
|
+
const [T, _] = l.elementToImage(y.offsetX, y.offsetY), m = [T - c[0], _ - c[1]];
|
|
3543
3543
|
n(3, s = a(f, u, m)), r("change", s);
|
|
3544
3544
|
}
|
|
3545
3545
|
}, g = (y) => {
|
|
@@ -3784,7 +3784,7 @@ function fr(e, t, n) {
|
|
|
3784
3784
|
}, y = (m) => {
|
|
3785
3785
|
const w = m;
|
|
3786
3786
|
l && (u = s.elementToImage(w.offsetX, w.offsetY), n(1, c = Math.min(u[0], l[0])), n(2, f = Math.min(u[1], l[1])), n(3, d = Math.abs(u[0] - l[0])), n(4, p = Math.abs(u[1] - l[1])));
|
|
3787
|
-
},
|
|
3787
|
+
}, T = (m) => {
|
|
3788
3788
|
const w = m, b = performance.now() - a;
|
|
3789
3789
|
if (r === "click") {
|
|
3790
3790
|
if (b > 300) return;
|
|
@@ -3812,7 +3812,7 @@ function fr(e, t, n) {
|
|
|
3812
3812
|
n(0, l = void 0), u = void 0;
|
|
3813
3813
|
};
|
|
3814
3814
|
return Je(() => {
|
|
3815
|
-
o("pointerdown", g), o("pointermove", y), o("pointerup",
|
|
3815
|
+
o("pointerdown", g), o("pointermove", y), o("pointerup", T, !0);
|
|
3816
3816
|
}), e.$$set = (m) => {
|
|
3817
3817
|
"addEventListener" in m && n(5, o = m.addEventListener), "drawingMode" in m && n(6, r = m.drawingMode), "transform" in m && n(7, s = m.transform);
|
|
3818
3818
|
}, [l, c, f, d, p, o, r, s];
|
|
@@ -3965,7 +3965,7 @@ function pr(e, t, n) {
|
|
|
3965
3965
|
gr
|
|
3966
3966
|
));
|
|
3967
3967
|
}
|
|
3968
|
-
},
|
|
3968
|
+
}, T = (w) => {
|
|
3969
3969
|
const b = w;
|
|
3970
3970
|
if (d && clearTimeout(d), s === "click") {
|
|
3971
3971
|
const C = b.timeStamp - u.timeStamp, P = wt([u.offsetX, u.offsetY], [b.offsetX, b.offsetY]);
|
|
@@ -4007,7 +4007,7 @@ function pr(e, t, n) {
|
|
|
4007
4007
|
n(0, c = []), n(1, f = void 0), o("create", w);
|
|
4008
4008
|
};
|
|
4009
4009
|
return Je(() => {
|
|
4010
|
-
r("pointerdown", g, !0), r("pointermove", y), r("pointerup",
|
|
4010
|
+
r("pointerdown", g, !0), r("pointermove", y), r("pointerup", T, !0), r("dblclick", _, !0);
|
|
4011
4011
|
}), e.$$set = (w) => {
|
|
4012
4012
|
"addEventListener" in w && n(4, r = w.addEventListener), "drawingMode" in w && n(5, s = w.drawingMode), "transform" in w && n(6, a = w.transform), "viewportScale" in w && n(7, l = w.viewportScale);
|
|
4013
4013
|
}, e.$$.update = () => {
|
|
@@ -5213,9 +5213,9 @@ function Yr(e) {
|
|
|
5213
5213
|
function Xr(e, t, n) {
|
|
5214
5214
|
let i, o, r, s, a, l, u, c, f, d, p, g = Q, y = () => (g(), g = Nn(M, (S) => n(17, p = S)), M);
|
|
5215
5215
|
e.$$.on_destroy.push(() => g());
|
|
5216
|
-
let { drawingEnabled:
|
|
5217
|
-
const G = () => n(5, x += 1), q = () => C, oe = () =>
|
|
5218
|
-
let
|
|
5216
|
+
let { drawingEnabled: T } = t, { image: _ } = t, { preferredDrawingMode: m } = t, { state: w } = t, { style: b = void 0 } = t, { toolName: C = zn()[0] } = t, { user: P } = t, { visible: k = !0 } = t, x = 0;
|
|
5217
|
+
const G = () => n(5, x += 1), q = () => C, oe = () => T;
|
|
5218
|
+
let A, O, M;
|
|
5219
5219
|
Je(() => y(n(7, M = Bo(_, O))));
|
|
5220
5220
|
const { hover: R, selection: B, store: D } = w;
|
|
5221
5221
|
dt(e, R, (S) => n(15, c = S)), dt(e, B, (S) => n(33, f = S)), dt(e, D, (S) => n(16, d = S));
|
|
@@ -5255,7 +5255,7 @@ function Xr(e, t, n) {
|
|
|
5255
5255
|
}, be = (S) => er(S), Y = (S) => ft(S);
|
|
5256
5256
|
function je(S) {
|
|
5257
5257
|
ut[S ? "unshift" : "push"](() => {
|
|
5258
|
-
|
|
5258
|
+
A = S, n(6, A);
|
|
5259
5259
|
});
|
|
5260
5260
|
}
|
|
5261
5261
|
function et(S) {
|
|
@@ -5264,7 +5264,7 @@ function Xr(e, t, n) {
|
|
|
5264
5264
|
});
|
|
5265
5265
|
}
|
|
5266
5266
|
return e.$$set = (S) => {
|
|
5267
|
-
"drawingEnabled" in S && n(0,
|
|
5267
|
+
"drawingEnabled" in S && n(0, T = S.drawingEnabled), "image" in S && n(25, _ = S.image), "preferredDrawingMode" in S && n(26, m = S.preferredDrawingMode), "state" in S && n(27, w = S.state), "style" in S && n(1, b = S.style), "toolName" in S && n(2, C = S.toolName), "user" in S && n(28, P = S.user), "visible" in S && n(3, k = S.visible);
|
|
5268
5268
|
}, e.$$.update = () => {
|
|
5269
5269
|
e.$$.dirty[0] & /*toolName*/
|
|
5270
5270
|
4 && n(14, { tool: i, opts: o } = jn(C) || { tool: void 0, opts: void 0 }, i, (n(32, o), n(2, C))), e.$$.dirty[0] & /*preferredDrawingMode*/
|
|
@@ -5275,13 +5275,13 @@ function Xr(e, t, n) {
|
|
|
5275
5275
|
4 && n(9, u = (S) => f.selected.find((N) => N.id === S.id && N.editable)), e.$$.dirty[1] & /*$selection*/
|
|
5276
5276
|
4 && Te(f.selected);
|
|
5277
5277
|
}, [
|
|
5278
|
-
|
|
5278
|
+
T,
|
|
5279
5279
|
b,
|
|
5280
5280
|
C,
|
|
5281
5281
|
k,
|
|
5282
5282
|
O,
|
|
5283
5283
|
x,
|
|
5284
|
-
|
|
5284
|
+
A,
|
|
5285
5285
|
M,
|
|
5286
5286
|
te,
|
|
5287
5287
|
u,
|
|
@@ -5622,8 +5622,8 @@ const Kr = () => {
|
|
|
5622
5622
|
e.clear(), t.clear();
|
|
5623
5623
|
}, o = (f) => {
|
|
5624
5624
|
if (!lt(f)) return;
|
|
5625
|
-
const { minX: d, minY: p, maxX: g, maxY: y } = f.selector.geometry.bounds,
|
|
5626
|
-
e.insert(
|
|
5625
|
+
const { minX: d, minY: p, maxX: g, maxY: y } = f.selector.geometry.bounds, T = { minX: d, minY: p, maxX: g, maxY: y, target: f };
|
|
5626
|
+
e.insert(T), t.set(f.annotation, T);
|
|
5627
5627
|
}, r = (f) => {
|
|
5628
5628
|
if (!lt(f)) return;
|
|
5629
5629
|
const d = t.get(f.annotation);
|
|
@@ -5632,15 +5632,14 @@ const Kr = () => {
|
|
|
5632
5632
|
return {
|
|
5633
5633
|
all: n,
|
|
5634
5634
|
clear: i,
|
|
5635
|
-
getAt: (f, d) => {
|
|
5636
|
-
const
|
|
5635
|
+
getAt: (f, d, p) => {
|
|
5636
|
+
const y = e.search({
|
|
5637
5637
|
minX: f,
|
|
5638
5638
|
minY: d,
|
|
5639
5639
|
maxX: f,
|
|
5640
5640
|
maxY: d
|
|
5641
|
-
}).map((
|
|
5642
|
-
|
|
5643
|
-
return g.sort((y, A) => Nt(y.selector) - Nt(A.selector)), g[0];
|
|
5641
|
+
}).map((T) => T.target).filter((T) => T.selector.type === j.RECTANGLE || fi(T.selector, f, d));
|
|
5642
|
+
return y.length > 0 ? (y.sort((T, _) => Nt(T.selector) - Nt(_.selector)), y) : [];
|
|
5644
5643
|
},
|
|
5645
5644
|
getIntersecting: (f, d, p, g) => e.search({
|
|
5646
5645
|
minX: f,
|
|
@@ -5654,8 +5653,8 @@ const Kr = () => {
|
|
|
5654
5653
|
d && i();
|
|
5655
5654
|
const p = f.reduce((g, y) => {
|
|
5656
5655
|
if (lt(y)) {
|
|
5657
|
-
const { minX:
|
|
5658
|
-
return [...g, { minX:
|
|
5656
|
+
const { minX: T, minY: _, maxX: m, maxY: w } = y.selector.geometry.bounds;
|
|
5657
|
+
return [...g, { minX: T, minY: _, maxX: m, maxY: w, target: y }];
|
|
5659
5658
|
} else
|
|
5660
5659
|
return g;
|
|
5661
5660
|
}, []);
|
|
@@ -5673,9 +5672,14 @@ const Kr = () => {
|
|
|
5673
5672
|
}), {
|
|
5674
5673
|
store: {
|
|
5675
5674
|
...t,
|
|
5676
|
-
getAt: (l, u) => {
|
|
5677
|
-
const
|
|
5678
|
-
|
|
5675
|
+
getAt: (l, u, c) => {
|
|
5676
|
+
const f = n.getAt(l, u, c);
|
|
5677
|
+
if (c)
|
|
5678
|
+
return f.map((p) => t.getAnnotation(p.annotation)).filter(Boolean).filter(c)[0];
|
|
5679
|
+
{
|
|
5680
|
+
const d = f[0];
|
|
5681
|
+
return d ? t.getAnnotation(d.annotation) : void 0;
|
|
5682
|
+
}
|
|
5679
5683
|
},
|
|
5680
5684
|
getIntersecting: (l, u, c, f) => n.getIntersecting(l, u, c, f).map((d) => t.getAnnotation(d.annotation))
|
|
5681
5685
|
},
|
|
@@ -5755,29 +5759,29 @@ const Kr = () => {
|
|
|
5755
5759
|
user: f
|
|
5756
5760
|
}
|
|
5757
5761
|
});
|
|
5758
|
-
d.$on("click", (
|
|
5759
|
-
const { originalEvent: O, annotation: M } =
|
|
5762
|
+
d.$on("click", (A) => {
|
|
5763
|
+
const { originalEvent: O, annotation: M } = A.detail;
|
|
5760
5764
|
M ? r.userSelect(M.id, O) : r.isEmpty() || r.clear();
|
|
5761
5765
|
});
|
|
5762
5766
|
const p = To(o, a, i.adapter), g = () => d.cancelDrawing(), y = () => {
|
|
5763
5767
|
d.$destroy(), u.parentNode.insertBefore(n, u), u.parentNode.removeChild(u), c.destroy(), a.destroy();
|
|
5764
|
-
},
|
|
5765
|
-
if (!jn(
|
|
5766
|
-
throw `No drawing tool named ${
|
|
5767
|
-
d.$set({ toolName:
|
|
5768
|
-
}, P = (
|
|
5768
|
+
}, T = () => d.getDrawingTool(), _ = () => f, m = () => d.isDrawingEnabled(), w = (A, O, M) => _r(A, O, M), b = (A, O) => tr(A, O), C = (A) => {
|
|
5769
|
+
if (!jn(A))
|
|
5770
|
+
throw `No drawing tool named ${A}`;
|
|
5771
|
+
d.$set({ toolName: A });
|
|
5772
|
+
}, P = (A) => d.$set({ drawingEnabled: A }), k = (A) => {
|
|
5769
5773
|
console.warn("Filter not implemented yet");
|
|
5770
|
-
}, x = (
|
|
5771
|
-
f =
|
|
5772
|
-
}, oe = (
|
|
5774
|
+
}, x = (A) => d.$set({ style: A }), G = (A) => On(n, u, A), q = (A) => {
|
|
5775
|
+
f = A, d.$set({ user: A });
|
|
5776
|
+
}, oe = (A) => (
|
|
5773
5777
|
// @ts-ignore
|
|
5774
|
-
d.$set({ visible:
|
|
5778
|
+
d.$set({ visible: A })
|
|
5775
5779
|
);
|
|
5776
5780
|
return {
|
|
5777
5781
|
...p,
|
|
5778
5782
|
cancelDrawing: g,
|
|
5779
5783
|
destroy: y,
|
|
5780
|
-
getDrawingTool:
|
|
5784
|
+
getDrawingTool: T,
|
|
5781
5785
|
getUser: _,
|
|
5782
5786
|
isDrawingEnabled: m,
|
|
5783
5787
|
listDrawingTools: zn,
|