@soomo/text-annotator 3.0.0-staging.21 → 3.0.0-staging.23
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.
|
@@ -1053,7 +1053,10 @@ const Qe = 250, Je = (t) => {
|
|
|
1053
1053
|
u.has(y) ? u.get(y).push(h) : u.set(y, [h]);
|
|
1054
1054
|
}, p = (y, h) => {
|
|
1055
1055
|
const d = u.get(y);
|
|
1056
|
-
|
|
1056
|
+
if (d) {
|
|
1057
|
+
const l = d.indexOf(h);
|
|
1058
|
+
l !== -1 && d.splice(l, 1);
|
|
1059
|
+
}
|
|
1057
1060
|
}, g = (y, h, d) => {
|
|
1058
1061
|
u.has(y) && setTimeout(() => {
|
|
1059
1062
|
u.get(y).forEach((l) => {
|
|
@@ -1639,7 +1642,7 @@ const Cn = (t, e) => {
|
|
|
1639
1642
|
l && a();
|
|
1640
1643
|
const b = e.getBoundingClientRect(), S = d.map((C) => ({ target: C, rects: i(C, b) }));
|
|
1641
1644
|
S.forEach(({ target: C, rects: B }) => o.set(C.annotation, B));
|
|
1642
|
-
const L = S.
|
|
1645
|
+
const L = S.flatMap(({ rects: C }) => C);
|
|
1643
1646
|
n.load(L);
|
|
1644
1647
|
}, c = (d, l) => {
|
|
1645
1648
|
const b = n.search({
|
|
@@ -1671,7 +1674,7 @@ const Cn = (t, e) => {
|
|
|
1671
1674
|
getAnnotationBounds: p,
|
|
1672
1675
|
getAnnotationRects: g,
|
|
1673
1676
|
getIntersecting: (d, l, b, S) => {
|
|
1674
|
-
const L = n.search({ minX: d, minY: l, maxX: b, maxY: S }), C = new Set(L.
|
|
1677
|
+
const L = n.search({ minX: d, minY: l, maxX: b, maxY: S }), C = new Set(L.map((B) => B.annotation.id));
|
|
1675
1678
|
return Array.from(C).map((B) => ({
|
|
1676
1679
|
annotation: t.getAnnotation(B),
|
|
1677
1680
|
rects: g(B)
|
|
@@ -1717,8 +1720,8 @@ const Cn = (t, e) => {
|
|
|
1717
1720
|
}
|
|
1718
1721
|
}, w = () => o.recalculate();
|
|
1719
1722
|
return n.observe(({ changes: y }) => {
|
|
1720
|
-
const h = (y.
|
|
1721
|
-
h.length > 0 &&
|
|
1723
|
+
const h = (y.deleted || []).filter((b) => $(b.target.selector)), d = (y.created || []).filter((b) => $(b.target.selector)), l = (y.updated || []).filter((b) => $(b.newValue.target.selector));
|
|
1724
|
+
(h == null ? void 0 : h.length) > 0 && h.forEach((b) => o.remove(b.target)), d.length > 0 && o.set(d.map((b) => b.target), !1), (l == null ? void 0 : l.length) > 0 && l.forEach(({ newValue: b }) => o.update(b.target));
|
|
1722
1725
|
}), {
|
|
1723
1726
|
store: {
|
|
1724
1727
|
...n,
|