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

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 (69) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +6 -0
  3. package/dist/floorplan.js +1 -1
  4. package/dist/index.js +15 -15
  5. package/dist/internal/{BasePlugin-Bcnwb_Wp.js → BasePlugin-YE4dMDWJ.js} +2 -2
  6. package/dist/internal/{BasePlugin-Bcnwb_Wp.js.map → BasePlugin-YE4dMDWJ.js.map} +1 -1
  7. package/dist/internal/BasePluginWithData-BYGIbLnT.js +7 -0
  8. package/dist/internal/{BasePluginWithData-veD_f0Qf.js.map → BasePluginWithData-BYGIbLnT.js.map} +1 -1
  9. package/dist/internal/{Controller-DMHTzGm7.js → Controller-DiO9Qxpi.js} +2 -2
  10. package/dist/internal/{Controller-DMHTzGm7.js.map → Controller-DiO9Qxpi.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-Cc8wyIMJ.js} +4 -4
  16. package/dist/internal/{Rectangle-CC2WYvov.js.map → Rectangle-Cc8wyIMJ.js.map} +1 -1
  17. package/dist/internal/{Work-BqpiX1z5.js → Work-CxG2jTr2.js} +4 -4
  18. package/dist/internal/{Work-BqpiX1z5.js.map → Work-CxG2jTr2.js.map} +1 -1
  19. package/dist/internal/{area-maker-B8zUUhVk.js → area-maker-BegnIza6.js} +2 -2
  20. package/dist/internal/{area-maker-B8zUUhVk.js.map → area-maker-BegnIza6.js.map} +1 -1
  21. package/dist/internal/{controller-BBHxJoEH.js → controller-D8MTSGfb.js} +3 -3
  22. package/dist/internal/{controller-BBHxJoEH.js.map → controller-D8MTSGfb.js.map} +1 -1
  23. package/dist/internal/{cruise-DeRGFGQ7.js → cruise-Ej9TGc5U.js} +2 -2
  24. package/dist/internal/{cruise-DeRGFGQ7.js.map → cruise-Ej9TGc5U.js.map} +1 -1
  25. package/dist/internal/{current-pano-image-sc2LFrya.js → current-pano-image-CQVXZtOG.js} +2 -2
  26. package/dist/internal/{current-pano-image-sc2LFrya.js.map → current-pano-image-CQVXZtOG.js.map} +1 -1
  27. package/dist/internal/{floorplan-BOdqCcAc.js → floorplan-BMkAM7lm.js} +2 -2
  28. package/dist/internal/{floorplan-BOdqCcAc.js.map → floorplan-BMkAM7lm.js.map} +1 -1
  29. package/dist/internal/{measure-D6kvLcMk.js → measure-Comf7Ysy.js} +262 -339
  30. package/dist/internal/measure-Comf7Ysy.js.map +1 -0
  31. package/dist/internal/{model-maker-p7IecfuB.js → model-maker-CZUFGUpx.js} +3 -3
  32. package/dist/internal/{model-maker-p7IecfuB.js.map → model-maker-CZUFGUpx.js.map} +1 -1
  33. package/dist/internal/object3d-helper-CcOhIpo0.js +7 -0
  34. package/dist/internal/{object3d-helper-DHPCLk5D.js.map → object3d-helper-CcOhIpo0.js.map} +1 -1
  35. package/dist/internal/{pano-compass-B_gNSkDR.js → pano-compass-BaYsdtsu.js} +2 -2
  36. package/dist/internal/{pano-compass-B_gNSkDR.js.map → pano-compass-BaYsdtsu.js.map} +1 -1
  37. package/dist/internal/{pano-door-label-BllgT6o-.js → pano-door-label-BkWTtRu_.js} +2 -2
  38. package/dist/internal/{pano-door-label-BllgT6o-.js.map → pano-door-label-BkWTtRu_.js.map} +1 -1
  39. package/dist/internal/{pano-measure-CoyU2j3g.js → pano-measure-Dj-NC0va.js} +2 -2
  40. package/dist/internal/{pano-measure-CoyU2j3g.js.map → pano-measure-Dj-NC0va.js.map} +1 -1
  41. package/dist/internal/{pano-tag-NjpQygy3.js → pano-tag-oy6Uwfvh.js} +2 -2
  42. package/dist/internal/{pano-tag-NjpQygy3.js.map → pano-tag-oy6Uwfvh.js.map} +1 -1
  43. package/dist/internal/{pano-video-DGQi5GPp.js → pano-video-D79p2k_c.js} +2 -2
  44. package/dist/internal/{pano-video-DGQi5GPp.js.map → pano-video-D79p2k_c.js.map} +1 -1
  45. package/dist/internal/{pipeline-D3S3Qt7T.js → pipeline-koQyF_J8.js} +2 -2
  46. package/dist/internal/{pipeline-D3S3Qt7T.js.map → pipeline-koQyF_J8.js.map} +1 -1
  47. package/dist/internal/{sculpt-Cqspd_4E.js → sculpt-Ceg49sX_.js} +4 -4
  48. package/dist/internal/{sculpt-Cqspd_4E.js.map → sculpt-Ceg49sX_.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.js +1 -1
  54. package/dist/plugins/model-maker.js +1 -1
  55. package/dist/plugins/object3d-helper.js +2 -2
  56. package/dist/plugins/pano-compass.js +1 -1
  57. package/dist/plugins/pano-door-label.js +1 -1
  58. package/dist/plugins/pano-measure.js +1 -1
  59. package/dist/plugins/pano-tag.js +2 -2
  60. package/dist/plugins/pano-video.js +1 -1
  61. package/dist/plugins/pipeline.js +1 -1
  62. package/dist/plugins/sculpt.js +4 -4
  63. package/dist/types/MeasurePlugin/Controller.d.ts +8 -12
  64. package/dist/types/shared-utils/three/PointSprite.d.ts +2 -1
  65. package/package.json +1 -1
  66. package/dist/internal/BasePluginWithData-veD_f0Qf.js +0 -7
  67. package/dist/internal/Polygon-D3xIL1Pl.js.map +0 -1
  68. package/dist/internal/measure-D6kvLcMk.js.map +0 -1
  69. 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,10 @@ 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();
408
411
  get pointSelector() {
409
412
  return this._pointSelector ||= new t(this.five, {
410
413
  mode: "cursor",
@@ -414,11 +417,11 @@ var Q = class extends e {
414
417
  }
415
418
  _pointSelector;
416
419
  get fiveDomEvents() {
417
- return this._fiveDomEvents ||= new o(this.five, { fiveModels: null }), this._fiveDomEvents;
420
+ return this._fiveDomEvents ||= new s(this.five, { fiveModels: null }), this._fiveDomEvents;
418
421
  }
419
422
  _fiveDomEvents;
420
423
  get cursor() {
421
- return this._cursor ||= new s(), this._cursor;
424
+ return this._cursor ||= new c(), this._cursor;
422
425
  }
423
426
  _cursor;
424
427
  get config() {
@@ -453,26 +456,26 @@ var Q = class extends e {
453
456
  this.config = t ? {
454
457
  ...r,
455
458
  ...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();
459
+ } : 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
460
  }
458
461
  initEventListeners = () => {
459
462
  this.group.children.forEach(this.addMeshEventListeners);
460
463
  };
461
464
  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({
465
+ this.cleanupPendingPress?.(), this.repositioningState && this.cancelRepositioning(), this.listener.addMeasureListener(), Y.unbind("delete, backspace"), this.group.children.forEach((e) => e.unselect()), this.cursor.removeDeleteButton();
466
+ let e = new h({
464
467
  lineStyle: this.lineStyle,
465
468
  polygonStyle: this.polygonStyle
466
469
  });
467
470
  this.currentMeasureMesh = e, e.line.setStyle({ cssStyle: "pointer-events: none;" }), this.pointSelector.actionIfNoIntersection = "disable", this.updateSelectAdsorbedHelper();
468
- let t = new l({
471
+ let t = new u({
469
472
  occlusionMode: "depthTest",
470
473
  occlusionVisibility: !0
471
- }), n = new u({
474
+ }), n = new d({
472
475
  ...this.lineStyle,
473
476
  dashed: !0,
474
477
  cssStyle: "pointer-events: none;"
475
- }), i = new d(this.polygonStyle), a = new r({
478
+ }), i = new f(this.polygonStyle), a = new r({
476
479
  ...this.lineStyle,
477
480
  lineOpacity: .5,
478
481
  lineColor: 3407837,
@@ -484,12 +487,12 @@ var Q = class extends e {
484
487
  lineColor: 3407837,
485
488
  dashed: !0,
486
489
  cssStyle: "pointer-events: none; opacity: 0.5;"
487
- }), s = new l({
490
+ }), s = new u({
488
491
  occlusionMode: "depthTest",
489
492
  occlusionVisibility: !0,
490
493
  color: 3407837,
491
494
  opacity: .5
492
- }), c = null, h = !1, g = !1, _ = (e) => {
495
+ }), c = null, l = !1, g = !1, _ = (e) => {
493
496
  e.key === "Shift" && (g = !0);
494
497
  }, v = (e) => {
495
498
  e.key === "Shift" && (g = !1);
@@ -498,18 +501,18 @@ var Q = class extends e {
498
501
  };
499
502
  this.group.add(e), document.addEventListener("keydown", _), document.addEventListener("keyup", v);
500
503
  let b = (r) => {
501
- if (!r) y(), c = null, h = !1;
504
+ if (!r) y(), c = null, l = !1;
502
505
  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) {
506
+ 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
507
  if (this.pointSelector.actionIfNoIntersection = "virtualPoint", t.removeFromParent(), this.group.addIfNotExists(n), n.setStyle({
505
508
  ...this.lineStyle,
506
509
  dashed: !0,
507
510
  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;
511
+ }), n.setPoints([e.points.at(-1), r.point]), r.isAdsorbed) a.removeFromParent(), o.removeFromParent(), s.removeFromParent(), c = null, l = !1;
509
512
  else {
510
513
  let t = e.points.at(-1);
511
514
  if (Math.abs(r.point.y - t.y) > .2) {
512
- let e = new f.Vector3(r.point.x, t.y, r.point.z);
515
+ let e = new p.Vector3(r.point.x, t.y, r.point.z);
513
516
  a.setStyle({
514
517
  ...this.lineStyle,
515
518
  lineOpacity: .5,
@@ -522,10 +525,10 @@ var Q = class extends e {
522
525
  lineColor: 3407837,
523
526
  dashed: !0,
524
527
  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;
528
+ }), a.setPoints([t, e]), o.setPoints([e, r.point]), s.position.copy(e), c = e.clone(), l = !0;
526
529
  } 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({
530
+ let e = new p.Vector3();
531
+ 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
532
  ...this.lineStyle,
530
533
  lineOpacity: .5,
531
534
  lineColor: 3407837,
@@ -537,20 +540,20 @@ var Q = class extends e {
537
540
  lineColor: 3407837,
538
541
  dashed: !0,
539
542
  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;
543
+ }), a.setPoints([t, e]), o.setPoints([e, r.point]), s.position.copy(e), c = e.clone(), l = !0;
541
544
  }
542
545
  this.group.addIfNotExists(a, o, s);
543
546
  }
544
547
  }
545
548
  if (e.points.length >= 2) {
546
549
  let t = [...e.points, r.point];
547
- p(t) ? (i.setStyle({ ...this.polygonStyle }), i.setPoints(t), this.group.addIfNotExists(i)) : i.removeFromParent();
550
+ m(t) ? (i.setStyle({ ...this.polygonStyle }), i.setPoints(t), this.group.addIfNotExists(i)) : i.removeFromParent();
548
551
  }
549
552
  }
550
553
  }, x = (t) => {
551
554
  if (!t) return;
552
555
  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());
556
+ g && l && c && e.points.length >= 1 && (n = c.clone()), y(), e.setPoints([...e.points, n]), this.updateSelectAdsorbedHelper(), e.isPolygon && (this.currentEndReason = "polygon", this.pointSelector.disable());
554
557
  }, S = () => {
555
558
  e?.setPoints(e.points.slice(0, -1)), y(), this.pointSelector.pointSelectorHelper?.magnifier?.render(), this.updateSelectAdsorbedHelper(), this.five.needsRender = !0;
556
559
  }, C = () => {
@@ -628,31 +631,32 @@ var Q = class extends e {
628
631
  this.currentMeasureMesh?.removeFromParent(), this.currentMeasureMesh = null, this.pointSelector.disable();
629
632
  };
630
633
  clear = () => {
631
- this.currentMeasureMesh = null, this.pointSelector.disable(), this.group.children.forEach(this.removeMeshEventListeners), this.group.removeChildren(), this.cursor.removeDeleteButton();
634
+ this.cleanupPendingPress?.(), this.cancelRepositioning(), this.currentMeasureMesh = null, this.pointSelector.disable(), this.group.children.forEach(this.removeMeshEventListeners), this.group.removeChildren(), this.cursor.removeDeleteButton();
632
635
  };
633
636
  dispose = () => {
634
- this.listener.removeMeasureListener(), this.listener.removeClickListener(), this.pointSelector.disable(), this.disposeGlobalTouchHandler(), this.clear();
637
+ 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
638
  };
636
639
  listener = {
637
640
  addClickListener: () => {
638
- this.five.on("panoArrived", this.onMoveToPano), this.five.on("modeChange", this.onModeChange), J("delete, backspace", this.deleteSelectedMesh), this.initEventListeners();
641
+ this.five.on("panoArrived", this.onMoveToPano), this.five.on("modeChange", this.onModeChange), Y("delete, backspace", this.deleteSelectedMesh), this.initEventListeners();
639
642
  },
640
643
  removeClickListener: () => {
641
644
  this.group.children.forEach((e) => {
642
645
  e.line.doms?.forEach((e) => {
643
646
  e?.container && (e.container.onclick = null, e.container.onmouseenter = null, e.container.onmouseleave = null);
644
647
  }), 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");
648
+ }), this.fiveDomEvents.clear(), this.five.off("panoArrived", this.onMoveToPano), this.five.off("modeChange", this.onModeChange), Y.unbind("delete, backspace");
646
649
  },
647
650
  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);
651
+ 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
652
  },
650
653
  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);
654
+ 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
655
  }
653
656
  };
654
657
  onMoveToPano = (e) => {
655
- let t = this.group.children.filter((e) => e !== this.currentMeasureMesh), n = new a();
658
+ this.cleanupPendingPress?.(), this.cancelRepositioning();
659
+ let t = this.group.children.filter((e) => e !== this.currentMeasureMesh), n = new o();
656
660
  t.forEach((t) => {
657
661
  t.unselect(), t.__five_pano_index === e ? t.visible = !0 : (t.visible = !!t.line.points?.some((e) => {
658
662
  let t = e.clone().sub(this.five.camera.position).normalize();
@@ -665,7 +669,7 @@ var Q = class extends e {
665
669
  });
666
670
  };
667
671
  onModeChange = (e) => {
668
- e === "Mapview" && this.group.children.forEach((e) => {
672
+ this.cleanupPendingPress?.(), this.cancelRepositioning(), e === "Mapview" && this.group.children.forEach((e) => {
669
673
  e.visible = !0;
670
674
  });
671
675
  };
@@ -707,12 +711,15 @@ var Q = class extends e {
707
711
  }), this.cursor.removeDeleteButton(), this.five.needsRender = !0;
708
712
  };
709
713
  removeMeshEventListeners = (e) => {
714
+ this.removeEndpointLongPressListeners(e), e.line.doms?.forEach((e) => {
715
+ e?.container && (e.container.onclick = null, e.container.onmouseenter = null, e.container.onmouseleave = null);
716
+ }), 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");
717
+ };
718
+ removeEndpointLongPressListeners = (e) => {
710
719
  e.line.pointMeshes?.forEach((e) => {
711
720
  let t = e.__longPressCleanup;
712
721
  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");
722
+ });
716
723
  };
717
724
  updateSelectAdsorbedHelper = () => {
718
725
  if (!this.currentMeasureMesh || this.currentMeasureMesh.points.length === 0) this.pointSelector.setAdherePoints(null), this.pointSelector.adhereLine = [], this.pointSelector.adherePlane = [];
@@ -721,13 +728,13 @@ var Q = class extends e {
721
728
  this.pointSelector.setAdherePoints([this.currentMeasureMesh.points[0]]);
722
729
  let e = this.currentMeasureMesh.points.at(-1);
723
730
  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))
731
+ new p.Line3(new p.Vector3(1, 0, 0).add(e), new p.Vector3(-1, 0, 0).add(e)),
732
+ new p.Line3(new p.Vector3(0, 1, 0).add(e), new p.Vector3(0, -1, 0).add(e)),
733
+ new p.Line3(new p.Vector3(0, 0, 1).add(e), new p.Vector3(0, 0, -1).add(e))
727
734
  ], this.pointSelector.adherePlane = [];
728
735
  }
729
736
  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]);
737
+ let e = new p.Plane().setFromCoplanarPoints(this.currentMeasureMesh.points[0], this.currentMeasureMesh.points[1], this.currentMeasureMesh.points[2]);
731
738
  this.pointSelector.adherePlane = [e];
732
739
  } else this.pointSelector.adherePlane = [];
733
740
  }
@@ -743,64 +750,60 @@ var Q = class extends e {
743
750
  target: e
744
751
  }), 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
752
  };
753
+ onEndpointPointerDown = (e) => {
754
+ if (e.button !== 0 || !e.isPrimary || this.currentMeasureMesh || this.repositioningState) return;
755
+ let t = this.five.getElement().getBoundingClientRect(), n, r = e.pointerType === "touch" ? 30 : 12;
756
+ for (let a of this.group.children) for (let o of a.line.pointMeshes) {
757
+ if (!i(o)) continue;
758
+ let a = o.getWorldPosition(new p.Vector3()).project(this.five.camera);
759
+ if (a.z < -1 || a.z > 1) continue;
760
+ 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);
761
+ l <= r && (n = o, r = l);
762
+ }
763
+ n && this.endpointPressHandlers.get(n)?.(e);
764
+ };
746
765
  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
