softbox 4.19.0 → 4.21.0
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/README.md +21 -0
- package/dist/index.d.cts +55 -0
- package/dist/index.d.ts +55 -0
- package/dist/simple-viewer.cjs +2 -2
- package/dist/simple-viewer.es.js +302 -265
- package/package.json +1 -1
package/dist/simple-viewer.es.js
CHANGED
|
@@ -90,7 +90,7 @@ var St = "#1a1a1f", Ct = (e) => {
|
|
|
90
90
|
if (a()) return;
|
|
91
91
|
n.ok ? t.applyToScene(e, n.value, s) : console.warn("Failed to load environment map:", n.error);
|
|
92
92
|
} else if (i.helpers?.studioEnvironment) {
|
|
93
|
-
let r = t.createStudioEnvironment();
|
|
93
|
+
let r = t.createStudioEnvironment(i.environment?.studioLook);
|
|
94
94
|
if (r.ok) {
|
|
95
95
|
if (t.applyToScene(e, r.value, {
|
|
96
96
|
...s,
|
|
@@ -802,7 +802,7 @@ var Bt = (e) => [
|
|
|
802
802
|
resetEnvironment() {
|
|
803
803
|
if (this.deps.isDisposed()) return r.err(new e("Viewer is disposed", d.INVALID_STATE));
|
|
804
804
|
if (!this.deps.environmentService) return r.err(new e("Environment service unavailable", d.INVALID_STATE));
|
|
805
|
-
let t = this.deps.environmentService.createStudioEnvironment();
|
|
805
|
+
let t = this.deps.environmentService.createStudioEnvironment(this.deps.getOptions().environment?.studioLook);
|
|
806
806
|
if (!t.ok) return r.err(t.error);
|
|
807
807
|
let n = this.deps.environmentService.applyToScene(this.deps.scene, t.value, { setBackground: !1 });
|
|
808
808
|
if (!n.ok) return n;
|
|
@@ -6111,10 +6111,12 @@ function aa(e) {
|
|
|
6111
6111
|
});
|
|
6112
6112
|
}
|
|
6113
6113
|
//#endregion
|
|
6114
|
-
//#region src/
|
|
6115
|
-
var oa =
|
|
6114
|
+
//#region src/types/options/ControlsOptions.ts
|
|
6115
|
+
var oa = /* @__PURE__ */ function(e) {
|
|
6116
|
+
return e.MapControls = "MapControls", e.OrbitControls = "OrbitControls", e;
|
|
6117
|
+
}({}), sa = "crisp", ca = 256, la = .1, ua = 100, da = class {
|
|
6116
6118
|
constructor() {
|
|
6117
|
-
this.pmremGenerator = null, this.threeRenderer = null, this.loadedTextures = /* @__PURE__ */ new Map(), this.renderTargets = [], this.
|
|
6119
|
+
this.pmremGenerator = null, this.threeRenderer = null, this.loadedTextures = /* @__PURE__ */ new Map(), this.renderTargets = [], this.studioBakes = /* @__PURE__ */ new Map(), this.originalByPmrem = /* @__PURE__ */ new WeakMap(), this.disposed = !1;
|
|
6118
6120
|
}
|
|
6119
6121
|
async initialize(t) {
|
|
6120
6122
|
try {
|
|
@@ -6127,7 +6129,7 @@ var oa = 256, sa = .1, ca = 100, la = class {
|
|
|
6127
6129
|
async loadEnvironmentMap(t) {
|
|
6128
6130
|
try {
|
|
6129
6131
|
let n = this.loadedTextures.get(t);
|
|
6130
|
-
if (n) return r.ok(new
|
|
6132
|
+
if (n) return r.ok(new fa(n));
|
|
6131
6133
|
let i = t.split(".").pop()?.toLowerCase(), a;
|
|
6132
6134
|
switch (i) {
|
|
6133
6135
|
case "hdr":
|
|
@@ -6157,9 +6159,9 @@ var oa = 256, sa = .1, ca = 100, la = class {
|
|
|
6157
6159
|
let e = this.pmremGenerator.fromEquirectangular(o);
|
|
6158
6160
|
this.renderTargets.push(e);
|
|
6159
6161
|
let n = e.texture;
|
|
6160
|
-
return this.loadedTextures.set(t, n), this.loadedTextures.set(t + "_original", o), this.originalByPmrem.set(n, o), r.ok(new
|
|
6162
|
+
return this.loadedTextures.set(t, n), this.loadedTextures.set(t + "_original", o), this.originalByPmrem.set(n, o), r.ok(new fa(n));
|
|
6161
6163
|
}
|
|
6162
|
-
return this.loadedTextures.set(t, o), r.ok(new
|
|
6164
|
+
return this.loadedTextures.set(t, o), r.ok(new fa(o));
|
|
6163
6165
|
} catch (n) {
|
|
6164
6166
|
return r.err(new e("Failed to load environment map", d.TEXTURE_LOAD_FAILED, {
|
|
6165
6167
|
url: t,
|
|
@@ -6182,7 +6184,7 @@ var oa = 256, sa = .1, ca = 100, la = class {
|
|
|
6182
6184
|
}
|
|
6183
6185
|
getOriginalEnvironmentTexture(e) {
|
|
6184
6186
|
let t = this.loadedTextures.get(e + "_original");
|
|
6185
|
-
return t ? new
|
|
6187
|
+
return t ? new fa(t) : null;
|
|
6186
6188
|
}
|
|
6187
6189
|
async setBackgroundImage(t, n) {
|
|
6188
6190
|
try {
|
|
@@ -6208,38 +6210,45 @@ var oa = 256, sa = .1, ca = 100, la = class {
|
|
|
6208
6210
|
});
|
|
6209
6211
|
});
|
|
6210
6212
|
}
|
|
6211
|
-
createStudioEnvironment() {
|
|
6213
|
+
createStudioEnvironment(t = sa) {
|
|
6212
6214
|
try {
|
|
6213
6215
|
if (!this.pmremGenerator) return r.err(new e("Environment service not initialized", d.INITIALIZATION_FAILED));
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
this.
|
|
6219
|
-
|
|
6220
|
-
|
|
6216
|
+
let n = this.studioBakes.get(t);
|
|
6217
|
+
if (n) return r.ok(new fa(n.pmremTexture));
|
|
6218
|
+
let i = new $i();
|
|
6219
|
+
t !== "soft" && aa(i);
|
|
6220
|
+
let a = this.pmremGenerator.fromScene(i);
|
|
6221
|
+
this.renderTargets.push(a);
|
|
6222
|
+
let o = a.texture;
|
|
6223
|
+
return this.captureStudioCubeOriginal(t, i, o), this.studioBakes.has(t) || this.studioBakes.set(t, {
|
|
6224
|
+
pmremTexture: o,
|
|
6225
|
+
cubeTarget: null
|
|
6226
|
+
}), i.dispose(), r.ok(new fa(o));
|
|
6221
6227
|
} catch (t) {
|
|
6222
6228
|
return r.err(new e("Failed to create studio environment", d.TEXTURE_LOAD_FAILED, { originalError: t }));
|
|
6223
6229
|
}
|
|
6224
6230
|
}
|
|
6225
|
-
captureStudioCubeOriginal(e, t) {
|
|
6231
|
+
captureStudioCubeOriginal(e, t, n) {
|
|
6226
6232
|
if (this.threeRenderer) try {
|
|
6227
|
-
let
|
|
6233
|
+
let r = new k.WebGLCubeRenderTarget(ca, { type: k.HalfFloatType }), i = new k.CubeCamera(la, ua, r), a = this.threeRenderer.toneMapping;
|
|
6228
6234
|
this.threeRenderer.toneMapping = k.NoToneMapping;
|
|
6229
6235
|
try {
|
|
6230
|
-
|
|
6236
|
+
i.update(this.threeRenderer, t);
|
|
6231
6237
|
} finally {
|
|
6232
|
-
this.threeRenderer.toneMapping =
|
|
6238
|
+
this.threeRenderer.toneMapping = a;
|
|
6233
6239
|
}
|
|
6234
|
-
this.
|
|
6240
|
+
this.studioBakes.set(e, {
|
|
6241
|
+
pmremTexture: n,
|
|
6242
|
+
cubeTarget: r
|
|
6243
|
+
}), this.originalByPmrem.set(n, r.texture);
|
|
6235
6244
|
} catch (e) {
|
|
6236
6245
|
console.warn("Failed to capture the studio environment for path tracing:", e);
|
|
6237
6246
|
}
|
|
6238
6247
|
}
|
|
6239
6248
|
dispose() {
|
|
6240
|
-
this.disposed = !0, this.loadedTextures.forEach((e) => e.dispose()), this.loadedTextures.clear(), this.renderTargets.forEach((e) => e.dispose()), this.renderTargets = [], this.
|
|
6249
|
+
this.disposed = !0, this.loadedTextures.forEach((e) => e.dispose()), this.loadedTextures.clear(), this.renderTargets.forEach((e) => e.dispose()), this.renderTargets = [], this.studioBakes.forEach((e) => e.cubeTarget?.dispose()), this.studioBakes.clear(), this.pmremGenerator &&= (this.pmremGenerator.dispose(), null), this.threeRenderer = null;
|
|
6241
6250
|
}
|
|
6242
|
-
},
|
|
6251
|
+
}, fa = class {
|
|
6243
6252
|
constructor(e) {
|
|
6244
6253
|
this.texture = e;
|
|
6245
6254
|
}
|
|
@@ -6261,7 +6270,7 @@ var oa = 256, sa = .1, ca = 100, la = class {
|
|
|
6261
6270
|
getThreeTexture() {
|
|
6262
6271
|
return this.texture;
|
|
6263
6272
|
}
|
|
6264
|
-
},
|
|
6273
|
+
}, pa = class {
|
|
6265
6274
|
constructor(e) {
|
|
6266
6275
|
this.object = e, this.boundingBox = new k.Box3().setFromObject(this.object);
|
|
6267
6276
|
}
|
|
@@ -6276,19 +6285,19 @@ var oa = 256, sa = .1, ca = 100, la = class {
|
|
|
6276
6285
|
applyOffset(e) {
|
|
6277
6286
|
this.object.position.add(e);
|
|
6278
6287
|
}
|
|
6279
|
-
},
|
|
6288
|
+
}, ma = class {
|
|
6280
6289
|
alignToFloor(t) {
|
|
6281
6290
|
try {
|
|
6282
6291
|
let n = null;
|
|
6283
|
-
return "getThreeObject" in t && typeof t.getThreeObject == "function" ? n = t.getThreeObject() : t instanceof k.Object3D && (n = t), n ? (new
|
|
6292
|
+
return "getThreeObject" in t && typeof t.getThreeObject == "function" ? n = t.getThreeObject() : t instanceof k.Object3D && (n = t), n ? (new pa(n).alignToFloor(), r.ok(void 0)) : r.err(new e("Could not get Three.js object for floor alignment", d.INVALID_PARAMETER));
|
|
6284
6293
|
} catch (t) {
|
|
6285
6294
|
return r.err(new e("Failed to align object to floor", d.OPERATION_FAILED, { originalError: t }));
|
|
6286
6295
|
}
|
|
6287
6296
|
}
|
|
6288
|
-
},
|
|
6297
|
+
}, ha = {
|
|
6289
6298
|
touch: 10,
|
|
6290
6299
|
default: 5
|
|
6291
|
-
},
|
|
6300
|
+
}, ga = class {
|
|
6292
6301
|
constructor() {
|
|
6293
6302
|
this.raycaster = new k.Raycaster(), this.activePointers = /* @__PURE__ */ new Set(), this.options = null, this.pending = null, this.detach = null;
|
|
6294
6303
|
}
|
|
@@ -6307,7 +6316,7 @@ var oa = 256, sa = .1, ca = 100, la = class {
|
|
|
6307
6316
|
pointerId: e.pointerId,
|
|
6308
6317
|
x: e.clientX,
|
|
6309
6318
|
y: e.clientY,
|
|
6310
|
-
threshold: e.pointerType === "touch" ?
|
|
6319
|
+
threshold: e.pointerType === "touch" ? ha.touch : ha.default
|
|
6311
6320
|
};
|
|
6312
6321
|
}, r = (e) => {
|
|
6313
6322
|
this.activePointers.delete(e.pointerId);
|
|
@@ -6351,7 +6360,7 @@ var oa = 256, sa = .1, ca = 100, la = class {
|
|
|
6351
6360
|
dispose() {
|
|
6352
6361
|
this.detach?.(), this.detach = null, this.options = null, this.pending = null, this.activePointers.clear();
|
|
6353
6362
|
}
|
|
6354
|
-
},
|
|
6363
|
+
}, _a = .001, va = { visible: !1 }, ya = class {
|
|
6355
6364
|
constructor(e) {
|
|
6356
6365
|
this.sources = e, this.anchor = new k.Vector3(), this.projected = new k.Vector3(), this.cameraPosition = new k.Vector3(), this.toAnchor = new k.Vector3(), this.raycaster = new k.Raycaster(), this.lastCameraMatrix = new k.Matrix4(), this.lastWidth = -1, this.lastHeight = -1, this.hasProjected = !1;
|
|
6357
6366
|
}
|
|
@@ -6362,7 +6371,7 @@ var oa = 256, sa = .1, ca = 100, la = class {
|
|
|
6362
6371
|
let n = y(this.sources.camera), r = this.sources.getCanvas();
|
|
6363
6372
|
if (!n || !r) return null;
|
|
6364
6373
|
let i = r.clientWidth || r.width, a = r.clientHeight || r.height;
|
|
6365
|
-
return this.hasProjected && i === this.lastWidth && a === this.lastHeight && this.lastCameraMatrix.equals(n.matrixWorld) ? null : (this.lastCameraMatrix.copy(n.matrixWorld), this.lastWidth = i, this.lastHeight = a, this.hasProjected = !0, this.anchor.set(e.x, e.y, e.z), n.getWorldPosition(this.cameraPosition), this.projected.copy(this.anchor).applyMatrix4(n.matrixWorldInverse), this.projected.z >= 0 || t && this.isOccluded(n) ?
|
|
6374
|
+
return this.hasProjected && i === this.lastWidth && a === this.lastHeight && this.lastCameraMatrix.equals(n.matrixWorld) ? null : (this.lastCameraMatrix.copy(n.matrixWorld), this.lastWidth = i, this.lastHeight = a, this.hasProjected = !0, this.anchor.set(e.x, e.y, e.z), n.getWorldPosition(this.cameraPosition), this.projected.copy(this.anchor).applyMatrix4(n.matrixWorldInverse), this.projected.z >= 0 || t && this.isOccluded(n) ? va : (this.projected.copy(this.anchor).project(n), {
|
|
6366
6375
|
visible: !0,
|
|
6367
6376
|
left: (this.projected.x + 1) / 2 * i,
|
|
6368
6377
|
top: (1 - this.projected.y) / 2 * a
|
|
@@ -6375,13 +6384,13 @@ var oa = 256, sa = .1, ca = 100, la = class {
|
|
|
6375
6384
|
let n = this.toAnchor.length();
|
|
6376
6385
|
this.raycaster.set(this.cameraPosition, this.toAnchor.normalize()), this.raycaster.camera = e, this.raycaster.firstHitOnly = !0;
|
|
6377
6386
|
let r = this.raycaster.intersectObject(t, !0)[0];
|
|
6378
|
-
return !!(r && r.distance < n -
|
|
6387
|
+
return !!(r && r.distance < n - _a);
|
|
6379
6388
|
}
|
|
6380
|
-
},
|
|
6389
|
+
}, ba = class {
|
|
6381
6390
|
createProjector(e) {
|
|
6382
|
-
return new
|
|
6391
|
+
return new ya(e);
|
|
6383
6392
|
}
|
|
6384
|
-
},
|
|
6393
|
+
}, xa = class {
|
|
6385
6394
|
constructor() {
|
|
6386
6395
|
this.mixer = null, this.clips = [], this.activeActions = [], this.playing = !1, this.speed = 1;
|
|
6387
6396
|
}
|
|
@@ -6389,7 +6398,7 @@ var oa = 256, sa = .1, ca = 100, la = class {
|
|
|
6389
6398
|
this.detach();
|
|
6390
6399
|
let t = _(e);
|
|
6391
6400
|
if (!t) return;
|
|
6392
|
-
let n =
|
|
6401
|
+
let n = Sa(t);
|
|
6393
6402
|
n && (this.clips = n.animations, this.mixer = new k.AnimationMixer(n), this.mixer.timeScale = this.speed);
|
|
6394
6403
|
}
|
|
6395
6404
|
getClipNames() {
|
|
@@ -6429,24 +6438,22 @@ var oa = 256, sa = .1, ca = 100, la = class {
|
|
|
6429
6438
|
this.mixer && (this.mixer.stopAllAction(), this.mixer.uncacheRoot(this.mixer.getRoot())), this.mixer = null, this.clips = [], this.activeActions = [], this.playing = !1;
|
|
6430
6439
|
}
|
|
6431
6440
|
};
|
|
6432
|
-
function
|
|
6441
|
+
function Sa(e) {
|
|
6433
6442
|
let t = null;
|
|
6434
6443
|
return e.traverse((e) => {
|
|
6435
6444
|
!t && (e.animations?.length ?? 0) > 0 && (t = e);
|
|
6436
6445
|
}), t;
|
|
6437
6446
|
}
|
|
6438
6447
|
//#endregion
|
|
6439
|
-
//#region src/
|
|
6440
|
-
var
|
|
6441
|
-
return e.MapControls = "MapControls", e.OrbitControls = "OrbitControls", e;
|
|
6442
|
-
}({}), Sa = class {
|
|
6448
|
+
//#region src/infrastructure/factories/ViewerFactory.ts
|
|
6449
|
+
var Ca = class {
|
|
6443
6450
|
static createViewer(e, t) {
|
|
6444
6451
|
xt(t.units);
|
|
6445
|
-
let n = new mn(e), r = new Xt(), i = this.createCamera(t), a = this.createControls(i.getThreeCamera(), e, t), o = new
|
|
6452
|
+
let n = new mn(e), r = new Xt(), i = this.createCamera(t), a = this.createControls(i.getThreeCamera(), e, t), o = new wa().createDefaultLoader({
|
|
6446
6453
|
renderer: n.getThreeRenderer() ?? void 0,
|
|
6447
6454
|
bvh: t.selection?.bvh,
|
|
6448
6455
|
...t.loaders
|
|
6449
|
-
}), s = new _i(), c = new
|
|
6456
|
+
}), s = new _i(), c = new da(), l = new vi(), u = new ma(), d = new ga(), f = new ba(), p = new xa(), m = an.convertRendererOptions(t.renderer || {});
|
|
6450
6457
|
return m.preserveDrawingBuffer = !0, new Ut({
|
|
6451
6458
|
renderer: n,
|
|
6452
6459
|
scene: r,
|
|
@@ -6479,23 +6486,23 @@ var xa = /* @__PURE__ */ function(e) {
|
|
|
6479
6486
|
}), s;
|
|
6480
6487
|
}
|
|
6481
6488
|
static createControls(e, t, n) {
|
|
6482
|
-
let r = n.controls || {}, i = r.type ||
|
|
6483
|
-
a = i ===
|
|
6489
|
+
let r = n.controls || {}, i = r.type || oa.OrbitControls, a;
|
|
6490
|
+
a = i === oa.MapControls ? new Jr(e, t) : new qr(e, t), a.enabled = r.enabled ?? !0, a.enableDamping = r.enableDamping ?? !0, a.dampingFactor = r.dampingFactor ?? .25, a.enableZoom = r.enableZoom ?? !0, a.enableRotate = r.enableRotate ?? !0, a.enablePan = r.enablePan ?? !0, a.autoRotate = r.autoRotate ?? !1, r.autoRotateSpeed !== void 0 && (a.autoRotateSpeed = r.autoRotateSpeed), r.minDistance !== void 0 && (a.minDistance = r.minDistance), r.maxDistance !== void 0 && (a.maxDistance = r.maxDistance), r.minPolarAngle !== void 0 && (a.minPolarAngle = r.minPolarAngle), r.maxPolarAngle !== void 0 && (a.maxPolarAngle = r.maxPolarAngle);
|
|
6484
6491
|
let o = n.camera || {}, s = o.target || o.cameraTarget;
|
|
6485
6492
|
return s && a.target && (a.target.set(s[0], s[1], s[2]), a.update()), a;
|
|
6486
6493
|
}
|
|
6487
|
-
},
|
|
6494
|
+
}, wa = class extends br {
|
|
6488
6495
|
createDefaultLoader(e = {}) {
|
|
6489
6496
|
return br.createLoader("model.glb", e);
|
|
6490
6497
|
}
|
|
6491
|
-
},
|
|
6498
|
+
}, Ta = [
|
|
6492
6499
|
"toneMappingExposure",
|
|
6493
6500
|
"bloom",
|
|
6494
6501
|
"vignette",
|
|
6495
6502
|
"filmGrain",
|
|
6496
6503
|
"colorGrade"
|
|
6497
|
-
],
|
|
6498
|
-
function
|
|
6504
|
+
], Ea = ["environmentIntensity"], Da = ["autoRotate", "autoRotateSpeed"], Oa = ["enabled"];
|
|
6505
|
+
function ka(e) {
|
|
6499
6506
|
let t = {
|
|
6500
6507
|
backgroundColor: e.backgroundColor,
|
|
6501
6508
|
backgroundColorEdge: e.backgroundColorEdge
|
|
@@ -6515,7 +6522,7 @@ function Oa(e) {
|
|
|
6515
6522
|
}
|
|
6516
6523
|
//#endregion
|
|
6517
6524
|
//#region src/defaultOptions.ts
|
|
6518
|
-
var
|
|
6525
|
+
var Aa = {
|
|
6519
6526
|
staticScene: !1,
|
|
6520
6527
|
backgroundColor: "#f0f0f7",
|
|
6521
6528
|
replaceWithScreenshotOnComplete: !1,
|
|
@@ -6548,7 +6555,8 @@ var ka = {
|
|
|
6548
6555
|
},
|
|
6549
6556
|
environment: {
|
|
6550
6557
|
backgroundIntensity: 1,
|
|
6551
|
-
environmentIntensity: .5
|
|
6558
|
+
environmentIntensity: .5,
|
|
6559
|
+
studioLook: sa
|
|
6552
6560
|
},
|
|
6553
6561
|
lighting: {
|
|
6554
6562
|
ambientLight: {
|
|
@@ -6615,7 +6623,7 @@ var ka = {
|
|
|
6615
6623
|
toneMappingExposure: 1.15
|
|
6616
6624
|
},
|
|
6617
6625
|
controls: {
|
|
6618
|
-
type:
|
|
6626
|
+
type: oa.OrbitControls,
|
|
6619
6627
|
enabled: !0,
|
|
6620
6628
|
enableDamping: !0,
|
|
6621
6629
|
dampingFactor: .25,
|
|
@@ -6644,7 +6652,38 @@ var ka = {
|
|
|
6644
6652
|
studioEnvironment: !0,
|
|
6645
6653
|
darkStudioMode: !1
|
|
6646
6654
|
}
|
|
6647
|
-
},
|
|
6655
|
+
}, ja = {
|
|
6656
|
+
studio_dome: {
|
|
6657
|
+
helpers: {
|
|
6658
|
+
grid: { type: "shadow_floor" },
|
|
6659
|
+
studioEnvironment: !0
|
|
6660
|
+
},
|
|
6661
|
+
environment: { studioLook: "crisp" }
|
|
6662
|
+
},
|
|
6663
|
+
studio_soft: {
|
|
6664
|
+
helpers: {
|
|
6665
|
+
grid: { type: "shadow_floor" },
|
|
6666
|
+
studioEnvironment: !0
|
|
6667
|
+
},
|
|
6668
|
+
environment: { studioLook: "soft" },
|
|
6669
|
+
lighting: {
|
|
6670
|
+
ambientLight: { intensity: .55 },
|
|
6671
|
+
hemisphereLight: { intensity: .6 },
|
|
6672
|
+
directionalLight: {
|
|
6673
|
+
intensity: 1.4,
|
|
6674
|
+
shadow: { radius: 26 }
|
|
6675
|
+
},
|
|
6676
|
+
fillLight: { intensity: 1.2 },
|
|
6677
|
+
rimLight: { intensity: .7 }
|
|
6678
|
+
}
|
|
6679
|
+
}
|
|
6680
|
+
}, Ma = "studio_dome";
|
|
6681
|
+
function Na(e) {
|
|
6682
|
+
return e ? ja[e] ?? {} : {};
|
|
6683
|
+
}
|
|
6684
|
+
//#endregion
|
|
6685
|
+
//#region src/presets.ts
|
|
6686
|
+
var Pa = {
|
|
6648
6687
|
studio: {
|
|
6649
6688
|
backgroundColor: "#f0f0f7",
|
|
6650
6689
|
renderer: { toneMappingExposure: 1.15 },
|
|
@@ -6672,30 +6711,31 @@ var ka = {
|
|
|
6672
6711
|
environment: { environmentIntensity: .6 }
|
|
6673
6712
|
}
|
|
6674
6713
|
};
|
|
6675
|
-
function
|
|
6676
|
-
return e ?
|
|
6714
|
+
function Fa(e) {
|
|
6715
|
+
return e ? Pa[e] ?? {} : {};
|
|
6677
6716
|
}
|
|
6678
|
-
function
|
|
6679
|
-
return Ot(Ot(e,
|
|
6717
|
+
function Ia(e, t) {
|
|
6718
|
+
return Ot(Ot(Ot(e, Na(t.scene)), Fa(t.preset)), t);
|
|
6680
6719
|
}
|
|
6681
6720
|
//#endregion
|
|
6682
6721
|
//#region src/presentation/hooks/useStableOptions.ts
|
|
6683
|
-
var
|
|
6722
|
+
var La = (e, ...t) => {
|
|
6684
6723
|
if (!e) return;
|
|
6685
6724
|
let n = { ...e };
|
|
6686
6725
|
for (let e of t) delete n[e];
|
|
6687
6726
|
return Object.keys(n).length > 0 ? n : void 0;
|
|
6688
6727
|
};
|
|
6689
|
-
function
|
|
6728
|
+
function Ra(e) {
|
|
6690
6729
|
let t = ee(() => JSON.stringify({
|
|
6691
|
-
pathTracing:
|
|
6730
|
+
pathTracing: La(e.pathTracing, ...Oa),
|
|
6692
6731
|
staticScene: e.staticScene,
|
|
6693
|
-
renderer:
|
|
6732
|
+
renderer: La(e.renderer, ...Ta),
|
|
6694
6733
|
camera: e.camera,
|
|
6695
|
-
controls:
|
|
6696
|
-
environment:
|
|
6734
|
+
controls: La(e.controls, ...Da),
|
|
6735
|
+
environment: La(e.environment, ...Ea),
|
|
6736
|
+
scene: e.scene ?? "studio_dome",
|
|
6697
6737
|
lighting: e.lighting,
|
|
6698
|
-
helpers:
|
|
6738
|
+
helpers: La(e.helpers, "gizmo"),
|
|
6699
6739
|
rendering: e.rendering,
|
|
6700
6740
|
replaceWithScreenshotOnComplete: e.replaceWithScreenshotOnComplete,
|
|
6701
6741
|
loaders: e.loaders,
|
|
@@ -6709,6 +6749,7 @@ function Pa(e) {
|
|
|
6709
6749
|
e.camera,
|
|
6710
6750
|
e.controls,
|
|
6711
6751
|
e.environment,
|
|
6752
|
+
e.scene,
|
|
6712
6753
|
e.lighting,
|
|
6713
6754
|
e.helpers,
|
|
6714
6755
|
e.rendering,
|
|
@@ -6718,8 +6759,8 @@ function Pa(e) {
|
|
|
6718
6759
|
e.floorAlignment,
|
|
6719
6760
|
e.selection
|
|
6720
6761
|
]), n = ee(() => {
|
|
6721
|
-
let t =
|
|
6722
|
-
return JSON.stringify(
|
|
6762
|
+
let t = Ia(Aa, e);
|
|
6763
|
+
return JSON.stringify(ka(t));
|
|
6723
6764
|
}, [
|
|
6724
6765
|
e.preset,
|
|
6725
6766
|
e.backgroundColor,
|
|
@@ -6738,8 +6779,8 @@ function Pa(e) {
|
|
|
6738
6779
|
}
|
|
6739
6780
|
//#endregion
|
|
6740
6781
|
//#region src/presentation/hooks/useViewportGate.ts
|
|
6741
|
-
var
|
|
6742
|
-
function
|
|
6782
|
+
var za = "200px";
|
|
6783
|
+
function Ba(e, t) {
|
|
6743
6784
|
let [n, r] = te(!t);
|
|
6744
6785
|
return E(() => {
|
|
6745
6786
|
if (n) return;
|
|
@@ -6754,7 +6795,7 @@ function Ia(e, t) {
|
|
|
6754
6795
|
}
|
|
6755
6796
|
let a = new IntersectionObserver((e) => {
|
|
6756
6797
|
e.some((e) => e.isIntersecting) && r(!0);
|
|
6757
|
-
}, { rootMargin:
|
|
6798
|
+
}, { rootMargin: za });
|
|
6758
6799
|
return a.observe(i), () => a.disconnect();
|
|
6759
6800
|
}, [
|
|
6760
6801
|
e,
|
|
@@ -6764,19 +6805,19 @@ function Ia(e, t) {
|
|
|
6764
6805
|
}
|
|
6765
6806
|
//#endregion
|
|
6766
6807
|
//#region src/presentation/hooks/useViewerCore.ts
|
|
6767
|
-
function
|
|
6808
|
+
function Va(e, t) {
|
|
6768
6809
|
let n = O(null), r = O({
|
|
6769
6810
|
width: 0,
|
|
6770
6811
|
height: 0
|
|
6771
|
-
}), [i, a] = te(
|
|
6812
|
+
}), [i, a] = te(null), o = i !== null, [s, c] = te(null), { options: l, structuralKey: u, runtimeKey: d } = Ra(t), f = Ba(e, (t.loading ?? "eager") === "lazy");
|
|
6772
6813
|
return E(() => {
|
|
6773
|
-
if (!
|
|
6774
|
-
|
|
6775
|
-
let t =
|
|
6814
|
+
if (!f || !e.current || n.current) return;
|
|
6815
|
+
c(null);
|
|
6816
|
+
let t = Ia(Aa, l), i;
|
|
6776
6817
|
try {
|
|
6777
|
-
i =
|
|
6818
|
+
i = Ca.createViewer(e.current, t);
|
|
6778
6819
|
} catch (e) {
|
|
6779
|
-
console.error("Failed to create viewer:", e),
|
|
6820
|
+
console.error("Failed to create viewer:", e), c(e instanceof Error ? e : Error(String(e)));
|
|
6780
6821
|
return;
|
|
6781
6822
|
}
|
|
6782
6823
|
n.current = i, r.current = {
|
|
@@ -6785,19 +6826,19 @@ function La(e, t) {
|
|
|
6785
6826
|
};
|
|
6786
6827
|
let o = !1;
|
|
6787
6828
|
return i.initialize().then((e) => {
|
|
6788
|
-
o || (e.ok ? a(
|
|
6829
|
+
o || (e.ok ? a(i) : (console.error("Failed to initialize viewer:", e.error), c(e.error)));
|
|
6789
6830
|
}), () => {
|
|
6790
|
-
o = !0, i.dispose(), n.current = null, a(
|
|
6831
|
+
o = !0, i.dispose(), n.current = null, a(null);
|
|
6791
6832
|
};
|
|
6792
6833
|
}, [
|
|
6793
6834
|
e,
|
|
6794
|
-
|
|
6795
|
-
|
|
6835
|
+
u,
|
|
6836
|
+
f
|
|
6796
6837
|
]), E(() => {
|
|
6797
|
-
if (!
|
|
6798
|
-
let e =
|
|
6799
|
-
|
|
6800
|
-
}, [
|
|
6838
|
+
if (!i) return;
|
|
6839
|
+
let e = Ia(Aa, l);
|
|
6840
|
+
i.updateOptions(ka(e));
|
|
6841
|
+
}, [d, i]), E(() => {
|
|
6801
6842
|
if (!n.current || !e.current) return;
|
|
6802
6843
|
let t = null, i = (i) => {
|
|
6803
6844
|
if (e.current && n.current) {
|
|
@@ -6822,19 +6863,15 @@ function La(e, t) {
|
|
|
6822
6863
|
return typeof ResizeObserver < "u" && e.current.parentElement && (o = new ResizeObserver(i), o.observe(e.current.parentElement)), () => {
|
|
6823
6864
|
window.removeEventListener("resize", a), o?.disconnect(), t !== null && cancelAnimationFrame(t);
|
|
6824
6865
|
};
|
|
6825
|
-
}, [
|
|
6826
|
-
i,
|
|
6827
|
-
|
|
6828
|
-
|
|
6829
|
-
]), {
|
|
6830
|
-
viewer: n.current,
|
|
6831
|
-
isInitialized: i,
|
|
6832
|
-
initError: o
|
|
6866
|
+
}, [i, e]), {
|
|
6867
|
+
viewer: i,
|
|
6868
|
+
isInitialized: o,
|
|
6869
|
+
initError: s
|
|
6833
6870
|
};
|
|
6834
6871
|
}
|
|
6835
6872
|
//#endregion
|
|
6836
6873
|
//#region src/presentation/hooks/useViewerEvents.ts
|
|
6837
|
-
function
|
|
6874
|
+
function Ha(e, t) {
|
|
6838
6875
|
let n = O(t);
|
|
6839
6876
|
n.current = t, E(() => {
|
|
6840
6877
|
if (!e) return;
|
|
@@ -6853,7 +6890,7 @@ function Ra(e, t) {
|
|
|
6853
6890
|
}
|
|
6854
6891
|
//#endregion
|
|
6855
6892
|
//#region src/presentation/hooks/usePickedPreset.ts
|
|
6856
|
-
function
|
|
6893
|
+
function Ua(e, t) {
|
|
6857
6894
|
let [n, r] = te(null), i = O(/* @__PURE__ */ new Set());
|
|
6858
6895
|
E(() => {
|
|
6859
6896
|
if (e !== void 0 && i.current.has(e)) {
|
|
@@ -6877,7 +6914,7 @@ function za(e, t) {
|
|
|
6877
6914
|
}
|
|
6878
6915
|
//#endregion
|
|
6879
6916
|
//#region src/presentation/hooks/useResolvedOptions.ts
|
|
6880
|
-
function
|
|
6917
|
+
function Wa(e, t, n, r, i) {
|
|
6881
6918
|
return ee(() => {
|
|
6882
6919
|
let a = e.preset !== t, o = n === !0 && e.pathTracing?.enabled === void 0, s = r !== void 0 && e.controls?.autoRotate === void 0, c = i !== void 0 && e.animations?.autoplay === void 0;
|
|
6883
6920
|
return !a && !o && !s && !c ? e : {
|
|
@@ -6906,7 +6943,7 @@ function Ba(e, t, n, r, i) {
|
|
|
6906
6943
|
}
|
|
6907
6944
|
//#endregion
|
|
6908
6945
|
//#region src/presentation/hooks/useModelLoader.ts
|
|
6909
|
-
function
|
|
6946
|
+
function Ga(e, t, n) {
|
|
6910
6947
|
let r = ee(() => {
|
|
6911
6948
|
if (typeof n == "string") return n;
|
|
6912
6949
|
if (n) return `object-${n.uuid || "no-uuid"}`;
|
|
@@ -6932,7 +6969,7 @@ function Va(e, t, n) {
|
|
|
6932
6969
|
}
|
|
6933
6970
|
//#endregion
|
|
6934
6971
|
//#region src/presentation/adapters/EventAdapter.ts
|
|
6935
|
-
var
|
|
6972
|
+
var Ka = class {
|
|
6936
6973
|
static toThreeObject(e) {
|
|
6937
6974
|
let t = _(e);
|
|
6938
6975
|
if (t) return t;
|
|
@@ -6973,24 +7010,24 @@ var Ha = class {
|
|
|
6973
7010
|
};
|
|
6974
7011
|
//#endregion
|
|
6975
7012
|
//#region src/presentation/hooks/useForwardedEvents.ts
|
|
6976
|
-
function
|
|
7013
|
+
function qa(e) {
|
|
6977
7014
|
let n = O(new t());
|
|
6978
|
-
return
|
|
7015
|
+
return Ha(e, ee(() => ({
|
|
6979
7016
|
"model:loading": (e) => n.current.emit("model:loading", e),
|
|
6980
7017
|
"model:progress": (e) => n.current.emit("model:progress", e),
|
|
6981
|
-
"model:loaded": (e) => n.current.emit("model:loaded",
|
|
7018
|
+
"model:loaded": (e) => n.current.emit("model:loaded", Ka.convertModelLoaded(e)),
|
|
6982
7019
|
"model:error": (e) => n.current.emit("model:error", e),
|
|
6983
7020
|
"render:complete": (e) => n.current.emit("render:complete", e),
|
|
6984
|
-
"controls:change": (e) => n.current.emit("controls:change",
|
|
6985
|
-
"object:selected": (e) => n.current.emit("object:selected",
|
|
7021
|
+
"controls:change": (e) => n.current.emit("controls:change", Ka.convertControlsChange(e)),
|
|
7022
|
+
"object:selected": (e) => n.current.emit("object:selected", Ka.convertObjectSelected(e)),
|
|
6986
7023
|
error: (e) => n.current.emit("error", e)
|
|
6987
7024
|
}), [])), n.current;
|
|
6988
7025
|
}
|
|
6989
7026
|
//#endregion
|
|
6990
7027
|
//#region src/presentation/hooks/useOptionCallbacks.ts
|
|
6991
|
-
function
|
|
7028
|
+
function Ja(e, t, n) {
|
|
6992
7029
|
let r = O(n);
|
|
6993
|
-
r.current = n,
|
|
7030
|
+
r.current = n, Ha(e, ee(() => ({
|
|
6994
7031
|
"model:loaded": () => r.current.onLoad?.(),
|
|
6995
7032
|
"model:progress": (e) => r.current.onProgress?.(Math.min(1, e.loaded / e.total)),
|
|
6996
7033
|
"model:error": (e) => r.current.onError?.(e.error)
|
|
@@ -7007,26 +7044,26 @@ function Wa(e, t, n) {
|
|
|
7007
7044
|
}
|
|
7008
7045
|
//#endregion
|
|
7009
7046
|
//#region src/presentation/components/ViewerContext.tsx
|
|
7010
|
-
var
|
|
7011
|
-
function
|
|
7047
|
+
var Ya = S(null);
|
|
7048
|
+
function Xa({ viewer: e, canvasRef: t, children: n }) {
|
|
7012
7049
|
let r = ee(() => ({
|
|
7013
7050
|
viewer: e,
|
|
7014
7051
|
canvasRef: t
|
|
7015
7052
|
}), [e, t]);
|
|
7016
|
-
return /* @__PURE__ */ U(
|
|
7053
|
+
return /* @__PURE__ */ U(Ya.Provider, {
|
|
7017
7054
|
value: r,
|
|
7018
7055
|
children: n
|
|
7019
7056
|
});
|
|
7020
7057
|
}
|
|
7021
|
-
function
|
|
7022
|
-
let e = T(
|
|
7058
|
+
function Za() {
|
|
7059
|
+
let e = T(Ya);
|
|
7023
7060
|
if (!e) throw Error("useViewerContext must be used within ViewerProvider");
|
|
7024
7061
|
return e;
|
|
7025
7062
|
}
|
|
7026
7063
|
//#endregion
|
|
7027
7064
|
//#region src/presentation/components/ViewerCanvas.tsx
|
|
7028
|
-
function
|
|
7029
|
-
let { canvasRef: e } =
|
|
7065
|
+
function Qa() {
|
|
7066
|
+
let { canvasRef: e } = Za();
|
|
7030
7067
|
return /* @__PURE__ */ U("canvas", {
|
|
7031
7068
|
ref: e,
|
|
7032
7069
|
style: {
|
|
@@ -7050,13 +7087,13 @@ function Ja() {
|
|
|
7050
7087
|
console.error("vite-plugin-css-injected-by-js", e);
|
|
7051
7088
|
}
|
|
7052
7089
|
})();
|
|
7053
|
-
var
|
|
7090
|
+
var $a = (e, t, n, r, i, a) => {
|
|
7054
7091
|
let o = performance.now(), s = () => {
|
|
7055
7092
|
let c = performance.now() - o, l = Math.min(c / i, 1);
|
|
7056
7093
|
e.position.lerpVectors(n, r, l), t?.update(), a(), l < 1 && requestAnimationFrame(s);
|
|
7057
7094
|
};
|
|
7058
7095
|
requestAnimationFrame(s);
|
|
7059
|
-
},
|
|
7096
|
+
}, eo = { type: "change" }, to = { type: "start" }, no = { type: "end" }, ro = new R(), io = new Xe(), ao = Math.cos(70 * Fe.DEG2RAD), X = new H(), Z = 2 * Math.PI, Q = {
|
|
7060
7097
|
NONE: -1,
|
|
7061
7098
|
ROTATE: 0,
|
|
7062
7099
|
DOLLY: 1,
|
|
@@ -7065,7 +7102,7 @@ var Ya = (e, t, n, r, i, a) => {
|
|
|
7065
7102
|
TOUCH_PAN: 4,
|
|
7066
7103
|
TOUCH_DOLLY_PAN: 5,
|
|
7067
7104
|
TOUCH_DOLLY_ROTATE: 6
|
|
7068
|
-
},
|
|
7105
|
+
}, oo = 1e-6, so = class extends fe {
|
|
7069
7106
|
constructor(e, t = null) {
|
|
7070
7107
|
super(e, t), this.state = Q.NONE, this.target = new H(), this.cursor = new H(), this.minDistance = 0, this.maxDistance = Infinity, this.minZoom = 0, this.maxZoom = Infinity, this.minTargetRadius = 0, this.maxTargetRadius = Infinity, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -Infinity, this.maxAzimuthAngle = Infinity, this.enableDamping = !1, this.dampingFactor = .05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = {
|
|
7071
7108
|
LEFT: "ArrowLeft",
|
|
@@ -7079,7 +7116,7 @@ var Ya = (e, t, n, r, i, a) => {
|
|
|
7079
7116
|
}, this.touches = {
|
|
7080
7117
|
ONE: B.ROTATE,
|
|
7081
7118
|
TWO: B.DOLLY_PAN
|
|
7082
|
-
}, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new H(), this._lastQuaternion = new tt(), this._lastTargetPosition = new H(), this._quat = new tt().setFromUnitVectors(e.up, new H(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new ft(), this._sphericalDelta = new ft(), this._scale = 1, this._panOffset = new H(), this._rotateStart = new V(), this._rotateEnd = new V(), this._rotateDelta = new V(), this._panStart = new V(), this._panEnd = new V(), this._panDelta = new V(), this._dollyStart = new V(), this._dollyEnd = new V(), this._dollyDelta = new V(), this._dollyDirection = new H(), this._mouse = new V(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove =
|
|
7119
|
+
}, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new H(), this._lastQuaternion = new tt(), this._lastTargetPosition = new H(), this._quat = new tt().setFromUnitVectors(e.up, new H(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new ft(), this._sphericalDelta = new ft(), this._scale = 1, this._panOffset = new H(), this._rotateStart = new V(), this._rotateEnd = new V(), this._rotateDelta = new V(), this._panStart = new V(), this._panEnd = new V(), this._panDelta = new V(), this._dollyStart = new V(), this._dollyEnd = new V(), this._dollyDelta = new V(), this._dollyDirection = new H(), this._mouse = new V(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = lo.bind(this), this._onPointerDown = co.bind(this), this._onPointerUp = uo.bind(this), this._onContextMenu = vo.bind(this), this._onMouseWheel = mo.bind(this), this._onKeyDown = ho.bind(this), this._onTouchStart = go.bind(this), this._onTouchMove = _o.bind(this), this._onMouseDown = fo.bind(this), this._onMouseMove = po.bind(this), this._interceptControlDown = yo.bind(this), this._interceptControlUp = bo.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
|
|
7083
7120
|
}
|
|
7084
7121
|
connect(e) {
|
|
7085
7122
|
super.connect(e), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerUp), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.getRootNode().addEventListener("keydown", this._interceptControlDown, {
|
|
@@ -7112,7 +7149,7 @@ var Ya = (e, t, n, r, i, a) => {
|
|
|
7112
7149
|
this.target0.copy(this.target), this.position0.copy(this.object.position), this.zoom0 = this.object.zoom;
|
|
7113
7150
|
}
|
|
7114
7151
|
reset() {
|
|
7115
|
-
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(
|
|
7152
|
+
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(eo), this.update(), this.state = Q.NONE;
|
|
7116
7153
|
}
|
|
7117
7154
|
update(e = null) {
|
|
7118
7155
|
let t = this.object.position;
|
|
@@ -7140,12 +7177,12 @@ var Ya = (e, t, n, r, i, a) => {
|
|
|
7140
7177
|
let r = new H(this._mouse.x, this._mouse.y, 0);
|
|
7141
7178
|
r.unproject(this.object), this.object.position.sub(r).add(t), this.object.updateMatrixWorld(), e = X.length();
|
|
7142
7179
|
} else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
|
|
7143
|
-
e !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(e).add(this.object.position) : (
|
|
7180
|
+
e !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(e).add(this.object.position) : (ro.origin.copy(this.object.position), ro.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(ro.direction)) < ao ? this.object.lookAt(this.target) : (io.setFromNormalAndCoplanarPoint(this.object.up, this.target), ro.intersectPlane(io, this.target))));
|
|
7144
7181
|
} else if (this.object.isOrthographicCamera) {
|
|
7145
7182
|
let e = this.object.zoom;
|
|
7146
7183
|
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), e !== this.object.zoom && (this.object.updateProjectionMatrix(), i = !0);
|
|
7147
7184
|
}
|
|
7148
|
-
return this._scale = 1, this._performCursorZoom = !1, i || this._lastPosition.distanceToSquared(this.object.position) >
|
|
7185
|
+
return this._scale = 1, this._performCursorZoom = !1, i || this._lastPosition.distanceToSquared(this.object.position) > oo || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > oo || this._lastTargetPosition.distanceToSquared(this.target) > oo ? (this.dispatchEvent(eo), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
|
|
7149
7186
|
}
|
|
7150
7187
|
_getAutoRotationAngle(e) {
|
|
7151
7188
|
return e === null ? Z / 60 / 60 * this.autoRotateSpeed : Z / 60 * this.autoRotateSpeed * e;
|
|
@@ -7324,16 +7361,16 @@ var Ya = (e, t, n, r, i, a) => {
|
|
|
7324
7361
|
return e.ctrlKey && !this._controlActive && (n.deltaY *= 10), n;
|
|
7325
7362
|
}
|
|
7326
7363
|
};
|
|
7327
|
-
function
|
|
7364
|
+
function co(e) {
|
|
7328
7365
|
this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(e.pointerId), this.domElement.addEventListener("pointermove", this._onPointerMove), this.domElement.addEventListener("pointerup", this._onPointerUp)), !this._isTrackingPointer(e) && (this._addPointer(e), e.pointerType === "touch" ? this._onTouchStart(e) : this._onMouseDown(e)));
|
|
7329
7366
|
}
|
|
7330
|
-
function
|
|
7367
|
+
function lo(e) {
|
|
7331
7368
|
this.enabled !== !1 && (e.pointerType === "touch" ? this._onTouchMove(e) : this._onMouseMove(e));
|
|
7332
7369
|
}
|
|
7333
|
-
function
|
|
7370
|
+
function uo(e) {
|
|
7334
7371
|
switch (this._removePointer(e), this._pointers.length) {
|
|
7335
7372
|
case 0:
|
|
7336
|
-
this.domElement.releasePointerCapture(e.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(
|
|
7373
|
+
this.domElement.releasePointerCapture(e.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(no), this.state = Q.NONE;
|
|
7337
7374
|
break;
|
|
7338
7375
|
case 1:
|
|
7339
7376
|
let t = this._pointers[0], n = this._pointerPositions[t];
|
|
@@ -7345,7 +7382,7 @@ function oo(e) {
|
|
|
7345
7382
|
break;
|
|
7346
7383
|
}
|
|
7347
7384
|
}
|
|
7348
|
-
function
|
|
7385
|
+
function fo(e) {
|
|
7349
7386
|
let t;
|
|
7350
7387
|
switch (e.button) {
|
|
7351
7388
|
case 0:
|
|
@@ -7384,9 +7421,9 @@ function so(e) {
|
|
|
7384
7421
|
break;
|
|
7385
7422
|
default: this.state = Q.NONE;
|
|
7386
7423
|
}
|
|
7387
|
-
this.state !== Q.NONE && this.dispatchEvent(
|
|
7424
|
+
this.state !== Q.NONE && this.dispatchEvent(to);
|
|
7388
7425
|
}
|
|
7389
|
-
function
|
|
7426
|
+
function po(e) {
|
|
7390
7427
|
switch (this.state) {
|
|
7391
7428
|
case Q.ROTATE:
|
|
7392
7429
|
if (this.enableRotate === !1) return;
|
|
@@ -7402,13 +7439,13 @@ function co(e) {
|
|
|
7402
7439
|
break;
|
|
7403
7440
|
}
|
|
7404
7441
|
}
|
|
7405
|
-
function
|
|
7406
|
-
this.enabled === !1 || this.enableZoom === !1 || this.state !== Q.NONE || (e.preventDefault(), this.dispatchEvent(
|
|
7442
|
+
function mo(e) {
|
|
7443
|
+
this.enabled === !1 || this.enableZoom === !1 || this.state !== Q.NONE || (e.preventDefault(), this.dispatchEvent(to), this._handleMouseWheel(this._customWheelEvent(e)), this.dispatchEvent(no));
|
|
7407
7444
|
}
|
|
7408
|
-
function
|
|
7445
|
+
function ho(e) {
|
|
7409
7446
|
this.enabled !== !1 && this._handleKeyDown(e);
|
|
7410
7447
|
}
|
|
7411
|
-
function
|
|
7448
|
+
function go(e) {
|
|
7412
7449
|
switch (this._trackPointer(e), this._pointers.length) {
|
|
7413
7450
|
case 1:
|
|
7414
7451
|
switch (this.touches.ONE) {
|
|
@@ -7438,9 +7475,9 @@ function fo(e) {
|
|
|
7438
7475
|
break;
|
|
7439
7476
|
default: this.state = Q.NONE;
|
|
7440
7477
|
}
|
|
7441
|
-
this.state !== Q.NONE && this.dispatchEvent(
|
|
7478
|
+
this.state !== Q.NONE && this.dispatchEvent(to);
|
|
7442
7479
|
}
|
|
7443
|
-
function
|
|
7480
|
+
function _o(e) {
|
|
7444
7481
|
switch (this._trackPointer(e), this.state) {
|
|
7445
7482
|
case Q.TOUCH_ROTATE:
|
|
7446
7483
|
if (this.enableRotate === !1) return;
|
|
@@ -7461,22 +7498,22 @@ function po(e) {
|
|
|
7461
7498
|
default: this.state = Q.NONE;
|
|
7462
7499
|
}
|
|
7463
7500
|
}
|
|
7464
|
-
function
|
|
7501
|
+
function vo(e) {
|
|
7465
7502
|
this.enabled !== !1 && e.preventDefault();
|
|
7466
7503
|
}
|
|
7467
|
-
function
|
|
7504
|
+
function yo(e) {
|
|
7468
7505
|
e.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, {
|
|
7469
7506
|
passive: !0,
|
|
7470
7507
|
capture: !0
|
|
7471
7508
|
}));
|
|
7472
7509
|
}
|
|
7473
|
-
function
|
|
7510
|
+
function bo(e) {
|
|
7474
7511
|
e.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, {
|
|
7475
7512
|
passive: !0,
|
|
7476
7513
|
capture: !0
|
|
7477
7514
|
}));
|
|
7478
7515
|
}
|
|
7479
|
-
var
|
|
7516
|
+
var xo = class extends so {
|
|
7480
7517
|
constructor(e, t) {
|
|
7481
7518
|
super(e, t), this.screenSpacePanning = !1, this.mouseButtons = {
|
|
7482
7519
|
LEFT: L.PAN,
|
|
@@ -7501,39 +7538,39 @@ var _o = class extends ro {
|
|
|
7501
7538
|
EDGE_COLOR: "#EFF3F2",
|
|
7502
7539
|
CORNER_COLOR: "#EFF3F2",
|
|
7503
7540
|
LINE_COLOR: 0
|
|
7504
|
-
},
|
|
7541
|
+
}, So = /* @__PURE__ */ ((e) => (e.FRONT = "FRONT", e.BACK = "BACK", e.RIGHT = "RIGHT", e.LEFT = "LEFT", e.TOP = "TOP", e.BOTTOM = "BOTTOM", e))(So || {});
|
|
7505
7542
|
new k.Vector3(0, 1, 0);
|
|
7506
|
-
var
|
|
7543
|
+
var Co = "rotation-arrows-name", wo = "left-rotation-arrow-name", To = "right-rotation-arrow-name", Eo = "gizmo-group-name", Do = [To, wo], Oo = {
|
|
7507
7544
|
GIZMO_DISTANCE: 8,
|
|
7508
7545
|
DEFAULT_UP: new k.Vector3(0, 1, 0),
|
|
7509
7546
|
FORWARD: new k.Vector3(0, 0, -1)
|
|
7510
|
-
},
|
|
7511
|
-
constructor(e, t =
|
|
7547
|
+
}, ko = (e) => Oo.FORWARD.clone().applyQuaternion(e), Ao = (e, t, n = new k.Vector3()) => n.clone().add(e.multiplyScalar(-t)), jo = class {
|
|
7548
|
+
constructor(e, t = Co) {
|
|
7512
7549
|
this.gizmoScene = e, this.gizmoArrowsName = t;
|
|
7513
7550
|
}
|
|
7514
7551
|
syncGizmoWithMain(e, t) {
|
|
7515
7552
|
e.quaternion.copy(t.quaternion), e.up.copy(t.up);
|
|
7516
|
-
let n =
|
|
7517
|
-
e.position.copy(
|
|
7553
|
+
let n = ko(e.quaternion).normalize();
|
|
7554
|
+
e.position.copy(Ao(n, Oo.GIZMO_DISTANCE)), e.camera.updateMatrixWorld(!0);
|
|
7518
7555
|
let r = this.gizmoScene.getObjectByName(this.gizmoArrowsName);
|
|
7519
7556
|
r && r.rotation.copy(e.camera.rotation);
|
|
7520
7557
|
}
|
|
7521
7558
|
syncMainWithGizmo(e, t, n) {
|
|
7522
7559
|
let r = n.target.clone(), i = e.position.distanceTo(r), a = e.camera instanceof k.PerspectiveCamera;
|
|
7523
|
-
n instanceof
|
|
7560
|
+
n instanceof xo && !a ? this.syncMapControls(e, t, r, i) : this.syncOrbitControls(e, t, r, i), e.camera.updateMatrix(), e.camera.updateMatrixWorld(!0), n.update();
|
|
7524
7561
|
}
|
|
7525
7562
|
syncMapControls(e, t, n, r) {
|
|
7526
|
-
let i = e.position.y - n.y, a =
|
|
7563
|
+
let i = e.position.y - n.y, a = ko(t.quaternion);
|
|
7527
7564
|
a.y = 0, a.normalize();
|
|
7528
7565
|
let o = n.clone();
|
|
7529
|
-
o.y += i, o.add(a.multiplyScalar(-r)), e.position.copy(o), e.up.copy(
|
|
7566
|
+
o.y += i, o.add(a.multiplyScalar(-r)), e.position.copy(o), e.up.copy(Oo.DEFAULT_UP), e.camera.lookAt(n);
|
|
7530
7567
|
}
|
|
7531
7568
|
syncOrbitControls(e, t, n, r) {
|
|
7532
|
-
let i =
|
|
7569
|
+
let i = ko(t.quaternion), a = Oo.DEFAULT_UP.clone().applyQuaternion(t.quaternion), o = Ao(i, r, n);
|
|
7533
7570
|
e.position.copy(o), e.up.copy(a), e.camera.lookAt(n);
|
|
7534
7571
|
}
|
|
7535
|
-
},
|
|
7536
|
-
|
|
7572
|
+
}, Mo = (e) => new jo(e), No = (e, t, n) => {
|
|
7573
|
+
Mo(n).syncGizmoWithMain({
|
|
7537
7574
|
camera: e,
|
|
7538
7575
|
position: e.position,
|
|
7539
7576
|
quaternion: e.quaternion,
|
|
@@ -7544,8 +7581,8 @@ var yo = "rotation-arrows-name", bo = "left-rotation-arrow-name", xo = "right-ro
|
|
|
7544
7581
|
quaternion: t.quaternion,
|
|
7545
7582
|
up: t.up
|
|
7546
7583
|
});
|
|
7547
|
-
},
|
|
7548
|
-
|
|
7584
|
+
}, Po = (e, t, n) => {
|
|
7585
|
+
Mo(t.userData.scene).syncMainWithGizmo({
|
|
7549
7586
|
camera: e,
|
|
7550
7587
|
position: e.position,
|
|
7551
7588
|
quaternion: e.quaternion,
|
|
@@ -7556,17 +7593,17 @@ var yo = "rotation-arrows-name", bo = "left-rotation-arrow-name", xo = "right-ro
|
|
|
7556
7593
|
quaternion: t.quaternion,
|
|
7557
7594
|
up: t.up
|
|
7558
7595
|
}, n);
|
|
7559
|
-
},
|
|
7596
|
+
}, Fo = () => {
|
|
7560
7597
|
try {
|
|
7561
7598
|
let e = document.createElement("canvas");
|
|
7562
7599
|
return !!(window.WebGLRenderingContext && (e.getContext("webgl") || e.getContext("experimental-webgl")));
|
|
7563
7600
|
} catch {
|
|
7564
7601
|
return !1;
|
|
7565
7602
|
}
|
|
7566
|
-
},
|
|
7603
|
+
}, Io = () => Fo() ? new k.WebGLRenderer({
|
|
7567
7604
|
alpha: !0,
|
|
7568
7605
|
antialias: !1
|
|
7569
|
-
}) : (console.error("WebGL is not supported in this environment."), null),
|
|
7606
|
+
}) : (console.error("WebGL is not supported in this environment."), null), Lo = (e) => {
|
|
7570
7607
|
let t = new k.AmbientLight(16777215, 1);
|
|
7571
7608
|
e.add(t);
|
|
7572
7609
|
let n = new k.DirectionalLight(16777215, 1);
|
|
@@ -7575,14 +7612,14 @@ var yo = "rotation-arrows-name", bo = "left-rotation-arrow-name", xo = "right-ro
|
|
|
7575
7612
|
r.position.set(-5, -10, 5), e.add(r);
|
|
7576
7613
|
let i = new k.PointLight(16777215, 1, 100);
|
|
7577
7614
|
i.position.set(0, 0, 5), e.add(i), n.castShadow = !1, r.castShadow = !1, i.castShadow = !1;
|
|
7578
|
-
},
|
|
7615
|
+
}, Ro = class {
|
|
7579
7616
|
static createTextTexture(e) {
|
|
7580
7617
|
let t = document.createElement("canvas"), n = t.getContext("2d");
|
|
7581
7618
|
t.width = $.CANVAS_SIZE, t.height = $.CANVAS_SIZE, n && (n.clearRect(0, 0, t.width, t.height), n.font = `${$.FONT_SIZE} Arial`, n.fillStyle = $.TEXT_COLOR, n.textAlign = $.TEXT_ALIGN, n.textBaseline = $.TEXT_BASELINE, n.fillText(e, t.width / 2, t.height / 2));
|
|
7582
7619
|
let r = new k.CanvasTexture(t);
|
|
7583
7620
|
return r.needsUpdate = !0, r;
|
|
7584
7621
|
}
|
|
7585
|
-
},
|
|
7622
|
+
}, zo = class {
|
|
7586
7623
|
static createWireframe([e, t, n]) {
|
|
7587
7624
|
let r = new k.BoxGeometry(e, t, n), i = new k.EdgesGeometry(r), a = new k.LineBasicMaterial({ color: $.LINE_COLOR }), o = new k.LineSegments(i, a);
|
|
7588
7625
|
return o.name = "Wireframe", o;
|
|
@@ -7605,20 +7642,20 @@ var yo = "rotation-arrows-name", bo = "left-rotation-arrow-name", xo = "right-ro
|
|
|
7605
7642
|
let r = new k.Group(), i = new k.BoxGeometry($.CUBE_SIZE - $.EDGE_SECTION_SIZE, $.CUBE_SIZE - $.EDGE_SECTION_SIZE, $.FACE_THICKNESS), a = new k.MeshStandardMaterial({ color: $.FACE_COLOR }), o = new k.Mesh(i, a);
|
|
7606
7643
|
o.name = `Face Box ${n}`, r.add(o);
|
|
7607
7644
|
let s = new k.PlaneGeometry($.CUBE_SIZE - $.EDGE_SECTION_SIZE, $.CUBE_SIZE - $.EDGE_SECTION_SIZE), c = new k.MeshStandardMaterial({
|
|
7608
|
-
map:
|
|
7645
|
+
map: Ro.createTextTexture(n),
|
|
7609
7646
|
transparent: !0,
|
|
7610
7647
|
depthWrite: !1
|
|
7611
7648
|
}), l = new k.Mesh(s, c);
|
|
7612
7649
|
return l.position.set(0, 0, $.FACE_THICKNESS / 2 + .01), r.add(l), r.position.copy(e), r.rotation.copy(t), r;
|
|
7613
7650
|
}
|
|
7614
|
-
},
|
|
7651
|
+
}, Bo = (e, t) => {
|
|
7615
7652
|
let n = document.createElement("canvas");
|
|
7616
7653
|
n.width = 64, n.height = 64;
|
|
7617
7654
|
let r = n.getContext("2d");
|
|
7618
7655
|
r.fillStyle = "rgba(0, 0, 0, 0)", r.fillRect(0, 0, n.width, n.height), r.font = "Bold 48px Arial", r.fillStyle = `#${t.toString(16).padStart(6, "0")}`, r.textAlign = "center", r.textBaseline = "middle", r.fillText(e, n.width / 2, n.height / 2);
|
|
7619
7656
|
let i = new k.CanvasTexture(n), a = new k.SpriteMaterial({ map: i }), o = new k.Sprite(a);
|
|
7620
7657
|
return o.scale.set(.5, .5, .5), o;
|
|
7621
|
-
},
|
|
7658
|
+
}, Vo = class {
|
|
7622
7659
|
constructor(e) {
|
|
7623
7660
|
this.hoveredObject = null, this.originalColor = null, this.config = e;
|
|
7624
7661
|
}
|
|
@@ -7627,17 +7664,17 @@ var yo = "rotation-arrows-name", bo = "left-rotation-arrow-name", xo = "right-ro
|
|
|
7627
7664
|
}
|
|
7628
7665
|
getInitialRotation() {
|
|
7629
7666
|
switch (this.config.initialFace) {
|
|
7630
|
-
case
|
|
7631
|
-
case
|
|
7632
|
-
case
|
|
7633
|
-
case
|
|
7634
|
-
case
|
|
7635
|
-
case
|
|
7667
|
+
case So.BACK: return new k.Euler(0, Math.PI, 0);
|
|
7668
|
+
case So.RIGHT: return new k.Euler(0, -Math.PI / 2, 0);
|
|
7669
|
+
case So.LEFT: return new k.Euler(0, Math.PI / 2, 0);
|
|
7670
|
+
case So.TOP: return new k.Euler(Math.PI / 2, 0, 0);
|
|
7671
|
+
case So.BOTTOM: return new k.Euler(-Math.PI / 2, 0, 0);
|
|
7672
|
+
case So.FRONT:
|
|
7636
7673
|
default: return new k.Euler(0, 0, 0);
|
|
7637
7674
|
}
|
|
7638
7675
|
}
|
|
7639
7676
|
createWireframe() {
|
|
7640
|
-
let e = $.CUBE_SIZE + $.EDGE_SECTION_SIZE, t =
|
|
7677
|
+
let e = $.CUBE_SIZE + $.EDGE_SECTION_SIZE, t = zo.createWireframe([
|
|
7641
7678
|
e,
|
|
7642
7679
|
e,
|
|
7643
7680
|
e
|
|
@@ -7645,15 +7682,15 @@ var yo = "rotation-arrows-name", bo = "left-rotation-arrow-name", xo = "right-ro
|
|
|
7645
7682
|
return t.userData.gizmoCube = this, t;
|
|
7646
7683
|
}
|
|
7647
7684
|
createEdgeBox(e, t, n) {
|
|
7648
|
-
let r =
|
|
7685
|
+
let r = zo.createEdgeBox(e, t, n);
|
|
7649
7686
|
return r.userData.gizmoCube = this, r;
|
|
7650
7687
|
}
|
|
7651
7688
|
createCornerCube(e, t) {
|
|
7652
|
-
let n =
|
|
7689
|
+
let n = zo.createCornerCube(e, t);
|
|
7653
7690
|
return n.userData.gizmoCube = this, n;
|
|
7654
7691
|
}
|
|
7655
7692
|
createFace(e, t, n) {
|
|
7656
|
-
let r =
|
|
7693
|
+
let r = zo.createFace(e, t, n), i = r.getObjectByName(`Face Box ${n}`);
|
|
7657
7694
|
return i.userData.gizmoCube = this, r;
|
|
7658
7695
|
}
|
|
7659
7696
|
createEdges(e) {
|
|
@@ -7773,7 +7810,7 @@ var yo = "rotation-arrows-name", bo = "left-rotation-arrow-name", xo = "right-ro
|
|
|
7773
7810
|
d.setRotationFromAxisAngle(e, t);
|
|
7774
7811
|
}
|
|
7775
7812
|
s.add(d);
|
|
7776
|
-
let f =
|
|
7813
|
+
let f = Bo(o, t);
|
|
7777
7814
|
return f.position.copy(i).add(n.clone().multiplyScalar(r + .1)), s.add(f), s;
|
|
7778
7815
|
}
|
|
7779
7816
|
createCoordinateAxes() {
|
|
@@ -7813,7 +7850,7 @@ var yo = "rotation-arrows-name", bo = "left-rotation-arrow-name", xo = "right-ro
|
|
|
7813
7850
|
}
|
|
7814
7851
|
create() {
|
|
7815
7852
|
let e = new k.Group();
|
|
7816
|
-
e.name =
|
|
7853
|
+
e.name = Eo;
|
|
7817
7854
|
let t = this.createWireframe();
|
|
7818
7855
|
e.add(t), this.createEdges(e), this.createCorners(e), this.createFaces(e);
|
|
7819
7856
|
let n = this.createCoordinateAxes();
|
|
@@ -7835,11 +7872,11 @@ var yo = "rotation-arrows-name", bo = "left-rotation-arrow-name", xo = "right-ro
|
|
|
7835
7872
|
this.hoveredObject.userData.vectorToCube = n;
|
|
7836
7873
|
}
|
|
7837
7874
|
}
|
|
7838
|
-
},
|
|
7875
|
+
}, Ho = class {
|
|
7839
7876
|
constructor(e) {
|
|
7840
7877
|
this.onChangeMainControlsListener = () => {}, this.onChangeGizmoControlsListener = () => {}, this.animationId = 0;
|
|
7841
7878
|
let { gizmoParams: t, mainParams: n, syncFunctions: r, options: i } = e;
|
|
7842
|
-
this.gizmoDiv = t.gizmoDiv, this.gizmoScene = t.gizmoScene, this.gizmoRenderer = t.gizmoRenderer, this.gizmoCamera = t.gizmoCamera, this.mainCamera = n.mainCamera, this.mainControls = n.mainControls, this.renderGizmo = n.renderGizmo, this.syncFunctions = r, this.options = i, this.gizmoControls = new
|
|
7879
|
+
this.gizmoDiv = t.gizmoDiv, this.gizmoScene = t.gizmoScene, this.gizmoRenderer = t.gizmoRenderer, this.gizmoCamera = t.gizmoCamera, this.mainCamera = n.mainCamera, this.mainControls = n.mainControls, this.renderGizmo = n.renderGizmo, this.syncFunctions = r, this.options = i, this.gizmoControls = new so(this.gizmoCamera, this.gizmoRenderer.domElement), this.initializeRenderer(), this.initializeScene(), this.initializeControls(), this.startAnimationLoop();
|
|
7843
7880
|
}
|
|
7844
7881
|
initializeRenderer() {
|
|
7845
7882
|
var e;
|
|
@@ -7848,12 +7885,12 @@ var yo = "rotation-arrows-name", bo = "left-rotation-arrow-name", xo = "right-ro
|
|
|
7848
7885
|
this.gizmoCamera.aspect = t, this.gizmoCamera.updateProjectionMatrix(), (e = this.options) != null && e.up && this.gizmoCamera.up.copy(this.options.up), this.gizmoDiv.appendChild(this.gizmoRenderer.domElement);
|
|
7849
7886
|
}
|
|
7850
7887
|
initializeScene() {
|
|
7851
|
-
let e = new
|
|
7852
|
-
this.gizmoScene.add(e),
|
|
7888
|
+
let e = new Vo({ initialFace: this.options?.initialFace ?? So.FRONT }).create();
|
|
7889
|
+
this.gizmoScene.add(e), Lo(this.gizmoScene);
|
|
7853
7890
|
}
|
|
7854
7891
|
initializeControls() {
|
|
7855
7892
|
this.onChangeMainControlsListener = () => this.syncFunctions.syncGizmoCameraWithMain(this.gizmoCamera, this.mainCamera, this.gizmoScene), this.mainControls.addEventListener("change", this.onChangeMainControlsListener), this.gizmoControls.enableZoom = !1, this.gizmoControls.enablePan = !1, this.gizmoControls.rotateSpeed = .5, this.gizmoControls.update(), this.onChangeGizmoControlsListener = () => {
|
|
7856
|
-
this.gizmoScene.getObjectByName(
|
|
7893
|
+
this.gizmoScene.getObjectByName(Co)?.rotation.copy(this.gizmoCamera.rotation), this.syncFunctions.syncMainCameraWithGizmo(this.mainCamera, this.gizmoCamera, this.mainControls), this.renderGizmo();
|
|
7857
7894
|
}, this.gizmoControls.addEventListener("change", this.onChangeGizmoControlsListener);
|
|
7858
7895
|
}
|
|
7859
7896
|
startAnimationLoop() {
|
|
@@ -7867,25 +7904,25 @@ var yo = "rotation-arrows-name", bo = "left-rotation-arrow-name", xo = "right-ro
|
|
|
7867
7904
|
dispose() {
|
|
7868
7905
|
this.mainControls.removeEventListener("change", this.onChangeMainControlsListener), this.gizmoControls.removeEventListener("change", this.onChangeGizmoControlsListener), this.gizmoScene.clear(), cancelAnimationFrame(this.animationId);
|
|
7869
7906
|
}
|
|
7870
|
-
},
|
|
7907
|
+
}, Uo = (e, t) => {
|
|
7871
7908
|
let n;
|
|
7872
7909
|
return function(...r) {
|
|
7873
7910
|
n || (e.apply(this, r), n = !0, setTimeout(() => n = !1, t));
|
|
7874
7911
|
};
|
|
7875
7912
|
};
|
|
7876
|
-
function
|
|
7913
|
+
function Wo(e, t, n) {
|
|
7877
7914
|
if (!t) return;
|
|
7878
7915
|
let r = t.domElement.getBoundingClientRect();
|
|
7879
7916
|
n.x = (e.clientX - r.left) / r.width * 2 - 1, n.y = -((e.clientY - r.top) / r.height) * 2 + 1;
|
|
7880
7917
|
}
|
|
7881
|
-
var
|
|
7918
|
+
var Go = (e, t, n, r) => (r.setFromCamera(e, t), r.intersectObjects(n.children, !0)), Ko = (e) => {
|
|
7882
7919
|
let t = ["Wireframe", ""];
|
|
7883
7920
|
return e.find((e) => !t.includes(e.object.name))?.object || null;
|
|
7884
7921
|
};
|
|
7885
|
-
function
|
|
7886
|
-
return !t || !n ? null :
|
|
7922
|
+
function qo(e, t, n, r) {
|
|
7923
|
+
return !t || !n ? null : Ko(Go(e, t, n, r));
|
|
7887
7924
|
}
|
|
7888
|
-
function
|
|
7925
|
+
function Jo(e, t) {
|
|
7889
7926
|
let n = e?.userData.gizmoCube;
|
|
7890
7927
|
if (e && n) {
|
|
7891
7928
|
n.handleClick();
|
|
@@ -7893,28 +7930,28 @@ function Wo(e, t) {
|
|
|
7893
7930
|
e && t(e);
|
|
7894
7931
|
}
|
|
7895
7932
|
}
|
|
7896
|
-
var
|
|
7933
|
+
var Yo = {
|
|
7897
7934
|
radius: 2.1,
|
|
7898
7935
|
color: 12369854,
|
|
7899
7936
|
tubeRadius: .1,
|
|
7900
7937
|
tubeSegments: 8,
|
|
7901
7938
|
numPoints: 64,
|
|
7902
7939
|
tubeOffset: 1.5
|
|
7903
|
-
},
|
|
7940
|
+
}, Xo = {
|
|
7904
7941
|
size: .2,
|
|
7905
7942
|
depth: .1,
|
|
7906
7943
|
heightRatio: 1.4,
|
|
7907
7944
|
segments: 1
|
|
7908
|
-
},
|
|
7945
|
+
}, Zo = class {
|
|
7909
7946
|
constructor(e = {}) {
|
|
7910
7947
|
this.config = {
|
|
7911
|
-
...
|
|
7948
|
+
...Yo,
|
|
7912
7949
|
...e
|
|
7913
7950
|
}, this.material = new k.MeshBasicMaterial({ color: this.config.color });
|
|
7914
7951
|
}
|
|
7915
7952
|
create() {
|
|
7916
7953
|
let e = new k.Group(), t = this.createQuarterCircleCurves();
|
|
7917
|
-
return e.add(...this.createTubes(t), ...this.createArrowHeads(t)), e.name =
|
|
7954
|
+
return e.add(...this.createTubes(t), ...this.createArrowHeads(t)), e.name = Co, e;
|
|
7918
7955
|
}
|
|
7919
7956
|
createQuarterCircleCurves() {
|
|
7920
7957
|
let e = this.generateQuarterCirclePoints(), t = Math.floor(e.length / 2);
|
|
@@ -7932,10 +7969,10 @@ var Go = {
|
|
|
7932
7969
|
let n = new k.TubeGeometry(e, this.config.numPoints, this.config.tubeRadius, this.config.tubeSegments, !1), r = new k.Mesh(n, this.material);
|
|
7933
7970
|
return r.name = t, r;
|
|
7934
7971
|
};
|
|
7935
|
-
return [n(e,
|
|
7972
|
+
return [n(e, wo), n(t, To)];
|
|
7936
7973
|
}
|
|
7937
7974
|
createArrowHeads([e, t]) {
|
|
7938
|
-
let { size: n, depth: r, heightRatio: i, segments: a } =
|
|
7975
|
+
let { size: n, depth: r, heightRatio: i, segments: a } = Xo, o = this.createArrowShape(n, i), s = new k.ExtrudeGeometry(o, {
|
|
7939
7976
|
steps: a,
|
|
7940
7977
|
depth: r,
|
|
7941
7978
|
bevelEnabled: !1
|
|
@@ -7943,7 +7980,7 @@ var Go = {
|
|
|
7943
7980
|
let r = new k.Mesh(s, this.material);
|
|
7944
7981
|
return r.position.copy(e), r.rotation.z = t, r.name = n, r;
|
|
7945
7982
|
};
|
|
7946
|
-
return [c(e.getPoint(0), this.calculateArrowRotation(e.getTangent(0)) + Math.PI / 2,
|
|
7983
|
+
return [c(e.getPoint(0), this.calculateArrowRotation(e.getTangent(0)) + Math.PI / 2, wo), c(t.getPoint(1), this.calculateArrowRotation(t.getTangent(1)) - Math.PI / 2, To)];
|
|
7947
7984
|
}
|
|
7948
7985
|
createArrowShape(e, t) {
|
|
7949
7986
|
return new k.Shape().moveTo(0, 0).lineTo(e, -e * t).lineTo(-e, -e * t).lineTo(0, 0);
|
|
@@ -7951,31 +7988,31 @@ var Go = {
|
|
|
7951
7988
|
calculateArrowRotation(e) {
|
|
7952
7989
|
return Math.atan2(e.y, e.x);
|
|
7953
7990
|
}
|
|
7954
|
-
},
|
|
7991
|
+
}, Qo = (e) => {
|
|
7955
7992
|
let t = e.rotation, n = .01, r = Math.PI, i = (Math.abs(t.x) % (2 * r) + 2 * r) % (2 * r), a = (Math.abs(t.y) % (2 * r) + 2 * r) % (2 * r), o = Math.abs(i - r / 2) < n || Math.abs(i - 3 * r / 2) < n || Math.abs(a - r / 2) < n || Math.abs(a - 3 * r / 2) < n, s = (Math.abs(i) < n || Math.abs(i - r) < n) && (Math.abs(a) < n || Math.abs(a - r) < n);
|
|
7956
7993
|
return !(o || s);
|
|
7957
|
-
},
|
|
7958
|
-
function
|
|
7994
|
+
}, $o = 25, es = 200;
|
|
7995
|
+
function ts({ gizmoRenderer: e, gizmoScene: t, gizmoCamera: n, alignCameraWithVector: r, gizmoControlRef: i }) {
|
|
7959
7996
|
let a = O(null), o = O(null), s = O(new k.Raycaster()).current, c = O(new k.Vector2()).current, l = w(() => {
|
|
7960
|
-
let e = t.getObjectByName(
|
|
7997
|
+
let e = t.getObjectByName(Co), r = Qo(n);
|
|
7961
7998
|
if (e && r) {
|
|
7962
7999
|
t.remove(e);
|
|
7963
8000
|
return;
|
|
7964
8001
|
}
|
|
7965
8002
|
if (e || r) return;
|
|
7966
|
-
let i = new
|
|
8003
|
+
let i = new Zo().create();
|
|
7967
8004
|
i.rotation.copy(n.rotation), t.add(i);
|
|
7968
8005
|
}, [t, n]), u = w(() => {
|
|
7969
|
-
let e = t.getObjectByName(
|
|
8006
|
+
let e = t.getObjectByName(Co);
|
|
7970
8007
|
e && t.remove(e);
|
|
7971
|
-
}, [t]), d = w(
|
|
8008
|
+
}, [t]), d = w(Uo((r) => {
|
|
7972
8009
|
if (!i.current || !e) return;
|
|
7973
|
-
|
|
7974
|
-
let a =
|
|
8010
|
+
Wo(r, e, c);
|
|
8011
|
+
let a = Go(c, n, t, s), o = Ko(a);
|
|
7975
8012
|
o != null && o.userData.gizmoCube ? o.userData.gizmoCube.highlightObject(o) : t.traverse((e) => {
|
|
7976
8013
|
e.userData.gizmoCube && e.userData.gizmoCube.highlightObject(null);
|
|
7977
8014
|
}), a.length > 0 ? l() : u();
|
|
7978
|
-
}, 1e3 /
|
|
8015
|
+
}, 1e3 / $o), [
|
|
7979
8016
|
i,
|
|
7980
8017
|
e,
|
|
7981
8018
|
n,
|
|
@@ -7991,17 +8028,17 @@ function Zo({ gizmoRenderer: e, gizmoScene: t, gizmoCamera: n, alignCameraWithVe
|
|
|
7991
8028
|
};
|
|
7992
8029
|
}, []), p = w((e) => {
|
|
7993
8030
|
var t;
|
|
7994
|
-
let r = e.name ===
|
|
8031
|
+
let r = e.name === To ? 1 : -1, a = 90 * Math.PI / 180, o = new k.Vector3(0, 0, 0), s = r * a, c = new k.Matrix4();
|
|
7995
8032
|
c.makeRotationZ(s), n.up.applyMatrix4(c), n.lookAt(o), (t = i.current) == null || t.gizmoControls.update();
|
|
7996
8033
|
}, [n, i]);
|
|
7997
8034
|
return {
|
|
7998
8035
|
onMouseDown: f,
|
|
7999
8036
|
onMouseMove: d,
|
|
8000
8037
|
onMouseUp: w((i) => {
|
|
8001
|
-
if ((a.current ? Date.now() - a.current : 0) <
|
|
8002
|
-
|
|
8003
|
-
let a =
|
|
8004
|
-
a != null && a.name &&
|
|
8038
|
+
if ((a.current ? Date.now() - a.current : 0) < es) {
|
|
8039
|
+
Wo(i, e, c);
|
|
8040
|
+
let a = qo(c, n, t, s);
|
|
8041
|
+
a != null && a.name && Do.includes(a.name) ? p(a) : Jo(a, r);
|
|
8005
8042
|
}
|
|
8006
8043
|
a.current = null, o.current = null;
|
|
8007
8044
|
}, [
|
|
@@ -8016,15 +8053,15 @@ function Zo({ gizmoRenderer: e, gizmoScene: t, gizmoCamera: n, alignCameraWithVe
|
|
|
8016
8053
|
onMouseLeave: u
|
|
8017
8054
|
};
|
|
8018
8055
|
}
|
|
8019
|
-
var
|
|
8020
|
-
let a = O(null), o = O(new k.Scene()).current, [s] = te(() =>
|
|
8056
|
+
var ns = ({ camera: e, controls: t, className: n, render: r, options: i }) => {
|
|
8057
|
+
let a = O(null), o = O(new k.Scene()).current, [s] = te(() => Io()), c = O(new k.PerspectiveCamera(30, 1, .1, 10)).current, l = O(null), u = w(() => {
|
|
8021
8058
|
s && (r(), s.render(o, c));
|
|
8022
8059
|
}, [
|
|
8023
8060
|
r,
|
|
8024
8061
|
s,
|
|
8025
8062
|
o,
|
|
8026
8063
|
c
|
|
8027
|
-
]), { onMouseDown: d, onMouseMove: f, onMouseUp: p, onMouseLeave: m } =
|
|
8064
|
+
]), { onMouseDown: d, onMouseMove: f, onMouseUp: p, onMouseLeave: m } = ts({
|
|
8028
8065
|
gizmoRenderer: s,
|
|
8029
8066
|
gizmoScene: o,
|
|
8030
8067
|
gizmoCamera: c,
|
|
@@ -8033,7 +8070,7 @@ var Qo = ({ camera: e, controls: t, className: n, render: r, options: i }) => {
|
|
|
8033
8070
|
let r = e.position.length(), i = n.clone().multiplyScalar(r), a = new k.Matrix4();
|
|
8034
8071
|
a.lookAt(i, new k.Vector3(0, 0, 0), new k.Vector3(0, 1, 0));
|
|
8035
8072
|
let o = new k.Quaternion();
|
|
8036
|
-
o.setFromRotationMatrix(a), e.quaternion.copy(o),
|
|
8073
|
+
o.setFromRotationMatrix(a), e.quaternion.copy(o), $a(e, t, e.position.clone(), i, 400, u), e.up.set(0, 1, 0), e.lookAt(new k.Vector3(0, 0, 0)), t.target.set(0, 0, 0), t.update();
|
|
8037
8074
|
}, [
|
|
8038
8075
|
e,
|
|
8039
8076
|
t,
|
|
@@ -8044,7 +8081,7 @@ var Qo = ({ camera: e, controls: t, className: n, render: r, options: i }) => {
|
|
|
8044
8081
|
});
|
|
8045
8082
|
return E(() => {
|
|
8046
8083
|
let n = a.current;
|
|
8047
|
-
if (!(!n || !e || !t || !s)) return l.current && l.current.dispose(), l.current = new
|
|
8084
|
+
if (!(!n || !e || !t || !s)) return l.current && l.current.dispose(), l.current = new Ho({
|
|
8048
8085
|
gizmoParams: {
|
|
8049
8086
|
gizmoDiv: n,
|
|
8050
8087
|
gizmoScene: o,
|
|
@@ -8057,8 +8094,8 @@ var Qo = ({ camera: e, controls: t, className: n, render: r, options: i }) => {
|
|
|
8057
8094
|
renderGizmo: u
|
|
8058
8095
|
},
|
|
8059
8096
|
syncFunctions: {
|
|
8060
|
-
syncGizmoCameraWithMain:
|
|
8061
|
-
syncMainCameraWithGizmo:
|
|
8097
|
+
syncGizmoCameraWithMain: No,
|
|
8098
|
+
syncMainCameraWithGizmo: Po
|
|
8062
8099
|
},
|
|
8063
8100
|
options: i
|
|
8064
8101
|
}), n.addEventListener("mousedown", d), n.addEventListener("mousemove", f), n.addEventListener("mouseup", p), n.addEventListener("mouseleave", m), () => {
|
|
@@ -8072,17 +8109,17 @@ var Qo = ({ camera: e, controls: t, className: n, render: r, options: i }) => {
|
|
|
8072
8109
|
d,
|
|
8073
8110
|
p
|
|
8074
8111
|
]), E(() => {
|
|
8075
|
-
e && (
|
|
8112
|
+
e && (No(c, e, o), u());
|
|
8076
8113
|
}, [e, u]), /* @__PURE__ */ U("div", {
|
|
8077
8114
|
className: n ? `${n}` : "gizmo-default",
|
|
8078
8115
|
ref: a
|
|
8079
8116
|
});
|
|
8080
|
-
},
|
|
8081
|
-
top: e.startsWith("top") ?
|
|
8082
|
-
bottom: e.startsWith("bottom") ?
|
|
8083
|
-
left: e.endsWith("left") ?
|
|
8084
|
-
right: e.endsWith("right") ?
|
|
8085
|
-
}),
|
|
8117
|
+
}, rs = 10, is = (e) => ({
|
|
8118
|
+
top: e.startsWith("top") ? rs : "auto",
|
|
8119
|
+
bottom: e.startsWith("bottom") ? rs : "auto",
|
|
8120
|
+
left: e.endsWith("left") ? rs : "auto",
|
|
8121
|
+
right: e.endsWith("right") ? rs : "auto"
|
|
8122
|
+
}), as = ({ camera: e, controls: t, render: n, placement: r = "top-right", size: i = 128 }) => {
|
|
8086
8123
|
if (!e || !t) return null;
|
|
8087
8124
|
let a = t;
|
|
8088
8125
|
return /* @__PURE__ */ U("div", {
|
|
@@ -8092,15 +8129,15 @@ var Qo = ({ camera: e, controls: t, className: n, render: r, options: i }) => {
|
|
|
8092
8129
|
width: i,
|
|
8093
8130
|
height: i,
|
|
8094
8131
|
zIndex: 10,
|
|
8095
|
-
...
|
|
8132
|
+
...is(r)
|
|
8096
8133
|
},
|
|
8097
|
-
children: /* @__PURE__ */ U(
|
|
8134
|
+
children: /* @__PURE__ */ U(ns, {
|
|
8098
8135
|
camera: e,
|
|
8099
8136
|
controls: a,
|
|
8100
8137
|
render: n
|
|
8101
8138
|
})
|
|
8102
8139
|
});
|
|
8103
|
-
},
|
|
8140
|
+
}, os = class extends x {
|
|
8104
8141
|
constructor(e) {
|
|
8105
8142
|
super(e), this.reset = () => {
|
|
8106
8143
|
this.setState({
|
|
@@ -8146,13 +8183,13 @@ var Qo = ({ camera: e, controls: t, className: n, render: r, options: i }) => {
|
|
|
8146
8183
|
] })
|
|
8147
8184
|
}) : this.props.children;
|
|
8148
8185
|
}
|
|
8149
|
-
},
|
|
8150
|
-
if (!
|
|
8151
|
-
let t = window.matchMedia(
|
|
8186
|
+
}, ss = "(prefers-reduced-motion: reduce)", cs = () => typeof window < "u" && typeof window.matchMedia == "function", ls = (e) => {
|
|
8187
|
+
if (!cs()) return () => {};
|
|
8188
|
+
let t = window.matchMedia(ss);
|
|
8152
8189
|
return t.addEventListener("change", e), () => t.removeEventListener("change", e);
|
|
8153
|
-
},
|
|
8154
|
-
function
|
|
8155
|
-
let i = ne(
|
|
8190
|
+
}, us = () => cs() && window.matchMedia(ss).matches;
|
|
8191
|
+
function ds({ status: e, label: t, color: n, backdrop: r }) {
|
|
8192
|
+
let i = ne(ls, us, () => !1);
|
|
8156
8193
|
return /* @__PURE__ */ bt("div", {
|
|
8157
8194
|
"data-testid": "viewer-loading-overlay",
|
|
8158
8195
|
role: "status",
|
|
@@ -8239,14 +8276,14 @@ function ss({ status: e, label: t, color: n, backdrop: r }) {
|
|
|
8239
8276
|
}
|
|
8240
8277
|
//#endregion
|
|
8241
8278
|
//#region src/presentation/components/theme.ts
|
|
8242
|
-
var
|
|
8279
|
+
var fs = "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif", ps = {
|
|
8243
8280
|
background: "rgba(255,255,255,0.78)",
|
|
8244
8281
|
backdropFilter: "blur(16px)",
|
|
8245
8282
|
WebkitBackdropFilter: "blur(16px)",
|
|
8246
8283
|
border: "1px solid rgba(0,0,0,0.06)",
|
|
8247
8284
|
boxShadow: "0 8px 30px rgba(0,0,0,0.10)"
|
|
8248
|
-
},
|
|
8249
|
-
function
|
|
8285
|
+
}, ms = Object.keys(Pa);
|
|
8286
|
+
function hs({ active: e, onSelect: t }) {
|
|
8250
8287
|
return /* @__PURE__ */ U("div", {
|
|
8251
8288
|
"data-testid": "viewer-preset-picker",
|
|
8252
8289
|
role: "group",
|
|
@@ -8263,9 +8300,9 @@ function ds({ active: e, onSelect: t }) {
|
|
|
8263
8300
|
borderRadius: 999,
|
|
8264
8301
|
maxWidth: "calc(100% - 16px)",
|
|
8265
8302
|
overflowX: "auto",
|
|
8266
|
-
...
|
|
8303
|
+
...ps
|
|
8267
8304
|
},
|
|
8268
|
-
children:
|
|
8305
|
+
children: ms.map((n) => /* @__PURE__ */ U("button", {
|
|
8269
8306
|
type: "button",
|
|
8270
8307
|
"aria-pressed": n === e,
|
|
8271
8308
|
onClick: () => t(n),
|
|
@@ -8275,7 +8312,7 @@ function ds({ active: e, onSelect: t }) {
|
|
|
8275
8312
|
border: n === e ? "1px solid #111318" : "1px solid transparent",
|
|
8276
8313
|
background: n === e ? "#111318" : "transparent",
|
|
8277
8314
|
color: n === e ? "#fff" : "#3f3f4a",
|
|
8278
|
-
fontFamily:
|
|
8315
|
+
fontFamily: fs,
|
|
8279
8316
|
fontSize: 13,
|
|
8280
8317
|
fontWeight: 500,
|
|
8281
8318
|
lineHeight: 1,
|
|
@@ -8291,32 +8328,32 @@ function ds({ active: e, onSelect: t }) {
|
|
|
8291
8328
|
}
|
|
8292
8329
|
//#endregion
|
|
8293
8330
|
//#region src/presentation/components/loadingIndicatorConfig.ts
|
|
8294
|
-
var
|
|
8331
|
+
var gs = {
|
|
8295
8332
|
enabled: !0,
|
|
8296
8333
|
label: "Loading…",
|
|
8297
8334
|
color: "#ffffff",
|
|
8298
8335
|
backdrop: "rgba(15,16,20,0.6)"
|
|
8299
8336
|
};
|
|
8300
|
-
function
|
|
8301
|
-
return e === void 0 || e === !0 ?
|
|
8302
|
-
...
|
|
8337
|
+
function _s(e) {
|
|
8338
|
+
return e === void 0 || e === !0 ? gs : e === !1 ? {
|
|
8339
|
+
...gs,
|
|
8303
8340
|
enabled: !1
|
|
8304
8341
|
} : {
|
|
8305
8342
|
enabled: e.enabled ?? !0,
|
|
8306
|
-
label: e.label ??
|
|
8343
|
+
label: e.label ?? gs.label,
|
|
8307
8344
|
errorLabel: e.errorLabel,
|
|
8308
|
-
color: e.color ??
|
|
8309
|
-
backdrop: e.backdrop ??
|
|
8345
|
+
color: e.color ?? gs.color,
|
|
8346
|
+
backdrop: e.backdrop ?? gs.backdrop
|
|
8310
8347
|
};
|
|
8311
8348
|
}
|
|
8312
8349
|
//#endregion
|
|
8313
8350
|
//#region src/presentation/components/SimpleViewer.tsx
|
|
8314
|
-
var
|
|
8315
|
-
let l = O(null), { activePreset: d, pickerEnabled: f, selectPreset: p } =
|
|
8316
|
-
|
|
8351
|
+
var vs = () => new e("Viewer is not ready yet", d.COMPONENT_NOT_MOUNTED), ys = C(({ object: e, options: t = {}, preset: n, pathTraced: r, turntable: i, animations: o, children: s }, c) => {
|
|
8352
|
+
let l = O(null), { activePreset: d, pickerEnabled: f, selectPreset: p } = Ua(t.preset ?? n, t.ui), { viewer: h, isInitialized: g, initError: _ } = Va(l, Wa(t, d, r, i, o)), v = Ga(h, g, e), b = qa(h);
|
|
8353
|
+
Ja(h, _, t);
|
|
8317
8354
|
let x = h ? y(h.getCamera()) : null, S = h ? m(h.getControls()) : null, C = h ? u(h.getRenderer()) : null, T = w(() => {
|
|
8318
8355
|
h?.requestRender();
|
|
8319
|
-
}, [h]), E = t.helpers?.gizmo !== void 0 && t.helpers.gizmo !== !1, te = typeof t.helpers?.gizmo == "object" ? t.helpers.gizmo : {}, ne = ee(() =>
|
|
8356
|
+
}, [h]), E = t.helpers?.gizmo !== void 0 && t.helpers.gizmo !== !1, te = typeof t.helpers?.gizmo == "object" ? t.helpers.gizmo : {}, ne = ee(() => _s(t.loadingIndicator), [t.loadingIndicator]), k = v.status === "error" || !!_, re = ne.enabled && (v.status === "loading" || k);
|
|
8320
8357
|
return D(c, () => ({
|
|
8321
8358
|
scene: h ? a(h.getScene()) : null,
|
|
8322
8359
|
camera: x,
|
|
@@ -8324,25 +8361,25 @@ var ms = () => new e("Viewer is not ready yet", d.COMPONENT_NOT_MOUNTED), hs = C
|
|
|
8324
8361
|
controls: S,
|
|
8325
8362
|
events: b,
|
|
8326
8363
|
loadModel: async (e) => {
|
|
8327
|
-
if (!h) throw
|
|
8364
|
+
if (!h) throw vs();
|
|
8328
8365
|
let t = typeof e == "string" ? e : new Kt(e), n = await h.loadModel(t);
|
|
8329
8366
|
if (!n.ok) throw n.error;
|
|
8330
8367
|
},
|
|
8331
8368
|
captureStill: async (e) => {
|
|
8332
|
-
if (!h) throw
|
|
8369
|
+
if (!h) throw vs();
|
|
8333
8370
|
let t = await h.captureStill(e);
|
|
8334
8371
|
if (!t.ok) throw t.error;
|
|
8335
8372
|
return t.value;
|
|
8336
8373
|
},
|
|
8337
8374
|
captureVideo: async (e) => {
|
|
8338
|
-
if (!h) throw
|
|
8375
|
+
if (!h) throw vs();
|
|
8339
8376
|
let t = await h.captureVideo(e);
|
|
8340
8377
|
if (!t.ok) throw t.error;
|
|
8341
8378
|
return t.value;
|
|
8342
8379
|
},
|
|
8343
8380
|
getAnimationNames: () => h?.getAnimationNames() ?? [],
|
|
8344
8381
|
playAnimations: (e) => {
|
|
8345
|
-
if (!h) throw
|
|
8382
|
+
if (!h) throw vs();
|
|
8346
8383
|
let t = h.playAnimations(e);
|
|
8347
8384
|
if (!t.ok) throw t.error;
|
|
8348
8385
|
},
|
|
@@ -8350,22 +8387,22 @@ var ms = () => new e("Viewer is not ready yet", d.COMPONENT_NOT_MOUNTED), hs = C
|
|
|
8350
8387
|
h?.pauseAnimations();
|
|
8351
8388
|
},
|
|
8352
8389
|
setEnvironmentMap: async (e) => {
|
|
8353
|
-
if (!h) throw
|
|
8390
|
+
if (!h) throw vs();
|
|
8354
8391
|
let t = await h.setEnvironmentMap(e);
|
|
8355
8392
|
if (!t.ok) throw t.error;
|
|
8356
8393
|
},
|
|
8357
8394
|
resetEnvironment: () => {
|
|
8358
|
-
if (!h) throw
|
|
8395
|
+
if (!h) throw vs();
|
|
8359
8396
|
let e = h.resetEnvironment();
|
|
8360
8397
|
if (!e.ok) throw e.error;
|
|
8361
8398
|
},
|
|
8362
8399
|
setBackgroundImage: async (e) => {
|
|
8363
|
-
if (!h) throw
|
|
8400
|
+
if (!h) throw vs();
|
|
8364
8401
|
let t = await h.setBackgroundImage(e);
|
|
8365
8402
|
if (!t.ok) throw t.error;
|
|
8366
8403
|
},
|
|
8367
8404
|
setBackgroundColor: (e) => {
|
|
8368
|
-
if (!h) throw
|
|
8405
|
+
if (!h) throw vs();
|
|
8369
8406
|
let t = h.setBackgroundColor(e);
|
|
8370
8407
|
if (!t.ok) throw t.error;
|
|
8371
8408
|
},
|
|
@@ -8378,7 +8415,7 @@ var ms = () => new e("Viewer is not ready yet", d.COMPONENT_NOT_MOUNTED), hs = C
|
|
|
8378
8415
|
C,
|
|
8379
8416
|
S,
|
|
8380
8417
|
b
|
|
8381
|
-
]), /* @__PURE__ */ U(
|
|
8418
|
+
]), /* @__PURE__ */ U(os, { children: /* @__PURE__ */ U(Xa, {
|
|
8382
8419
|
viewer: h,
|
|
8383
8420
|
canvasRef: l,
|
|
8384
8421
|
children: /* @__PURE__ */ bt("div", {
|
|
@@ -8388,21 +8425,21 @@ var ms = () => new e("Viewer is not ready yet", d.COMPONENT_NOT_MOUNTED), hs = C
|
|
|
8388
8425
|
height: "100%"
|
|
8389
8426
|
},
|
|
8390
8427
|
children: [
|
|
8391
|
-
/* @__PURE__ */ U(
|
|
8392
|
-
E && g && x && S && /* @__PURE__ */ U(
|
|
8428
|
+
/* @__PURE__ */ U(Qa, {}),
|
|
8429
|
+
E && g && x && S && /* @__PURE__ */ U(as, {
|
|
8393
8430
|
camera: x,
|
|
8394
8431
|
controls: S,
|
|
8395
8432
|
render: T,
|
|
8396
8433
|
placement: te.placement,
|
|
8397
8434
|
size: te.size
|
|
8398
8435
|
}),
|
|
8399
|
-
re && /* @__PURE__ */ U(
|
|
8436
|
+
re && /* @__PURE__ */ U(ds, {
|
|
8400
8437
|
status: k ? "error" : "loading",
|
|
8401
8438
|
label: k ? ne.errorLabel ?? _?.message ?? v.error ?? "Failed to load model" : ne.label,
|
|
8402
8439
|
color: ne.color,
|
|
8403
8440
|
backdrop: ne.backdrop
|
|
8404
8441
|
}),
|
|
8405
|
-
f && /* @__PURE__ */ U(
|
|
8442
|
+
f && /* @__PURE__ */ U(hs, {
|
|
8406
8443
|
active: d ?? "studio",
|
|
8407
8444
|
onSelect: p
|
|
8408
8445
|
}),
|
|
@@ -8411,17 +8448,17 @@ var ms = () => new e("Viewer is not ready yet", d.COMPONENT_NOT_MOUNTED), hs = C
|
|
|
8411
8448
|
})
|
|
8412
8449
|
}) });
|
|
8413
8450
|
});
|
|
8414
|
-
|
|
8451
|
+
ys.displayName = "SimpleViewer";
|
|
8415
8452
|
//#endregion
|
|
8416
8453
|
//#region src/SimpleViewerWrapper.tsx
|
|
8417
|
-
var
|
|
8454
|
+
var bs = C((e, t) => /* @__PURE__ */ U(ys, {
|
|
8418
8455
|
ref: t,
|
|
8419
8456
|
...e
|
|
8420
8457
|
}));
|
|
8421
|
-
|
|
8458
|
+
bs.displayName = "SimpleViewer";
|
|
8422
8459
|
//#endregion
|
|
8423
8460
|
//#region src/presentation/components/Hotspot.tsx
|
|
8424
|
-
var
|
|
8461
|
+
var xs = () => /* @__PURE__ */ U("span", {
|
|
8425
8462
|
"aria-hidden": "true",
|
|
8426
8463
|
style: {
|
|
8427
8464
|
display: "block",
|
|
@@ -8433,8 +8470,8 @@ var _s = () => /* @__PURE__ */ U("span", {
|
|
|
8433
8470
|
boxShadow: "0 2px 8px rgba(0,0,0,0.35)"
|
|
8434
8471
|
}
|
|
8435
8472
|
});
|
|
8436
|
-
function
|
|
8437
|
-
let { viewer: r } =
|
|
8473
|
+
function Ss({ position: e, occlude: t = !1, children: n }) {
|
|
8474
|
+
let { viewer: r } = Za(), i = O(null), [a, o, s] = e;
|
|
8438
8475
|
E(() => {
|
|
8439
8476
|
if (!r) return;
|
|
8440
8477
|
let e = i.current;
|
|
@@ -8486,8 +8523,8 @@ function vs({ position: e, occlude: t = !1, children: n }) {
|
|
|
8486
8523
|
zIndex: 5,
|
|
8487
8524
|
pointerEvents: c ? "auto" : "none"
|
|
8488
8525
|
},
|
|
8489
|
-
children: c ? n : /* @__PURE__ */ U(
|
|
8526
|
+
children: c ? n : /* @__PURE__ */ U(xs, {})
|
|
8490
8527
|
});
|
|
8491
8528
|
}
|
|
8492
8529
|
//#endregion
|
|
8493
|
-
export {
|
|
8530
|
+
export { oa as ControlType, Ma as DEFAULT_SCENE, sa as DEFAULT_STUDIO_LOOK, d as ErrorCode, Ss as Hotspot, bs as SimpleViewer, e as ThreeViewerError, t as TypedEventEmitter, Pa as VIEWER_PRESETS, ja as VIEWER_SCENES, Aa as defaultOptions, Fa as resolvePreset, Na as resolveScene };
|