@milaboratories/miplots4 1.0.124 → 1.0.125

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.
Files changed (60) hide show
  1. package/dist/index.d.ts +3 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +4 -2
  4. package/dist/index.js.map +1 -1
  5. package/dist/node_modules/d3-drag/src/constant.js +5 -0
  6. package/dist/node_modules/d3-drag/src/constant.js.map +1 -0
  7. package/dist/node_modules/d3-drag/src/drag.js +122 -0
  8. package/dist/node_modules/d3-drag/src/drag.js.map +1 -0
  9. package/dist/node_modules/d3-drag/src/event.js +34 -0
  10. package/dist/node_modules/d3-drag/src/event.js.map +1 -0
  11. package/dist/node_modules/d3-drag/src/noevent.js +10 -5
  12. package/dist/node_modules/d3-drag/src/noevent.js.map +1 -1
  13. package/dist/node_modules/react/index.js +1 -1
  14. package/dist/node_modules/react-dom/index.js +1 -1
  15. package/dist/scatterplot/index.js +27 -27
  16. package/dist/scatterplot/index.js.map +1 -1
  17. package/dist/scatterplot-umap/ChartRenderer.d.ts +8 -8
  18. package/dist/scatterplot-umap/ChartRenderer.d.ts.map +1 -1
  19. package/dist/scatterplot-umap/ChartRenderer.js +160 -151
  20. package/dist/scatterplot-umap/ChartRenderer.js.map +1 -1
  21. package/dist/scatterplot-umap/SettingsImpl.d.ts +0 -1
  22. package/dist/scatterplot-umap/SettingsImpl.d.ts.map +1 -1
  23. package/dist/scatterplot-umap/SettingsImpl.js +12 -13
  24. package/dist/scatterplot-umap/SettingsImpl.js.map +1 -1
  25. package/dist/scatterplot-umap/components/Lasso.d.ts +6 -4
  26. package/dist/scatterplot-umap/components/Lasso.d.ts.map +1 -1
  27. package/dist/scatterplot-umap/components/Lasso.js +212 -57
  28. package/dist/scatterplot-umap/components/Lasso.js.map +1 -1
  29. package/dist/scatterplot-umap/components/SVGLayer.d.ts +1 -1
  30. package/dist/scatterplot-umap/components/SVGLayer.d.ts.map +1 -1
  31. package/dist/scatterplot-umap/components/SVGLayer.js +49 -46
  32. package/dist/scatterplot-umap/components/SVGLayer.js.map +1 -1
  33. package/dist/scatterplot-umap/components/UpperSVG.d.ts +6 -4
  34. package/dist/scatterplot-umap/components/UpperSVG.d.ts.map +1 -1
  35. package/dist/scatterplot-umap/components/UpperSVG.js +35 -30
  36. package/dist/scatterplot-umap/components/UpperSVG.js.map +1 -1
  37. package/dist/scatterplot-umap/constants.d.ts +6 -0
  38. package/dist/scatterplot-umap/constants.d.ts.map +1 -1
  39. package/dist/scatterplot-umap/constants.js +12 -6
  40. package/dist/scatterplot-umap/constants.js.map +1 -1
  41. package/dist/scatterplot-umap/index.d.ts +3 -2
  42. package/dist/scatterplot-umap/index.d.ts.map +1 -1
  43. package/dist/scatterplot-umap/index.js +90 -72
  44. package/dist/scatterplot-umap/index.js.map +1 -1
  45. package/dist/scatterplot-umap/types.d.ts +14 -2
  46. package/dist/scatterplot-umap/types.d.ts.map +1 -1
  47. package/dist/types/bubble.d.ts +10 -10
  48. package/dist/types/common.d.ts +7 -4
  49. package/dist/types/common.d.ts.map +1 -1
  50. package/dist/types/common.js.map +1 -1
  51. package/dist/types/dendro.d.ts +22 -22
  52. package/dist/types/discrete.d.ts +14 -14
  53. package/dist/types/heatmap.d.ts +50 -50
  54. package/dist/types/histogram.d.ts +12 -12
  55. package/dist/types/scatterplot-umap.d.ts +8 -11
  56. package/dist/types/scatterplot-umap.d.ts.map +1 -1
  57. package/dist/types/scatterplot-umap.js +2 -3
  58. package/dist/types/scatterplot-umap.js.map +1 -1
  59. package/dist/types/scatterplot.d.ts +36 -36
  60. package/package.json +3 -1
