@realsee/dnalogel 4.0.0-webgpu.10 → 4.0.0-webgpu.12

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 (72) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +16 -0
  3. package/dist/floorplan.js +1 -1
  4. package/dist/index.js +15 -15
  5. package/dist/internal/{BasePlugin-Bcnwb_Wp.js → BasePlugin-BW_ljJJD.js} +2 -2
  6. package/dist/internal/{BasePlugin-Bcnwb_Wp.js.map → BasePlugin-BW_ljJJD.js.map} +1 -1
  7. package/dist/internal/BasePluginWithData-D0fXwQd_.js +7 -0
  8. package/dist/internal/{BasePluginWithData-veD_f0Qf.js.map → BasePluginWithData-D0fXwQd_.js.map} +1 -1
  9. package/dist/internal/{Controller-DMHTzGm7.js → Controller-DG3aerF4.js} +2 -2
  10. package/dist/internal/{Controller-DMHTzGm7.js.map → Controller-DG3aerF4.js.map} +1 -1
  11. package/dist/internal/{Polygon-D3xIL1Pl.js → Polygon-BXajWnCj.js} +57 -40
  12. package/dist/internal/Polygon-BXajWnCj.js.map +1 -0
  13. package/dist/internal/{Prism-CJlyAEAU.js → Prism-BwjQPOyR.js} +2 -2
  14. package/dist/internal/{Prism-CJlyAEAU.js.map → Prism-BwjQPOyR.js.map} +1 -1
  15. package/dist/internal/{Rectangle-CC2WYvov.js → Rectangle-DkXDREEe.js} +4 -4
  16. package/dist/internal/{Rectangle-CC2WYvov.js.map → Rectangle-DkXDREEe.js.map} +1 -1
  17. package/dist/internal/{Work-BqpiX1z5.js → Work-BhhN7u0F.js} +4 -4
  18. package/dist/internal/{Work-BqpiX1z5.js.map → Work-BhhN7u0F.js.map} +1 -1
  19. package/dist/internal/{area-maker-B8zUUhVk.js → area-maker-BeBn65zc.js} +2 -2
  20. package/dist/internal/{area-maker-B8zUUhVk.js.map → area-maker-BeBn65zc.js.map} +1 -1
  21. package/dist/internal/{controller-BBHxJoEH.js → controller-BPXvtI5O.js} +3 -3
  22. package/dist/internal/{controller-BBHxJoEH.js.map → controller-BPXvtI5O.js.map} +1 -1
  23. package/dist/internal/{cruise-DeRGFGQ7.js → cruise-D473G5eR.js} +2 -2
  24. package/dist/internal/{cruise-DeRGFGQ7.js.map → cruise-D473G5eR.js.map} +1 -1
  25. package/dist/internal/{current-pano-image-sc2LFrya.js → current-pano-image-CVkGFOqe.js} +2 -2
  26. package/dist/internal/{current-pano-image-sc2LFrya.js.map → current-pano-image-CVkGFOqe.js.map} +1 -1
  27. package/dist/internal/{floorplan-BOdqCcAc.js → floorplan-Bi8r_6Gk.js} +2 -2
  28. package/dist/internal/{floorplan-BOdqCcAc.js.map → floorplan-Bi8r_6Gk.js.map} +1 -1
  29. package/dist/internal/{measure-D6kvLcMk.js → measure-y2GbIzBe.js} +285 -349
  30. package/dist/internal/measure-y2GbIzBe.js.map +1 -0
  31. package/dist/internal/{model-maker-p7IecfuB.js → model-maker-CwyCnEOs.js} +3 -3
  32. package/dist/internal/{model-maker-p7IecfuB.js.map → model-maker-CwyCnEOs.js.map} +1 -1
  33. package/dist/internal/object3d-helper-CpTwFvfA.js +7 -0
  34. package/dist/internal/{object3d-helper-DHPCLk5D.js.map → object3d-helper-CpTwFvfA.js.map} +1 -1
  35. package/dist/internal/{pano-compass-B_gNSkDR.js → pano-compass-AD-jrS_J.js} +2 -2
  36. package/dist/internal/{pano-compass-B_gNSkDR.js.map → pano-compass-AD-jrS_J.js.map} +1 -1
  37. package/dist/internal/{pano-door-label-BllgT6o-.js → pano-door-label-yE2L5n-c.js} +2 -2
  38. package/dist/internal/{pano-door-label-BllgT6o-.js.map → pano-door-label-yE2L5n-c.js.map} +1 -1
  39. package/dist/internal/{pano-measure-CoyU2j3g.js → pano-measure-COBz9Fp1.js} +2 -2
  40. package/dist/internal/{pano-measure-CoyU2j3g.js.map → pano-measure-COBz9Fp1.js.map} +1 -1
  41. package/dist/internal/{pano-tag-NjpQygy3.js → pano-tag-BJ4_t4J4.js} +2 -2
  42. package/dist/internal/{pano-tag-NjpQygy3.js.map → pano-tag-BJ4_t4J4.js.map} +1 -1
  43. package/dist/internal/{pano-video-DGQi5GPp.js → pano-video-D7q3cxv8.js} +2 -2
  44. package/dist/internal/{pano-video-DGQi5GPp.js.map → pano-video-D7q3cxv8.js.map} +1 -1
  45. package/dist/internal/{pipeline-D3S3Qt7T.js → pipeline-BRRIQUds.js} +2 -2
  46. package/dist/internal/{pipeline-D3S3Qt7T.js.map → pipeline-BRRIQUds.js.map} +1 -1
  47. package/dist/internal/{sculpt-Cqspd_4E.js → sculpt-9Mn330l3.js} +4 -4
  48. package/dist/internal/{sculpt-Cqspd_4E.js.map → sculpt-9Mn330l3.js.map} +1 -1
  49. package/dist/plugins/area-maker.js +1 -1
  50. package/dist/plugins/cruise.js +2 -2
  51. package/dist/plugins/current-pano-image.js +1 -1
  52. package/dist/plugins/guide-line.js +1 -1
  53. package/dist/plugins/measure.d.ts +1 -1
  54. package/dist/plugins/measure.js +1 -1
  55. package/dist/plugins/model-maker.js +1 -1
  56. package/dist/plugins/object3d-helper.js +2 -2
  57. package/dist/plugins/pano-compass.js +1 -1
  58. package/dist/plugins/pano-door-label.js +1 -1
  59. package/dist/plugins/pano-measure.js +1 -1
  60. package/dist/plugins/pano-tag.js +2 -2
  61. package/dist/plugins/pano-video.js +1 -1
  62. package/dist/plugins/pipeline.js +1 -1
  63. package/dist/plugins/sculpt.js +4 -4
  64. package/dist/types/MeasurePlugin/Controller.d.ts +20 -12
  65. package/dist/types/MeasurePlugin/index.d.ts +1 -1
  66. package/dist/types/public/plugins/measure.d.ts +1 -1
  67. package/dist/types/shared-utils/three/PointSprite.d.ts +2 -1
  68. package/package.json +1 -1
  69. package/dist/internal/BasePluginWithData-veD_f0Qf.js +0 -7
  70. package/dist/internal/Polygon-D3xIL1Pl.js.map +0 -1
  71. package/dist/internal/measure-D6kvLcMk.js.map +0 -1
  72. package/dist/internal/object3d-helper-DHPCLk5D.js +0 -7
@@ -1,31 +1,32 @@
1
1
  import { t as e } from "./Subscribe-DLlAl88n.js";
2
2
  import { r as t } from "./PointHelper-qhcK4big.js";
3
3
  import { C as n, c as r } from "./generatePolygonGeometry-BOnzdCaG.js";
4
- import { n as i } from "./getNormal-BatLuzsS.js";
5
- import { r as a } from "./resizeObserver-AY-35us4.js";
6
- import { t as o } from "./FiveDomEvents-BUBLFzti.js";
7
- import { t as s } from "./Cursor-3AwKvViZ.js";
8
- import { t as c } from "./vectorIsEqual-BXdJrP0J.js";
9
- import { i as l, r as u, t as d } from "./Polygon-D3xIL1Pl.js";
10
- import * as f from "three/webgpu";
4
+ import { r as i } from "./util-vGeVT4oo.js";
5
+ import { n as a } from "./getNormal-BatLuzsS.js";
6
+ import { r as o } from "./resizeObserver-AY-35us4.js";
7
+ import { t as s } from "./FiveDomEvents-BUBLFzti.js";
8
+ import { t as c } from "./Cursor-3AwKvViZ.js";
9
+ import { t as l } from "./vectorIsEqual-BXdJrP0J.js";
10
+ import { i as u, r as d, t as f } from "./Polygon-BXajWnCj.js";
11
+ import * as p from "three/webgpu";
11
12
  //#region src/MeasurePlugin/utils/validatePolygon.ts
