@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.
- package/CHANGELOG.md +12 -0
- package/README.md +16 -0
- package/dist/floorplan.js +1 -1
- package/dist/index.js +15 -15
- package/dist/internal/{BasePlugin-Bcnwb_Wp.js → BasePlugin-BW_ljJJD.js} +2 -2
- package/dist/internal/{BasePlugin-Bcnwb_Wp.js.map → BasePlugin-BW_ljJJD.js.map} +1 -1
- package/dist/internal/BasePluginWithData-D0fXwQd_.js +7 -0
- package/dist/internal/{BasePluginWithData-veD_f0Qf.js.map → BasePluginWithData-D0fXwQd_.js.map} +1 -1
- package/dist/internal/{Controller-DMHTzGm7.js → Controller-DG3aerF4.js} +2 -2
- package/dist/internal/{Controller-DMHTzGm7.js.map → Controller-DG3aerF4.js.map} +1 -1
- package/dist/internal/{Polygon-D3xIL1Pl.js → Polygon-BXajWnCj.js} +57 -40
- package/dist/internal/Polygon-BXajWnCj.js.map +1 -0
- package/dist/internal/{Prism-CJlyAEAU.js → Prism-BwjQPOyR.js} +2 -2
- package/dist/internal/{Prism-CJlyAEAU.js.map → Prism-BwjQPOyR.js.map} +1 -1
- package/dist/internal/{Rectangle-CC2WYvov.js → Rectangle-DkXDREEe.js} +4 -4
- package/dist/internal/{Rectangle-CC2WYvov.js.map → Rectangle-DkXDREEe.js.map} +1 -1
- package/dist/internal/{Work-BqpiX1z5.js → Work-BhhN7u0F.js} +4 -4
- package/dist/internal/{Work-BqpiX1z5.js.map → Work-BhhN7u0F.js.map} +1 -1
- package/dist/internal/{area-maker-B8zUUhVk.js → area-maker-BeBn65zc.js} +2 -2
- package/dist/internal/{area-maker-B8zUUhVk.js.map → area-maker-BeBn65zc.js.map} +1 -1
- package/dist/internal/{controller-BBHxJoEH.js → controller-BPXvtI5O.js} +3 -3
- package/dist/internal/{controller-BBHxJoEH.js.map → controller-BPXvtI5O.js.map} +1 -1
- package/dist/internal/{cruise-DeRGFGQ7.js → cruise-D473G5eR.js} +2 -2
- package/dist/internal/{cruise-DeRGFGQ7.js.map → cruise-D473G5eR.js.map} +1 -1
- package/dist/internal/{current-pano-image-sc2LFrya.js → current-pano-image-CVkGFOqe.js} +2 -2
- package/dist/internal/{current-pano-image-sc2LFrya.js.map → current-pano-image-CVkGFOqe.js.map} +1 -1
- package/dist/internal/{floorplan-BOdqCcAc.js → floorplan-Bi8r_6Gk.js} +2 -2
- package/dist/internal/{floorplan-BOdqCcAc.js.map → floorplan-Bi8r_6Gk.js.map} +1 -1
- package/dist/internal/{measure-D6kvLcMk.js → measure-y2GbIzBe.js} +285 -349
- package/dist/internal/measure-y2GbIzBe.js.map +1 -0
- package/dist/internal/{model-maker-p7IecfuB.js → model-maker-CwyCnEOs.js} +3 -3
- package/dist/internal/{model-maker-p7IecfuB.js.map → model-maker-CwyCnEOs.js.map} +1 -1
- package/dist/internal/object3d-helper-CpTwFvfA.js +7 -0
- package/dist/internal/{object3d-helper-DHPCLk5D.js.map → object3d-helper-CpTwFvfA.js.map} +1 -1
- package/dist/internal/{pano-compass-B_gNSkDR.js → pano-compass-AD-jrS_J.js} +2 -2
- package/dist/internal/{pano-compass-B_gNSkDR.js.map → pano-compass-AD-jrS_J.js.map} +1 -1
- package/dist/internal/{pano-door-label-BllgT6o-.js → pano-door-label-yE2L5n-c.js} +2 -2
- package/dist/internal/{pano-door-label-BllgT6o-.js.map → pano-door-label-yE2L5n-c.js.map} +1 -1
- package/dist/internal/{pano-measure-CoyU2j3g.js → pano-measure-COBz9Fp1.js} +2 -2
- package/dist/internal/{pano-measure-CoyU2j3g.js.map → pano-measure-COBz9Fp1.js.map} +1 -1
- package/dist/internal/{pano-tag-NjpQygy3.js → pano-tag-BJ4_t4J4.js} +2 -2
- package/dist/internal/{pano-tag-NjpQygy3.js.map → pano-tag-BJ4_t4J4.js.map} +1 -1
- package/dist/internal/{pano-video-DGQi5GPp.js → pano-video-D7q3cxv8.js} +2 -2
- package/dist/internal/{pano-video-DGQi5GPp.js.map → pano-video-D7q3cxv8.js.map} +1 -1
- package/dist/internal/{pipeline-D3S3Qt7T.js → pipeline-BRRIQUds.js} +2 -2
- package/dist/internal/{pipeline-D3S3Qt7T.js.map → pipeline-BRRIQUds.js.map} +1 -1
- package/dist/internal/{sculpt-Cqspd_4E.js → sculpt-9Mn330l3.js} +4 -4
- package/dist/internal/{sculpt-Cqspd_4E.js.map → sculpt-9Mn330l3.js.map} +1 -1
- package/dist/plugins/area-maker.js +1 -1
- package/dist/plugins/cruise.js +2 -2
- package/dist/plugins/current-pano-image.js +1 -1
- package/dist/plugins/guide-line.js +1 -1
- package/dist/plugins/measure.d.ts +1 -1
- package/dist/plugins/measure.js +1 -1
- package/dist/plugins/model-maker.js +1 -1
- package/dist/plugins/object3d-helper.js +2 -2
- package/dist/plugins/pano-compass.js +1 -1
- package/dist/plugins/pano-door-label.js +1 -1
- package/dist/plugins/pano-measure.js +1 -1
- package/dist/plugins/pano-tag.js +2 -2
- package/dist/plugins/pano-video.js +1 -1
- package/dist/plugins/pipeline.js +1 -1
- package/dist/plugins/sculpt.js +4 -4
- package/dist/types/MeasurePlugin/Controller.d.ts +20 -12
- package/dist/types/MeasurePlugin/index.d.ts +1 -1
- package/dist/types/public/plugins/measure.d.ts +1 -1
- package/dist/types/shared-utils/three/PointSprite.d.ts +2 -1
- package/package.json +1 -1
- package/dist/internal/BasePluginWithData-veD_f0Qf.js +0 -7
- package/dist/internal/Polygon-D3xIL1Pl.js.map +0 -1
- package/dist/internal/measure-D6kvLcMk.js.map +0 -1
- 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 {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { t as s } from "./
|
|
8
|
-
import { t as c } from "./
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
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
|
|
13
|
-
if (e.length < 3 || !
|
|
14
|
-
let t = !0, n = new
|
|
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
|
|
17
|
-
if (!
|
|
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
|
|
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
|
|
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
|
|
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 =
|
|
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
|
-
},
|
|
66
|
-
function
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
"-":
|
|
149
|
-
"=":
|
|
150
|
-
";":
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
180
|
+
}, E = {
|
|
180
181
|
16: !1,
|
|
181
182
|
18: !1,
|
|
182
183
|
17: !1,
|
|
183
184
|
91: !1
|
|
184
|
-
},
|
|
185
|
-
for (let e = 1; e < 20; e++)
|
|
186
|
-
var
|
|
187
|
-
|
|
188
|
-
},
|
|
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(
|
|
191
|
-
|
|
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) =>
|
|
197
|
+
keys: t.split("+").map((e) => N(e))
|
|
197
198
|
});
|
|
198
199
|
});
|
|
199
200
|
}), e;
|
|
200
|
-
},
|
|
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
|
-
},
|
|
213
|
+
}, H = (e) => (typeof e == "string" && (e = N(e)), O.indexOf(e) !== -1), U = (e, t) => {
|
|
213
214
|
let n, r;
|
|
214
|
-
e ||=
|
|
215
|
-
for (let t in
|
|
216
|
-
|
|
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
|
|
219
|
-
let t =
|
|
220
|
-
e.key && e.key.toLowerCase() === "capslock" && (t =
|
|
221
|
-
let n =
|
|
222
|
-
if (n >= 0 &&
|
|
223
|
-
|
|
224
|
-
for (let e in
|
|
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
|
|
228
|
-
if (e === void 0) Object.keys(
|
|
229
|
-
Array.isArray(
|
|
230
|
-
}),
|
|
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 &&
|
|
233
|
+
e.key && K(e);
|
|
233
234
|
});
|
|
234
|
-
else if (typeof e == "object") e.key &&
|
|
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 = ""),
|
|
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
|
-
},
|
|
245
|
-
|
|
246
|
-
let i = e.split(r), a = i.length, o = i[a - 1], s = o === "*" ? "*" :
|
|
247
|
-
if (!
|
|
248
|
-
t ||=
|
|
249
|
-
let c = a > 1 ?
|
|
250
|
-
|
|
251
|
-
let r = (!n || e.method === n) && e.scope === t &&
|
|
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) =>
|
|
254
|
+
}), l.forEach((e) => Z(e));
|
|
254
255
|
});
|
|
255
256
|
};
|
|
256
|
-
function
|
|
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
|
|
262
|
-
(t.mods.length === 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
|
|
266
|
-
let n =
|
|
267
|
-
if (e.key && e.key.toLowerCase() === "capslock" || !(
|
|
268
|
-
if ((r === 93 || r === 224) && (r = 91),
|
|
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 =
|
|
275
|
-
e[t] &&
|
|
276
|
-
}), r in
|
|
277
|
-
|
|
278
|
-
for (let t in
|
|
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
|
|
282
|
-
e.getModifierState && (!e.altKey || e.ctrlKey) && e.getModifierState("AltGraph") && (
|
|
283
|
-
let 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) &&
|
|
285
|
-
if (!(r in
|
|
286
|
-
let a =
|
|
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(
|
|
290
|
-
c.sort().join("") ===
|
|
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
|
|
294
|
-
|
|
295
|
-
let i =
|
|
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 &&
|
|
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 =
|
|
303
|
+
a = [], e.length > 1 && (a = y(w, e));
|
|
303
304
|
let t = e[e.length - 1];
|
|
304
|
-
t = t === "*" ? "*" :
|
|
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 (!
|
|
318
|
-
let e = (e = window.event) =>
|
|
319
|
-
|
|
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
|
-
|
|
322
|
+
M.set(s, {
|
|
322
323
|
keydownListener: e,
|
|
323
324
|
keyupListenr: t,
|
|
324
325
|
capture: f
|
|
325
|
-
}),
|
|
326
|
+
}), _(s, "keydown", e, f), _(s, "keyup", t, f);
|
|
326
327
|
}
|
|
327
|
-
if (!
|
|
328
|
+
if (!k) {
|
|
328
329
|
let e = () => {
|
|
329
|
-
|
|
330
|
+
O = [];
|
|
330
331
|
};
|
|
331
|
-
|
|
332
|
+
k = {
|
|
332
333
|
listener: e,
|
|
333
334
|
capture: f
|
|
334
|
-
},
|
|
335
|
+
}, _(window, "focus", e, f);
|
|
335
336
|
}
|
|
336
|
-
if (!
|
|
337
|
+
if (!A && typeof document < "u") {
|
|
337
338
|
let t = () => {
|
|
338
|
-
|
|
339
|
-
for (let e in
|
|
340
|
-
for (let t in
|
|
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),
|
|
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
|
|
350
|
-
Object.keys(
|
|
351
|
-
|
|
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
|
|
357
|
-
let t = Object.values(
|
|
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 } =
|
|
360
|
-
t && n && (
|
|
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 ||
|
|
363
|
-
if (Array.from(
|
|
364
|
-
let { keydownListener: t, keyupListenr: n, capture: r } =
|
|
365
|
-
t && n && (
|
|
366
|
-
}),
|
|
367
|
-
let { listener: e, capture: t } =
|
|
368
|
-
|
|
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
|
-
|
|
371
|
+
A && typeof document < "u" && (document.removeEventListener("fullscreenchange", A.fullscreen), document.removeEventListener("webkitfullscreenchange", A.webkit), A = null);
|
|
371
372
|
}
|
|
372
373
|
}
|
|
373
|
-
var
|
|
374
|
-
getPressedKeyString:
|
|
375
|
-
setScope:
|
|
376
|
-
getScope:
|
|
377
|
-
deleteScope:
|
|
378
|
-
getPressedKeyCodes:
|
|
379
|
-
getAllKeyCodes:
|
|
380
|
-
isPressed:
|
|
381
|
-
filter:
|
|
382
|
-
trigger:
|
|
383
|
-
unbind:
|
|
384
|
-
keyMap:
|
|
385
|
-
modifier:
|
|
386
|
-
modifierMap:
|
|
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
|
|
389
|
+
for (let e in Q) {
|
|
389
390
|
let t = e;
|
|
390
|
-
Object.prototype.hasOwnProperty.call(
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
407
|
-
|
|
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
|
|
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
|
|
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
|
|
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(),
|
|
463
|
-
let e = new
|
|
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
|
|
484
|
+
let t = new u({
|
|
469
485
|
occlusionMode: "depthTest",
|
|
470
486
|
occlusionVisibility: !0
|
|
471
|
-
}), n = new
|
|
487
|
+
}), n = new d({
|
|
472
488
|
...this.lineStyle,
|
|
473
489
|
dashed: !0,
|
|
474
490
|
cssStyle: "pointer-events: none;"
|
|
475
|
-
}), i = new
|
|
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
|
|
503
|
+
}), s = new u({
|
|
488
504
|
occlusionMode: "depthTest",
|
|
489
505
|
occlusionVisibility: !0,
|
|
490
506
|
color: 3407837,
|
|
491
507
|
opacity: .5
|
|
492
|
-
}), c = null,
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
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(),
|
|
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
|
|
528
|
-
e = Math.abs(r.point.x - t.x) < Math.abs(r.point.z - t.z) ? new
|
|
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(),
|
|
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
|
-
|
|
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 &&
|
|
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.
|
|
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),
|
|
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),
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
})
|
|
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
|
|
725
|
-
new
|
|
726
|
-
new
|
|
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
|
|
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.
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
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.
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
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
|
-
|
|
779
|
-
|
|
780
|
-
|
|
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.
|
|
784
|
-
|
|
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
|
|
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.
|
|
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
|
-
|
|
884
|
-
let
|
|
885
|
-
if (!e)
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
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:
|
|
921
|
+
raycaster: i,
|
|
916
922
|
isVirtual: !0
|
|
917
|
-
}
|
|
918
|
-
}, i = (
|
|
919
|
-
|
|
920
|
-
}, a = (
|
|
921
|
-
|
|
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
|
|
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
|
|
953
|
+
this.longPressIndicator &&= (this.longPressIndicator.remove(), null);
|
|
948
954
|
};
|
|
949
955
|
preventFiveGestures = () => !1;
|
|
950
956
|
cleanupRepositioning = () => {
|
|
951
|
-
|
|
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
|
-
},
|
|
959
|
+
}, ee = (e, t) => new $(e, t);
|
|
1024
960
|
//#endregion
|
|
1025
|
-
export {
|
|
961
|
+
export { m as n, ee as t };
|
|
1026
962
|
|
|
1027
|
-
//# sourceMappingURL=measure-
|
|
963
|
+
//# sourceMappingURL=measure-y2GbIzBe.js.map
|