- }
766
+ let t = this.five.getElement();
767
+ 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) => {
768
+ let r = e.isPolygon && n >= e.points.length - 1 ? 0 : n, i = !1, a, o = (n) => {
769
+ this.cleanupPendingPress?.(), i = !1;
770
+ let o = {
771
+ x: n.clientX,
772
+ y: n.clientY
772
773
  };
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);
774
+ this.showLongPressIndicator(t, o);
775
+ let s = (e) => {
776
+ e.pointerId === n.pointerId && (!(e.buttons & 1) || Math.hypot(e.clientX - o.x, e.clientY - o.y) > 10) && a?.();
777
+ }, c = (e) => {
778
+ e.pointerId === n.pointerId && a?.();
779
+ }, l = (e) => {
780
+ e.pointerId !== n.pointerId && a?.();
781
+ }, u = (e) => {
782
+ e.key === "Escape" && a?.();
783
+ }, d = setTimeout(() => {
784
+ a?.(), i = !0, this.startRepositioning(e, r, !0, o, n);
777
785
  }, 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) => {
786
+ a = () => {
787
+ clearTimeout(d), 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", a), this.hideLongPressIndicator(), this.cleanupPendingPress === a && (this.cleanupPendingPress = void 0);
788
+ }, 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", a);
789
+ }, s = (e) => {
781
790
  if (i) return e.stopPropagation(), i = !1, !1;
782
791
  };
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;
792
+ this.endpointPressHandlers.set(t, o), this.fiveDomEvents.addEventListener(t, "click", s), t.__longPressCleanup = () => {
793
+ this.cleanupPendingPress === a && a?.(), this.endpointPressHandlers.delete(t), this.fiveDomEvents.removeEventListener(t, "click", s);
791
794
  };
792
795
  });