12
- function p(e) {
13
- if (e.length < 3 || !c(e[0], e.at(-1))) return !1;
14
- let t = !0, n = new f.Vector3().subVectors(e[1], e[0]).normalize();
13
+ function m(e) {
14
+ if (e.length < 3 || !l(e[0], e.at(-1))) return !1;
15
+ let t = !0, n = new p.Vector3().subVectors(e[1], e[0]).normalize();
15
16
  for (let r = 2; r < e.length; r++) {
16
- let i = new f.Vector3().subVectors(e[r], e[0]).normalize();
17
- if (!c(i, n) && !c(i, n.clone().negate())) {
17
+ let i = new p.Vector3().subVectors(e[r], e[0]).normalize();
18
+ if (!l(i, n) && !l(i, n.clone().negate())) {
18
19
  t = !1;
19
20
  break;
20
21
  }
21
22
  }
22
23
  if (t) return !1;
23
- let r = new f.Plane().setFromCoplanarPoints(e[0], e[1], e[2]);
24
+ let r = new p.Plane().setFromCoplanarPoints(e[0], e[1], e[2]);
24
25
  return e.every((e, t) => t < 3 || r.distanceToPoint(e) < 1e-6);
25
26
  }
26
27
  //#endregion
27
28
  //#region src/MeasurePlugin/utils/MeasureMesh.ts
28
- var m = class extends i {
29
+ var h = class extends a {
29
30
  name = "MeasureMesh";
30
31
  isMeasureMesh = !0;
31
32
  points = [];
@@ -34,14 +35,14 @@ var m = class extends i {
34
35
  line;
35
36
  polygon;
36
37
  constructor(e) {
37
- super(), this.line = new u(e?.lineStyle), this.polygon = new d(e?.polygonStyle), this.add(this.line);
38
+ super(), this.line = new d(e?.lineStyle), this.polygon = new f(e?.polygonStyle), this.add(this.line);
38
39
  }
39
40
  changeConfig(e) {
40
41
  this.line.setStyle(e?.lineStyle), this.polygon.setStyle(e?.polygonStyle);
41
42
  }
42
43
  setPoints(e) {
43
44
  this.points = e, this.line.setPoints(this.points);
44
- let t = p(this.points);
45
+ let t = m(this.points);
45
46
  this.isPolygon = t, t && (this.addIfNotExists(this.polygon), this.polygon.setPoints(this.points));
46
47
  }
47
48
  select() {
@@ -62,30 +63,30 @@ var m = class extends i {
62
63
  unhighlight() {
63
64
  this.line.unhighlight(), this.polygon.unhighlight();
64
65
  }
65
- }, h = typeof navigator < "u" && navigator.userAgent.toLowerCase().indexOf("firefox") > 0;
66
- function g(e, t, n, r) {
66
+ }, g = typeof navigator < "u" && navigator.userAgent.toLowerCase().indexOf("firefox") > 0;
67
+ function _(e, t, n, r) {
67
68
  e.addEventListener ? e.addEventListener(t, n, r) : e.attachEvent && e.attachEvent(`on${t}`, n);
68
69
  }
69
- function _(e, t, n, r) {
70
+ function v(e, t, n, r) {
70
71
  e && (e.removeEventListener ? e.removeEventListener(t, n, r) : e.detachEvent && e.detachEvent(`on${t}`, n));
71
72
  }
72
- function v(e, t) {
73
+ function y(e, t) {
73
74
  let n = t.slice(0, t.length - 1), r = [];
74
75
  for (let t = 0; t < n.length; t++) r.push(e[n[t].toLowerCase()]);
75
76
  return r;
76
77
  }
77
- function y(e) {
78
+ function b(e) {
78
79
  typeof e != "string" && (e = ""), e = e.replace(/\s/g, "");
79
80
  let t = e.split(","), n = t.lastIndexOf("");
80
81
  for (; n >= 0;) t[n - 1] += ",", t.splice(n, 1), n = t.lastIndexOf("");
81
82
  return t;
82
83
  }
83
- function b(e, t) {
84
+ function x(e, t) {
84
85
  let n = e.length >= t.length ? e : t, r = e.length >= t.length ? t : e, i = !0;
85
86
  for (let e = 0; e < n.length; e++) r.indexOf(n[e]) === -1 && (i = !1);
86
87
  return i;
87
88
  }
88
- function x(e, t, n) {
89
+ function S(e, t, n) {
89
90
  let r = e.keyCode || e.which || e.charCode;
90
91
  if (e.key) {
91
92
  let r = e.key.toLowerCase();
@@ -96,7 +97,7 @@ function x(e, t, n) {
96
97
  }
97
98
  return e.code && /^Key[A-Z]$/.test(e.code) && (r = e.code.charCodeAt(3)), r;
98
99
  }
99
- var S = {
100
+ var C = {
100
101
  backspace: 8,
101
102
  "⌫": 8,
102
103
  tab: 9,
@@ -145,16 +146,16 @@ var S = {
145
146
  ".": 190,
146
147
  "/": 191,
147
148
  "`": 192,
148
- "-": h ? 173 : 189,
149
- "=": h ? 61 : 187,
150
- ";": h ? 59 : 186,
149
+ "-": g ? 173 : 189,
150
+ "=": g ? 61 : 187,
151
+ ";": g ? 59 : 186,
151
152
  "'": 222,
152
153
  "{": 219,
153
154
  "}": 221,
154
155
  "[": 219,
155
156
  "]": 221,
156
157
  "\\": 220
157
- }, C = {
158
+ }, w = {
158
159
  "⇧": 16,
159
160
  shift: 16,
160
161
  "⌥": 18,
@@ -167,7 +168,7 @@ var S = {
167
168
  cmd: 91,
168
169
  meta: 91,
169
170
  command: 91
170
- }, w = {
171
+ }, T = {
171
172
  16: "shiftKey",
172
173
  18: "altKey",
173
174
  17: "ctrlKey",
@@ -176,28 +177,28 @@ var S = {
176
177
  ctrlKey: 17,
177
178
  altKey: 18,
178
179
  metaKey: 91
179
- }, T = {
180
+ }, E = {
180
181
  16: !1,
181
182
  18: !1,
182
183
  17: !1,
183
184
  91: !1
184
- }, E = {};
185
- for (let e = 1; e < 20; e++) S[`f${e}`] = 111 + e;
186
- var D = [], O = null, k = null, A = "all", j = /* @__PURE__ */ new Map(), M = (e) => S[e.toLowerCase()] || C[e.toLowerCase()] || e.toUpperCase().charCodeAt(0), N = (e) => Object.keys(S).find((t) => S[t] === e), P = (e) => Object.keys(C).find((t) => C[t] === e), F = (e) => {
187
- A = e || "all";
188
- }, I = () => A || "all", L = () => D.slice(0), R = () => D.map((e) => N(e) || P(e) || String.fromCharCode(e)), z = () => {
185
+ }, D = {};
186
+ for (let e = 1; e < 20; e++) C[`f${e}`] = 111 + e;
187
+ var O = [], k = null, A = null, j = "all", M = /* @__PURE__ */ new Map(), N = (e) => C[e.toLowerCase()] || w[e.toLowerCase()] || e.toUpperCase().charCodeAt(0), P = (e) => Object.keys(C).find((t) => C[t] === e), F = (e) => Object.keys(w).find((t) => w[t] === e), I = (e) => {
188
+ j = e || "all";
189
+ }, L = () => j || "all", R = () => O.slice(0), z = () => O.map((e) => P(e) || F(e) || String.fromCharCode(e)), B = () => {
189
190
  let e = [];
190
- return Object.keys(E).forEach((t) => {
191
- E[t].forEach(({ key: t, scope: n, mods: r, shortcut: i }) => {
191
+ return Object.keys(D).forEach((t) => {
192
+ D[t].forEach(({ key: t, scope: n, mods: r, shortcut: i }) => {
192
193
  e.push({
193
194
  scope: n,
194
195
  shortcut: i,
195
196
  mods: r,
196
- keys: t.split("+").map((e) => M(e))
197
+ keys: t.split("+").map((e) => N(e))
197
198
  });
198
199
  });
199
200
  }), e;
200
- }, B = (e) => {
201
+ }, V = (e) => {
201
202
  let t = e.target || e.srcElement, { tagName: n } = t, r = !0, i = n === "INPUT" && ![
202
203
  "checkbox",
203
204
  "radio",
@@ -209,99 +210,99 @@ var D = [], O = null, k = null, A = "all", j = /* @__PURE__ */ new Map(), M = (e
209
210
  "color"
210
211
  ].includes(t.type);
211
212
  return (t.isContentEditable || (i || n === "TEXTAREA" || n === "SELECT") && !t.readOnly) && (r = !1), r;
212
- }, V = (e) => (typeof e == "string" && (e = M(e)), D.indexOf(e) !== -1), H = (e, t) => {
213
+ }, H = (e) => (typeof e == "string" && (e = N(e)), O.indexOf(e) !== -1), U = (e, t) => {
213
214
  let n, r;
214
- e ||= I();
215
- for (let t in E) if (Object.prototype.hasOwnProperty.call(E, t)) for (n = E[t], r = 0; r < n.length;) n[r].scope === e ? n.splice(r, 1).forEach(({ element: e }) => X(e)) : r++;
216
- I() === e && F(t || "all");
215
+ e ||= L();
216
+ for (let t in D) if (Object.prototype.hasOwnProperty.call(D, t)) for (n = D[t], r = 0; r < n.length;) n[r].scope === e ? n.splice(r, 1).forEach(({ element: e }) => Z(e)) : r++;
217
+ L() === e && I(t || "all");
217
218
  };
218
- function U(e) {
219
- let t = x(e, S, C);
220
- e.key && e.key.toLowerCase() === "capslock" && (t = M(e.key));
221
- let n = D.indexOf(t);
222
- if (n >= 0 && D.splice(n, 1), e.key && e.key.toLowerCase() === "meta" && D.splice(0, D.length), (t === 93 || t === 224) && (t = 91), t in T) {
223
- T[t] = !1;
224
- for (let e in C) C[e] === t && (J[e] = !1);
219
+ function W(e) {
220
+ let t = S(e, C, w);
221
+ e.key && e.key.toLowerCase() === "capslock" && (t = N(e.key));
222
+ let n = O.indexOf(t);
223
+ if (n >= 0 && O.splice(n, 1), e.key && e.key.toLowerCase() === "meta" && O.splice(0, O.length), (t === 93 || t === 224) && (t = 91), t in E) {
224
+ E[t] = !1;
225
+ for (let e in w) w[e] === t && (Y[e] = !1);
225
226
  }
226
227
  }
227
- var W = (e, ...t) => {
228
- if (e === void 0) Object.keys(E).forEach((e) => {
229
- Array.isArray(E[e]) && E[e].forEach((e) => G(e)), delete E[e];
230
- }), X(null);
228
+ var G = (e, ...t) => {
229
+ if (e === void 0) Object.keys(D).forEach((e) => {
230
+ Array.isArray(D[e]) && D[e].forEach((e) => K(e)), delete D[e];
231
+ }), Z(null);
231
232
  else if (Array.isArray(e)) e.forEach((e) => {
232
- e.key && G(e);
233
+ e.key && K(e);
233
234
  });
234
- else if (typeof e == "object") e.key && G(e);
235
+ else if (typeof e == "object") e.key && K(e);
235
236
  else if (typeof e == "string") {
236
237
  let [n, r] = t;
237
- typeof n == "function" && (r = n, n = ""), G({
238
+ typeof n == "function" && (r = n, n = ""), K({
238
239
  key: e,
239
240
  scope: n,
240
241
  method: r,
241
242
  splitKey: "+"
242
243
  });
243
244
  }
244
- }, G = ({ key: e, scope: t, method: n, splitKey: r = "+" }) => {
245
- y(e).forEach((e) => {
246
- let i = e.split(r), a = i.length, o = i[a - 1], s = o === "*" ? "*" : M(o);
247
- if (!E[s]) return;
248
- t ||= I();
249
- let c = a > 1 ? v(C, i) : [], l = [];
250
- E[s] = E[s].filter((e) => {
251
- let r = (!n || e.method === n) && e.scope === t && b(e.mods, c);
245
+ }, K = ({ key: e, scope: t, method: n, splitKey: r = "+" }) => {
246
+ b(e).forEach((e) => {
247
+ let i = e.split(r), a = i.length, o = i[a - 1], s = o === "*" ? "*" : N(o);
248
+ if (!D[s]) return;
249
+ t ||= L();
250
+ let c = a > 1 ? y(w, i) : [], l = [];
251
+ D[s] = D[s].filter((e) => {
252
+ let r = (!n || e.method === n) && e.scope === t && x(e.mods, c);
252
253
  return r && l.push(e.element), !r;
253
- }), l.forEach((e) => X(e));
254
+ }), l.forEach((e) => Z(e));
254
255
  });
255
256
  };
256
- function K(e, t, n, r) {
257
+ function q(e, t, n, r) {
257
258
  if (t.element !== r) return;
258
259
  let i;
259
260
  if (t.scope === n || t.scope === "all") {
260
261
  i = t.mods.length > 0;
261
- for (let e in T) Object.prototype.hasOwnProperty.call(T, e) && (!T[e] && t.mods.indexOf(+e) > -1 || T[e] && t.mods.indexOf(+e) === -1) && (i = !1);
262
- (t.mods.length === 0 && !T[16] && !T[18] && !T[17] && !T[91] || i || t.shortcut === "*") && (t.keys = [], t.keys = t.keys.concat(D), t.method(e, t) === !1 && (e.preventDefault ? e.preventDefault() : e.returnValue = !1, e.stopPropagation && e.stopPropagation(), e.cancelBubble &&= !0));
262
+ for (let e in E) Object.prototype.hasOwnProperty.call(E, e) && (!E[e] && t.mods.indexOf(+e) > -1 || E[e] && t.mods.indexOf(+e) === -1) && (i = !1);
263
+ (t.mods.length === 0 && !E[16] && !E[18] && !E[17] && !E[91] || i || t.shortcut === "*") && (t.keys = [], t.keys = t.keys.concat(O), t.method(e, t) === !1 && (e.preventDefault ? e.preventDefault() : e.returnValue = !1, e.stopPropagation && e.stopPropagation(), e.cancelBubble &&= !0));
263
264
  }
264
265
  }
265
- function q(e, t) {
266
- let n = E["*"], r = x(e, S, C);
267
- if (e.key && e.key.toLowerCase() === "capslock" || !(J.filter || B).call(this, e)) return;
268
- if ((r === 93 || r === 224) && (r = 91), D.indexOf(r) === -1 && r !== 229 && D.push(r), [
266
+ function J(e, t) {
267
+ let n = D["*"], r = S(e, C, w);
268
+ if (e.key && e.key.toLowerCase() === "capslock" || !(Y.filter || V).call(this, e)) return;
269
+ if ((r === 93 || r === 224) && (r = 91), O.indexOf(r) === -1 && r !== 229 && O.push(r), [
269
270
  "metaKey",
270
271
  "ctrlKey",
271
272
  "altKey",
272
273
  "shiftKey"
273
274
  ].forEach((t) => {
274
- let n = w[t];
275
- e[t] && D.indexOf(n) === -1 ? D.push(n) : !e[t] && D.indexOf(n) > -1 ? D.splice(D.indexOf(n), 1) : t === "metaKey" && e[t] && (D = D.filter((e) => e in w || e === r));
276
- }), r in T) {
277
- T[r] = !0;
278
- for (let t in C) Object.prototype.hasOwnProperty.call(C, t) && (J[t] = e[w[C[t]]]);
275
+ let n = T[t];
276
+ e[t] && O.indexOf(n) === -1 ? O.push(n) : !e[t] && O.indexOf(n) > -1 ? O.splice(O.indexOf(n), 1) : t === "metaKey" && e[t] && (O = O.filter((e) => e in T || e === r));
277
+ }), r in E) {
278
+ E[r] = !0;
279
+ for (let t in w) Object.prototype.hasOwnProperty.call(w, t) && (Y[t] = e[T[w[t]]]);
279
280
  if (!n) return;
280
281
  }
281
- for (let t in T) Object.prototype.hasOwnProperty.call(T, t) && (T[t] = e[w[t]]);
282
- e.getModifierState && (!e.altKey || e.ctrlKey) && e.getModifierState("AltGraph") && (D.indexOf(17) === -1 && D.push(17), D.indexOf(18) === -1 && D.push(18), T[17] = !0, T[18] = !0);
283
- let i = I();
284
- if (n) for (let r = 0; r < n.length; r++) n[r].scope === i && (e.type === "keydown" && n[r].keydown || e.type === "keyup" && n[r].keyup) && K(e, n[r], i, t);
285
- if (!(r in E)) return;
286
- let a = E[r], o = a.length;
282
+ for (let t in E) Object.prototype.hasOwnProperty.call(E, t) && (E[t] = e[T[t]]);
283
+ e.getModifierState && (!e.altKey || e.ctrlKey) && e.getModifierState("AltGraph") && (O.indexOf(17) === -1 && O.push(17), O.indexOf(18) === -1 && O.push(18), E[17] = !0, E[18] = !0);
284
+ let i = L();
285
+ if (n) for (let r = 0; r < n.length; r++) n[r].scope === i && (e.type === "keydown" && n[r].keydown || e.type === "keyup" && n[r].keyup) && q(e, n[r], i, t);
286
+ if (!(r in D)) return;
287
+ let a = D[r], o = a.length;
287
288
  for (let n = 0; n < o; n++) if ((e.type === "keydown" && a[n].keydown || e.type === "keyup" && a[n].keyup) && a[n].key) {
288
289
  let r = a[n], { splitKey: o } = r, s = r.key.split(o), c = [];
289
- for (let e = 0; e < s.length; e++) c.push(M(s[e]));
290
- c.sort().join("") === D.sort().join("") && K(e, r, i, t);
290
+ for (let e = 0; e < s.length; e++) c.push(N(s[e]));
291
+ c.sort().join("") === O.sort().join("") && q(e, r, i, t);
291
292
  }
292
293
  }
293
- var J = function e(t, n, r) {
294
- D = [];
295
- let i = y(t), a = [], o = "all", s = document, c = 0, l = !1, u = !0, d = "+", f = !1, p = !1;
294
+ var Y = function e(t, n, r) {
295
+ O = [];
296
+ let i = b(t), a = [], o = "all", s = document, c = 0, l = !1, u = !0, d = "+", f = !1, p = !1;
296
297
  if (r === void 0 && typeof n == "function" && (r = n), Object.prototype.toString.call(n) === "[object Object]") {
297
298
  let e = n;
298
299
  e.scope && (o = e.scope), e.element && (s = e.element), e.keyup && (l = e.keyup), e.keydown !== void 0 && (u = e.keydown), e.capture !== void 0 && (f = e.capture), typeof e.splitKey == "string" && (d = e.splitKey), e.single === !0 && (p = !0);
299
300
  }
300
- for (typeof n == "string" && (o = n), p && W(t, o); c < i.length; c++) {
301
+ for (typeof n == "string" && (o = n), p && G(t, o); c < i.length; c++) {
301
302
  let e = i[c].split(d);
302
- a = [], e.length > 1 && (a = v(C, e));
303
+ a = [], e.length > 1 && (a = y(w, e));
303
304
  let t = e[e.length - 1];
304
- t = t === "*" ? "*" : M(t), t in E || (E[t] = []), E[t].push({
305
+ t = t === "*" ? "*" : N(t), t in D || (D[t] = []), D[t].push({
305
306
  keyup: l,
306
307
  keydown: u,
307
308
  scope: o,
@@ -314,88 +315,88 @@ var J = function e(t, n, r) {
314
315
  });
315
316
  }
316
317
  if (s !== void 0 && typeof window < "u") {
317
- if (!j.has(s)) {
318
- let e = (e = window.event) => q(e, s), t = (e = window.event) => {
319
- q(e, s), U(e);
318
+ if (!M.has(s)) {
319
+ let e = (e = window.event) => J(e, s), t = (e = window.event) => {
320
+ J(e, s), W(e);
320
321
  };
321
- j.set(s, {
322
+ M.set(s, {
322
323
  keydownListener: e,
323
324
  keyupListenr: t,
324
325
  capture: f
325
- }), g(s, "keydown", e, f), g(s, "keyup", t, f);
326
+ }), _(s, "keydown", e, f), _(s, "keyup", t, f);
326
327
  }
327
- if (!O) {
328
+ if (!k) {
328
329
  let e = () => {
329
- D = [];
330
+ O = [];
330
331
  };
331
- O = {
332
+ k = {
332
333
  listener: e,
333
334
  capture: f
334
- }, g(window, "focus", e, f);
335
+ }, _(window, "focus", e, f);
335
336
  }
336
- if (!k && typeof document < "u") {
337
+ if (!A && typeof document < "u") {
337
338
  let t = () => {
338
- D = [];
339
- for (let e in T) T[e] = !1;
340
- for (let t in C) e[t] = !1;
339
+ O = [];
340
+ for (let e in E) E[e] = !1;
341
+ for (let t in w) e[t] = !1;
341
342
  }, n = t, r = t;
342
- document.addEventListener("fullscreenchange", n), document.addEventListener("webkitfullscreenchange", r), k = {
343
+ document.addEventListener("fullscreenchange", n), document.addEventListener("webkitfullscreenchange", r), A = {
343
344
  fullscreen: n,
344
345
  webkit: r
345
346
  };
346
347
  }
347
348
  }
348
349
  };
349
- function Y(e, t = "all") {
350
- Object.keys(E).forEach((n) => {
351
- E[n].filter((n) => n.scope === t && (n.shortcut === e || n.shortcut === "*")).forEach((e) => {
350
+ function X(e, t = "all") {
351
+ Object.keys(D).forEach((n) => {
352
+ D[n].filter((n) => n.scope === t && (n.shortcut === e || n.shortcut === "*")).forEach((e) => {
352
353
  e && e.method && e.method({}, e);
353
354
  });
354
355
  });
355
356
  }
356
- function X(e) {
357
- let t = Object.values(E).flat();
357
+ function Z(e) {
358
+ let t = Object.values(D).flat();
358
359
  if (t.findIndex(({ element: t }) => t === e) < 0 && e) {
359
- let { keydownListener: t, keyupListenr: n, capture: r } = j.get(e) || {};
360
- t && n && (_(e, "keyup", n, r), _(e, "keydown", t, r), j.delete(e));
360
+ let { keydownListener: t, keyupListenr: n, capture: r } = M.get(e) || {};
361
+ t && n && (v(e, "keyup", n, r), v(e, "keydown", t, r), M.delete(e));
361
362
  }
362
- if (t.length <= 0 || j.size <= 0) {
363
- if (Array.from(j.keys()).forEach((e) => {
364
- let { keydownListener: t, keyupListenr: n, capture: r } = j.get(e) || {};
365
- t && n && (_(e, "keyup", n, r), _(e, "keydown", t, r), j.delete(e));
366
- }), j.clear(), Object.keys(E).forEach((e) => delete E[e]), O) {
367
- let { listener: e, capture: t } = O;
368
- _(window, "focus", e, t), O = null;
363
+ if (t.length <= 0 || M.size <= 0) {
364
+ if (Array.from(M.keys()).forEach((e) => {
365
+ let { keydownListener: t, keyupListenr: n, capture: r } = M.get(e) || {};
366
+ t && n && (v(e, "keyup", n, r), v(e, "keydown", t, r), M.delete(e));
367
+ }), M.clear(), Object.keys(D).forEach((e) => delete D[e]), k) {
368
+ let { listener: e, capture: t } = k;
369
+ v(window, "focus", e, t), k = null;
369
370
  }
370
- k && typeof document < "u" && (document.removeEventListener("fullscreenchange", k.fullscreen), document.removeEventListener("webkitfullscreenchange", k.webkit), k = null);
371
+ A && typeof document < "u" && (document.removeEventListener("fullscreenchange", A.fullscreen), document.removeEventListener("webkitfullscreenchange", A.webkit), A = null);
371
372
  }
372
373
  }
373
- var Z = {
374
- getPressedKeyString: R,
375
- setScope: F,
376
- getScope: I,
377
- deleteScope: H,
378
- getPressedKeyCodes: L,
379
- getAllKeyCodes: z,
380
- isPressed: V,
381
- filter: B,
382
- trigger: Y,
383
- unbind: W,
384
- keyMap: S,
385
- modifier: C,
386
- modifierMap: w
374
+ var Q = {
375
+ getPressedKeyString: z,
376
+ setScope: I,
377
+ getScope: L,
378
+ deleteScope: U,
379
+ getPressedKeyCodes: R,
380
+ getAllKeyCodes: B,
381
+ isPressed: H,
382
+ filter: V,
383
+ trigger: X,
384
+ unbind: G,
385
+ keyMap: C,
386
+ modifier: w,
387
+ modifierMap: T
387
388
  };
388
- for (let e in Z) {
389
+ for (let e in Q) {
389
390
  let t = e;
390
- Object.prototype.hasOwnProperty.call(Z, t) && (J[t] = Z[t]);
391
+ Object.prototype.hasOwnProperty.call(Q, t) && (Y[t] = Q[t]);
391
392
  }
392
393
  if (typeof window < "u") {
393
394
  let e = window.hotkeys;
394
- J.noConflict = (t) => (t && window.hotkeys === J && (window.hotkeys = e), J), window.hotkeys = J;
395
+ Y.noConflict = (t) => (t && window.hotkeys === Y && (window.hotkeys = e), Y), window.hotkeys = Y;
395
396
  }
396
397
  //#endregion
397
398
  //#region src/MeasurePlugin/Controller.ts
398
- var Q = class extends e {
399
+ var $ = class extends e {
399
400
  name = "MeasurePlugin";
400
401
  currentMeasureMesh;
401
402
  five;
@@ -403,8 +404,23 @@ var Q = class extends e {
403
404
  currentEndReason = "enter";
404
405
  repositioningState = null;
405
406
  longPressIndicator = null;
406
- cleanupGlobalListeners;
407
- globalTouchHandler = null;
407
+ cleanupPendingPress;
408
+ cleanupRepositioningListeners;
409
+ endpointPointerElement;
410
+ endpointPressHandlers = /* @__PURE__ */ new WeakMap();
411
+ interactionPhase = "idle";
412
+ interactionResult;
413
+ get interactionState() {
414
+ return {
415
+ phase: this.interactionPhase,
416
+ measurementCount: this.group.children.filter((e) => e.isMeasureMesh && e !== this.currentMeasureMesh && e.points.length >= 2).length,
417
+ pointCount: this.currentMeasureMesh?.points.length ?? 0,
418
+ result: this.interactionResult
419
+ };
420
+ }
421
+ publishInteraction = (e, t) => {
422
+ this.interactionPhase = e, this.interactionResult = t, this.emit("interactionChange", this.interactionState);
423
+ };
408
424
  get pointSelector() {
409
425
  return this._pointSelector ||= new t(this.five, {
410
426
  mode: "cursor",
@@ -414,11 +430,11 @@ var Q = class extends e {
414
430
  }
415
431
  _pointSelector;
416
432
  get fiveDomEvents() {
417
- return this._fiveDomEvents ||= new o(this.five, { fiveModels: null }), this._fiveDomEvents;
433
+ return this._fiveDomEvents ||= new s(this.five, { fiveModels: null }), this._fiveDomEvents;
418
434
  }
419
435
  _fiveDomEvents;
420
436
  get cursor() {
421
- return this._cursor ||= new s(), this._cursor;
437
+ return this._cursor ||= new c(), this._cursor;
422
438
  }
423
439
  _cursor;
424
440
  get config() {
@@ -453,26 +469,26 @@ var Q = class extends e {
453
469
  this.config = t ? {
454
470
  ...r,
455
471
  ...t
456
- } : r, this.group = new i(), this.group.name = "MeasureGroup", n(this.group, this.five), this.five.scene.add(this.group), this.five.on("panoArrived", this.onMoveToPano), this.five.on("modeChange", this.onModeChange), J("delete, backspace", this.deleteSelectedMesh), this.initEventListeners();
472
+ } : r, this.group = new a(), this.group.name = "MeasureGroup", n(this.group, this.five), this.five.scene.add(this.group), this.five.on("panoArrived", this.onMoveToPano), this.five.on("modeChange", this.onModeChange), Y("delete, backspace", this.deleteSelectedMesh), this.initEventListeners();
457
473
  }
458
474
  initEventListeners = () => {
459
475
  this.group.children.forEach(this.addMeshEventListeners);
460
476
  };
461
477
  measure = () => {
462
- this.repositioningState && this.cancelRepositioning(), this.listener.addMeasureListener(), J.unbind("delete, backspace"), this.group.children.forEach((e) => e.unselect()), this.cursor.removeDeleteButton();
463
- let e = new m({
478
+ this.cleanupPendingPress?.(), this.repositioningState && this.cancelRepositioning(), this.listener.addMeasureListener(), Y.unbind("delete, backspace"), this.group.children.forEach((e) => e.unselect()), this.cursor.removeDeleteButton();
479
+ let e = new h({
464
480
  lineStyle: this.lineStyle,
465
481
  polygonStyle: this.polygonStyle
466
482
  });
467
483
  this.currentMeasureMesh = e, e.line.setStyle({ cssStyle: "pointer-events: none;" }), this.pointSelector.actionIfNoIntersection = "disable", this.updateSelectAdsorbedHelper();
468
- let t = new l({
484
+ let t = new u({
469
485
  occlusionMode: "depthTest",
470
486
  occlusionVisibility: !0
471
- }), n = new u({
487
+ }), n = new d({
472
488
  ...this.lineStyle,
473
489
  dashed: !0,
474
490
  cssStyle: "pointer-events: none;"
475
- }), i = new d(this.polygonStyle), a = new r({
491
+ }), i = new f(this.polygonStyle), a = new r({
476
492
  ...this.lineStyle,
477
493
  lineOpacity: .5,
478
494
  lineColor: 3407837,
@@ -484,12 +500,12 @@ var Q = class extends e {
484
500
  lineColor: 3407837,
485
501
  dashed: !0,
486
502
  cssStyle: "pointer-events: none; opacity: 0.5;"
487
- }), s = new l({
503
+ }), s = new u({
488
504
  occlusionMode: "depthTest",
489
505
  occlusionVisibility: !0,
490
506
  color: 3407837,
491
507
  opacity: .5
492
- }), c = null, h = !1, g = !1, _ = (e) => {
508
+ }), c = null, l = !1, g = !1, _ = (e) => {
493
509
  e.key === "Shift" && (g = !0);
494
510
  }, v = (e) => {
495
511
  e.key === "Shift" && (g = !1);
@@ -498,18 +514,18 @@ var Q = class extends e {
498
514
  };
499
515
  this.group.add(e), document.addEventListener("keydown", _), document.addEventListener("keyup", v);
500
516
  let b = (r) => {
501
- if (!r) y(), c = null, h = !1;
517
+ if (!r) y(), c = null, l = !1;
502
518
  else {
503
- if (e.points.length === 0 && (this.pointSelector.actionIfNoIntersection = "disable", this.group.addIfNotExists(t), t.position.copy(r.point), c = null, h = !1), e.points.length >= 1) {
519
+ if (e.points.length === 0 && (this.pointSelector.actionIfNoIntersection = "disable", this.group.addIfNotExists(t), t.position.copy(r.point), c = null, l = !1), e.points.length >= 1) {
504
520
  if (this.pointSelector.actionIfNoIntersection = "virtualPoint", t.removeFromParent(), this.group.addIfNotExists(n), n.setStyle({
505
521
  ...this.lineStyle,
506
522
  dashed: !0,
507
523
  cssStyle: "pointer-events: none;"
508
- }), n.setPoints([e.points.at(-1), r.point]), r.isAdsorbed) a.removeFromParent(), o.removeFromParent(), s.removeFromParent(), c = null, h = !1;
524
+ }), n.setPoints([e.points.at(-1), r.point]), r.isAdsorbed) a.removeFromParent(), o.removeFromParent(), s.removeFromParent(), c = null, l = !1;
509
525
  else {
510
526
  let t = e.points.at(-1);
511
527
  if (Math.abs(r.point.y - t.y) > .2) {
512
- let e = new f.Vector3(r.point.x, t.y, r.point.z);
528
+ let e = new p.Vector3(r.point.x, t.y, r.point.z);
513
529
  a.setStyle({
514
530
  ...this.lineStyle,
515
531
  lineOpacity: .5,
@@ -522,10 +538,10 @@ var Q = class extends e {
522
538
  lineColor: 3407837,
523
539
  dashed: !0,
524
540
  cssStyle: "pointer-events: none; opacity: 0.5;"
525
- }), a.setPoints([t, e]), o.setPoints([e, r.point]), s.position.copy(e), c = e.clone(), h = !0;
541
+ }), a.setPoints([t, e]), o.setPoints([e, r.point]), s.position.copy(e), c = e.clone(), l = !0;
526
542
  } else {
527
- let e = new f.Vector3();
528
- e = Math.abs(r.point.x - t.x) < Math.abs(r.point.z - t.z) ? new f.Vector3(r.point.x, t.y, t.z) : new f.Vector3(t.x, t.y, r.point.z), a.setStyle({
543
+ let e = new p.Vector3();
544
+ e = Math.abs(r.point.x - t.x) < Math.abs(r.point.z - t.z) ? new p.Vector3(r.point.x, t.y, t.z) : new p.Vector3(t.x, t.y, r.point.z), a.setStyle({
529
545
  ...this.lineStyle,
530
546
  lineOpacity: .5,
531
547
  lineColor: 3407837,
@@ -537,28 +553,28 @@ var Q = class extends e {
537
553
  lineColor: 3407837,
538
554
  dashed: !0,
539
555
  cssStyle: "pointer-events: none; opacity: 0.5;"
540
- }), a.setPoints([t, e]), o.setPoints([e, r.point]), s.position.copy(e), c = e.clone(), h = !0;
556
+ }), a.setPoints([t, e]), o.setPoints([e, r.point]), s.position.copy(e), c = e.clone(), l = !0;
541
557
  }
542
558
  this.group.addIfNotExists(a, o, s);
543
559
  }
544
560
  }
545
561
  if (e.points.length >= 2) {
546
562
  let t = [...e.points, r.point];
547
- p(t) ? (i.setStyle({ ...this.polygonStyle }), i.setPoints(t), this.group.addIfNotExists(i)) : i.removeFromParent();
563
+ m(t) ? (i.setStyle({ ...this.polygonStyle }), i.setPoints(t), this.group.addIfNotExists(i)) : i.removeFromParent();
548
564
  }
549
565
  }
550
566
  }, x = (t) => {
551
567
  if (!t) return;
552
568
  let n = t.point;
553
- g && h && c && e.points.length >= 1 && (n = c.clone()), y(), e.setPoints([...e.points, n]), this.updateSelectAdsorbedHelper(), e.isPolygon && (this.currentEndReason = "polygon", this.pointSelector.disable());
569
+ g && l && c && e.points.length >= 1 && (n = c.clone()), y(), e.setPoints([...e.points, n]), this.updateSelectAdsorbedHelper(), this.publishInteraction("drawing"), e.isPolygon && (this.currentEndReason = "polygon", this.pointSelector.disable());
554
570
  }, S = () => {
555
- e?.setPoints(e.points.slice(0, -1)), y(), this.pointSelector.pointSelectorHelper?.magnifier?.render(), this.updateSelectAdsorbedHelper(), this.five.needsRender = !0;
571
+ e?.setPoints(e.points.slice(0, -1)), y(), this.pointSelector.pointSelectorHelper?.magnifier?.render(), this.updateSelectAdsorbedHelper(), this.publishInteraction("drawing"), this.five.needsRender = !0;
556
572
  }, C = () => {
557
573
  this.pointSelector.off("intersectionUpdate", b), this.pointSelector.off("select", x), this.pointSelector.off("disable", C), this.off("undo", S), document.removeEventListener("keydown", _), document.removeEventListener("keyup", v), e.line.setStyle({ cssStyle: "pointer-events: auto;" }), y();
558
574
  let t = this.currentEndReason, n = !0;
559
- t === "escape" ? n = !1 : e.points.length < 2 ? (e.removeFromParent(), t = "points_insufficient", n = !1) : this.addMeshEventListeners(e), e.__five_pano_index = this.five.panoIndex, this.currentMeasureMesh = null, this.listener.removeMeasureListener(), this.emit("measureEnd", t, n ? e.points : []), this.currentEndReason = "enter";
575
+ t === "escape" ? n = !1 : e.points.length < 2 ? (e.removeFromParent(), t = "points_insufficient", n = !1) : this.addMeshEventListeners(e), e.__five_pano_index = this.five.panoIndex, this.currentMeasureMesh = null, this.publishInteraction("idle"), this.listener.removeMeasureListener(), this.emit("measureEnd", t, n ? e.points : []), this.currentEndReason = "enter";
560
576
  };
561
- this.on("undo", S), this.pointSelector.on("intersectionUpdate", b), this.pointSelector.on("select", x), this.pointSelector.on("disable", C), this.pointSelector.enable();
577
+ this.on("undo", S), this.pointSelector.on("intersectionUpdate", b), this.pointSelector.on("select", x), this.pointSelector.on("disable", C), this.pointSelector.enable(), this.publishInteraction("drawing");
562
578
  };
563
579
  endMeasure = () => {
564
580
  this.currentEndReason = "external", this.pointSelector.disable();
@@ -628,31 +644,32 @@ var Q = class extends e {
628
644
  this.currentMeasureMesh?.removeFromParent(), this.currentMeasureMesh = null, this.pointSelector.disable();
629
645
  };
630
646
  clear = () => {
631
- this.currentMeasureMesh = null, this.pointSelector.disable(), this.group.children.forEach(this.removeMeshEventListeners), this.group.removeChildren(), this.cursor.removeDeleteButton();
647
+ this.cleanupPendingPress?.(), this.cancelRepositioning(), this.currentMeasureMesh = null, this.pointSelector.disable(), this.group.children.forEach(this.removeMeshEventListeners), this.group.removeChildren(), this.cursor.removeDeleteButton(), this.publishInteraction("idle");
632
648
  };
633
649
  dispose = () => {
634
- this.listener.removeMeasureListener(), this.listener.removeClickListener(), this.pointSelector.disable(), this.disposeGlobalTouchHandler(), this.clear();
650
+ this.listener.removeMeasureListener(), this.listener.removeClickListener(), this.pointSelector.disable(), this.clear(), this.endpointPointerElement?.removeEventListener("pointerdown", this.onEndpointPointerDown, !0), this.endpointPointerElement = void 0, this._fiveDomEvents?.dispose();
635
651
  };
636
652
  listener = {
637
653
  addClickListener: () => {
638
- this.five.on("panoArrived", this.onMoveToPano), this.five.on("modeChange", this.onModeChange), J("delete, backspace", this.deleteSelectedMesh), this.initEventListeners();
654
+ this.five.on("panoArrived", this.onMoveToPano), this.five.on("modeChange", this.onModeChange), Y("delete, backspace", this.deleteSelectedMesh), this.initEventListeners();
639
655
  },
640
656
  removeClickListener: () => {
641
657
  this.group.children.forEach((e) => {
642
658
  e.line.doms?.forEach((e) => {
643
659
  e?.container && (e.container.onclick = null, e.container.onmouseenter = null, e.container.onmouseleave = null);
644
660
  }), e.polygon.areaDom?.container && (e.polygon.areaDom.container.onclick = null, e.polygon.areaDom.container.onmouseenter = null, e.polygon.areaDom.container.onmouseleave = null);
645
- }), this.fiveDomEvents.clear(), this.five.off("panoArrived", this.onMoveToPano), this.five.off("modeChange", this.onModeChange), J.unbind("delete, backspace");
661
+ }), this.fiveDomEvents.clear(), this.five.off("panoArrived", this.onMoveToPano), this.five.off("modeChange", this.onModeChange), Y.unbind("delete, backspace");
646
662
  },
647
663
  addMeasureListener: () => {
648
- J("ctrl+z, command+z", this.undo), J("esc", this.cancel), J("enter", this.endMeasureByEnter), this.five.on("mode.change", this.endMeasureByModeChange), this.five.on("pano.moveTo", this.endMeasureByPanoMove), this.five.on("model.changeShownFloor", this.endMeasureByFloorChange);
664
+ Y("ctrl+z, command+z", this.undo), Y("esc", this.cancel), Y("enter", this.endMeasureByEnter), this.five.on("mode.change", this.endMeasureByModeChange), this.five.on("pano.moveTo", this.endMeasureByPanoMove), this.five.on("model.changeShownFloor", this.endMeasureByFloorChange);
649
665
  },
650
666
  removeMeasureListener: () => {
651
- J.unbind("ctrl+z, command+z"), J.unbind("esc"), J.unbind("enter"), this.five.off("mode.change", this.endMeasureByModeChange), this.five.off("pano.moveTo", this.endMeasureByPanoMove), this.five.off("model.changeShownFloor", this.endMeasureByFloorChange);
667
+ Y.unbind("ctrl+z, command+z"), Y.unbind("esc"), Y.unbind("enter"), this.five.off("mode.change", this.endMeasureByModeChange), this.five.off("pano.moveTo", this.endMeasureByPanoMove), this.five.off("model.changeShownFloor", this.endMeasureByFloorChange);
652
668
  }
653
669
  };
654
670
  onMoveToPano = (e) => {
655
- let t = this.group.children.filter((e) => e !== this.currentMeasureMesh), n = new a();
671
+ this.cleanupPendingPress?.(), this.cancelRepositioning();
672
+ let t = this.group.children.filter((e) => e !== this.currentMeasureMesh), n = new o();
656
673
  t.forEach((t) => {
657
674
  t.unselect(), t.__five_pano_index === e ? t.visible = !0 : (t.visible = !!t.line.points?.some((e) => {
658
675
  let t = e.clone().sub(this.five.camera.position).normalize();
@@ -665,7 +682,7 @@ var Q = class extends e {
665
682
  });
666
683
  };
667
684
  onModeChange = (e) => {
668
- e === "Mapview" && this.group.children.forEach((e) => {
685
+ this.cleanupPendingPress?.(), this.cancelRepositioning(), e === "Mapview" && this.group.children.forEach((e) => {
669
686
  e.visible = !0;
670
687
  });
671
688
  };
@@ -680,7 +697,7 @@ var Q = class extends e {
680
697
  if (e && ("touches" in e && e.touches && e.touches[0] ? (r = e.touches[0].clientX, i = e.touches[0].clientY) : "clientX" in e && "clientY" in e && (r = e.clientX, i = e.clientY)), r === void 0 || i === void 0) return;
681
698
  this.group.children.forEach((e) => e.unselect()), n.select();
682
699
  let a = () => {
683
- this.removeMeshEventListeners(n), n.removeFromParent(), this.cursor.removeDeleteButton(), this.five.needsRender = !0;
700
+ this.removeMeshEventListeners(n), n.removeFromParent(), this.publishInteraction("idle"), this.cursor.removeDeleteButton(), this.five.needsRender = !0;
684
701
  }, o = this.five.getElement()?.parentElement || document.body;
685
702
  this.cursor.showDeleteButton({
686
703
  clientX: r,
@@ -702,17 +719,20 @@ var Q = class extends e {
702
719
  t && t.unhover();
703
720
  };
704
721
  deleteSelectedMesh = () => {
705
- this.group.children.filter((e) => e.selected).forEach((e) => {
722
+ this.cleanupPendingPress?.(), this.cancelRepositioning(), this.group.children.filter((e) => e.selected).forEach((e) => {
706
723
  this.removeMeshEventListeners(e), e.removeFromParent();
707
- }), this.cursor.removeDeleteButton(), this.five.needsRender = !0;
724
+ }), this.cursor.removeDeleteButton(), this.publishInteraction("idle"), this.five.needsRender = !0;
708
725
  };
709
726
  removeMeshEventListeners = (e) => {
727
+ this.removeEndpointLongPressListeners(e), e.line.doms?.forEach((e) => {
728
+ e?.container && (e.container.onclick = null, e.container.onmouseenter = null, e.container.onmouseleave = null);
729
+ }), e.polygon.areaDom?.container && (e.polygon.areaDom.container.onclick = null, e.polygon.areaDom.container.onmouseenter = null, e.polygon.areaDom.container.onmouseleave = null), this.fiveDomEvents.removeEventListener(e, "click"), this.fiveDomEvents.removeEventListener(e, "hover"), this.fiveDomEvents.removeEventListener(e, "unHover");
730
+ };
731
+ removeEndpointLongPressListeners = (e) => {
710
732
  e.line.pointMeshes?.forEach((e) => {
711
733
  let t = e.__longPressCleanup;
712
734
  t && (t(), delete e.__longPressCleanup);
713
- }), e.line.doms?.forEach((e) => {
714
- e?.container && (e.container.onclick = null, e.container.onmouseenter = null, e.container.onmouseleave = null);
715
- }), e.polygon.areaDom?.container && (e.polygon.areaDom.container.onclick = null, e.polygon.areaDom.container.onmouseenter = null, e.polygon.areaDom.container.onmouseleave = null), this.fiveDomEvents.removeEventListener(e, "click"), this.fiveDomEvents.removeEventListener(e, "hover"), this.fiveDomEvents.removeEventListener(e, "unHover");
735
+ });
716
736
  };
717
737
  updateSelectAdsorbedHelper = () => {
718
738
  if (!this.currentMeasureMesh || this.currentMeasureMesh.points.length === 0) this.pointSelector.setAdherePoints(null), this.pointSelector.adhereLine = [], this.pointSelector.adherePlane = [];
@@ -721,13 +741,13 @@ var Q = class extends e {
721
741
  this.pointSelector.setAdherePoints([this.currentMeasureMesh.points[0]]);
722
742
  let e = this.currentMeasureMesh.points.at(-1);
723
743
  this.pointSelector.adhereLine = [
724
- new f.Line3(new f.Vector3(1, 0, 0).add(e), new f.Vector3(-1, 0, 0).add(e)),
725
- new f.Line3(new f.Vector3(0, 1, 0).add(e), new f.Vector3(0, -1, 0).add(e)),
726
- new f.Line3(new f.Vector3(0, 0, 1).add(e), new f.Vector3(0, 0, -1).add(e))
744
+ new p.Line3(new p.Vector3(1, 0, 0).add(e), new p.Vector3(-1, 0, 0).add(e)),
745
+ new p.Line3(new p.Vector3(0, 1, 0).add(e), new p.Vector3(0, -1, 0).add(e)),
746
+ new p.Line3(new p.Vector3(0, 0, 1).add(e), new p.Vector3(0, 0, -1).add(e))
727
747
  ], this.pointSelector.adherePlane = [];
728
748
  }
729
749
  if (this.currentMeasureMesh.points.length >= 3) {
730
- let e = new f.Plane().setFromCoplanarPoints(this.currentMeasureMesh.points[0], this.currentMeasureMesh.points[1], this.currentMeasureMesh.points[2]);
750
+ let e = new p.Plane().setFromCoplanarPoints(this.currentMeasureMesh.points[0], this.currentMeasureMesh.points[1], this.currentMeasureMesh.points[2]);
731
751
  this.pointSelector.adherePlane = [e];
732
752
  } else this.pointSelector.adherePlane = [];
733
753
  }
@@ -743,64 +763,60 @@ var Q = class extends e {
743
763
  target: e
744
764
  }), e.polygon.areaDom.container.onmouseenter = () => this.onHover({ target: e }), e.polygon.areaDom.container.onmouseleave = () => this.onUnHover({ target: e })), this.fiveDomEvents.addEventListener(e, "click", this.onClick), this.fiveDomEvents.addEventListener(e, "hover", this.onHover), this.fiveDomEvents.addEventListener(e, "unHover", this.onUnHover);
745
765
  };
766
+ onEndpointPointerDown = (e) => {
767
+ if (e.button !== 0 || !e.isPrimary || this.currentMeasureMesh || this.repositioningState) return;
768
+ let t = this.five.getElement().getBoundingClientRect(), n, r = e.pointerType === "touch" ? 30 : 12;
769
+ for (let a of this.group.children) for (let o of a.line.pointMeshes) {
770
+ if (!i(o)) continue;
771
+ let a = o.getWorldPosition(new p.Vector3()).project(this.five.camera);
772
+ if (a.z < -1 || a.z > 1) continue;
773
+ let s = t.left + (a.x + 1) * t.width / 2, c = t.top + (1 - a.y) * t.height / 2, l = Math.hypot(e.clientX - s, e.clientY - c);
774
+ l <= r && (n = o, r = l);
775
+ }
776
+ n ? this.endpointPressHandlers.get(n)?.(e) : this.interactionResult && this.publishInteraction("idle");
777
+ };
746
778
  addEndpointLongPressListeners = (e) => {
747
- this.setupGlobalTouchHandler(), e.line.pointMeshes.forEach((t, n) => {
748
- let r, i = !1, a = n;
749
- e.isPolygon && e.points.length > 3 && (n === e.line.pointMeshes.length - 1 && (a = 0), n >= e.points.length && (a = 0));
750
- let o = (n) => {
751
- if (this.currentMeasureMesh) return;
752
- i = !1;
753
- let o = null;
754
- n.origDomEvent && ("clientX" in n.origDomEvent && "clientY" in n.origDomEvent ? o = {
755
- x: n.origDomEvent.clientX,
756
- y: n.origDomEvent.clientY
757
- } : "touches" in n.origDomEvent && n.origDomEvent.touches && n.origDomEvent.touches[0] ? o = {
758
- x: n.origDomEvent.touches[0].clientX,
759
- y: n.origDomEvent.touches[0].clientY
760
- } : "changedTouches" in n.origDomEvent && n.origDomEvent.changedTouches && n.origDomEvent.changedTouches[0] && (o = {
761
- x: n.origDomEvent.changedTouches[0].clientX,
762
- y: n.origDomEvent.changedTouches[0].clientY
763
- })), n.stopPropagation(), n.origDomEvent && (n.origDomEvent.preventDefault(), n.origDomEvent.stopPropagation()), this.showLongPressIndicator(t, o);
764
- let s = (e) => {
765
- if (o) {
766
- let t, n;
767
- if ("touches" in e && e.touches[0]) t = e.touches[0].clientX, n = e.touches[0].clientY;
768
- else if ("clientX" in e) t = e.clientX, n = e.clientY;
769
- else return;
770
- Math.sqrt((t - o.x) ** 2 + (n - o.y) ** 2) > 10 && (this.hideLongPressIndicator(), r &&= (clearTimeout(r), void 0), this.cleanupGlobalListeners?.());
771
- }
779
+ let t = this.five.getElement();
780
+ t !== this.endpointPointerElement && (this.endpointPointerElement?.removeEventListener("pointerdown", this.onEndpointPointerDown, !0), this.endpointPointerElement = t, t?.addEventListener("pointerdown", this.onEndpointPointerDown, !0)), e.line.pointMeshes.forEach((t, n) => {
781
+ let r = e.isPolygon && n >= e.points.length - 1 ? 0 : n, i = !1, a, o = (n) => {
782
+ this.cleanupPendingPress?.(), i = !1;
783
+ let o = {
784
+ x: n.clientX,
785
+ y: n.clientY
772
786
  };
773
- this.cleanupGlobalListeners = () => {
774
- document.removeEventListener("mousemove", s), document.removeEventListener("touchmove", s);
775
- }, document.addEventListener("mousemove", s), document.addEventListener("touchmove", s, { passive: !1 }), r = setTimeout(() => {
776
- i = !0, this.cleanupGlobalListeners?.(), this.hideLongPressIndicator(), this.startRepositioning(e, a, !0, o);
787
+ this.showLongPressIndicator(t, o);
788
+ let s = (e) => {
789
+ e.pointerId === n.pointerId && (!(e.buttons & 1) || Math.hypot(e.clientX - o.x, e.clientY - o.y) > 10) && a?.();
790
+ }, c = (e) => {
791
+ e.pointerId === n.pointerId && a?.();
792
+ }, l = (e) => {
793
+ e.pointerId !== n.pointerId && a?.();
794
+ }, u = (e) => {
795
+ e.key === "Escape" && a?.();
796
+ }, d = () => a?.(), f = setTimeout(() => {
797
+ a?.(!1), i = !0, this.startRepositioning(e, r, !0, o, n);
777
798
  }, 500);
778
- }, s = () => {
779
- r &&= (clearTimeout(r), void 0), this.cleanupGlobalListeners?.(), this.hideLongPressIndicator(), i && this.repositioningState && (this.repositioningState.isDragMode && this.repositioningState.hasMoved || this.repositioningState.isDragMode, i = !1);
780
- }, c = (e) => {
799
+ a = (e = !0) => {
800
+ clearTimeout(f), document.removeEventListener("pointermove", s, !0), document.removeEventListener("pointerup", c, !0), document.removeEventListener("pointercancel", c, !0), document.removeEventListener("pointerdown", l, !0), document.removeEventListener("keydown", u), window.removeEventListener("blur", d), this.hideLongPressIndicator(), this.cleanupPendingPress === a && (this.cleanupPendingPress = void 0, e && this.publishInteraction("idle"));
801
+ }, this.cleanupPendingPress = a, document.addEventListener("pointermove", s, !0), document.addEventListener("pointerup", c, !0), document.addEventListener("pointercancel", c, !0), document.addEventListener("pointerdown", l, !0), document.addEventListener("keydown", u), window.addEventListener("blur", d), this.publishInteraction("holding");
802
+ }, s = (e) => {
781
803
  if (i) return e.stopPropagation(), i = !1, !1;
782
804
  };
783
- this.fiveDomEvents.addEventListener(t, "mousedown", o), this.fiveDomEvents.addEventListener(t, "mouseup", s), this.fiveDomEvents.addEventListener(t, "click", c), t.__longPressHandlers = {
784
- onPointerDown: o,
785
- onPointerUp: s,
786
- onClick: c,
787
- measureMesh: e,
788
- pointIndex: a
789
- }, t.__longPressCleanup = () => {
790
- r && clearTimeout(r), this.cleanupGlobalListeners?.(), this.hideLongPressIndicator(), this.fiveDomEvents.removeEventListener(t, "mousedown", o), this.fiveDomEvents.removeEventListener(t, "mouseup", s), this.fiveDomEvents.removeEventListener(t, "click", c), delete t.__longPressHandlers;
805
+ this.endpointPressHandlers.set(t, o), this.fiveDomEvents.addEventListener(t, "click", s), t.__longPressCleanup = () => {
806
+ this.cleanupPendingPress === a && a?.(), this.endpointPressHandlers.delete(t), this.fiveDomEvents.removeEventListener(t, "click", s);
791
807
  };
792
808
  });
793
809
  };
794
810
  load = (e) => {
795
811
  this.clear(), e.forEach((e) => {
796
- let t = new m({
812
+ let t = new h({
797
813
  lineStyle: this.lineStyle,
798
814
  polygonStyle: this.polygonStyle
799
815
  });
800
816
  this.group.add(t), t.setPoints(e.points), this.addMeshEventListeners(t), t.__five_pano_index = this.five.panoIndex;
801
- }), this.five.needsRender = !0;
817
+ }), this.publishInteraction("idle"), this.five.needsRender = !0;
802
818
  };
803
- startRepositioning = (e, t, n = !1, r) => {
819
+ startRepositioning = (e, t, n = !1, r, i) => {
804
820
  this.currentMeasureMesh || this.repositioningState || (this.repositioningState = {
805
821
  measureMesh: e,
806
822
  pointIndex: t,
@@ -809,7 +825,7 @@ var Q = class extends e {
809
825
  isDragMode: n,
810
826
  mouseDownPosition: r || void 0,
811
827
  hasMoved: !1
812
- }, this.applyRepositioningStyle(e, !0), this.five.on("wantsGesture", this.preventFiveGestures), n ? this.enableGlobalMouseTracking() : (this.pointSelector.actionIfNoIntersection = "virtualPoint", this.pointSelector.enable(), this.pointSelector.on("intersectionUpdate", this.onRepositioningMove), this.pointSelector.on("select", this.onRepositioningConfirm), this.pointSelector.on("disable", this.cancelRepositioning)), J("esc", this.cancelRepositioning));
828
+ }, this.applyRepositioningStyle(e, !0), this.five.on("wantsGesture", this.preventFiveGestures), n ? this.enableGlobalPointerTracking(i) : (this.pointSelector.actionIfNoIntersection = "virtualPoint", this.pointSelector.enable(), this.pointSelector.on("intersectionUpdate", this.onRepositioningMove), this.pointSelector.on("select", this.onRepositioningConfirm), this.pointSelector.on("disable", this.cancelRepositioning)), this.repositioningState && (Y("esc", this.cancelRepositioning), this.publishInteraction("editing")));
813
829
  };
814
830
  updatePolygonPoints = (e, t, n, r = !1) => {
815
831
  if (e.isPolygon && t.length > 3 && n !== void 0) {
@@ -846,7 +862,7 @@ var Q = class extends e {
846
862
  }
847
863
  }
848
864
  e.isPolygon && e.polygon.setPoints(t);
849
- } else e.line.setPoints(t), e.isPolygon && e.polygon.setPoints(t);
865
+ } else this.removeEndpointLongPressListeners(e), e.line.setPoints(t), e.isPolygon && e.polygon.setPoints(t);
850
866
  };
851
867
  onRepositioningMove = (e) => {
852
868
  if (!this.repositioningState || !e) return;
@@ -858,17 +874,17 @@ var Q = class extends e {
858
874
  onRepositioningConfirm = (e) => {
859
875
  if (!this.repositioningState || !e) return;
860
876
  let { measureMesh: t, pointIndex: n } = this.repositioningState, r = [...t.points];
861
- r[n] = e.point.clone(), this.updatePolygonPoints(t, r, n, !1), this.applyRepositioningStyle(t, !1), this.addEndpointLongPressListeners(t), this.cleanupRepositioning();
877
+ r[n] = e.point.clone(), this.updatePolygonPoints(t, r, n, !1), this.applyRepositioningStyle(t, !1), this.addEndpointLongPressListeners(t), this.cleanupRepositioning(), this.publishInteraction("idle", "confirmed");
862
878
  };
863
879
  confirmRepositioningOnDragEnd = () => {
864
880
  if (!this.repositioningState) return;
865
881
  let { measureMesh: e, pointIndex: t } = this.repositioningState, n = [...e.points];
866
- this.updatePolygonPoints(e, n, t, !1), this.applyRepositioningStyle(e, !1), this.addEndpointLongPressListeners(e), this.cleanupRepositioning();
882
+ this.updatePolygonPoints(e, n, t, !1), this.applyRepositioningStyle(e, !1), this.addEndpointLongPressListeners(e), this.cleanupRepositioning(), this.publishInteraction("idle", "confirmed");
867
883
  };
868
884
  cancelRepositioning = () => {
869
885
  if (!this.repositioningState) return;
870
886
  let { measureMesh: e, originalMeshState: t } = this.repositioningState;
871
- this.updatePolygonPoints(e, t, void 0, !1), this.applyRepositioningStyle(e, !1), this.addEndpointLongPressListeners(e), this.cleanupRepositioning();
887
+ this.updatePolygonPoints(e, t, void 0, !1), this.applyRepositioningStyle(e, !1), this.addEndpointLongPressListeners(e), this.cleanupRepositioning(), this.publishInteraction("idle", "cancelled");
872
888
  };
873
889
  applyRepositioningStyle = (e, t) => {
874
890
  let n = t ? .4 : 1, r = t;
@@ -880,57 +896,47 @@ var Q = class extends e {
880
896
  e.setStyle({ opacity: n });
881
897
  });
882
898
  };
883
- enableGlobalMouseTracking = () => {
884
- let e = this.five.getElement();
885
- if (!e) return;
886
- let t = null, n = (n) => {
887
- if (!this.repositioningState) return;
888
- let r = e.getBoundingClientRect(), i = (n.clientX - r.left) / r.width * 2 - 1, a = -((n.clientY - r.top) / r.height) * 2 + 1, o = new f.Raycaster();
889
- o.setFromCamera(new f.Vector2(i, a), this.five.camera);
890
- let s = this.five.model.intersectRaycaster(o);
891
- s && s.length > 0 ? (t = {
892
- point: s[0].point,
893
- distance: s[0].distance,
894
- face: s[0].face,
895
- raycaster: o
896
- }, this.onRepositioningMove(t)) : (t = {
897
- point: o.ray.origin.clone().add(o.ray.direction.clone().multiplyScalar(5)),
898
- distance: 5,
899
- raycaster: o,
900
- isVirtual: !0
901
- }, this.onRepositioningMove(t));
902
- }, r = (n) => {
903
- if (!this.repositioningState || !n.touches[0]) return;
904
- let r = e.getBoundingClientRect(), i = n.touches[0], a = (i.clientX - r.left) / r.width * 2 - 1, o = -((i.clientY - r.top) / r.height) * 2 + 1, s = new f.Raycaster();
905
- s.setFromCamera(new f.Vector2(a, o), this.five.camera);
906
- let c = this.five.model.intersectRaycaster(s);
907
- c && c.length > 0 ? (t = {
908
- point: c[0].point,
909
- distance: c[0].distance,
910
- face: c[0].face,
911
- raycaster: s
912
- }, this.onRepositioningMove(t)) : (t = {
913
- point: s.ray.origin.clone().add(s.ray.direction.clone().multiplyScalar(5)),
899
+ enableGlobalPointerTracking = (e) => {
900
+ let t = this.five.getElement();
901
+ if (!t || !e) {
902
+ this.cancelRepositioning();
903
+ return;
904
+ }
905
+ let n = e.target instanceof Element ? e.target : null, r = (n) => {
906
+ if (n.pointerId !== e.pointerId || !this.repositioningState) return;
907
+ if (!(n.buttons & 1)) {
908
+ this.cancelRepositioning();
909
+ return;
910
+ }
911
+ n.preventDefault();
912
+ let r = t.getBoundingClientRect(), i = new p.Raycaster();
913
+ i.setFromCamera(new p.Vector2((n.clientX - r.left) / r.width * 2 - 1, -((n.clientY - r.top) / r.height) * 2 + 1), this.five.camera);
914
+ let a = this.five.model.intersectRaycaster(i)[0];
915
+ this.onRepositioningMove(a ? {
916
+ ...a,
917
+ raycaster: i
918
+ } : {
919
+ point: i.ray.at(5, new p.Vector3()),
914
920
  distance: 5,
915
- raycaster: s,
921
+ raycaster: i,
916
922
  isVirtual: !0
917
- }, this.onRepositioningMove(t));
918
- }, i = (e) => {
919
- this.repositioningState && (t ? this.onRepositioningConfirm(t) : this.confirmRepositioningOnDragEnd());
920
- }, a = (e) => {
921
- this.repositioningState && (t ? this.onRepositioningConfirm(t) : this.confirmRepositioningOnDragEnd());
922
- }, o = (e) => {
923
- this.repositioningState && t && this.onRepositioningConfirm(t);
924
- };
925
- document.addEventListener("mousemove", n), document.addEventListener("mouseup", i), document.addEventListener("click", o), document.addEventListener("touchmove", r, { passive: !1 }), document.addEventListener("touchend", a, { passive: !1 }), this.repositioningState.__globalMouseCleanup = () => {
926
- document.removeEventListener("mousemove", n), document.removeEventListener("mouseup", i), document.removeEventListener("click", o), document.removeEventListener("touchmove", r), document.removeEventListener("touchend", a);
923
+ });
924
+ }, i = (t) => {
925
+ t.pointerId === e.pointerId && (t.type === "pointerup" ? this.confirmRepositioningOnDragEnd() : this.cancelRepositioning());
926
+ }, a = (t) => {
927
+ t.pointerId !== e.pointerId && this.cancelRepositioning();
927
928
  };
929
+ document.addEventListener("pointermove", r, {
930
+ capture: !0,
931
+ passive: !1
932
+ }), document.addEventListener("pointerup", i, !0), document.addEventListener("pointercancel", i, !0), document.addEventListener("pointerdown", a, !0), n?.addEventListener("lostpointercapture", this.cancelRepositioning), window.addEventListener("blur", this.cancelRepositioning), this.cleanupRepositioningListeners = () => {
933
+ document.removeEventListener("pointermove", r, !0), document.removeEventListener("pointerup", i, !0), document.removeEventListener("pointercancel", i, !0), document.removeEventListener("pointerdown", a, !0), n?.removeEventListener("lostpointercapture", this.cancelRepositioning), window.removeEventListener("blur", this.cancelRepositioning), n?.hasPointerCapture(e.pointerId) && n.releasePointerCapture(e.pointerId);
934
+ }, n?.setPointerCapture(e.pointerId);
928
935
  };
929
936
  showLongPressIndicator = (e, t) => {
930
937
  this.hideLongPressIndicator();
931
938
  let n = this.five.getElement();
932
939
  if (!n) return;
933
- this.five.on("wantsGesture", this.preventFiveGestures);
934
940
  let r = document.createElement("div");
935
941
  if (r.style.position = "absolute", r.style.width = "80px", r.style.height = "80px", r.style.border = "6px solid #f0f0f0", r.style.borderRadius = "50%", r.style.pointerEvents = "none", r.style.zIndex = "10000", r.style.boxSizing = "border-box", r.style.animation = "longPressShrink 500ms linear forwards", !document.querySelector("#longpress-keyframes")) {
936
942
  let e = document.createElement("style");
@@ -938,90 +944,20 @@ var Q = class extends e {
938
944
  }
939
945
  if (t) r.style.left = `${t.x}px`, r.style.top = `${t.y}px`, r.style.transform = "translate(-50%, -50%)";
940
946
  else {
941
- let t = e.getWorldPosition(new f.Vector3()).clone().project(this.five.camera), i = n.getBoundingClientRect(), a = (t.x + 1) * i.width / 2 + i.left, o = (-t.y + 1) * i.height / 2 + i.top;
947
+ let t = e.getWorldPosition(new p.Vector3()).clone().project(this.five.camera), i = n.getBoundingClientRect(), a = (t.x + 1) * i.width / 2 + i.left, o = (-t.y + 1) * i.height / 2 + i.top;
942
948
  r.style.left = `${a}px`, r.style.top = `${o}px`, r.style.transform = "translate(-50%, -50%)";
943
949
  }
944
950
  document.body.appendChild(r), this.longPressIndicator = r;
945
951
  };
946
952
  hideLongPressIndicator = () => {
947
- this.longPressIndicator && (this.longPressIndicator.remove(), this.longPressIndicator = null, this.five.off("wantsGesture", this.preventFiveGestures));
953
+ this.longPressIndicator &&= (this.longPressIndicator.remove(), null);
948
954
  };
949
955
  preventFiveGestures = () => !1;
950
956
  cleanupRepositioning = () => {
951
- if (this.repositioningState) {
952
- let e = this.repositioningState.__globalMouseCleanup;
953
- e && e(), this.repositioningState.isDragMode || (this.pointSelector.off("intersectionUpdate", this.onRepositioningMove), this.pointSelector.off("select", this.onRepositioningConfirm), this.pointSelector.off("disable", this.cancelRepositioning), this.pointSelector.disable());
954
- }
955
- this.five.off("wantsGesture", this.preventFiveGestures), J.unbind("esc", this.cancelRepositioning), this.repositioningState = null, this.five.needsRender = !0;
956
- };
957
- setupGlobalTouchHandler = () => {
958
- if (this.globalTouchHandler?.isSetup) return;
959
- let e = this.five.getElement();
960
- if (!e) return;
961
- let t = (t) => {
962
- if (this.currentMeasureMesh) return;
963
- let n = t.touches[0];
964
- if (!n) return;
965
- let r = e.getBoundingClientRect(), i = (n.clientX - r.left) / r.width * 2 - 1, a = -((n.clientY - r.top) / r.height) * 2 + 1, o = new f.Raycaster();
966
- o.setFromCamera(new f.Vector2(i, a), this.five.camera), o.params.Points.threshold = .5, o.params.Line.threshold = .1, o.params.Mesh = {};
967
- let s = [];
968
- for (let t of this.group.children) if (t && t.line && t.line.pointMeshes) for (let r = 0; r < t.line.pointMeshes.length; r++) {
969
- let i = t.line.pointMeshes[r];
970
- if (i && o.intersectObject(i, !0).length > 0) {
971
- let t = i.__longPressHandlers;
972
- if (t) {
973
- let r = this.calculateScreenDistance(n, i, e);
974
- r < 30 && s.push({
975
- pointMesh: i,
976
- handlers: t,
977
- distance: r,
978
- measureMesh: t.measureMesh,
979
- pointIndex: t.pointIndex
980
- });
981
- }
982
- }
983
- }
984
- if (s.length > 0) {
985
- s.sort((e, t) => e.distance - t.distance);
986
- let e = s[0];
987
- if (this.repositioningState) return;
988
- let n = {
989
- type: "mousedown",
990
- target: e.pointMesh,
991
- origDomEvent: t,
992
- raycaster: o,
993
- intersects: [{ distance: 0 }],
994
- stopPropagation: () => {
995
- t.stopPropagation();
996
- }
997
- };
998
- e.handlers && typeof e.handlers.onPointerDown == "function" && e.handlers.onPointerDown(n);
999
- }
1000
- }, n = (e) => {
1001
- for (let e of this.group.children) if (e && e.line && e.line.pointMeshes) for (let t of e.line.pointMeshes) {
1002
- if (!t) continue;
1003
- let e = t.__longPressHandlers;
1004
- e && typeof e.onPointerUp == "function" && e.onPointerUp();
1005
- }
1006
- };
1007
- e.addEventListener("touchstart", t, { passive: !1 }), e.addEventListener("touchend", n, { passive: !1 }), this.globalTouchHandler = {
1008
- isSetup: !0,
1009
- onTouchStart: t,
1010
- onTouchEnd: n
1011
- };
1012
- };
1013
- disposeGlobalTouchHandler = () => {
1014
- if (this.globalTouchHandler?.isSetup) {
1015
- let e = this.five.getElement();
1016
- e && (e.removeEventListener("touchstart", this.globalTouchHandler.onTouchStart), e.removeEventListener("touchend", this.globalTouchHandler.onTouchEnd)), this.globalTouchHandler = null;
1017
- }
1018
- };
1019
- calculateScreenDistance = (e, t, n) => {
1020
- let r = e.clientX, i = e.clientY, a = t.getWorldPosition(new f.Vector3()).clone().project(this.five.camera), o = n.getBoundingClientRect(), s = (a.x + 1) * o.width / 2 + o.left, c = (-a.y + 1) * o.height / 2 + o.top, l = r - s, u = i - c;
1021
- return Math.sqrt(l * l + u * u);
957
+ this.cleanupRepositioningListeners?.(), this.cleanupRepositioningListeners = void 0, this.repositioningState && (this.repositioningState.isDragMode || (this.pointSelector.off("intersectionUpdate", this.onRepositioningMove), this.pointSelector.off("select", this.onRepositioningConfirm), this.pointSelector.off("disable", this.cancelRepositioning), this.pointSelector.disable())), this.five.off("wantsGesture", this.preventFiveGestures), Y.unbind("esc", this.cancelRepositioning), this.repositioningState = null, this.five.needsRender = !0;
1022
958
  };
1023
- }, $ = (e, t) => new Q(e, t);
959
+ }, ee = (e, t) => new $(e, t);
1024
960
  //#endregion
1025
- export { p as n, $ as t };
961
+ export { m as n, ee as t };
1026
962
 
1027
- //# sourceMappingURL=measure-D6kvLcMk.js.map
963
+ //# sourceMappingURL=measure-y2GbIzBe.js.map