@@ -1,77 +1,232 @@
1
- import { j as v } from "../../node_modules/react/jsx-runtime.js";
2
- import { BLACK as L } from "../../constants.js";
3
- import { r } from "../../_virtual/index.js";
4
- const S = 20;
5
- function K({ scales: u, chartSizes: E, disabled: h, onPolygonUpdate: l }) {
6
- const [s, g] = r.useState([]), [m, a] = r.useState(null), [p, j] = r.useState(null), f = r.useRef(null), c = r.useRef(null), o = r.useRef(null), y = r.useRef(s);
7
- function k() {
8
- f.current = null, c.current = null, o.current = null, y.current = [], g([]), a(null);
1
+ import { j as i } from "../../node_modules/react/jsx-runtime.js";
2
+ import { SCATTERPLOT_LASSO_EVENTS as g } from "../constants.js";
3
+ import { BLACK as _ } from "../../constants.js";
4
+ import { r as n } from "../../_virtual/index.js";
5
+ import ae from "../../node_modules/d3-drag/src/drag.js";
6
+ import D from "../../node_modules/d3-selection/src/select.js";
7
+ const v = "#845CFF", de = 20, A = 3, fe = 10;
8
+ function xe({
9
+ scales: o,
10
+ chartSizes: B,
11
+ zoomStateKey: U,
12
+ defaultPolygons: W,
13
+ onPolygonsApply: P,
14
+ onLassoControlsStateUpdate: X
15
+ }) {
16
+ n.useEffect(() => {
17
+ function e() {
18
+ L.current !== null && (E([...a.current.filter((c, l) => l !== L.current)]), I(null), P(a.current));
19
+ }
20
+ function t(c) {
21
+ $(c.detail);
22
+ }
23
+ function u() {
24
+ K(x.current - 1);
25
+ }
26
+ function s() {
27
+ K(x.current + 1);
28
+ }
29
+ return document.addEventListener(g.delete, e), document.addEventListener(g.selectMode, t), document.addEventListener(g.back, u), document.addEventListener(g.forward, s), () => {
30
+ document.removeEventListener(g.delete, e), document.removeEventListener(g.selectMode, t), document.removeEventListener(g.back, u), document.removeEventListener(g.forward, s);
31
+ };
32
+ }, []);
33
+ const [f, V] = n.useState("pen"), [S, z] = n.useState(W), a = n.useRef(W), [J, Y] = n.useState(null), [k, Q] = n.useState(null), L = n.useRef(null), [d, Z] = n.useState([]), y = n.useRef(d), [C, ee] = n.useState([{ newPolygonPoints: d, closedPolygons: S }]), [h, G] = n.useState(0), w = n.useRef(C), x = n.useRef(h), [p, te] = n.useState(null), R = n.useRef(null), [b, M] = n.useState(!1), m = n.useRef(null), T = n.useRef(null), H = n.useCallback(function() {
34
+ const e = {
35
+ newPolygonPoints: [...y.current],
36
+ closedPolygons: [...a.current]
37
+ }, t = w.current.slice(0, x.current + 1);
38
+ t.push(e), t.length > fe && t.shift(), ee(t), G(t.length - 1), w.current = t, x.current = t.length - 1;
39
+ }, []), K = n.useCallback(function(e) {
40
+ if (e > w.current.length - 1 || e < 0)
41
+ return;
42
+ $("selection");
43
+ const t = w.current[e];
44
+ E(t.closedPolygons, !1), j(t.newPolygonPoints, !1), G(e), x.current = e;
45
+ }, []);
46
+ function E(e, t = !0) {
47
+ z(e), a.current = e, t && H();
48
+ }
49
+ function j(e, t = !0) {
50
+ y.current = e, Z(e), t && H();
51
+ }
52
+ function I(e) {
53
+ Q(e), L.current = e;
54
+ }
55
+ function $(e) {
56
+ if (V(e), e === "selection" && (I(null), T.current = null, m.current = null), e === "pen") {
57
+ if (y.current.length > 2) {
58
+ const t = { points: y.current, closed: !0 };
59
+ E([...a.current, t]), P([...a.current, t]);
60
+ }
61
+ N();
62
+ }
9
63
  }
10
- function R(t) {
11
- h || !(t.key === "Escape") || k();
64
+ function N(e = !0) {
65
+ R.current = null, j([], e);
12
66
  }
13
- r.useEffect(() => {
14
- h && (f.current = null, c.current = null, o.current = null, a(null));
15
- }, [h]), r.useEffect(() => (document.addEventListener("keydown", R), () => document.removeEventListener("keydown", R)), []), r.useEffect(() => {
16
- if (m && p)
67
+ function q(e) {
68
+ e.key === "Escape" && N();
69
+ }
70
+ n.useEffect(() => (document.addEventListener("keydown", q), () => document.removeEventListener("keydown", q)), []), n.useEffect(() => {
71
+ var e;
72
+ (e = T.current) == null || e.attr("cx", (t) => o.x(t.p[0])).attr("cy", (t) => o.y(t.p[1]));
73
+ }, [U]);
74
+ const ne = n.useCallback(function() {
75
+ if (M(!1), !R.current || f === "pen")
17
76
  return;
18
- if (s.length === 0) {
19
- l([]);
77
+ const e = [...R.current], t = o.x.invert(e[0]), u = o.y.invert(e[1]);
78
+ if (!y.current.length) {
79
+ j([[t, u]]);
20
80
  return;
21
81
  }
22
- const t = s.map((e) => e[0]);
23
- t.push(s[s.length - 1][1]), l(t);
24
- }, [s]);
25
- function C() {
26
- if (!f.current || h)
27
- return;
28
- const t = [...f.current], e = u.x.invert(t[0]), i = u.y.invert(t[1]);
29
- let n = y.current, x = o.current;
30
- const w = c.current && n.length > 1 ? Math.sqrt((t[0] - c.current[0]) ** 2 + (t[1] - c.current[1]) ** 2) : 1 / 0;
31
- o.current ? o.current && w > S ? (n = [...n, [o.current, [e, i]]], x = [e, i]) : (n = [...n, [o.current, [e, i]]], n.length > 2 && (n = [...n, [n[n.length - 1][1], n[0][0]]]), x = null, n.length <= 2 ? l([]) : l(n.map((M) => M[0])), c.current = null) : (c.current = t, n = [], x = [e, i], l([])), g(n), a(x), y.current = n, o.current = x;
82
+ const s = y.current;
83
+ if (!b || s.length < 3)
84
+ j([...s, [t, u]]);
85
+ else {
86
+ const l = { points: [...s], closed: !0 };
87
+ N(!1), E([...S, l]), setTimeout(() => P([...S, l]), 0);
88
+ }
89
+ }, [f, b]), oe = n.useCallback(function(e) {
90
+ const t = [e.nativeEvent.offsetX, e.nativeEvent.offsetY], u = y.current, s = y.current[0];
91
+ if (s) {
92
+ const c = o.x(s[0]), l = o.y(s[1]), r = u.length > 1 ? Math.sqrt((t[0] - c) ** 2 + (t[1] - l) ** 2) : 1 / 0;
93
+ M(r < de);
94
+ } else
95
+ M(!1);
96
+ te(t), R.current = t;
97
+ }, []);
98
+ function re() {
99
+ m.current && D(m.current).data([]).exit().remove();
32
100
  }
33
- function P(t) {
34
- const e = [t.nativeEvent.offsetX, t.nativeEvent.offsetY];
35
- j(e), f.current = e;
101
+ function se(e) {
102
+ e !== m.current && e && (re(), m.current = e, ce(k));
36
103
  }
37
- return /* @__PURE__ */ v.jsxs("g", { children: [
38
- /* @__PURE__ */ v.jsx(
104
+ const ce = n.useCallback(function(e) {
105
+ if (f !== "selection" && e !== null) {
106
+ const t = ae().on("drag", function(c) {
107
+ const l = D(this), r = l.data()[0];
108
+ r[0] = c.x, r[1] = c.y, r.p = [o.x.invert(r[0]), o.y.invert(r[1])], l.attr("cx", r[0]).attr("cy", r[1]);
109
+ const O = a.current.map((F, ie) => e !== ie ? F : {
110
+ ...F,
111
+ points: F.points.map(
112
+ (le, ue) => ue === r.idx ? [o.x.invert(r[0]), o.y.invert(r[1])] : le
113
+ )
114
+ });
115
+ E(O, !1);
116
+ }).on("end", function() {
117
+ H(), P(a.current);
118
+ }), u = a.current[e].points.map((c, l) => ({ idx: l, p: c })), s = D(m.current).selectAll("circle").data(u, (c) => c.idx).join("circle");
119
+ T.current = s, s.attr("cx", (c) => o.x(c.p[0])).attr("cy", (c) => o.y(c.p[1])).attr("r", A).attr("fill", "white").attr("stroke", v), s.call(t);
120
+ }
121
+ }, []);
122
+ return n.useEffect(() => {
123
+ X(f === "pen" ? {
124
+ mode: f,
125
+ backEnabled: h > 0,
126
+ forwardEnabled: h < C.length - 1,
127
+ deleteEnabled: k !== null
128
+ } : {
129
+ mode: f,
130
+ backEnabled: h > 0,
131
+ forwardEnabled: h < C.length - 1,
132
+ deleteEnabled: !1
133
+ });
134
+ }, [f, k, h, C]), /* @__PURE__ */ i.jsx(i.Fragment, { children: /* @__PURE__ */ i.jsxs("g", { children: [
135
+ /* @__PURE__ */ i.jsx("defs", { children: /* @__PURE__ */ i.jsx(
136
+ "pattern",
137
+ {
138
+ id: "diagonalStripes",
139
+ width: "5",
140
+ height: "5",
141
+ patternTransform: "rotate(45 0 0)",
142
+ patternUnits: "userSpaceOnUse",
143
+ children: /* @__PURE__ */ i.jsx("line", { x1: "0", y1: "0", x2: "0", y2: "10", stroke: v, strokeWidth: "1" })
144
+ }
145
+ ) }),
146
+ /* @__PURE__ */ i.jsx(
39
147
  "rect",
40
148
  {
41
149
  fill: "transparent",
42
- width: E.chartWidth,
43
- height: E.chartHeight,
44
- onMouseMove: P,
45
- onClick: C
150
+ width: B.chartWidth,
151
+ height: B.chartHeight,
152
+ onMouseMove: oe,
153
+ onClick: ne
46
154
  }
47
155
  ),
48
- s.map(([t, e], i) => /* @__PURE__ */ v.jsx(
49
- "line",
156
+ S.map((e, t) => {
157
+ const u = t === J, s = t === k, l = e.points.map((r) => [o.x(r[0]), o.y(r[1])]).map((r, O) => (O === 0 ? "M" : "L") + r[0] + "," + r[1]).join("") + "z";
158
+ return /* @__PURE__ */ i.jsxs("g", { children: [
159
+ /* @__PURE__ */ i.jsx(
160
+ "path",
161
+ {
162
+ d: l,
163
+ fill: u && !s ? "url(#diagonalStripes)" : "transparent",
164
+ stroke: s || u ? v : _,
165
+ onMouseOver: () => Y(t),
166
+ onMouseLeave: () => Y(null),
167
+ onClick: () => I(t),
168
+ style: { pointerEvents: f === "selection" || s ? "none" : "auto" }
169
+ }
170
+ ),
171
+ s && /* @__PURE__ */ i.jsx("g", { ref: (r) => se(r) })
172
+ ] }, t);
173
+ }),
174
+ /* @__PURE__ */ i.jsx(
175
+ "polyline",
50
176
  {
51
- x1: u.x(t[0]),
52
- y1: u.y(t[1]),
53
- x2: u.x(e[0]),
54
- y2: u.y(e[1]),
55
- stroke: L,
177
+ points: d.map((e) => `${o.x(e[0])},${o.y(e[1])}`).join(" "),
178
+ stroke: _,
179
+ fill: "none",
56
180
  style: { pointerEvents: "none" }
57
- },
58
- i
59
- )),
60
- m && p && /* @__PURE__ */ v.jsx(
61
- "line",
181
+ }
182
+ ),
183
+ d.length > 0 && p && /* @__PURE__ */ i.jsxs("g", { style: { pointerEvents: "none" }, children: [
184
+ /* @__PURE__ */ i.jsx(
185
+ "line",
186
+ {
187
+ x1: o.x(d[d.length - 1][0]),
188
+ y1: o.y(d[d.length - 1][1]),
189
+ x2: p[0],
190
+ y2: p[1],
191
+ stroke: _
192
+ }
193
+ ),
194
+ d.map((e, t) => /* @__PURE__ */ i.jsx(
195
+ "circle",
196
+ {
197
+ cx: o.x(e[0]),
198
+ cy: o.y(e[1]),
199
+ r: A,
200
+ fill: "white",
201
+ stroke: v
202
+ },
203
+ t
204
+ )),
205
+ /* @__PURE__ */ i.jsx(
206
+ "circle",
207
+ {
208
+ cx: p[0],
209
+ cy: p[1],
210
+ r: A,
211
+ fill: "white",
212
+ stroke: v
213
+ }
214
+ )
215
+ ] }),
216
+ b && p && /* @__PURE__ */ i.jsx(
217
+ "circle",
62
218
  {
63
- x1: u.x(m[0]),
64
- y1: u.y(m[1]),
65
- x2: p[0],
66
- y2: p[1],
67
- stroke: L,
68
- style: { pointerEvents: "none" }
69
- },
70
- "lastLine"
219
+ cx: p[0] + 5,
220
+ cy: p[1] - 5,
221
+ r: 2,
222
+ fill: "none",
223
+ stroke: v,
224
+ strokeWidth: 0.5
225
+ }
71
226
  )
72
- ] });
227
+ ] }) });
73
228
  }
74
229
  export {
75
- K as Lasso
230
+ xe as Lasso
76
231
  };
77
232
  //# sourceMappingURL=Lasso.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Lasso.js","sources":["../../../src/scatterplot-umap/components/Lasso.tsx"],"sourcesContent":["import {BLACK} from '../../constants';\nimport type {ChartScales, ChartSizes, PairPoints, Point} from '../types';\nimport type {MouseEvent} from 'react';\nimport React, {useEffect, useRef, useState} from 'react';\n\nconst CLOSING_DISTANCE = 20;\nexport function Lasso({scales, chartSizes, disabled, onPolygonUpdate}: {\n scales: ChartScales;\n chartSizes: ChartSizes;\n disabled: boolean;\n onPolygonUpdate: (data:Point[]) => void;\n}) {\n const [points, setPoints] = useState<PairPoints[]>([]);\n const [lastPoint, setLastPoint] = useState<null | Point>(null);\n const [movingPoint, setMovingPoint] = useState<null | Point>(null);\n\n const movingPointRef = useRef<null | Point>(null);\n const startPointRef = useRef<null | Point>(null);\n const lastPointRef = useRef<null | Point>(null);\n const pointsRef = useRef(points);\n function clear() {\n movingPointRef.current = null;\n startPointRef.current = null;\n lastPointRef.current = null;\n pointsRef.current = [];\n setPoints([]);\n setLastPoint(null);\n }\n function onKeyDown(e: KeyboardEvent) {\n if (disabled) {\n return;\n }\n const escape = e.key === 'Escape';\n if (!escape) {\n return;\n }\n clear();\n }\n\n useEffect(() => {\n if (disabled) {\n movingPointRef.current = null;\n startPointRef.current = null;\n lastPointRef.current = null;\n setLastPoint(null);\n }\n }, [disabled]);\n useEffect(() => {\n document.addEventListener('keydown', onKeyDown);\n return () => document.removeEventListener('keydown', onKeyDown);\n }, []);\n\n useEffect(() => {\n if (lastPoint && movingPoint) {\n return;\n }\n if (points.length === 0) {\n onPolygonUpdate([]);\n return;\n }\n const polygon = points.map(p => p[0]);\n polygon.push(points[points.length - 1][1]);\n onPolygonUpdate(polygon);\n }, [points]);\n function onClick() {\n if (!movingPointRef.current || disabled) {\n return;\n }\n const currentCoords = [...movingPointRef.current] as Point;\n const x = scales.x.invert(currentCoords[0]);\n const y = scales.y.invert(currentCoords[1]);\n let points = pointsRef.current;\n let lastPoint = lastPointRef.current;\n const distance = startPointRef.current && points.length > 1\n ? Math.sqrt((currentCoords[0] - startPointRef.current[0]) ** 2 + (currentCoords[1] - startPointRef.current[1]) ** 2)\n : Infinity;\n if (!lastPointRef.current) {\n startPointRef.current = currentCoords;\n points = [];\n lastPoint = [x, y];\n onPolygonUpdate([]);\n } else if (lastPointRef.current && distance > CLOSING_DISTANCE) {\n points = [...points, [lastPointRef.current, [x, y]]];\n lastPoint = [x, y];\n } else {\n points = [...points, [lastPointRef.current, [x, y]]];\n if (points.length > 2) {\n points = [...points, [points[points.length - 1][1], points[0][0]]];\n }\n lastPoint = null;\n if (points.length <= 2) {\n onPolygonUpdate([]);\n } else {\n onPolygonUpdate(points.map(p => p[0]));\n }\n startPointRef.current = null;\n }\n\n setPoints(points);\n setLastPoint(lastPoint);\n pointsRef.current = points;\n lastPointRef.current = lastPoint;\n }\n\n function onMouseMove(e: MouseEvent<SVGRectElement>) {\n const p:Point = [e.nativeEvent.offsetX, e.nativeEvent.offsetY];\n setMovingPoint(p);\n movingPointRef.current = p;\n }\n\n return (\n <g>\n <rect\n fill=\"transparent\"\n width={chartSizes.chartWidth}\n height={chartSizes.chartHeight}\n onMouseMove={onMouseMove}\n onClick={onClick}\n />\n {points.map(([p1, p2], idx) => (\n <line\n key={idx}\n x1={scales.x(p1[0])}\n y1={scales.y(p1[1])}\n x2={scales.x(p2[0])}\n y2={scales.y(p2[1])}\n stroke={BLACK}\n style={{pointerEvents: 'none'}}\n />\n ))}\n {lastPoint && movingPoint && (\n <line\n key=\"lastLine\"\n x1={scales.x(lastPoint[0])}\n y1={scales.y(lastPoint[1])}\n x2={movingPoint[0]}\n y2={movingPoint[1]}\n stroke={BLACK}\n style={{pointerEvents: 'none'}}\n />\n )}\n </g>\n );\n}\n"],"names":["CLOSING_DISTANCE","Lasso","scales","chartSizes","disabled","onPolygonUpdate","points","setPoints","useState","lastPoint","setLastPoint","movingPoint","setMovingPoint","movingPointRef","useRef","startPointRef","lastPointRef","pointsRef","clear","onKeyDown","e","useEffect","polygon","p","onClick","currentCoords","x","y","distance","onMouseMove","jsx","p1","p2","idx","BLACK"],"mappings":";;;AAKA,MAAMA,IAAmB;AAClB,SAASC,EAAM,EAAC,QAAAC,GAAQ,YAAAC,GAAY,UAAAC,GAAU,iBAAAC,KAKlD;AACC,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAAA,SAAuB,CAAA,CAAE,GAC/C,CAACC,GAAWC,CAAY,IAAIF,EAAAA,SAAuB,IAAI,GACvD,CAACG,GAAaC,CAAc,IAAIJ,EAAAA,SAAuB,IAAI,GAE3DK,IAAiBC,EAAAA,OAAqB,IAAI,GAC1CC,IAAgBD,EAAAA,OAAqB,IAAI,GACzCE,IAAeF,EAAAA,OAAqB,IAAI,GACxCG,IAAYH,EAAAA,OAAOR,CAAM;AAC/B,WAASY,IAAQ;AACb,IAAAL,EAAe,UAAU,MACzBE,EAAc,UAAU,MACxBC,EAAa,UAAU,MACvBC,EAAU,UAAU,CAAA,GACpBV,EAAU,CAAA,CAAE,GACZG,EAAa,IAAI;AAAA,EACrB;AACA,WAASS,EAAUC,GAAkB;AAKjC,IAJIhB,KAIA,EADWgB,EAAE,QAAQ,aAIzBF,EAAA;AAAA,EACJ;AAEAG,EAAAA,EAAAA,UAAU,MAAM;AACZ,IAAIjB,M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C,eAAe,OAAA;AAAA,MAAM;AAAA,MANxBD;AAAA,IAAA,CAQZ;AAAA,IACAxB,KAAaE,KACVmB,gBAAAA,EAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QAEG,IAAI5B,EAAO,EAAEO,EAAU,CAAC,CAAC;AAAA,QACzB,IAAIP,EAAO,EAAEO,EAAU,CAAC,CAAC;AAAA,QACzB,IAAIE,EAAY,CAAC;AAAA,QACjB,IAAIA,EAAY,CAAC;AAAA,QACjB,QAAQuB;AAAA,QACR,OAAO,EAAC,eAAe,OAAA;AAAA,MAAM;AAAA,MANzB;AAAA,IAAA;AAAA,EAOR,GAER;AAER;"}
1
+ {"version":3,"file":"Lasso.js","sources":["../../../src/scatterplot-umap/components/Lasso.tsx"],"sourcesContent":["import {SCATTERPLOT_LASSO_EVENTS} from '../constants';\nimport type {LassoControlsState, LassoMode} from '../types';\nimport type {Polygon} from '../types';\nimport type {Selection} from 'd3-selection';\nimport {select} from 'd3-selection';\nimport {BLACK} from '../../constants';\nimport type {ChartScales, ChartSizes, Point} from '../types';\nimport type {MouseEvent} from 'react';\nimport React, {useCallback, useEffect, useRef, useState} from 'react';\nimport {drag} from 'd3-drag';\n\nconst SELECTION_COLOR = '#845CFF';\nconst CLOSING_DISTANCE = 20;\nconst R = 3;\nconst MAX_HISTORY_LENGTH = 10;\n\ntype CircleData = { // moving point for editing\n idx: number;\n p: Point;\n};\ntype CirclesSelection = Selection<SVGCircleElement, CircleData, SVGGElement | null, CircleData>;\n\ntype HistoryFrame = {\n newPolygonPoints: Point[],\n closedPolygons: Polygon[]\n}\n\n// Mode = 'selection': creating new polygons, pan with button\n// Mode = 'pen': selecting polygon to edit or delete, any zooming actions\nexport function Lasso({\n scales,\n chartSizes,\n zoomStateKey,\n defaultPolygons,\n onPolygonsApply,\n onLassoControlsStateUpdate,\n}: {\n scales: ChartScales;\n chartSizes: ChartSizes;\n zoomStateKey: string;\n defaultPolygons: Polygon[];\n onPolygonsApply: (data: Polygon[]) => void;\n onLassoControlsStateUpdate: (v: LassoControlsState) => void;\n}) {\n useEffect(() => {\n // Events from outer controls\n function onPolygonDelete() {\n if (selectedPolygonRef.current === null) {\n return;\n }\n updatePolygons([...closedPolygonsRef.current.filter((_p, idx) => idx !== selectedPolygonRef.current)]);\n updateSelectedPolygon(null);\n onPolygonsApply(closedPolygonsRef.current);\n }\n\n function onModeSelect(e: CustomEvent<LassoMode>) {\n updateMode(e.detail);\n }\n function onClickBack() {\n loadHistoryItem(historyIndexRef.current - 1);\n }\n function onClickForward() {\n loadHistoryItem(historyIndexRef.current + 1);\n }\n document.addEventListener(SCATTERPLOT_LASSO_EVENTS.delete, onPolygonDelete);\n document.addEventListener(SCATTERPLOT_LASSO_EVENTS.selectMode, onModeSelect as EventListener);\n document.addEventListener(SCATTERPLOT_LASSO_EVENTS.back, onClickBack);\n document.addEventListener(SCATTERPLOT_LASSO_EVENTS.forward, onClickForward);\n return () => {\n document.removeEventListener(SCATTERPLOT_LASSO_EVENTS.delete, onPolygonDelete);\n document.removeEventListener(SCATTERPLOT_LASSO_EVENTS.selectMode, onModeSelect as EventListener);\n document.removeEventListener(SCATTERPLOT_LASSO_EVENTS.back, onClickBack);\n document.removeEventListener(SCATTERPLOT_LASSO_EVENTS.forward, onClickForward);\n };\n }, []);\n\n // inner state\n const [lassoMode, setLassoMode] = useState<LassoMode>('pen');\n\n const [closedPolygons, setClosedPolygons] = useState<Polygon[]>(defaultPolygons);\n const closedPolygonsRef = useRef<Polygon[]>(defaultPolygons);\n\n const [hoveredPolygon, setHoveredPolygon] = useState<number | null>(null);\n\n const [selectedPolygon, setSelectedPolygon] = useState<number | null>(null);\n const selectedPolygonRef = useRef<number | null>(null);\n\n const [newPolygonPoints, setNewPolygonPoints] = useState<Point[]>([]);\n const newPolygonPointsRef = useRef(newPolygonPoints);\n\n const [history, setHistory] = useState<HistoryFrame[]>([{newPolygonPoints, closedPolygons}]);\n const [historyIndex, setHistoryIndex] = useState(0);\n const historyRef = useRef(history);\n const historyIndexRef = useRef(historyIndex);\n\n const [movingPoint, setMovingPoint] = useState<null | Point>(null);\n const movingPointRef = useRef<null | Point>(null);\n\n const [closeToStartPoint, setCloseToStartPoint] = useState(false);\n\n const selectedCirclesContainerRef = useRef<SVGGElement | null>(null);\n const selectedCirclesSelectionRef = useRef<CirclesSelection | null>(null);\n\n const saveCurrentStateToHistory = useCallback(function () {\n const newHistoryItem = {\n newPolygonPoints: [...newPolygonPointsRef.current],\n closedPolygons: [...closedPolygonsRef.current]\n };\n const newHistory = historyRef.current.slice(0, historyIndexRef.current + 1);\n newHistory.push(newHistoryItem);\n if (newHistory.length > MAX_HISTORY_LENGTH) {\n newHistory.shift();\n }\n setHistory(newHistory);\n setHistoryIndex(newHistory.length - 1);\n historyRef.current = newHistory;\n historyIndexRef.current = newHistory.length - 1;\n }, []);\n\n const loadHistoryItem = useCallback(function (index:number) {\n if (index > historyRef.current.length - 1 || index < 0) {\n return;\n }\n updateMode('selection');\n const historyState = historyRef.current[index];\n updatePolygons(historyState.closedPolygons, false);\n updateNewPolygon(historyState.newPolygonPoints, false);\n setHistoryIndex(index);\n historyIndexRef.current = index;\n }, []);\n function updatePolygons(p: Polygon[], saveToHistory = true) {\n setClosedPolygons(p);\n closedPolygonsRef.current = p;\n if (saveToHistory) {\n saveCurrentStateToHistory();\n }\n }\n\n function updateNewPolygon(points:Point[], saveToHistory = true) {\n newPolygonPointsRef.current = points;\n setNewPolygonPoints(points);\n if (saveToHistory) {\n saveCurrentStateToHistory();\n }\n }\n\n function updateSelectedPolygon(idx: number | null) {\n setSelectedPolygon(idx);\n selectedPolygonRef.current = idx;\n }\n\n function updateMode(v: LassoMode) {\n setLassoMode(v);\n if (v === 'selection') {\n updateSelectedPolygon(null);\n selectedCirclesSelectionRef.current = null;\n selectedCirclesContainerRef.current = null;\n }\n if (v === 'pen') {\n if (newPolygonPointsRef.current.length > 2) {\n const polygon:Polygon = {points: newPolygonPointsRef.current, closed: true};\n updatePolygons([...closedPolygonsRef.current, polygon]);\n onPolygonsApply([...closedPolygonsRef.current, polygon]);\n }\n clearNotFinishedPolygon();\n }\n }\n function clearNotFinishedPolygon(saveToHistory = true) {\n movingPointRef.current = null;\n updateNewPolygon([], saveToHistory);\n }\n\n function onKeyDown(e: KeyboardEvent) {\n const escape = e.key === 'Escape';\n if (!escape) {\n return;\n }\n clearNotFinishedPolygon();\n }\n\n useEffect(() => {\n document.addEventListener('keydown', onKeyDown);\n return () => document.removeEventListener('keydown', onKeyDown);\n }, []);\n\n useEffect(() => {\n selectedCirclesSelectionRef.current?.attr('cx', d => scales.x(d.p[0])).attr('cy', d => scales.y(d.p[1]));\n }, [zoomStateKey]);\n\n const onNewPointAddByClick = useCallback(function () {\n setCloseToStartPoint(false);\n if (!movingPointRef.current || lassoMode === 'pen') {\n return;\n }\n const currentCoords = [...movingPointRef.current] as Point;\n const x = scales.x.invert(currentCoords[0]);\n const y = scales.y.invert(currentCoords[1]);\n\n if (!newPolygonPointsRef.current.length) {\n updateNewPolygon([[x, y]]);\n return;\n }\n\n const points = newPolygonPointsRef.current;\n const tooFar = !closeToStartPoint;\n if (tooFar || points.length < 3) {\n updateNewPolygon([...points, [x, y]]);\n } else {\n const polygon:Polygon = {points: [...points], closed: true};\n clearNotFinishedPolygon(false);\n updatePolygons([...closedPolygons, polygon]);\n // to avoid freezing of ui updating in case of big amount of points to apply polygons and change opacity\n setTimeout(() => onPolygonsApply([...closedPolygons, polygon]), 0);\n }\n }, [lassoMode, closeToStartPoint]);\n\n const onMouseMove = useCallback(function(e: MouseEvent<SVGRectElement>) {\n const p: Point = [e.nativeEvent.offsetX, e.nativeEvent.offsetY];\n const points = newPolygonPointsRef.current;\n const startPoint = newPolygonPointsRef.current[0];\n if (startPoint) {\n const startX = scales.x(startPoint[0]);\n const startY = scales.y(startPoint[1]);\n const distance = points.length > 1\n ? Math.sqrt((p[0] - startX) ** 2 + (p[1] - startY) ** 2)\n : Infinity;\n setCloseToStartPoint(distance < CLOSING_DISTANCE);\n } else {\n setCloseToStartPoint(false);\n }\n\n setMovingPoint(p);\n movingPointRef.current = p;\n }, []);\n\n function clearSelectedCircles() {\n if (selectedCirclesContainerRef.current) {\n select(selectedCirclesContainerRef.current).data([]).exit().remove();\n }\n }\n\n function updateSelectedCircles(el: SVGGElement | null) {\n if (el !== selectedCirclesContainerRef.current && el) {\n clearSelectedCircles();\n selectedCirclesContainerRef.current = el;\n onPolygonSelect(selectedPolygon);\n }\n }\n\n const onPolygonSelect = useCallback(function (idx: number | null) {\n if (lassoMode === 'selection') {\n return;\n }\n if (idx !== null) {\n const d = drag<SVGCircleElement, CircleData, SVGGElement | null>()\n .on('drag', function (e) {\n const el = select<SVGCircleElement, CircleData>(this);\n const d = el.data()[0] as number[] & CircleData;\n d[0] = e.x;\n d[1] = e.y;\n d.p = [scales.x.invert(d[0]), scales.y.invert(d[1])];\n el.attr('cx', d[0]).attr('cy', d[1]);\n const editedPolygons = closedPolygonsRef.current.map((polygon, polygonIdx) => {\n return idx !== polygonIdx ? polygon : {\n ...polygon,\n points: polygon.points.map((el, pointIdx) =>\n pointIdx === d.idx ? ([scales.x.invert(d[0]), scales.y.invert(d[1])] as Point) : el\n ),\n };\n });\n updatePolygons(editedPolygons, false);\n })\n .on('end', function () {\n saveCurrentStateToHistory();\n onPolygonsApply(closedPolygonsRef.current);\n });\n const draggablePointsData = closedPolygonsRef.current[idx].points.map((p, idx) => ({idx, p}));\n const selectedCircles = select(selectedCirclesContainerRef.current)\n .selectAll<SVGCircleElement, CircleData>('circle')\n .data(draggablePointsData, (d) => d.idx)\n .join('circle');\n selectedCirclesSelectionRef.current = selectedCircles;\n\n selectedCircles\n .attr('cx', d => scales.x(d.p[0]))\n .attr('cy', d => scales.y(d.p[1]))\n .attr('r', R)\n .attr('fill', 'white')\n .attr('stroke', SELECTION_COLOR);\n selectedCircles.call(d);\n }\n }, []);\n\n useEffect(() => {\n if (lassoMode === 'pen') {\n onLassoControlsStateUpdate({\n mode: lassoMode,\n backEnabled: historyIndex > 0,\n forwardEnabled: historyIndex < history.length - 1,\n deleteEnabled: selectedPolygon !== null,\n });\n } else {\n onLassoControlsStateUpdate({\n mode: lassoMode,\n backEnabled: historyIndex > 0,\n forwardEnabled: historyIndex < history.length - 1,\n deleteEnabled: false,\n });\n }\n }, [lassoMode, selectedPolygon, historyIndex, history]);\n\n return (\n <>\n <g>\n <defs>\n <pattern\n id=\"diagonalStripes\"\n width=\"5\"\n height=\"5\"\n patternTransform=\"rotate(45 0 0)\"\n patternUnits=\"userSpaceOnUse\"\n >\n <line x1=\"0\" y1=\"0\" x2=\"0\" y2=\"10\" stroke={SELECTION_COLOR} strokeWidth=\"1\" />\n </pattern>\n </defs>\n <rect\n fill=\"transparent\"\n width={chartSizes.chartWidth}\n height={chartSizes.chartHeight}\n onMouseMove={onMouseMove}\n onClick={onNewPointAddByClick}\n />\n {closedPolygons.map((p, idx) => {\n const isHovered = idx === hoveredPolygon;\n const isSelected = idx === selectedPolygon;\n const points = p.points.map(p => [scales.x(p[0]), scales.y(p[1])]);\n const pathD =\n points\n .map((p, idx) => {\n return (idx === 0 ? 'M' : 'L') + p[0] + ',' + p[1];\n })\n .join('') + 'z';\n return (\n <g key={idx}>\n <path\n d={pathD}\n fill={isHovered && !isSelected ? 'url(#diagonalStripes)' : 'transparent'}\n stroke={isSelected || isHovered ? SELECTION_COLOR : BLACK}\n onMouseOver={() => setHoveredPolygon(idx)}\n onMouseLeave={() => setHoveredPolygon(null)}\n onClick={() => updateSelectedPolygon(idx)}\n style={{pointerEvents: lassoMode === 'selection' || isSelected ? 'none' : 'auto'}}\n />\n {isSelected && <g ref={el => updateSelectedCircles(el)} />}\n </g>\n );\n })}\n <polyline\n points={newPolygonPoints.map((p) => `${scales.x(p[0])},${scales.y(p[1])}`).join(' ')}\n stroke={BLACK}\n fill=\"none\"\n style={{pointerEvents: 'none'}}\n />\n {newPolygonPoints.length > 0 && movingPoint && (\n <g style={{pointerEvents: 'none'}}>\n <line\n x1={scales.x(newPolygonPoints[newPolygonPoints.length - 1][0])}\n y1={scales.y(newPolygonPoints[newPolygonPoints.length - 1][1])}\n x2={movingPoint[0]}\n y2={movingPoint[1]}\n stroke={BLACK}\n />\n {newPolygonPoints.map((p, idx) => (\n <circle\n key={idx}\n cx={scales.x(p[0])}\n cy={scales.y(p[1])}\n r={R}\n fill=\"white\"\n stroke={SELECTION_COLOR}\n />\n ))}\n <circle\n cx={movingPoint[0]}\n cy={movingPoint[1]}\n r={R}\n fill=\"white\"\n stroke={SELECTION_COLOR}\n />\n </g>\n )}\n {closeToStartPoint && movingPoint && (\n <circle\n cx={movingPoint[0] + 5}\n cy={movingPoint[1] - 5}\n r={2}\n fill=\"none\"\n stroke={SELECTION_COLOR}\n strokeWidth={0.5}\n />\n )}\n </g>\n </>\n );\n}\n"],"names":["SELECTION_COLOR","CLOSING_DISTANCE","R","MAX_HISTORY_LENGTH","Lasso","scales","chartSizes","zoomStateKey","defaultPolygons","onPolygonsApply","onLassoControlsStateUpdate","useEffect","onPolygonDelete","selectedPolygonRef","updatePolygons","closedPolygonsRef","_p","idx","updateSelectedPolygon","onModeSelect","e","updateMode","onClickBack","loadHistoryItem","historyIndexRef","onClickForward","SCATTERPLOT_LASSO_EVENTS","lassoMode","setLassoMode","useState","closedPolygons","setClosedPolygons","useRef","hoveredPolygon","setHoveredPolygon","selectedPolygon","setSelectedPolygon","newPolygonPoints","setNewPolygonPoints","newPolygonPointsRef","history","setHistory","historyIndex","setHistoryIndex","historyRef","movingPoint","setMovingPoint","movingPointRef","closeToStartPoint","setCloseToStartPoint","selectedCirclesContainerRef","selectedCirclesSelectionRef","saveCurrentStateToHistory","useCallback","newHistoryItem","newHistory","index","historyState","updateNewPolygon","p","saveToHistory","points","v","polygon","clearNotFinishedPolygon","onKeyDown","_a","d","onNewPointAddByClick","currentCoords","x","y","onMouseMove","startPoint","startX","startY","distance","clearSelectedCircles","select","updateSelectedCircles","el","onPolygonSelect","drag","editedPolygons","polygonIdx","pointIdx","draggabl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AAA,UAC7D,IAAIQ,EAAY,CAAC;AAAA,UACjB,IAAIA,EAAY,CAAC;AAAA,UACjB,QAAQgD;AAAA,QAAA;AAAA,MAAA;AAAA,MAEXxD,EAAiB,IAAI,CAACsB,GAAG1C,MACtBuE,gBAAAA,EAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UAEG,IAAInF,EAAO,EAAEsD,EAAE,CAAC,CAAC;AAAA,UACjB,IAAItD,EAAO,EAAEsD,EAAE,CAAC,CAAC;AAAA,UACjB,GAAGzD;AAAA,UACH,MAAK;AAAA,UACL,QAAQF;AAAA,QAAA;AAAA,QALHiB;AAAA,MAAA,CAOZ;AAAA,MACDuE,gBAAAA,EAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACG,IAAI3C,EAAY,CAAC;AAAA,UACjB,IAAIA,EAAY,CAAC;AAAA,UACjB,GAAG3C;AAAA,UACH,MAAK;AAAA,UACL,QAAQF;AAAA,QAAA;AAAA,MAAA;AAAA,IACZ,GACJ;AAAA,IAEHgD,KAAqBH,KAClB2C,gBAAAA,EAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACG,IAAI3C,EAAY,CAAC,IAAI;AAAA,QACrB,IAAIA,EAAY,CAAC,IAAI;AAAA,QACrB,GAAG;AAAA,QACH,MAAK;AAAA,QACL,QAAQ7C;AAAA,QACR,aAAa;AAAA,MAAA;AAAA,IAAA;AAAA,EACjB,EAAA,CAER,EAAA,CACJ;AAER;"}
@@ -1,3 +1,3 @@
1
1
  import { SVGLayerProps } from '../types';
2
- export declare function SVGLayer({ settingsId, scales, chartSettings, mainTitle, keyColumn, margins, chartSizes, captionsSizes, onlyPositive, container, zoomStateKey, aesGetters, legendData, labels, onPolygonUpdate, onTooltipHintSwitch, lassoMode, dotsByGrouping, layers, selectedDot, }: SVGLayerProps): import("react/jsx-runtime").JSX.Element | null;
2
+ export declare function SVGLayer({ settingsId, scales, chartSettings, mainTitle, keyColumn, margins, chartSizes, captionsSizes, onlyPositive, container, zoomStateKey, aesGetters, legendData, labels, onPolygonUpdate, onTooltipHintSwitch, onLassoControlsStateUpdate, dotsByGrouping, layers, defaultPolygons, selectedDot, }: SVGLayerProps): import("react/jsx-runtime").JSX.Element | null;
3
3
  //# sourceMappingURL=SVGLayer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SVGLayer.d.ts","sourceRoot":"","sources":["../../../src/scatterplot-umap/components/SVGLayer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AAK5C,wBAAgB,QAAQ,CAAC,EACrB,UAAU,EACV,MAAM,EACN,aAAa,EACb,SAAS,EACT,SAAS,EACT,OAAO,EACP,UAAU,EACV,aAAa,EACb,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,UAAU,EACV,UAAU,EACV,MAAM,EACN,eAAe,EACf,mBAAmB,EACnB,SAAS,EACT,cAAc,EACd,MAAM,EACN,WAAkB,GACrB,EAAE,aAAa,kDAkDf"}
1
+ {"version":3,"file":"SVGLayer.d.ts","sourceRoot":"","sources":["../../../src/scatterplot-umap/components/SVGLayer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AAK5C,wBAAgB,QAAQ,CAAC,EACrB,UAAU,EACV,MAAM,EACN,aAAa,EACb,SAAS,EACT,SAAS,EACT,OAAO,EACP,UAAU,EACV,aAAa,EACb,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,UAAU,EACV,UAAU,EACV,MAAM,EACN,eAAe,EACf,mBAAmB,EACnB,0BAA0B,EAC1B,cAAc,EACd,MAAM,EACN,eAAe,EACf,WAAkB,GACrB,EAAE,aAAa,kDAoDf"}
@@ -1,70 +1,73 @@
1
1
  import { j as p } from "../../node_modules/react/jsx-runtime.js";
2
- import { useTooltip as V } from "../../common/Tooltip.js";
3
- import g from "./LowerSVG.js";
4
- import h from "./UpperSVG.js";
5
- import { r as w } from "../../_virtual/index.js";
6
- import { ErrorBoundary as B } from "../../common/ErrorBoundary.js";
7
- import { r as G } from "../../node_modules/react-dom/index.js";
8
- function c({
9
- settingsId: u,
10
- scales: t,
11
- chartSettings: s,
12
- mainTitle: x,
13
- keyColumn: a,
14
- margins: n,
15
- chartSizes: f,
16
- captionsSizes: e,
17
- onlyPositive: j,
2
+ import { useTooltip as w } from "../../common/Tooltip.js";
3
+ import y from "./LowerSVG.js";
4
+ import B from "./UpperSVG.js";
5
+ import { r as G } from "../../_virtual/index.js";
6
+ import { ErrorBoundary as I } from "../../common/ErrorBoundary.js";
7
+ import { r as O } from "../../node_modules/react-dom/index.js";
8
+ function k({
9
+ settingsId: s,
10
+ scales: f,
11
+ chartSettings: x,
12
+ mainTitle: a,
13
+ keyColumn: n,
14
+ margins: j,
15
+ chartSizes: i,
16
+ captionsSizes: l,
17
+ onlyPositive: E,
18
18
  container: r,
19
- zoomStateKey: l,
20
- aesGetters: i,
21
- legendData: E,
19
+ zoomStateKey: t,
20
+ aesGetters: u,
21
+ legendData: e,
22
22
  labels: v,
23
23
  onPolygonUpdate: d,
24
24
  onTooltipHintSwitch: L,
25
- lassoMode: y,
26
- dotsByGrouping: M,
27
- layers: S,
25
+ onLassoControlsStateUpdate: M,
26
+ dotsByGrouping: V,
27
+ layers: g,
28
+ defaultPolygons: h,
28
29
  selectedDot: o = null
29
30
  }) {
30
31
  if (!r)
31
32
  return null;
32
- const m = V(L);
33
- return w.useEffect(() => {
33
+ const m = w(L);
34
+ return G.useEffect(() => {
34
35
  o ? m.onMouseOver(o) : m.onMouseLeave();
35
- }, [o]), /* @__PURE__ */ p.jsx("div", { children: /* @__PURE__ */ p.jsxs(B, { dataId: u, children: [
36
+ }, [o]), /* @__PURE__ */ p.jsx("div", { children: /* @__PURE__ */ p.jsxs(I, { dataId: s, children: [
36
37
  /* @__PURE__ */ p.jsx(
37
- g,
38
+ y,
38
39
  {
39
- aesGetters: i,
40
- dotsByGrouping: M,
41
- layers: S,
42
- scales: t,
43
- keyColumn: a,
44
- margins: n,
45
- mainTitle: x,
46
- captionsSizes: e,
47
- chartSettings: s,
48
- chartSizes: f,
49
- onlyPositive: j,
40
+ aesGetters: u,
41
+ dotsByGrouping: V,
42
+ layers: g,
43
+ scales: f,
44
+ keyColumn: n,
45
+ margins: j,
46
+ mainTitle: a,
47
+ captionsSizes: l,
48
+ chartSettings: x,
49
+ chartSizes: i,
50
+ onlyPositive: E,
50
51
  container: r,
51
- zoomStateKey: l,
52
- legendData: E,
52
+ zoomStateKey: t,
53
+ legendData: e,
53
54
  tooltipData: m
54
55
  }
55
56
  ),
56
- G.createPortal(
57
+ O.createPortal(
57
58
  /* @__PURE__ */ p.jsx(
58
- h,
59
+ B,
59
60
  {
60
- scales: t,
61
+ scales: f,
61
62
  container: r,
62
- aesGetters: i,
63
+ aesGetters: u,
63
64
  labels: v,
64
- chartSizes: f,
65
+ chartSizes: i,
66
+ zoomStateKey: t,
65
67
  selectedDot: o,
68
+ defaultPolygons: h,
66
69
  onPolygonUpdate: d,
67
- lassoMode: y,
70
+ onLassoControlsStateUpdate: M,
68
71
  tooltipData: m
69
72
  }
70
73
  ),
@@ -73,6 +76,6 @@ function c({
73
76
  ] }) });
74
77
  }
75
78
  export {
76
- c as SVGLayer
79
+ k as SVGLayer
77
80
  };
78
81
  //# sourceMappingURL=SVGLayer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SVGLayer.js","sources":["../../../src/scatterplot-umap/components/SVGLayer.tsx"],"sourcesContent":["import {useTooltip} from '../../common/Tooltip';\nimport LowerSvg from './LowerSVG';\nimport UpperSVG from './UpperSVG';\nimport type {DotInfo} from '../types';\nimport type {SVGLayerProps} from '../types';\nimport React, {useEffect} from 'react';\nimport {ErrorBoundary} from '../../common/ErrorBoundary';\nimport {createPortal} from 'react-dom';\n\nexport function SVGLayer({\n settingsId,\n scales,\n chartSettings,\n mainTitle,\n keyColumn,\n margins,\n chartSizes,\n captionsSizes,\n onlyPositive,\n container,\n zoomStateKey,\n aesGetters,\n legendData,\n labels,\n onPolygonUpdate,\n onTooltipHintSwitch,\n lassoMode,\n dotsByGrouping,\n layers,\n selectedDot = null,\n}: SVGLayerProps) {\n if (!container) {\n return null;\n }\n const tooltipData = useTooltip<DotInfo>(onTooltipHintSwitch);\n useEffect(() => {\n if (selectedDot) {\n tooltipData.onMouseOver(selectedDot);\n } else {\n tooltipData.onMouseLeave();\n }\n }, [selectedDot]);\n\n return (\n <div>\n <ErrorBoundary dataId={settingsId}>\n <LowerSvg\n aesGetters={aesGetters}\n dotsByGrouping={dotsByGrouping}\n layers={layers}\n scales={scales}\n keyColumn={keyColumn}\n margins={margins}\n mainTitle={mainTitle}\n captionsSizes={captionsSizes}\n chartSettings={chartSettings}\n chartSizes={chartSizes}\n onlyPositive={onlyPositive}\n container={container}\n zoomStateKey={zoomStateKey}\n legendData={legendData}\n tooltipData={tooltipData}\n />\n {createPortal(\n <UpperSVG\n scales={scales}\n container={container}\n aesGetters={aesGetters}\n labels={labels}\n chartSizes={chartSizes}\n selectedDot={selectedDot}\n onPolygonUpdate={onPolygonUpdate}\n lassoMode={lassoMode}\n tooltipData={tooltipData}\n />,\n container\n )}\n </ErrorBoundary>\n </div>\n );\n}\n"],"names":["SVGLayer","settingsId","scales","chartSettings","mainTitle","keyColumn","margins","chartSizes","captionsSizes","onlyPositive","container","zoomStateKey","aesGetters","legendData","labels","onPolygonUpdate","onTooltipHintSwitch","lassoMode","dotsByGrouping","layers","selectedDot","tooltipData","useTooltip","useEffect","jsx","jsxs","ErrorBoundary","LowerSvg","createPortal","UpperSVG"],"mappings":";;;;;;;AASO,SAASA,EAAS;AAAA,EACrB,YAAAC;AAAA,EACA,QAAAC;AAAA,EACA,eAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,YAAAC;AAAA,EACA,eAAAC;AAAA,EACA,cAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,QAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,QAAAC;AAAA,EACA,aAAAC,IAAc;AAClB,GAAkB;AACd,MAAI,CAACV;AACD,WAAO;AAEX,QAAMW,IAAcC,EAAoBN,CAAmB;AAC3DO,SAAAA,EAAAA,UAAU,MAAM;AACZ,IAAIH,IACAC,EAAY,YAAYD,CAAW,IAEnCC,EAAY,aAAA;AAAA,EAEpB,GAAG,CAACD,CAAW,CAAC,GAGZI,gBAAAA,EAAAA,IAAC,OAAA,EACD,UAAAC,gBAAAA,EAAAA,KAACC,GAAA,EAAc,QAAQzB,GACnB,UAAA;AAAA,IAAAuB,gBAAAA,EAAAA;AAAAA,MAACG;AAAA,MAAA;AAAA,QACG,YAAAf;AAAA,QACA,gBAAAM;AAAA,QACA,QAAAC;AAAA,QACA,QAAAjB;AAAA,QACA,WAAAG;AAAA,QACA,SAAAC;AAAA,QACA,WAAAF;AAAA,QACA,eAAAI;AAAA,QACA,eAAAL;AAAA,QACA,YAAAI;AAAA,QACA,cAAAE;AAAA,QACA,WAAAC;AAAA,QACA,cAAAC;AAAA,QACA,YAAAE;AAAA,QACA,aAAAQ;AAAA,MAAA;AAAA,IAAA;AAAA,IAEHO,EAAAA;AAAAA,MACGJ,gBAAAA,EAAAA;AAAAA,QAACK;AAAA,QAAA;AAAA,UACG,QAAA3B;AAAA,UACA,WAAAQ;AAAA,UACA,YAAAE;AAAA,UACA,QAAAE;AAAA,UACA,YAAAP;AAAA,UACA,aAAAa;AAAA,UACA,iBAAAL;AAAA,UACA,WAAAE;AAAA,UACA,aAAAI;AAAA,QAAA;AAAA,MAAA;AAAA,MAEJX;AAAA,IAAA;AAAA,EACJ,EAAA,CACJ,EAAA,CACA;AAER;"}
1
+ {"version":3,"file":"SVGLayer.js","sources":["../../../src/scatterplot-umap/components/SVGLayer.tsx"],"sourcesContent":["import {useTooltip} from '../../common/Tooltip';\nimport LowerSvg from './LowerSVG';\nimport UpperSVG from './UpperSVG';\nimport type {DotInfo} from '../types';\nimport type {SVGLayerProps} from '../types';\nimport React, {useEffect} from 'react';\nimport {ErrorBoundary} from '../../common/ErrorBoundary';\nimport {createPortal} from 'react-dom';\n\nexport function SVGLayer({\n settingsId,\n scales,\n chartSettings,\n mainTitle,\n keyColumn,\n margins,\n chartSizes,\n captionsSizes,\n onlyPositive,\n container,\n zoomStateKey,\n aesGetters,\n legendData,\n labels,\n onPolygonUpdate,\n onTooltipHintSwitch,\n onLassoControlsStateUpdate,\n dotsByGrouping,\n layers,\n defaultPolygons,\n selectedDot = null,\n}: SVGLayerProps) {\n if (!container) {\n return null;\n }\n const tooltipData = useTooltip<DotInfo>(onTooltipHintSwitch);\n useEffect(() => {\n if (selectedDot) {\n tooltipData.onMouseOver(selectedDot);\n } else {\n tooltipData.onMouseLeave();\n }\n }, [selectedDot]);\n\n return (\n <div>\n <ErrorBoundary dataId={settingsId}>\n <LowerSvg\n aesGetters={aesGetters}\n dotsByGrouping={dotsByGrouping}\n layers={layers}\n scales={scales}\n keyColumn={keyColumn}\n margins={margins}\n mainTitle={mainTitle}\n captionsSizes={captionsSizes}\n chartSettings={chartSettings}\n chartSizes={chartSizes}\n onlyPositive={onlyPositive}\n container={container}\n zoomStateKey={zoomStateKey}\n legendData={legendData}\n tooltipData={tooltipData}\n />\n {createPortal(\n <UpperSVG\n scales={scales}\n container={container}\n aesGetters={aesGetters}\n labels={labels}\n chartSizes={chartSizes}\n zoomStateKey={zoomStateKey}\n selectedDot={selectedDot}\n defaultPolygons={defaultPolygons}\n onPolygonUpdate={onPolygonUpdate}\n onLassoControlsStateUpdate={onLassoControlsStateUpdate}\n tooltipData={tooltipData}\n />,\n container\n )}\n </ErrorBoundary>\n </div>\n );\n}\n"],"names":["SVGLayer","settingsId","scales","chartSettings","mainTitle","keyColumn","margins","chartSizes","captionsSizes","onlyPositive","container","zoomStateKey","aesGetters","legendData","labels","onPolygonUpdate","onTooltipHintSwitch","onLassoControlsStateUpdate","dotsByGrouping","layers","defaultPolygons","selectedDot","tooltipData","useTooltip","useEffect","jsx","jsxs","ErrorBoundary","LowerSvg","createPortal","UpperSVG"],"mappings":";;;;;;;AASO,SAASA,EAAS;AAAA,EACrB,YAAAC;AAAA,EACA,QAAAC;AAAA,EACA,eAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,YAAAC;AAAA,EACA,eAAAC;AAAA,EACA,cAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,QAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,4BAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,QAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,aAAAC,IAAc;AAClB,GAAkB;AACd,MAAI,CAACX;AACD,WAAO;AAEX,QAAMY,IAAcC,EAAoBP,CAAmB;AAC3DQ,SAAAA,EAAAA,UAAU,MAAM;AACZ,IAAIH,IACAC,EAAY,YAAYD,CAAW,IAEnCC,EAAY,aAAA;AAAA,EAEpB,GAAG,CAACD,CAAW,CAAC,GAGZI,gBAAAA,EAAAA,IAAC,OAAA,EACD,UAAAC,gBAAAA,EAAAA,KAACC,GAAA,EAAc,QAAQ1B,GACnB,UAAA;AAAA,IAAAwB,gBAAAA,EAAAA;AAAAA,MAACG;AAAA,MAAA;AAAA,QACG,YAAAhB;AAAA,QACA,gBAAAM;AAAA,QACA,QAAAC;AAAA,QACA,QAAAjB;AAAA,QACA,WAAAG;AAAA,QACA,SAAAC;AAAA,QACA,WAAAF;AAAA,QACA,eAAAI;AAAA,QACA,eAAAL;AAAA,QACA,YAAAI;AAAA,QACA,cAAAE;AAAA,QACA,WAAAC;AAAA,QACA,cAAAC;AAAA,QACA,YAAAE;AAAA,QACA,aAAAS;AAAA,MAAA;AAAA,IAAA;AAAA,IAEHO,EAAAA;AAAAA,MACGJ,gBAAAA,EAAAA;AAAAA,QAACK;AAAA,QAAA;AAAA,UACG,QAAA5B;AAAA,UACA,WAAAQ;AAAA,UACA,YAAAE;AAAA,UACA,QAAAE;AAAA,UACA,YAAAP;AAAA,UACA,cAAAI;AAAA,UACA,aAAAU;AAAA,UACA,iBAAAD;AAAA,UACA,iBAAAL;AAAA,UACA,4BAAAE;AAAA,UACA,aAAAK;AAAA,QAAA;AAAA,MAAA;AAAA,MAEJZ;AAAA,IAAA;AAAA,EACJ,EAAA,CACJ,EAAA,CACA;AAER;"}
@@ -1,14 +1,16 @@
1
1
  import { TooltipsData } from '../../common/Tooltip';
2
- import { AesGetters, ChartScales, ChartSizes, DotInfo, Point } from '../types';
2
+ import { AesGetters, LassoControlsState, Polygon, ChartScales, ChartSizes, DotInfo } from '../types';
3
3
  import { Label } from '../../scatterplot/utils/getVisibleLabels';
4
- declare function UpperSVG({ scales, container, labels, aesGetters, chartSizes, onPolygonUpdate, lassoMode, tooltipData }: {
4
+ declare function UpperSVG({ scales, container, labels, aesGetters, chartSizes, zoomStateKey, defaultPolygons, onPolygonUpdate, onLassoControlsStateUpdate, tooltipData }: {
5
5
  scales: ChartScales;
6
6
  container: SVGElement | null;
7
7
  aesGetters: AesGetters;
8
8
  labels: Label[];
9
9
  chartSizes: ChartSizes;
10
- onPolygonUpdate: (data: Point[]) => void;
11
- lassoMode: boolean;
10
+ zoomStateKey: string;
11
+ defaultPolygons: Polygon[];
12
+ onLassoControlsStateUpdate: (v: LassoControlsState) => void;
13
+ onPolygonUpdate: (data: Polygon[]) => void;
12
14
  tooltipData: TooltipsData<DotInfo>;
13
15
  selectedDot?: DotInfo | null;
14
16
  }): import("react/jsx-runtime").JSX.Element | null;
@@ -1 +1 @@
1
- {"version":3,"file":"UpperSVG.d.ts","sourceRoot":"","sources":["../../../src/scatterplot-umap/components/UpperSVG.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,M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