793
796
  };
794
797
  load = (e) => {
795
798
  this.clear(), e.forEach((e) => {
796
- let t = new m({
799
+ let t = new h({
797
800
  lineStyle: this.lineStyle,
798
801
  polygonStyle: this.polygonStyle
799
802
  });
800
803
  this.group.add(t), t.setPoints(e.points), this.addMeshEventListeners(t), t.__five_pano_index = this.five.panoIndex;
801
804
  }), this.five.needsRender = !0;
802
805
  };
803
- startRepositioning = (e, t, n = !1, r) => {
806
+ startRepositioning = (e, t, n = !1, r, i) => {
804
807
  this.currentMeasureMesh || this.repositioningState || (this.repositioningState = {
805
808
  measureMesh: e,
806
809
  pointIndex: t,
@@ -809,7 +812,7 @@ var Q = class extends e {
809
812
  isDragMode: n,
810
813
  mouseDownPosition: r || void 0,
811
814
  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));
815
+ }, 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)), Y("esc", this.cancelRepositioning));
813
816
  };
814
817
  updatePolygonPoints = (e, t, n, r = !1) => {
815
818
  if (e.isPolygon && t.length > 3 && n !== void 0) {
@@ -846,7 +849,7 @@ var Q = class extends e {
846
849
  }
847
850
  }
848
851
  e.isPolygon && e.polygon.setPoints(t);
849
- } else e.line.setPoints(t), e.isPolygon && e.polygon.setPoints(t);
852
+ } else this.removeEndpointLongPressListeners(e), e.line.setPoints(t), e.isPolygon && e.polygon.setPoints(t);
850
853
  };
