@shopware-ag/dive 2.1.0 → 2.1.1
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/build/chunks/{AssetCache-BQRROeKj.cjs → AssetCache-B02vAmfm.cjs} +1 -1
- package/build/chunks/{AssetCache-D-tIG2cD.mjs → AssetCache-DP95DtBA.mjs} +1 -1
- package/build/chunks/{AssetLoader-Da8hFXRL.mjs → AssetLoader-BOnrkFcl.mjs} +2 -2
- package/build/chunks/{AssetLoader-CoPAaRfM.cjs → AssetLoader-C6MLrKu2.cjs} +1 -1
- package/build/chunks/{FileTypes-B2n185uW.cjs → FileTypes-BobMthbh.cjs} +2 -2
- package/build/chunks/{FileTypes-CTHWb2IV.mjs → FileTypes-D5zw1toN.mjs} +272 -266
- package/build/chunks/{SelectTool-Bcc2oxWf.mjs → SelectTool-BNZdhIaO.mjs} +1 -1
- package/build/chunks/{SelectTool-ut3Qwv63.cjs → SelectTool-J55L_APQ.cjs} +1 -1
- package/build/dive.cjs +1 -1
- package/build/dive.mjs +2 -2
- package/build/plugins/ar/index.cjs +1 -1
- package/build/plugins/ar/index.mjs +1 -1
- package/build/plugins/assetcache/index.cjs +1 -1
- package/build/plugins/assetcache/index.mjs +1 -1
- package/build/plugins/assetloader/index.cjs +1 -1
- package/build/plugins/assetloader/index.mjs +1 -1
- package/build/plugins/orbitcontroller/index.cjs +1 -1
- package/build/plugins/orbitcontroller/index.mjs +1 -1
- package/build/plugins/orientationdisplay/index.cjs +1 -1
- package/build/plugins/orientationdisplay/index.mjs +1 -1
- package/build/plugins/quickview/index.cjs +1 -1
- package/build/plugins/quickview/index.mjs +16 -22
- package/build/plugins/state/index.cjs +4 -4
- package/build/plugins/state/index.mjs +746 -750
- package/build/plugins/toolbox/index.cjs +1 -1
- package/build/plugins/toolbox/index.mjs +2 -2
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var i = (r,
|
|
4
|
-
import { WebGLRenderer as
|
|
5
|
-
import { P as _, U as
|
|
6
|
-
import
|
|
7
|
-
class
|
|
1
|
+
var $ = Object.defineProperty;
|
|
2
|
+
var j = (r, s, t) => s in r ? $(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
|
|
3
|
+
var i = (r, s, t) => j(r, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
+
import { WebGLRenderer as tt, PCFSoftShadowMap as et, PCFShadowMap as it, BasicShadowMap as st, MathUtils as S, Object3D as w, AmbientLight as at, PointLight as nt, SphereGeometry as I, MeshBasicMaterial as G, FrontSide as F, Mesh as P, HemisphereLight as ot, DirectionalLight as rt, Vector3 as h, Box3 as L, MeshStandardMaterial as k, Raycaster as U, Color as g, CylinderGeometry as ht, BufferGeometry as H, BufferAttribute as A, BoxGeometry as M, ConeGeometry as lt, LineDashedMaterial as dt, Line as ct, PlaneGeometry as ut, GridHelper as pt, Scene as mt, TOUCH as f, MOUSE as m, EventDispatcher as gt, Spherical as C, Vector2 as p, Quaternion as T, AxesHelper as _t, Matrix4 as ft, OrthographicCamera as wt, Vector4 as yt, Box3Helper as bt, Sphere as Dt } from "three";
|
|
5
|
+
import { P as _, U as Et, H as St, C as y, a as Pt, D as O } from "./PerspectiveCamera-8tnOn5YS.mjs";
|
|
6
|
+
import x from "three-spritetext";
|
|
7
|
+
class vt {
|
|
8
8
|
constructor() {
|
|
9
9
|
i(this, "isDIVEClock", !0);
|
|
10
10
|
i(this, "_lastTime", 0);
|
|
@@ -17,26 +17,26 @@ class Pt {
|
|
|
17
17
|
stop() {
|
|
18
18
|
this._isRunning = !1;
|
|
19
19
|
}
|
|
20
|
-
addTicker(
|
|
21
|
-
this._tickers.find((t) => t.uuid ===
|
|
20
|
+
addTicker(s) {
|
|
21
|
+
this._tickers.find((t) => t.uuid === s.uuid) || this._tickers.push(s);
|
|
22
22
|
}
|
|
23
|
-
hasTicker(
|
|
24
|
-
return this._tickers.find((t) => t.uuid ===
|
|
23
|
+
hasTicker(s) {
|
|
24
|
+
return this._tickers.find((t) => t.uuid === s.uuid) !== void 0;
|
|
25
25
|
}
|
|
26
|
-
removeTicker(
|
|
27
|
-
const t = this._tickers.findIndex((e) => e.uuid ===
|
|
26
|
+
removeTicker(s) {
|
|
27
|
+
const t = this._tickers.findIndex((e) => e.uuid === s.uuid);
|
|
28
28
|
t !== -1 && this._tickers.splice(t, 1);
|
|
29
29
|
}
|
|
30
30
|
dispose() {
|
|
31
31
|
this.stop(), this._tickers = [], this._isRunning = !1, this._lastTime = 0;
|
|
32
32
|
}
|
|
33
|
-
_tick(
|
|
33
|
+
_tick(s) {
|
|
34
34
|
if (!this._isRunning) return;
|
|
35
|
-
const t = (
|
|
36
|
-
this._lastTime =
|
|
35
|
+
const t = (s - this._lastTime) / 1e3;
|
|
36
|
+
this._lastTime = s, this._tickers.forEach((e) => e.tick(t)), requestAnimationFrame(this._tick.bind(this));
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
const
|
|
39
|
+
const Y = {
|
|
40
40
|
canvas: void 0,
|
|
41
41
|
antialias: !0,
|
|
42
42
|
alpha: !0,
|
|
@@ -48,13 +48,13 @@ const H = {
|
|
|
48
48
|
shadows: !0,
|
|
49
49
|
shadowQuality: "high"
|
|
50
50
|
};
|
|
51
|
-
class
|
|
52
|
-
constructor(
|
|
51
|
+
class W {
|
|
52
|
+
constructor(s, t, e) {
|
|
53
53
|
i(this, "isDIVERenderer", !0);
|
|
54
54
|
i(this, "_webglrenderer");
|
|
55
55
|
i(this, "_settings");
|
|
56
|
-
this._scene =
|
|
57
|
-
...
|
|
56
|
+
this._scene = s, this._camera = t, this._settings = {
|
|
57
|
+
...Y,
|
|
58
58
|
...e ?? {}
|
|
59
59
|
}, this._webglrenderer = this._createWebGLRenderer();
|
|
60
60
|
}
|
|
@@ -67,62 +67,62 @@ class Y {
|
|
|
67
67
|
render() {
|
|
68
68
|
this._webglrenderer.render(this._scene, this._camera);
|
|
69
69
|
}
|
|
70
|
-
onResize(
|
|
71
|
-
this._webglrenderer.setSize(
|
|
70
|
+
onResize(s, t) {
|
|
71
|
+
this._webglrenderer.setSize(s, t, !1);
|
|
72
72
|
}
|
|
73
73
|
dispose() {
|
|
74
74
|
this._webglrenderer.dispose();
|
|
75
75
|
}
|
|
76
|
-
setCanvas(
|
|
77
|
-
this._webglrenderer.dispose(), this._settings.canvas =
|
|
76
|
+
setCanvas(s) {
|
|
77
|
+
this._webglrenderer.dispose(), this._settings.canvas = s, this._webglrenderer = this._createWebGLRenderer();
|
|
78
78
|
}
|
|
79
79
|
_createWebGLRenderer() {
|
|
80
|
-
const
|
|
81
|
-
return
|
|
80
|
+
const s = new tt(this._settings);
|
|
81
|
+
return s.shadowMap.enabled = this._settings.shadows, s.shadowMap.type = this._settings.shadowQuality === "high" ? et : this._settings.shadowQuality === "medium" ? it : st, s.setPixelRatio(window.devicePixelRatio), s;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
const te =
|
|
85
|
-
class
|
|
86
|
-
constructor(
|
|
84
|
+
const te = W;
|
|
85
|
+
class Mt {
|
|
86
|
+
constructor(s, t) {
|
|
87
87
|
i(this, "isDIVEResizeManager", !0);
|
|
88
88
|
i(this, "_resizeObserver");
|
|
89
89
|
i(this, "_width", 0);
|
|
90
90
|
i(this, "_height", 0);
|
|
91
|
-
this._renderer =
|
|
92
|
-
const
|
|
93
|
-
|
|
91
|
+
this._renderer = s, this._camera = t, this._resizeObserver = new ResizeObserver((e) => {
|
|
92
|
+
const a = e[0], { width: n, height: o } = a.contentRect;
|
|
93
|
+
n === this._width && o === this._height || (this._renderer.onResize(n, o), this._camera.onResize(n, o), this._width = n, this._height = o);
|
|
94
94
|
}), this._observeCanvas(this._renderer.canvas);
|
|
95
95
|
}
|
|
96
|
-
setCanvas(
|
|
97
|
-
this._resizeObserver.disconnect(), this._observeCanvas(
|
|
98
|
-
const { width: t, height: e } =
|
|
96
|
+
setCanvas(s) {
|
|
97
|
+
this._resizeObserver.disconnect(), this._observeCanvas(s);
|
|
98
|
+
const { width: t, height: e } = s.getBoundingClientRect();
|
|
99
99
|
this._renderer.onResize(t, e), this._camera.onResize(t, e), this._width = t, this._height = e;
|
|
100
100
|
}
|
|
101
101
|
dispose() {
|
|
102
102
|
this._resizeObserver.disconnect();
|
|
103
103
|
}
|
|
104
|
-
_observeCanvas(
|
|
105
|
-
if (
|
|
106
|
-
this._resizeObserver.observe(
|
|
104
|
+
_observeCanvas(s) {
|
|
105
|
+
if (s.parentElement)
|
|
106
|
+
this._resizeObserver.observe(s.parentElement);
|
|
107
107
|
else {
|
|
108
108
|
const t = setInterval(() => {
|
|
109
|
-
|
|
109
|
+
s.parentElement && (this._resizeObserver.observe(s.parentElement), clearInterval(t));
|
|
110
110
|
}, 16);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
class
|
|
115
|
-
constructor(
|
|
114
|
+
class B {
|
|
115
|
+
constructor(s, t, e) {
|
|
116
116
|
i(this, "isDIVEView", !0);
|
|
117
|
-
i(this, "uuid",
|
|
117
|
+
i(this, "uuid", S.generateUUID());
|
|
118
118
|
i(this, "_paused", !1);
|
|
119
119
|
i(this, "_renderer");
|
|
120
120
|
i(this, "_resizeManager");
|
|
121
|
-
this._scene =
|
|
121
|
+
this._scene = s, this._camera = t, this._settings = e, this._renderer = new W(
|
|
122
122
|
this._scene,
|
|
123
123
|
this._camera,
|
|
124
124
|
this._settings
|
|
125
|
-
), this._resizeManager = new
|
|
125
|
+
), this._resizeManager = new Mt(
|
|
126
126
|
this._renderer,
|
|
127
127
|
this._camera
|
|
128
128
|
);
|
|
@@ -142,11 +142,11 @@ class O {
|
|
|
142
142
|
dispose() {
|
|
143
143
|
this._resizeManager.dispose(), this._renderer.dispose();
|
|
144
144
|
}
|
|
145
|
-
onResize(
|
|
146
|
-
this._renderer.onResize(
|
|
145
|
+
onResize(s, t) {
|
|
146
|
+
this._renderer.onResize(s, t), this._camera.onResize(s, t);
|
|
147
147
|
}
|
|
148
|
-
setCanvas(
|
|
149
|
-
this._renderer.setCanvas(
|
|
148
|
+
setCanvas(s) {
|
|
149
|
+
this._renderer.setCanvas(s), this._resizeManager.setCanvas(s), this.onResize(
|
|
150
150
|
this._renderer.canvas.clientWidth,
|
|
151
151
|
this._renderer.canvas.clientHeight
|
|
152
152
|
);
|
|
@@ -159,14 +159,14 @@ class O {
|
|
|
159
159
|
this._paused = !1;
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
-
class
|
|
162
|
+
class xt extends w {
|
|
163
163
|
constructor() {
|
|
164
164
|
super();
|
|
165
165
|
i(this, "isDIVELight", !0);
|
|
166
166
|
i(this, "isDIVEAmbientLight", !0);
|
|
167
167
|
i(this, "isSelectable", !0);
|
|
168
168
|
i(this, "_light");
|
|
169
|
-
this.name = "DIVEAmbientLight", this._light = new
|
|
169
|
+
this.name = "DIVEAmbientLight", this._light = new at(16777215, 1), this._light.layers.mask = _, this.add(this._light);
|
|
170
170
|
}
|
|
171
171
|
setColor(t) {
|
|
172
172
|
this._light.color = t;
|
|
@@ -178,7 +178,7 @@ class Mt extends w {
|
|
|
178
178
|
this._light.visible = t;
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
-
class
|
|
181
|
+
class Tt extends w {
|
|
182
182
|
constructor() {
|
|
183
183
|
super();
|
|
184
184
|
i(this, "isDIVELight", !0);
|
|
@@ -189,17 +189,17 @@ class xt extends w {
|
|
|
189
189
|
i(this, "light");
|
|
190
190
|
i(this, "mesh");
|
|
191
191
|
this.name = "DIVEPointLight", this.light = new nt(16777215, 1), this.light.layers.mask = _, this.light.castShadow = !0, this.light.shadow.mapSize.width = 512, this.light.shadow.mapSize.height = 512, this.add(this.light);
|
|
192
|
-
const t = 0.1, e = new
|
|
192
|
+
const t = 0.1, e = new I(
|
|
193
193
|
t,
|
|
194
194
|
t * 320,
|
|
195
195
|
t * 320
|
|
196
|
-
),
|
|
196
|
+
), a = new G({
|
|
197
197
|
color: this.light.color,
|
|
198
198
|
transparent: !0,
|
|
199
199
|
opacity: 0.8,
|
|
200
|
-
side:
|
|
200
|
+
side: F
|
|
201
201
|
});
|
|
202
|
-
this.mesh = new
|
|
202
|
+
this.mesh = new P(e, a), this.mesh.layers.mask = Et, this.add(this.mesh);
|
|
203
203
|
}
|
|
204
204
|
setColor(t) {
|
|
205
205
|
this.light.color = t, this.mesh.material.color = t;
|
|
@@ -236,7 +236,7 @@ class xt extends w {
|
|
|
236
236
|
});
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
-
class
|
|
239
|
+
class It extends w {
|
|
240
240
|
constructor() {
|
|
241
241
|
super();
|
|
242
242
|
i(this, "isDIVELight", !0);
|
|
@@ -244,7 +244,7 @@ class Tt extends w {
|
|
|
244
244
|
i(this, "isSelectable", !0);
|
|
245
245
|
i(this, "_hemiLight");
|
|
246
246
|
i(this, "_dirLight");
|
|
247
|
-
this.name = "DIVESceneLight", this._hemiLight = new
|
|
247
|
+
this.name = "DIVESceneLight", this._hemiLight = new ot(16777215, 16777215, 2), this._hemiLight.layers.mask = _, this._hemiLight.position.set(0, 50, 0), this._hemiLight.visible = !0, this.add(this._hemiLight), this._dirLight = new rt(16777215, 3), this._dirLight.layers.mask = _, this._dirLight.position.set(1, 1.75, 1), this._dirLight.position.multiplyScalar(30), this._dirLight.castShadow = !0, this._dirLight.visible = !0, this._dirLight.shadow.mapSize.width = 2048, this._dirLight.shadow.mapSize.height = 2048;
|
|
248
248
|
const t = 5;
|
|
249
249
|
this._dirLight.shadow.camera.left = -5, this._dirLight.shadow.camera.right = t, this._dirLight.shadow.camera.top = t, this._dirLight.shadow.camera.bottom = -5, this._dirLight.shadow.camera.far = 3500, this.add(this._dirLight);
|
|
250
250
|
}
|
|
@@ -258,8 +258,8 @@ class Tt extends w {
|
|
|
258
258
|
this._hemiLight.visible = t, this._dirLight.visible = t;
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
|
-
const
|
|
262
|
-
class
|
|
261
|
+
const V = (r) => r.parent ? V(r.parent) : r;
|
|
262
|
+
class v extends w {
|
|
263
263
|
constructor() {
|
|
264
264
|
super();
|
|
265
265
|
i(this, "isSelectable", !0);
|
|
@@ -268,7 +268,7 @@ class P extends w {
|
|
|
268
268
|
i(this, "gizmo", null);
|
|
269
269
|
i(this, "_positionWorldBuffer");
|
|
270
270
|
i(this, "_boundingBox");
|
|
271
|
-
this.layers.mask = _, this._positionWorldBuffer = new h(), this._boundingBox = new
|
|
271
|
+
this.layers.mask = _, this._positionWorldBuffer = new h(), this._boundingBox = new L();
|
|
272
272
|
}
|
|
273
273
|
setPosition(t) {
|
|
274
274
|
if (!this.parent) {
|
|
@@ -329,7 +329,7 @@ class P extends w {
|
|
|
329
329
|
});
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
|
-
class
|
|
332
|
+
class Lt extends v {
|
|
333
333
|
constructor() {
|
|
334
334
|
super();
|
|
335
335
|
i(this, "isDIVEModel", !0);
|
|
@@ -342,10 +342,10 @@ class It extends P {
|
|
|
342
342
|
return this._assetLoader || (this._assetLoader = new (await import("../plugins/assetloader/index.mjs")).AssetLoader()), this._assetLoader;
|
|
343
343
|
}
|
|
344
344
|
async setFromURL(t) {
|
|
345
|
-
const
|
|
346
|
-
return this.setFromGLTF(
|
|
345
|
+
const a = await (await this._getAssetLoader()).load(t);
|
|
346
|
+
return this.setFromGLTF(a), import("../plugins/state/index.mjs").then(({ State: n }) => {
|
|
347
347
|
var o;
|
|
348
|
-
(o =
|
|
348
|
+
(o = n.get(this.userData.id)) == null || o.performAction("MODEL_LOADED", {
|
|
349
349
|
id: this.userData.id
|
|
350
350
|
});
|
|
351
351
|
}), this;
|
|
@@ -356,14 +356,14 @@ class It extends P {
|
|
|
356
356
|
}), this.add(t), this;
|
|
357
357
|
}
|
|
358
358
|
setMaterial(t) {
|
|
359
|
-
this._material || (this._material = new
|
|
359
|
+
this._material || (this._material = new k()), t.vertexColors !== void 0 && (this._material.vertexColors = t.vertexColors), t.color !== void 0 && this._material.color.set(t.color), t.map !== void 0 && (this._material.map = t.map), t.normalMap !== void 0 && (this._material.normalMap = t.normalMap), t.roughness !== void 0 && (this._material.roughness = t.roughness), t.roughnessMap !== void 0 && (this._material.roughnessMap = t.roughnessMap, this._material.roughnessMap && (this._material.roughness = 1)), t.metalness !== void 0 && (this._material.metalness = t.metalness), t.metalnessMap !== void 0 && (this._material.metalnessMap = t.metalnessMap, this._material.metalnessMap && (this._material.metalness = 1)), this._mesh && (this._mesh.material = this._material);
|
|
360
360
|
}
|
|
361
361
|
placeOnFloor() {
|
|
362
|
-
var
|
|
362
|
+
var n, o, l, c;
|
|
363
363
|
const t = this.getWorldPosition(this._positionWorldBuffer), e = t.clone();
|
|
364
|
-
(o = (
|
|
365
|
-
const
|
|
366
|
-
!
|
|
364
|
+
(o = (n = this._mesh) == null ? void 0 : n.geometry) == null || o.computeBoundingBox();
|
|
365
|
+
const a = (c = (l = this._mesh) == null ? void 0 : l.geometry) == null ? void 0 : c.boundingBox;
|
|
366
|
+
!a || !this._mesh || (t.y = t.y - this._mesh.localToWorld(a.min.clone()).y, t.y !== e.y && import("../plugins/state/index.mjs").then(({ State: d }) => {
|
|
367
367
|
var u;
|
|
368
368
|
(u = d.get(this.userData.id)) == null || u.performAction("UPDATE_OBJECT", {
|
|
369
369
|
id: this.userData.id,
|
|
@@ -385,14 +385,14 @@ class It extends P {
|
|
|
385
385
|
this._boundingBox.getCenter(new h()).multiply(this.scale)
|
|
386
386
|
);
|
|
387
387
|
e.y = t + this.position.y;
|
|
388
|
-
const
|
|
389
|
-
|
|
390
|
-
const
|
|
391
|
-
|
|
388
|
+
const a = new U(e, new h(0, -1, 0));
|
|
389
|
+
a.layers.mask = _;
|
|
390
|
+
const n = a.intersectObjects(
|
|
391
|
+
V(this).root.children,
|
|
392
392
|
!0
|
|
393
393
|
);
|
|
394
|
-
if (
|
|
395
|
-
const o =
|
|
394
|
+
if (n.length > 0) {
|
|
395
|
+
const o = n[0].object;
|
|
396
396
|
o.geometry.computeBoundingBox();
|
|
397
397
|
const l = o.geometry.boundingBox, c = o.localToWorld(l.max.clone()), d = this.position.clone(), u = this.position.clone().setY(c.y).sub(new h(0, t, 0));
|
|
398
398
|
if (this.position.copy(u), this.position.y === d.y) return;
|
|
@@ -400,12 +400,12 @@ class It extends P {
|
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
|
-
class
|
|
403
|
+
class kt extends v {
|
|
404
404
|
constructor() {
|
|
405
405
|
super();
|
|
406
406
|
i(this, "isDIVEPrimitive", !0);
|
|
407
407
|
i(this, "_mesh");
|
|
408
|
-
this._mesh = new
|
|
408
|
+
this._mesh = new P(), this._mesh.layers.mask = _, this._mesh.castShadow = !0, this._mesh.receiveShadow = !0, this._mesh.material = new k(), this.add(this._mesh);
|
|
409
409
|
}
|
|
410
410
|
setGeometry(t) {
|
|
411
411
|
const e = this.assembleGeometry(t);
|
|
@@ -416,11 +416,11 @@ class Lt extends P {
|
|
|
416
416
|
t.vertexColors !== void 0 && (e.vertexColors = t.vertexColors), t.color !== void 0 && (e.color = new g(t.color)), t.map !== void 0 && (e.map = t.map), t.normalMap !== void 0 && (e.normalMap = t.normalMap), t.roughness !== void 0 && (e.roughness = t.roughness), t.roughnessMap !== void 0 && (e.roughnessMap = t.roughnessMap, e.roughnessMap && (e.roughness = 1)), t.metalness !== void 0 && (e.metalness = t.metalness), t.metalnessMap !== void 0 && (e.metalnessMap = t.metalnessMap, e.metalnessMap && (e.metalness = 0)), this._mesh && (this._mesh.material = e);
|
|
417
417
|
}
|
|
418
418
|
placeOnFloor() {
|
|
419
|
-
var
|
|
419
|
+
var n, o, l, c;
|
|
420
420
|
const t = this.getWorldPosition(this._positionWorldBuffer), e = t.clone();
|
|
421
|
-
(o = (
|
|
422
|
-
const
|
|
423
|
-
!
|
|
421
|
+
(o = (n = this._mesh) == null ? void 0 : n.geometry) == null || o.computeBoundingBox();
|
|
422
|
+
const a = (c = (l = this._mesh) == null ? void 0 : l.geometry) == null ? void 0 : c.boundingBox;
|
|
423
|
+
!a || !this._mesh || (t.y = t.y - this._mesh.localToWorld(a.min.clone()).y, t.y !== e.y && import("../plugins/state/index.mjs").then(({ State: d }) => {
|
|
424
424
|
var u;
|
|
425
425
|
(u = d.get(this.userData.id)) == null || u.performAction("UPDATE_OBJECT", {
|
|
426
426
|
id: this.userData.id,
|
|
@@ -442,14 +442,14 @@ class Lt extends P {
|
|
|
442
442
|
this._boundingBox.getCenter(new h()).multiply(this.scale)
|
|
443
443
|
);
|
|
444
444
|
e.y = t + this.position.y;
|
|
445
|
-
const
|
|
446
|
-
|
|
447
|
-
const
|
|
448
|
-
|
|
445
|
+
const a = new U(e, new h(0, -1, 0));
|
|
446
|
+
a.layers.mask = _;
|
|
447
|
+
const n = a.intersectObjects(
|
|
448
|
+
V(this).root.children,
|
|
449
449
|
!0
|
|
450
450
|
);
|
|
451
|
-
if (
|
|
452
|
-
const o =
|
|
451
|
+
if (n.length > 0) {
|
|
452
|
+
const o = n[0].object;
|
|
453
453
|
o.geometry.computeBoundingBox();
|
|
454
454
|
const l = o.geometry.boundingBox, c = o.localToWorld(l.max.clone()), d = this.position.clone(), u = this.position.clone().setY(c.y).sub(new h(0, t, 0));
|
|
455
455
|
if (this.position.copy(u), this.position.y === d.y) return;
|
|
@@ -481,7 +481,7 @@ class Lt extends P {
|
|
|
481
481
|
}
|
|
482
482
|
}
|
|
483
483
|
createCylinderGeometry(t) {
|
|
484
|
-
const e = new
|
|
484
|
+
const e = new ht(
|
|
485
485
|
t.width / 2,
|
|
486
486
|
t.width / 2,
|
|
487
487
|
t.height,
|
|
@@ -490,7 +490,7 @@ class Lt extends P {
|
|
|
490
490
|
return e.translate(0, t.height / 2, 0), e;
|
|
491
491
|
}
|
|
492
492
|
createSphereGeometry(t) {
|
|
493
|
-
return new
|
|
493
|
+
return new I(t.width / 2, 256, 256);
|
|
494
494
|
}
|
|
495
495
|
createPyramidGeometry(t) {
|
|
496
496
|
const e = new Float32Array([
|
|
@@ -513,7 +513,7 @@ class Lt extends P {
|
|
|
513
513
|
0,
|
|
514
514
|
t.height,
|
|
515
515
|
0
|
|
516
|
-
]),
|
|
516
|
+
]), a = new Uint16Array([
|
|
517
517
|
0,
|
|
518
518
|
1,
|
|
519
519
|
2,
|
|
@@ -532,14 +532,14 @@ class Lt extends P {
|
|
|
532
532
|
3,
|
|
533
533
|
4,
|
|
534
534
|
0
|
|
535
|
-
]),
|
|
536
|
-
return
|
|
535
|
+
]), n = new H();
|
|
536
|
+
return n.setAttribute(
|
|
537
537
|
"position",
|
|
538
|
-
new
|
|
539
|
-
),
|
|
538
|
+
new A(e, 3)
|
|
539
|
+
), n.setIndex(new A(a, 1)), n.computeVertexNormals(), n.computeBoundingBox(), n.computeBoundingSphere(), n;
|
|
540
540
|
}
|
|
541
541
|
createBoxGeometry(t) {
|
|
542
|
-
const e = new
|
|
542
|
+
const e = new M(
|
|
543
543
|
t.width,
|
|
544
544
|
t.height,
|
|
545
545
|
t.depth
|
|
@@ -547,11 +547,11 @@ class Lt extends P {
|
|
|
547
547
|
return e.translate(0, t.height / 2, 0), e;
|
|
548
548
|
}
|
|
549
549
|
createConeGeometry(t) {
|
|
550
|
-
const e = new
|
|
550
|
+
const e = new lt(t.width / 2, t.height, 256);
|
|
551
551
|
return e.translate(0, t.height / 2, 0), e;
|
|
552
552
|
}
|
|
553
553
|
createWallGeometry(t) {
|
|
554
|
-
const e = new
|
|
554
|
+
const e = new M(
|
|
555
555
|
t.width,
|
|
556
556
|
t.height,
|
|
557
557
|
t.depth || 0.05,
|
|
@@ -560,7 +560,7 @@ class Lt extends P {
|
|
|
560
560
|
return e.translate(0, t.height / 2, 0), e;
|
|
561
561
|
}
|
|
562
562
|
createPlaneGeometry(t) {
|
|
563
|
-
const e = new
|
|
563
|
+
const e = new M(
|
|
564
564
|
t.width,
|
|
565
565
|
t.height,
|
|
566
566
|
t.depth
|
|
@@ -568,7 +568,7 @@ class Lt extends P {
|
|
|
568
568
|
return e.translate(0, t.height / 2, 0), e;
|
|
569
569
|
}
|
|
570
570
|
}
|
|
571
|
-
class
|
|
571
|
+
class Vt extends v {
|
|
572
572
|
// lines to children
|
|
573
573
|
constructor() {
|
|
574
574
|
super();
|
|
@@ -588,13 +588,13 @@ class kt extends P {
|
|
|
588
588
|
}
|
|
589
589
|
setLinesVisibility(t, e) {
|
|
590
590
|
if (!e) {
|
|
591
|
-
this._lines.forEach((
|
|
592
|
-
|
|
591
|
+
this._lines.forEach((n) => {
|
|
592
|
+
n.visible = t;
|
|
593
593
|
});
|
|
594
594
|
return;
|
|
595
595
|
}
|
|
596
|
-
const
|
|
597
|
-
|
|
596
|
+
const a = this._members.indexOf(e);
|
|
597
|
+
a !== -1 && (this._lines[a].visible = t);
|
|
598
598
|
}
|
|
599
599
|
attach(t) {
|
|
600
600
|
if (this._members.includes(t))
|
|
@@ -611,8 +611,8 @@ class kt extends P {
|
|
|
611
611
|
const e = this._members.indexOf(t);
|
|
612
612
|
if (e === -1)
|
|
613
613
|
return this;
|
|
614
|
-
const
|
|
615
|
-
return super.remove(
|
|
614
|
+
const a = this._lines[e];
|
|
615
|
+
return super.remove(a), this._lines.splice(e, 1), super.remove(t), this._members.splice(e, 1), this;
|
|
616
616
|
}
|
|
617
617
|
updateLineTo(t) {
|
|
618
618
|
const e = this._members.indexOf(t);
|
|
@@ -622,22 +622,22 @@ class kt extends P {
|
|
|
622
622
|
* Creates a line for visualization.
|
|
623
623
|
*/
|
|
624
624
|
createLine() {
|
|
625
|
-
const t = new
|
|
625
|
+
const t = new H(), e = new dt({
|
|
626
626
|
color: 6710886,
|
|
627
627
|
dashSize: 0.05,
|
|
628
628
|
gapSize: 0.025
|
|
629
|
-
}),
|
|
630
|
-
return
|
|
629
|
+
}), a = new ct(t, e);
|
|
630
|
+
return a.visible = !1, a;
|
|
631
631
|
}
|
|
632
632
|
/**
|
|
633
633
|
* Updates a line to the object.
|
|
634
634
|
*/
|
|
635
635
|
_updateLineTo(t, e) {
|
|
636
|
-
const
|
|
636
|
+
const a = [
|
|
637
637
|
new h(0, 0, 0),
|
|
638
638
|
e.position.clone()
|
|
639
639
|
];
|
|
640
|
-
t.geometry.setFromPoints(
|
|
640
|
+
t.geometry.setFromPoints(a), t.computeLineDistances();
|
|
641
641
|
}
|
|
642
642
|
// public setBoundingBoxVisibility(visible: boolean): void {
|
|
643
643
|
// this._boxMesh.visible = visible;
|
|
@@ -687,13 +687,13 @@ class kt extends P {
|
|
|
687
687
|
// this._boxMesh.visible = true;
|
|
688
688
|
// }
|
|
689
689
|
}
|
|
690
|
-
class Rt extends
|
|
690
|
+
class Rt extends P {
|
|
691
691
|
constructor() {
|
|
692
|
-
const t = new
|
|
692
|
+
const t = new ut(1, 1);
|
|
693
693
|
t.scale(1e3, 1e3, 1), t.rotateX(-Math.PI / 2);
|
|
694
|
-
const e = new
|
|
694
|
+
const e = new k({
|
|
695
695
|
color: new g(16777215),
|
|
696
|
-
side:
|
|
696
|
+
side: F
|
|
697
697
|
});
|
|
698
698
|
super(t, e);
|
|
699
699
|
i(this, "isDIVEFloor", !0);
|
|
@@ -706,7 +706,7 @@ class Rt extends S {
|
|
|
706
706
|
this.material.color = new g(t);
|
|
707
707
|
}
|
|
708
708
|
}
|
|
709
|
-
class
|
|
709
|
+
class At extends w {
|
|
710
710
|
constructor() {
|
|
711
711
|
super();
|
|
712
712
|
i(this, "isDIVERoot", !0);
|
|
@@ -717,17 +717,17 @@ class Vt extends w {
|
|
|
717
717
|
return this._floor;
|
|
718
718
|
}
|
|
719
719
|
computeSceneBB() {
|
|
720
|
-
const t = new
|
|
720
|
+
const t = new L();
|
|
721
721
|
return this.children.forEach((e) => {
|
|
722
|
-
"isDIVEFloor" in e || e.traverse((
|
|
723
|
-
"isObject3D" in
|
|
722
|
+
"isDIVEFloor" in e || e.traverse((a) => {
|
|
723
|
+
"isObject3D" in a && t.expandByObject(a);
|
|
724
724
|
});
|
|
725
725
|
}), t;
|
|
726
726
|
}
|
|
727
727
|
getSceneObject(t) {
|
|
728
728
|
let e;
|
|
729
|
-
return this.traverse((
|
|
730
|
-
e ||
|
|
729
|
+
return this.traverse((a) => {
|
|
730
|
+
e || a.userData.id === t.id && (e = a);
|
|
731
731
|
}), e;
|
|
732
732
|
}
|
|
733
733
|
addSceneObject(t) {
|
|
@@ -742,15 +742,15 @@ class Vt extends w {
|
|
|
742
742
|
case "light": {
|
|
743
743
|
switch (t.type) {
|
|
744
744
|
case "scene": {
|
|
745
|
-
e = new
|
|
745
|
+
e = new It();
|
|
746
746
|
break;
|
|
747
747
|
}
|
|
748
748
|
case "ambient": {
|
|
749
|
-
e = new
|
|
749
|
+
e = new xt();
|
|
750
750
|
break;
|
|
751
751
|
}
|
|
752
752
|
case "point": {
|
|
753
|
-
e = new
|
|
753
|
+
e = new Tt();
|
|
754
754
|
break;
|
|
755
755
|
}
|
|
756
756
|
default:
|
|
@@ -762,15 +762,15 @@ class Vt extends w {
|
|
|
762
762
|
break;
|
|
763
763
|
}
|
|
764
764
|
case "model": {
|
|
765
|
-
e = new
|
|
765
|
+
e = new Lt(), e.name = t.name, e.userData.id = t.id, e.userData.uri = t.uri, this.add(e), this._updateModel(e, t);
|
|
766
766
|
break;
|
|
767
767
|
}
|
|
768
768
|
case "primitive": {
|
|
769
|
-
e = new
|
|
769
|
+
e = new kt(), e.name = t.name, e.userData.id = t.id, this.add(e), this._updatePrimitive(e, t);
|
|
770
770
|
break;
|
|
771
771
|
}
|
|
772
772
|
case "group": {
|
|
773
|
-
e = new
|
|
773
|
+
e = new Vt(), e.name = t.name, e.userData.id = t.id, this.add(e), this._updateGroup(e, t);
|
|
774
774
|
break;
|
|
775
775
|
}
|
|
776
776
|
default:
|
|
@@ -880,12 +880,12 @@ class Vt extends w {
|
|
|
880
880
|
_setParent(t) {
|
|
881
881
|
const e = this.getSceneObject(t);
|
|
882
882
|
if (t.parentId !== null) {
|
|
883
|
-
const
|
|
883
|
+
const a = this.getSceneObject({
|
|
884
884
|
id: t.parentId,
|
|
885
885
|
entityType: t.entityType
|
|
886
886
|
});
|
|
887
|
-
if (!
|
|
888
|
-
|
|
887
|
+
if (!a) return;
|
|
888
|
+
a.attach(e);
|
|
889
889
|
} else
|
|
890
890
|
this.attach(e);
|
|
891
891
|
}
|
|
@@ -898,39 +898,39 @@ class Vt extends w {
|
|
|
898
898
|
return t.parent !== null ? this._findScene(t.parent) : t;
|
|
899
899
|
}
|
|
900
900
|
}
|
|
901
|
-
const
|
|
902
|
-
class
|
|
901
|
+
const Ct = "#888888", Ot = "#dddddd";
|
|
902
|
+
class Bt extends w {
|
|
903
903
|
constructor() {
|
|
904
904
|
super(), this.name = "Grid";
|
|
905
|
-
const
|
|
905
|
+
const s = new pt(
|
|
906
906
|
100,
|
|
907
907
|
100,
|
|
908
|
-
|
|
909
|
-
|
|
908
|
+
Ct,
|
|
909
|
+
Ot
|
|
910
910
|
);
|
|
911
|
-
|
|
911
|
+
s.material.depthTest = !1, s.layers.mask = St, this.add(s);
|
|
912
912
|
}
|
|
913
|
-
setVisibility(
|
|
914
|
-
this.visible =
|
|
913
|
+
setVisibility(s) {
|
|
914
|
+
this.visible = s;
|
|
915
915
|
}
|
|
916
916
|
}
|
|
917
|
-
const
|
|
917
|
+
const E = {
|
|
918
918
|
displayFloor: !1,
|
|
919
919
|
displayGrid: !1,
|
|
920
920
|
backgroundColor: "#ffffff"
|
|
921
921
|
};
|
|
922
|
-
class
|
|
922
|
+
class zt extends mt {
|
|
923
923
|
constructor(t) {
|
|
924
924
|
super();
|
|
925
925
|
i(this, "isDIVEScene", !0);
|
|
926
926
|
i(this, "_root");
|
|
927
927
|
i(this, "_grid");
|
|
928
928
|
this.background = new g(
|
|
929
|
-
(t == null ? void 0 : t.backgroundColor) ??
|
|
930
|
-
), this._root = new
|
|
931
|
-
(t == null ? void 0 : t.displayFloor) ??
|
|
932
|
-
), this.add(this._root), this._grid = new
|
|
933
|
-
(t == null ? void 0 : t.displayGrid) ??
|
|
929
|
+
(t == null ? void 0 : t.backgroundColor) ?? E.backgroundColor
|
|
930
|
+
), this._root = new At(), this._root.floor.setVisibility(
|
|
931
|
+
(t == null ? void 0 : t.displayFloor) ?? E.displayFloor
|
|
932
|
+
), this.add(this._root), this._grid = new Bt(), this._grid.setVisibility(
|
|
933
|
+
(t == null ? void 0 : t.displayGrid) ?? E.displayGrid
|
|
934
934
|
), this.add(this._grid);
|
|
935
935
|
}
|
|
936
936
|
get root() {
|
|
@@ -946,7 +946,7 @@ class Bt extends pt {
|
|
|
946
946
|
return this._root.computeSceneBB();
|
|
947
947
|
}
|
|
948
948
|
}
|
|
949
|
-
const
|
|
949
|
+
const Gt = {
|
|
950
950
|
enableDamping: !0,
|
|
951
951
|
dampingFactor: 0.05,
|
|
952
952
|
enabled: !0,
|
|
@@ -984,8 +984,8 @@ const zt = {
|
|
|
984
984
|
ONE: f.ROTATE,
|
|
985
985
|
TWO: f.DOLLY_PAN
|
|
986
986
|
}
|
|
987
|
-
}, b = class b extends
|
|
988
|
-
constructor(t, e,
|
|
987
|
+
}, b = class b extends gt {
|
|
988
|
+
constructor(t, e, a) {
|
|
989
989
|
super();
|
|
990
990
|
// public API
|
|
991
991
|
i(this, "object");
|
|
@@ -1031,12 +1031,12 @@ const zt = {
|
|
|
1031
1031
|
i(this, "target0");
|
|
1032
1032
|
i(this, "position0");
|
|
1033
1033
|
i(this, "zoom0");
|
|
1034
|
-
i(this, "uuid",
|
|
1034
|
+
i(this, "uuid", S.generateUUID());
|
|
1035
1035
|
// private state
|
|
1036
1036
|
i(this, "state", -1);
|
|
1037
1037
|
i(this, "EPS", 1e-6);
|
|
1038
|
-
i(this, "spherical", new
|
|
1039
|
-
i(this, "sphericalDelta", new
|
|
1038
|
+
i(this, "spherical", new C());
|
|
1039
|
+
i(this, "sphericalDelta", new C());
|
|
1040
1040
|
i(this, "scale", 1);
|
|
1041
1041
|
i(this, "panOffset", new h());
|
|
1042
1042
|
i(this, "zoomChanged", !1);
|
|
@@ -1056,18 +1056,18 @@ const zt = {
|
|
|
1056
1056
|
i(this, "quat");
|
|
1057
1057
|
i(this, "quatInverse");
|
|
1058
1058
|
i(this, "lastPosition", new h());
|
|
1059
|
-
i(this, "lastQuaternion", new
|
|
1059
|
+
i(this, "lastQuaternion", new T());
|
|
1060
1060
|
i(this, "lastTarget", new h());
|
|
1061
1061
|
i(this, "panLeft", (() => {
|
|
1062
1062
|
const t = new h();
|
|
1063
|
-
return (e,
|
|
1064
|
-
t.setFromMatrixColumn(
|
|
1063
|
+
return (e, a) => {
|
|
1064
|
+
t.setFromMatrixColumn(a, 0), t.multiplyScalar(-e), this.panOffset.add(t);
|
|
1065
1065
|
};
|
|
1066
1066
|
})());
|
|
1067
1067
|
i(this, "panUp", (() => {
|
|
1068
1068
|
const t = new h();
|
|
1069
|
-
return (e,
|
|
1070
|
-
this.screenSpacePanning === !0 ? t.setFromMatrixColumn(
|
|
1069
|
+
return (e, a) => {
|
|
1070
|
+
this.screenSpacePanning === !0 ? t.setFromMatrixColumn(a, 1) : (t.setFromMatrixColumn(a, 0), t.crossVectors(this.object.up, t)), t.multiplyScalar(e), this.panOffset.add(t);
|
|
1071
1071
|
};
|
|
1072
1072
|
})());
|
|
1073
1073
|
i(this, "onMouseDown", (t) => {
|
|
@@ -1221,10 +1221,10 @@ const zt = {
|
|
|
1221
1221
|
i(this, "onContextMenu", (t) => {
|
|
1222
1222
|
this.enabled !== !1 && t.preventDefault();
|
|
1223
1223
|
});
|
|
1224
|
-
this.object = t, this.domElements = Array.isArray(e) ? e : [e], Object.assign(this,
|
|
1224
|
+
this.object = t, this.domElements = Array.isArray(e) ? e : [e], Object.assign(this, a), this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this.quat = new T().setFromUnitVectors(
|
|
1225
1225
|
t.up,
|
|
1226
1226
|
new h(0, 1, 0)
|
|
1227
|
-
), this.quatInverse = this.quat.clone().invert(), this.domElements.forEach((
|
|
1227
|
+
), this.quatInverse = this.quat.clone().invert(), this.domElements.forEach((n) => this.addEventListeners(n)), this.update();
|
|
1228
1228
|
}
|
|
1229
1229
|
get domElement() {
|
|
1230
1230
|
return this.domElements[0];
|
|
@@ -1271,23 +1271,23 @@ const zt = {
|
|
|
1271
1271
|
}
|
|
1272
1272
|
removeDomElements(...t) {
|
|
1273
1273
|
t.forEach((e) => {
|
|
1274
|
-
const
|
|
1275
|
-
|
|
1274
|
+
const a = this.domElements.indexOf(e);
|
|
1275
|
+
a > -1 && (this.removeEventListeners(e), this.domElements.splice(a, 1));
|
|
1276
1276
|
});
|
|
1277
1277
|
}
|
|
1278
1278
|
setDomElements(...t) {
|
|
1279
1279
|
this.removeDomElements(...this.domElements), this.domElements = [], this.addDomElements(...t);
|
|
1280
1280
|
}
|
|
1281
1281
|
computeEncompassingView(t, e = 0) {
|
|
1282
|
-
const
|
|
1282
|
+
const a = t.center, o = t.sphere.radius, l = this.object.fov * (Math.PI / 180), c = this.object.aspect, d = l / 2, u = Math.atan(Math.tan(d) * c), q = o / Math.sin(d), K = o / Math.sin(u), Q = Math.max(q, K) * (1 + e), R = this.object.position.clone().sub(this.target).normalize(), J = R.length() > 1e-3 ? R : new h(0, 0, 1);
|
|
1283
1283
|
return {
|
|
1284
|
-
position:
|
|
1285
|
-
target:
|
|
1284
|
+
position: a.clone().add(J.multiplyScalar(Q)),
|
|
1285
|
+
target: a
|
|
1286
1286
|
};
|
|
1287
1287
|
}
|
|
1288
1288
|
focusObject(t, e = 0) {
|
|
1289
|
-
const
|
|
1290
|
-
this.object.position.copy(
|
|
1289
|
+
const a = new Xt(t), n = this.computeEncompassingView(a, e);
|
|
1290
|
+
this.object.position.copy(n.position), this.target.copy(n.target), this.update();
|
|
1291
1291
|
}
|
|
1292
1292
|
zoomIn(t) {
|
|
1293
1293
|
this.dollyIn(Math.pow(0.95, t ?? b.DEFAULT_ZOOM_FACTOR)), this.update();
|
|
@@ -1333,26 +1333,26 @@ const zt = {
|
|
|
1333
1333
|
rotateUp(t) {
|
|
1334
1334
|
this.sphericalDelta.phi -= t;
|
|
1335
1335
|
}
|
|
1336
|
-
pan(t, e,
|
|
1337
|
-
const
|
|
1336
|
+
pan(t, e, a) {
|
|
1337
|
+
const n = new h();
|
|
1338
1338
|
if ("isPerspectiveCamera" in this.object) {
|
|
1339
1339
|
const o = this.object.position;
|
|
1340
|
-
|
|
1341
|
-
let l =
|
|
1340
|
+
n.copy(o).sub(this.target);
|
|
1341
|
+
let l = n.length();
|
|
1342
1342
|
l *= Math.tan(
|
|
1343
1343
|
this.object.fov / 2 * Math.PI / 180
|
|
1344
1344
|
), this.panLeft(
|
|
1345
|
-
2 * t * l /
|
|
1345
|
+
2 * t * l / a.clientHeight,
|
|
1346
1346
|
this.object.matrix
|
|
1347
1347
|
), this.panUp(
|
|
1348
|
-
2 * e * l /
|
|
1348
|
+
2 * e * l / a.clientHeight,
|
|
1349
1349
|
this.object.matrix
|
|
1350
1350
|
);
|
|
1351
1351
|
} else "isOrthographicCamera" in this.object ? (this.panLeft(
|
|
1352
|
-
t * (this.object.right - this.object.left) / this.object.zoom /
|
|
1352
|
+
t * (this.object.right - this.object.left) / this.object.zoom / a.clientWidth,
|
|
1353
1353
|
this.object.matrix
|
|
1354
1354
|
), this.panUp(
|
|
1355
|
-
e * (this.object.top - this.object.bottom) / this.object.zoom /
|
|
1355
|
+
e * (this.object.top - this.object.bottom) / this.object.zoom / a.clientHeight,
|
|
1356
1356
|
this.object.matrix
|
|
1357
1357
|
)) : (console.warn(
|
|
1358
1358
|
"WARNING: OrbitController encountered an unknown camera type - pan disabled."
|
|
@@ -1399,19 +1399,19 @@ const zt = {
|
|
|
1399
1399
|
}
|
|
1400
1400
|
handleKeyDown(t) {
|
|
1401
1401
|
let e = !1;
|
|
1402
|
-
const
|
|
1402
|
+
const a = t.currentTarget;
|
|
1403
1403
|
switch (t.code) {
|
|
1404
1404
|
case this.keys.UP:
|
|
1405
|
-
this.pan(0, this.keyPanSpeed,
|
|
1405
|
+
this.pan(0, this.keyPanSpeed, a), e = !0;
|
|
1406
1406
|
break;
|
|
1407
1407
|
case this.keys.BOTTOM:
|
|
1408
|
-
this.pan(0, -this.keyPanSpeed,
|
|
1408
|
+
this.pan(0, -this.keyPanSpeed, a), e = !0;
|
|
1409
1409
|
break;
|
|
1410
1410
|
case this.keys.LEFT:
|
|
1411
|
-
this.pan(this.keyPanSpeed, 0,
|
|
1411
|
+
this.pan(this.keyPanSpeed, 0, a), e = !0;
|
|
1412
1412
|
break;
|
|
1413
1413
|
case this.keys.RIGHT:
|
|
1414
|
-
this.pan(-this.keyPanSpeed, 0,
|
|
1414
|
+
this.pan(-this.keyPanSpeed, 0, a), e = !0;
|
|
1415
1415
|
break;
|
|
1416
1416
|
}
|
|
1417
1417
|
e && (t.preventDefault(), this.update());
|
|
@@ -1420,20 +1420,20 @@ const zt = {
|
|
|
1420
1420
|
if (this.pointers.length === 1)
|
|
1421
1421
|
this.rotateStart.set(t.pageX, t.pageY);
|
|
1422
1422
|
else {
|
|
1423
|
-
const e = this.getSecondPointer(t),
|
|
1424
|
-
this.rotateStart.set(
|
|
1423
|
+
const e = this.getSecondPointer(t), a = 0.5 * (t.pageX + e.pageX), n = 0.5 * (t.pageY + e.pageY);
|
|
1424
|
+
this.rotateStart.set(a, n);
|
|
1425
1425
|
}
|
|
1426
1426
|
}
|
|
1427
1427
|
handleTouchStartPan(t) {
|
|
1428
1428
|
if (this.pointers.length === 1)
|
|
1429
1429
|
this.panStart.set(t.pageX, t.pageY);
|
|
1430
1430
|
else {
|
|
1431
|
-
const e = this.getSecondPointer(t),
|
|
1432
|
-
this.panStart.set(
|
|
1431
|
+
const e = this.getSecondPointer(t), a = 0.5 * (t.pageX + e.pageX), n = 0.5 * (t.pageY + e.pageY);
|
|
1432
|
+
this.panStart.set(a, n);
|
|
1433
1433
|
}
|
|
1434
1434
|
}
|
|
1435
1435
|
handleTouchStartDolly(t) {
|
|
1436
|
-
const e = this.getSecondPointer(t),
|
|
1436
|
+
const e = this.getSecondPointer(t), a = t.pageX - e.pageX, n = t.pageY - e.pageY, o = Math.sqrt(a * a + n * n);
|
|
1437
1437
|
this.dollyStart.set(0, o);
|
|
1438
1438
|
}
|
|
1439
1439
|
handleTouchStartDollyPan(t) {
|
|
@@ -1446,8 +1446,8 @@ const zt = {
|
|
|
1446
1446
|
if (this.pointers.length === 1)
|
|
1447
1447
|
this.rotateEnd.set(t.pageX, t.pageY);
|
|
1448
1448
|
else {
|
|
1449
|
-
const
|
|
1450
|
-
this.rotateEnd.set(
|
|
1449
|
+
const a = this.getSecondPointer(t), n = 0.5 * (t.pageX + a.pageX), o = 0.5 * (t.pageY + a.pageY);
|
|
1450
|
+
this.rotateEnd.set(n, o);
|
|
1451
1451
|
}
|
|
1452
1452
|
const e = t.currentTarget;
|
|
1453
1453
|
this.rotateDelta.subVectors(this.rotateEnd, this.rotateStart).multiplyScalar(this.rotateSpeed), this.rotateLeft(
|
|
@@ -1460,14 +1460,14 @@ const zt = {
|
|
|
1460
1460
|
if (this.pointers.length === 1)
|
|
1461
1461
|
this.panEnd.set(t.pageX, t.pageY);
|
|
1462
1462
|
else {
|
|
1463
|
-
const
|
|
1464
|
-
this.panEnd.set(
|
|
1463
|
+
const a = this.getSecondPointer(t), n = 0.5 * (t.pageX + a.pageX), o = 0.5 * (t.pageY + a.pageY);
|
|
1464
|
+
this.panEnd.set(n, o);
|
|
1465
1465
|
}
|
|
1466
1466
|
const e = t.currentTarget;
|
|
1467
1467
|
this.panDelta.subVectors(this.panEnd, this.panStart).multiplyScalar(this.panSpeed), this.pan(this.panDelta.x, this.panDelta.y, e), this.panStart.copy(this.panEnd);
|
|
1468
1468
|
}
|
|
1469
1469
|
handleTouchMoveDolly(t) {
|
|
1470
|
-
const e = this.getSecondPointer(t),
|
|
1470
|
+
const e = this.getSecondPointer(t), a = t.pageX - e.pageX, n = t.pageY - e.pageY, o = Math.sqrt(a * a + n * n);
|
|
1471
1471
|
this.dollyEnd.set(0, o), this.dollyDelta.set(
|
|
1472
1472
|
0,
|
|
1473
1473
|
Math.pow(this.dollyEnd.y / this.dollyStart.y, this.zoomSpeed)
|
|
@@ -1504,52 +1504,52 @@ const zt = {
|
|
|
1504
1504
|
}
|
|
1505
1505
|
};
|
|
1506
1506
|
i(b, "DEFAULT_ZOOM_FACTOR", 1);
|
|
1507
|
-
let
|
|
1508
|
-
class
|
|
1507
|
+
let z = b;
|
|
1508
|
+
class Ft extends w {
|
|
1509
1509
|
constructor() {
|
|
1510
1510
|
super();
|
|
1511
1511
|
i(this, "_axesHelper");
|
|
1512
|
-
this._axesHelper = new
|
|
1512
|
+
this._axesHelper = new _t(0.5), this._axesHelper.layers.mask = y, this._axesHelper.material.depthTest = !1, this._axesHelper.position.set(0, 0, -1), this._axesHelper.setColors(
|
|
1513
1513
|
new g(Wt),
|
|
1514
1514
|
new g(Zt),
|
|
1515
1515
|
new g(Nt)
|
|
1516
1516
|
);
|
|
1517
|
-
const t = new
|
|
1518
|
-
t.layers.mask = y, e.layers.mask = y,
|
|
1517
|
+
const t = new x("X", 0.2, Z), e = new x("Y", 0.2, N), a = new x("Z", 0.2, X);
|
|
1518
|
+
t.layers.mask = y, e.layers.mask = y, a.layers.mask = y, t.position.set(0.7, 0, 0), e.position.set(0, 0.7, 0), a.position.set(0, 0, 0.7), this._axesHelper.add(t), this._axesHelper.add(e), this._axesHelper.add(a);
|
|
1519
1519
|
}
|
|
1520
1520
|
setFromCameraMatrix(t) {
|
|
1521
1521
|
this._axesHelper.rotation.setFromRotationMatrix(
|
|
1522
|
-
new
|
|
1522
|
+
new ft().extractRotation(t).invert()
|
|
1523
1523
|
);
|
|
1524
1524
|
}
|
|
1525
1525
|
}
|
|
1526
|
-
class
|
|
1527
|
-
constructor(
|
|
1528
|
-
i(this, "uuid",
|
|
1526
|
+
class Ut {
|
|
1527
|
+
constructor(s, t, e) {
|
|
1528
|
+
i(this, "uuid", S.generateUUID());
|
|
1529
1529
|
i(this, "_axes");
|
|
1530
1530
|
i(this, "_orthographicCamera");
|
|
1531
|
-
i(this, "_restoreViewport", new
|
|
1532
|
-
this._renderer =
|
|
1531
|
+
i(this, "_restoreViewport", new yt());
|
|
1532
|
+
this._renderer = s, this._scene = t, this._camera = e, this._orthographicCamera = new wt(
|
|
1533
1533
|
-1,
|
|
1534
1534
|
1,
|
|
1535
1535
|
1,
|
|
1536
1536
|
-1,
|
|
1537
1537
|
0.1,
|
|
1538
1538
|
100
|
|
1539
|
-
), this._orthographicCamera.layers.mask = y, this._scene.add(this._orthographicCamera), this._axes = new
|
|
1539
|
+
), this._orthographicCamera.layers.mask = y, this._scene.add(this._orthographicCamera), this._axes = new Ft(), this._scene.add(this._axes);
|
|
1540
1540
|
}
|
|
1541
1541
|
tick() {
|
|
1542
|
-
const
|
|
1542
|
+
const s = this._scene.background;
|
|
1543
1543
|
this._scene.background = null, this._renderer.webglrenderer.getViewport(this._restoreViewport), this._renderer.webglrenderer.setViewport(0, 0, 150, 150), this._renderer.webglrenderer.autoClear = !1, this._axes.setFromCameraMatrix(this._camera.matrix), this._renderer.webglrenderer.render(
|
|
1544
1544
|
this._scene,
|
|
1545
1545
|
this._orthographicCamera
|
|
1546
|
-
), this._renderer.webglrenderer.setViewport(this._restoreViewport), this._renderer.webglrenderer.autoClear = !0, this._scene.background =
|
|
1546
|
+
), this._renderer.webglrenderer.setViewport(this._restoreViewport), this._renderer.webglrenderer.autoClear = !0, this._scene.background = s;
|
|
1547
1547
|
}
|
|
1548
1548
|
dispose() {
|
|
1549
1549
|
this._scene.remove(this._axes), this._scene.remove(this._orthographicCamera);
|
|
1550
1550
|
}
|
|
1551
1551
|
}
|
|
1552
|
-
const
|
|
1552
|
+
const Ht = `
|
|
1553
1553
|
@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@
|
|
1554
1554
|
@@@@+-:::::::---------------------==------------------------------=#@@@@
|
|
1555
1555
|
@@%=::::.......::---------------------------------------------------------+@@
|
|
@@ -1584,18 +1584,18 @@ window.DIVE = {
|
|
|
1584
1584
|
return window.DIVE.instances[0];
|
|
1585
1585
|
}
|
|
1586
1586
|
};
|
|
1587
|
-
const
|
|
1587
|
+
const D = {
|
|
1588
1588
|
autoStart: !0,
|
|
1589
1589
|
displayAxes: !1,
|
|
1590
|
-
...
|
|
1591
|
-
...
|
|
1592
|
-
...
|
|
1593
|
-
...
|
|
1590
|
+
...E,
|
|
1591
|
+
...Pt,
|
|
1592
|
+
...Y,
|
|
1593
|
+
...Gt
|
|
1594
1594
|
};
|
|
1595
1595
|
class Yt {
|
|
1596
|
-
constructor(
|
|
1596
|
+
constructor(s) {
|
|
1597
1597
|
// descriptive members
|
|
1598
|
-
i(this, "_instanceId",
|
|
1598
|
+
i(this, "_instanceId", S.generateUUID());
|
|
1599
1599
|
i(this, "_settings");
|
|
1600
1600
|
i(this, "_views");
|
|
1601
1601
|
i(this, "_mainView");
|
|
@@ -1603,26 +1603,32 @@ class Yt {
|
|
|
1603
1603
|
i(this, "_clock");
|
|
1604
1604
|
i(this, "orientationDisplay");
|
|
1605
1605
|
this._settings = {
|
|
1606
|
-
...
|
|
1607
|
-
...
|
|
1608
|
-
}, this._clock = new
|
|
1609
|
-
|
|
1606
|
+
...D,
|
|
1607
|
+
...s ?? {}
|
|
1608
|
+
}, this._clock = new vt(), this._scene = new zt(), this.scene.setBackground(
|
|
1609
|
+
(s == null ? void 0 : s.backgroundColor) ?? D.backgroundColor
|
|
1610
|
+
), this.scene.grid.setVisibility(
|
|
1611
|
+
(s == null ? void 0 : s.displayGrid) ?? D.displayGrid
|
|
1612
|
+
), this.scene.root.floor.setVisibility(
|
|
1613
|
+
(s == null ? void 0 : s.displayFloor) ?? D.displayFloor
|
|
1614
|
+
);
|
|
1615
|
+
const t = new B(
|
|
1610
1616
|
this._scene,
|
|
1611
|
-
new
|
|
1617
|
+
new O(),
|
|
1612
1618
|
this._settings
|
|
1613
1619
|
);
|
|
1614
|
-
this._clock.addTicker(t), this._views = [t], this._mainView = t, this._settings.autoStart && this.start(), this._settings.displayAxes ? (console.log("displayAxes", this._settings.displayAxes), this.orientationDisplay = new
|
|
1620
|
+
this._clock.addTicker(t), this._views = [t], this._mainView = t, this._settings.autoStart && this.start(), this._settings.displayAxes ? (console.log("displayAxes", this._settings.displayAxes), this.orientationDisplay = new Ut(
|
|
1615
1621
|
this.mainView.renderer,
|
|
1616
1622
|
this.scene,
|
|
1617
1623
|
this.mainView.camera
|
|
1618
|
-
), this.clock.addTicker(this.orientationDisplay)) : this.orientationDisplay = null, console.log("DIVE 2.1.
|
|
1624
|
+
), this.clock.addTicker(this.orientationDisplay)) : this.orientationDisplay = null, console.log("DIVE 2.1.1 initialized successfully!"), console.log(Ht), window.DIVE.instances.push(this);
|
|
1619
1625
|
}
|
|
1620
1626
|
/**
|
|
1621
1627
|
* @deprecated This static method will be removed in a future version. Please use `import { QuickView, QuickViewSettings, QuickViewDefaultSettings } from '@shopware-ag/dive/quickview'` instead.
|
|
1622
1628
|
*/
|
|
1623
|
-
static async QuickView(
|
|
1629
|
+
static async QuickView(s, t) {
|
|
1624
1630
|
return import("../plugins/quickview/index.mjs").then(
|
|
1625
|
-
({ QuickView: e }) => e(
|
|
1631
|
+
({ QuickView: e }) => e(s, t)
|
|
1626
1632
|
);
|
|
1627
1633
|
}
|
|
1628
1634
|
/**
|
|
@@ -1632,8 +1638,8 @@ class Yt {
|
|
|
1632
1638
|
return Object.assign(this, {
|
|
1633
1639
|
camera: this.mainView.camera,
|
|
1634
1640
|
renderer: this.mainView.renderer,
|
|
1635
|
-
setCanvas: (
|
|
1636
|
-
this.mainView.setCanvas(
|
|
1641
|
+
setCanvas: (s) => {
|
|
1642
|
+
this.mainView.setCanvas(s);
|
|
1637
1643
|
},
|
|
1638
1644
|
start: () => {
|
|
1639
1645
|
this.start();
|
|
@@ -1668,18 +1674,18 @@ class Yt {
|
|
|
1668
1674
|
this._clock.stop();
|
|
1669
1675
|
}
|
|
1670
1676
|
async dispose() {
|
|
1671
|
-
return new Promise((
|
|
1677
|
+
return new Promise((s) => {
|
|
1672
1678
|
this._views.forEach((t) => {
|
|
1673
1679
|
t.dispose();
|
|
1674
1680
|
}), this._views = [], this.orientationDisplay && (this._clock.removeTicker(this.orientationDisplay), this.orientationDisplay.dispose()), window.DIVE.instances = window.DIVE.instances.filter(
|
|
1675
1681
|
(t) => t._instanceId !== this._instanceId
|
|
1676
|
-
),
|
|
1682
|
+
), s();
|
|
1677
1683
|
});
|
|
1678
1684
|
}
|
|
1679
|
-
createView(
|
|
1680
|
-
const t = new
|
|
1685
|
+
createView(s) {
|
|
1686
|
+
const t = new B(
|
|
1681
1687
|
this._scene,
|
|
1682
|
-
|
|
1688
|
+
s ?? new O(),
|
|
1683
1689
|
{
|
|
1684
1690
|
...this._settings,
|
|
1685
1691
|
canvas: void 0
|
|
@@ -1688,12 +1694,12 @@ class Yt {
|
|
|
1688
1694
|
);
|
|
1689
1695
|
return this._views.push(t), this._clock.addTicker(t), this._views.length === 1 && (this._mainView = t), t;
|
|
1690
1696
|
}
|
|
1691
|
-
disposeView(
|
|
1692
|
-
this._views = this._views.filter((t) => t !==
|
|
1697
|
+
disposeView(s) {
|
|
1698
|
+
this._views = this._views.filter((t) => t !== s), this._clock.removeTicker(s), this._mainView === s && (this._mainView = this._views[0]), s.dispose();
|
|
1693
1699
|
}
|
|
1694
1700
|
}
|
|
1695
|
-
const ee = Yt,
|
|
1696
|
-
class Xt extends
|
|
1701
|
+
const ee = Yt, Z = "#c20017", N = "#00ab26", X = "#0081d4", Wt = Z, Zt = N, Nt = X;
|
|
1702
|
+
class Xt extends v {
|
|
1697
1703
|
/**
|
|
1698
1704
|
* Creates a new BoundingBox instance for the specified 3D object.
|
|
1699
1705
|
*
|
|
@@ -1716,7 +1722,7 @@ class Xt extends P {
|
|
|
1716
1722
|
* const defaultBox = new BoundingBox(mesh);
|
|
1717
1723
|
* ```
|
|
1718
1724
|
*/
|
|
1719
|
-
constructor(t, e = !1,
|
|
1725
|
+
constructor(t, e = !1, a = 65280) {
|
|
1720
1726
|
super();
|
|
1721
1727
|
/** The computed bounding box (Box3) */
|
|
1722
1728
|
i(this, "_box");
|
|
@@ -1732,19 +1738,19 @@ class Xt extends P {
|
|
|
1732
1738
|
i(this, "_sphereHelper");
|
|
1733
1739
|
/** The dimensions (width, height, depth) of the bounding box */
|
|
1734
1740
|
i(this, "_size");
|
|
1735
|
-
const
|
|
1736
|
-
e ?
|
|
1741
|
+
const n = new L();
|
|
1742
|
+
e ? n.setFromObject(t) : (t.updateWorldMatrix(!0, !0), t.traverse((l) => {
|
|
1737
1743
|
if (l.isMesh) {
|
|
1738
1744
|
const c = l, d = c.geometry.clone();
|
|
1739
1745
|
d.applyMatrix4(c.matrixWorld);
|
|
1740
|
-
const u = c.getWorldQuaternion(new
|
|
1741
|
-
d.applyQuaternion(u), d.computeBoundingBox(), d.boundingBox &&
|
|
1746
|
+
const u = c.getWorldQuaternion(new T()).invert();
|
|
1747
|
+
d.applyQuaternion(u), d.computeBoundingBox(), d.boundingBox && n.union(d.boundingBox);
|
|
1742
1748
|
}
|
|
1743
|
-
})), this.rotation.copy(t.rotation), this._box =
|
|
1744
|
-
const o = new
|
|
1745
|
-
o.translate(this._center.x, this._center.y, this._center.z), this._sphereHelper = new
|
|
1749
|
+
})), this.rotation.copy(t.rotation), this._box = n, this._size = n.getSize(new h()), this._center = n.getCenter(new h()), this._boxHelper = new bt(this._box, a), this._boxHelper.visible = !1, this.add(this._boxHelper), this._sphere = n.getBoundingSphere(new Dt()), this._radius = this._sphere.radius;
|
|
1750
|
+
const o = new I(this._radius, 32, 32);
|
|
1751
|
+
o.translate(this._center.x, this._center.y, this._center.z), this._sphereHelper = new P(
|
|
1746
1752
|
o,
|
|
1747
|
-
new
|
|
1753
|
+
new G({ color: a, wireframe: !0 })
|
|
1748
1754
|
), this._sphereHelper.visible = !1, this.add(this._sphereHelper);
|
|
1749
1755
|
}
|
|
1750
1756
|
/**
|
|
@@ -1839,40 +1845,40 @@ const qt = {
|
|
|
1839
1845
|
);
|
|
1840
1846
|
export {
|
|
1841
1847
|
Wt as A,
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1848
|
+
v as B,
|
|
1849
|
+
kt as C,
|
|
1850
|
+
D,
|
|
1851
|
+
At as E,
|
|
1846
1852
|
Xt as F,
|
|
1847
|
-
|
|
1848
|
-
|
|
1853
|
+
Ct as G,
|
|
1854
|
+
V as H,
|
|
1849
1855
|
qt as I,
|
|
1850
|
-
|
|
1856
|
+
Gt as O,
|
|
1851
1857
|
ie as S,
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1858
|
+
z as a,
|
|
1859
|
+
Ut as b,
|
|
1860
|
+
Ft as c,
|
|
1855
1861
|
Yt as d,
|
|
1856
|
-
|
|
1857
|
-
|
|
1862
|
+
It as e,
|
|
1863
|
+
Lt as f,
|
|
1858
1864
|
Zt as g,
|
|
1859
1865
|
Nt as h,
|
|
1860
1866
|
ee as i,
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1867
|
+
vt as j,
|
|
1868
|
+
Y as k,
|
|
1869
|
+
W as l,
|
|
1864
1870
|
te as m,
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1871
|
+
Mt as n,
|
|
1872
|
+
E as o,
|
|
1873
|
+
zt as p,
|
|
1874
|
+
B as q,
|
|
1875
|
+
Z as r,
|
|
1876
|
+
N as s,
|
|
1877
|
+
X as t,
|
|
1878
|
+
Ot as u,
|
|
1873
1879
|
Rt as v,
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1880
|
+
Bt as w,
|
|
1881
|
+
Vt as x,
|
|
1882
|
+
xt as y,
|
|
1883
|
+
Tt as z
|
|
1878
1884
|
};
|