851
854
  onRepositioningMove = (e) => {
852
855
  if (!this.repositioningState || !e) return;
@@ -880,57 +883,47 @@ var Q = class extends e {
880
883
  e.setStyle({ opacity: n });
881
884
  });
882
885
  };
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)),
886
+ enableGlobalPointerTracking = (e) => {
887
+ let t = this.five.getElement();
888
+ if (!t || !e) {
889
+ this.cancelRepositioning();
890
+ return;
891
+ }
892
+ let n = e.target instanceof Element ? e.target : null, r = (n) => {
893
+ if (n.pointerId !== e.pointerId || !this.repositioningState) return;
894
+ if (!(n.buttons & 1)) {
895
+ this.cancelRepositioning();
896
+ return;
897
+ }
898
+ n.preventDefault();
899
+ let r = t.getBoundingClientRect(), i = new p.Raycaster();
900
+ i.setFromCamera(new p.Vector2((n.clientX - r.left) / r.width * 2 - 1, -((n.clientY - r.top) / r.height) * 2 + 1), this.five.camera);
901
+ let a = this.five.model.intersectRaycaster(i)[0];
902
+ this.onRepositioningMove(a ? {
903
+ ...a,
904
+ raycaster: i
905
+ } : {
906
+ point: i.ray.at(5, new p.Vector3()),
914
907
  distance: 5,
915
- raycaster: s,
908
+ raycaster: i,
916
909
  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);
910
+ });
911
+ }, i = (t) => {
912
+ t.pointerId === e.pointerId && (t.type === "pointerup" ? this.confirmRepositioningOnDragEnd() : this.cancelRepositioning());
913
+ }, a = (t) => {
914
+ t.pointerId !== e.pointerId && this.cancelRepositioning();
927
915
  };
916
+ document.addEventListener("pointermove", r, {
917
+ capture: !0,
918
+ passive: !1
919
+ }), 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 = () => {
920
+ 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);
921
+ }, n?.setPointerCapture(e.pointerId);
928
922
  };
929
923
  showLongPressIndicator = (e, t) => {
930
924
  this.hideLongPressIndicator();
931
925
  let n = this.five.getElement();
932
926
  if (!n) return;
933
- this.five.on("wantsGesture", this.preventFiveGestures);
934
927
  let r = document.createElement("div");
935
928
  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
929
  let e = document.createElement("style");
@@ -938,90 +931,20 @@ var Q = class extends e {
938
931
  }
939
932
  if (t) r.style.left = `${t.x}px`, r.style.top = `${t.y}px`, r.style.transform = "translate(-50%, -50%)";
940
933
  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;
934
+ 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
935
  r.style.left = `${a}px`, r.style.top = `${o}px`, r.style.transform = "translate(-50%, -50%)";
943
936
  }
944
937
  document.body.appendChild(r), this.longPressIndicator = r;
945
938
  };
946
939
  hideLongPressIndicator = () => {
947
- this.longPressIndicator && (this.longPressIndicator.remove(), this.longPressIndicator = null, this.five.off("wantsGesture", this.preventFiveGestures));
940
+ this.longPressIndicator &&= (this.longPressIndicator.remove(), null);
948
941
  };
949
942
  preventFiveGestures = () => !1;
950
943
  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);
944
+ 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
945
  };
1023
- }, $ = (e, t) => new Q(e, t);
946
+ }, ee = (e, t) => new $(e, t);
1024
947
  //#endregion
1025
- export { p as n, $ as t };
948
+ export { m as n, ee as t };
1026
949
 
1027
- //# sourceMappingURL=measure-D6kvLcMk.js.map
950
+ //# sourceMappingURL=measure-Comf7Ysy.js.map