softbox 4.19.0 → 4.20.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 +279 -248
- 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,28 @@ 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
|
+
}
|
|
6670
|
+
}, Ma = "studio_dome";
|
|
6671
|
+
function Na(e) {
|
|
6672
|
+
return e ? ja[e] ?? {} : {};
|
|
6673
|
+
}
|
|
6674
|
+
//#endregion
|
|
6675
|
+
//#region src/presets.ts
|
|
6676
|
+
var Pa = {
|
|
6648
6677
|
studio: {
|
|
6649
6678
|
backgroundColor: "#f0f0f7",
|
|
6650
6679
|
renderer: { toneMappingExposure: 1.15 },
|
|
@@ -6672,30 +6701,31 @@ var ka = {
|
|
|
6672
6701
|
environment: { environmentIntensity: .6 }
|
|
6673
6702
|
}
|
|
6674
6703
|
};
|
|
6675
|
-
function
|
|
6676
|
-
return e ?
|
|
6704
|
+
function Fa(e) {
|
|
6705
|
+
return e ? Pa[e] ?? {} : {};
|
|
6677
6706
|
}
|
|
6678
|
-
function
|
|
6679
|
-
return Ot(Ot(e,
|
|
6707
|
+
function Ia(e, t) {
|
|
6708
|
+
return Ot(Ot(Ot(e, Na(t.scene)), Fa(t.preset)), t);
|
|
6680
6709
|
}
|
|
6681
6710
|
//#endregion
|
|
6682
6711
|
//#region src/presentation/hooks/useStableOptions.ts
|
|
6683
|
-
var
|
|
6712
|
+
var La = (e, ...t) => {
|
|
6684
6713
|
if (!e) return;
|
|
6685
6714
|
let n = { ...e };
|
|
6686
6715
|
for (let e of t) delete n[e];
|
|
6687
6716
|
return Object.keys(n).length > 0 ? n : void 0;
|
|
6688
6717
|
};
|
|
6689
|
-
function
|
|
6718
|
+
function Ra(e) {
|
|
6690
6719
|
let t = ee(() => JSON.stringify({
|
|
6691
|
-
pathTracing:
|
|
6720
|
+
pathTracing: La(e.pathTracing, ...Oa),
|
|
6692
6721
|
staticScene: e.staticScene,
|
|
6693
|
-
renderer:
|
|
6722
|
+
renderer: La(e.renderer, ...Ta),
|
|
6694
6723
|
camera: e.camera,
|
|
6695
|
-
controls:
|
|
6696
|
-
environment:
|
|
6724
|
+
controls: La(e.controls, ...Da),
|
|
6725
|
+
environment: La(e.environment, ...Ea),
|
|
6726
|
+
scene: e.scene ?? "studio_dome",
|
|
6697
6727
|
lighting: e.lighting,
|
|
6698
|
-
helpers:
|
|
6728
|
+
helpers: La(e.helpers, "gizmo"),
|
|
6699
6729
|
rendering: e.rendering,
|
|
6700
6730
|
replaceWithScreenshotOnComplete: e.replaceWithScreenshotOnComplete,
|
|
6701
6731
|
loaders: e.loaders,
|
|
@@ -6709,6 +6739,7 @@ function Pa(e) {
|
|
|
6709
6739
|
e.camera,
|
|
6710
6740
|
e.controls,
|
|
6711
6741
|
e.environment,
|
|
6742
|
+
e.scene,
|
|
6712
6743
|
e.lighting,
|
|
6713
6744
|
e.helpers,
|
|
6714
6745
|
e.rendering,
|
|
@@ -6718,8 +6749,8 @@ function Pa(e) {
|
|
|
6718
6749
|
e.floorAlignment,
|
|
6719
6750
|
e.selection
|
|
6720
6751
|
]), n = ee(() => {
|
|
6721
|
-
let t =
|
|
6722
|
-
return JSON.stringify(
|
|
6752
|
+
let t = Ia(Aa, e);
|
|
6753
|
+
return JSON.stringify(ka(t));
|
|
6723
6754
|
}, [
|
|
6724
6755
|
e.preset,
|
|
6725
6756
|
e.backgroundColor,
|
|
@@ -6738,8 +6769,8 @@ function Pa(e) {
|
|
|
6738
6769
|
}
|
|
6739
6770
|
//#endregion
|
|
6740
6771
|
//#region src/presentation/hooks/useViewportGate.ts
|
|
6741
|
-
var
|
|
6742
|
-
function
|
|
6772
|
+
var za = "200px";
|
|
6773
|
+
function Ba(e, t) {
|
|
6743
6774
|
let [n, r] = te(!t);
|
|
6744
6775
|
return E(() => {
|
|
6745
6776
|
if (n) return;
|
|
@@ -6754,7 +6785,7 @@ function Ia(e, t) {
|
|
|
6754
6785
|
}
|
|
6755
6786
|
let a = new IntersectionObserver((e) => {
|
|
6756
6787
|
e.some((e) => e.isIntersecting) && r(!0);
|
|
6757
|
-
}, { rootMargin:
|
|
6788
|
+
}, { rootMargin: za });
|
|
6758
6789
|
return a.observe(i), () => a.disconnect();
|
|
6759
6790
|
}, [
|
|
6760
6791
|
e,
|
|
@@ -6764,17 +6795,17 @@ function Ia(e, t) {
|
|
|
6764
6795
|
}
|
|
6765
6796
|
//#endregion
|
|
6766
6797
|
//#region src/presentation/hooks/useViewerCore.ts
|
|
6767
|
-
function
|
|
6798
|
+
function Va(e, t) {
|
|
6768
6799
|
let n = O(null), r = O({
|
|
6769
6800
|
width: 0,
|
|
6770
6801
|
height: 0
|
|
6771
|
-
}), [i, a] = te(!1), [o, s] = te(null), { options: c, structuralKey: l, runtimeKey: u } =
|
|
6802
|
+
}), [i, a] = te(!1), [o, s] = te(null), { options: c, structuralKey: l, runtimeKey: u } = Ra(t), d = Ba(e, (t.loading ?? "eager") === "lazy");
|
|
6772
6803
|
return E(() => {
|
|
6773
6804
|
if (!d || !e.current || n.current) return;
|
|
6774
6805
|
s(null);
|
|
6775
|
-
let t =
|
|
6806
|
+
let t = Ia(Aa, c), i;
|
|
6776
6807
|
try {
|
|
6777
|
-
i =
|
|
6808
|
+
i = Ca.createViewer(e.current, t);
|
|
6778
6809
|
} catch (e) {
|
|
6779
6810
|
console.error("Failed to create viewer:", e), s(e instanceof Error ? e : Error(String(e)));
|
|
6780
6811
|
return;
|
|
@@ -6795,8 +6826,8 @@ function La(e, t) {
|
|
|
6795
6826
|
d
|
|
6796
6827
|
]), E(() => {
|
|
6797
6828
|
if (!n.current || !i) return;
|
|
6798
|
-
let e =
|
|
6799
|
-
n.current.updateOptions(
|
|
6829
|
+
let e = Ia(Aa, c);
|
|
6830
|
+
n.current.updateOptions(ka(e));
|
|
6800
6831
|
}, [u, i]), E(() => {
|
|
6801
6832
|
if (!n.current || !e.current) return;
|
|
6802
6833
|
let t = null, i = (i) => {
|
|
@@ -6834,7 +6865,7 @@ function La(e, t) {
|
|
|
6834
6865
|
}
|
|
6835
6866
|
//#endregion
|
|
6836
6867
|
//#region src/presentation/hooks/useViewerEvents.ts
|
|
6837
|
-
function
|
|
6868
|
+
function Ha(e, t) {
|
|
6838
6869
|
let n = O(t);
|
|
6839
6870
|
n.current = t, E(() => {
|
|
6840
6871
|
if (!e) return;
|
|
@@ -6853,7 +6884,7 @@ function Ra(e, t) {
|
|
|
6853
6884
|
}
|
|
6854
6885
|
//#endregion
|
|
6855
6886
|
//#region src/presentation/hooks/usePickedPreset.ts
|
|
6856
|
-
function
|
|
6887
|
+
function Ua(e, t) {
|
|
6857
6888
|
let [n, r] = te(null), i = O(/* @__PURE__ */ new Set());
|
|
6858
6889
|
E(() => {
|
|
6859
6890
|
if (e !== void 0 && i.current.has(e)) {
|
|
@@ -6877,7 +6908,7 @@ function za(e, t) {
|
|
|
6877
6908
|
}
|
|
6878
6909
|
//#endregion
|
|
6879
6910
|
//#region src/presentation/hooks/useResolvedOptions.ts
|
|
6880
|
-
function
|
|
6911
|
+
function Wa(e, t, n, r, i) {
|
|
6881
6912
|
return ee(() => {
|
|
6882
6913
|
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
6914
|
return !a && !o && !s && !c ? e : {
|
|
@@ -6906,7 +6937,7 @@ function Ba(e, t, n, r, i) {
|
|
|
6906
6937
|
}
|
|
6907
6938
|
//#endregion
|
|
6908
6939
|
//#region src/presentation/hooks/useModelLoader.ts
|
|
6909
|
-
function
|
|
6940
|
+
function Ga(e, t, n) {
|
|
6910
6941
|
let r = ee(() => {
|
|
6911
6942
|
if (typeof n == "string") return n;
|
|
6912
6943
|
if (n) return `object-${n.uuid || "no-uuid"}`;
|
|
@@ -6932,7 +6963,7 @@ function Va(e, t, n) {
|
|
|
6932
6963
|
}
|
|
6933
6964
|
//#endregion
|
|
6934
6965
|
//#region src/presentation/adapters/EventAdapter.ts
|
|
6935
|
-
var
|
|
6966
|
+
var Ka = class {
|
|
6936
6967
|
static toThreeObject(e) {
|
|
6937
6968
|
let t = _(e);
|
|
6938
6969
|
if (t) return t;
|
|
@@ -6973,24 +7004,24 @@ var Ha = class {
|
|
|
6973
7004
|
};
|
|
6974
7005
|
//#endregion
|
|
6975
7006
|
//#region src/presentation/hooks/useForwardedEvents.ts
|
|
6976
|
-
function
|
|
7007
|
+
function qa(e) {
|
|
6977
7008
|
let n = O(new t());
|
|
6978
|
-
return
|
|
7009
|
+
return Ha(e, ee(() => ({
|
|
6979
7010
|
"model:loading": (e) => n.current.emit("model:loading", e),
|
|
6980
7011
|
"model:progress": (e) => n.current.emit("model:progress", e),
|
|
6981
|
-
"model:loaded": (e) => n.current.emit("model:loaded",
|
|
7012
|
+
"model:loaded": (e) => n.current.emit("model:loaded", Ka.convertModelLoaded(e)),
|
|
6982
7013
|
"model:error": (e) => n.current.emit("model:error", e),
|
|
6983
7014
|
"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",
|
|
7015
|
+
"controls:change": (e) => n.current.emit("controls:change", Ka.convertControlsChange(e)),
|
|
7016
|
+
"object:selected": (e) => n.current.emit("object:selected", Ka.convertObjectSelected(e)),
|
|
6986
7017
|
error: (e) => n.current.emit("error", e)
|
|
6987
7018
|
}), [])), n.current;
|
|
6988
7019
|
}
|
|
6989
7020
|
//#endregion
|
|
6990
7021
|
//#region src/presentation/hooks/useOptionCallbacks.ts
|
|
6991
|
-
function
|
|
7022
|
+
function Ja(e, t, n) {
|
|
6992
7023
|
let r = O(n);
|
|
6993
|
-
r.current = n,
|
|
7024
|
+
r.current = n, Ha(e, ee(() => ({
|
|
6994
7025
|
"model:loaded": () => r.current.onLoad?.(),
|
|
6995
7026
|
"model:progress": (e) => r.current.onProgress?.(Math.min(1, e.loaded / e.total)),
|
|
6996
7027
|
"model:error": (e) => r.current.onError?.(e.error)
|
|
@@ -7007,26 +7038,26 @@ function Wa(e, t, n) {
|
|
|
7007
7038
|
}
|
|
7008
7039
|
//#endregion
|
|
7009
7040
|
//#region src/presentation/components/ViewerContext.tsx
|
|
7010
|
-
var
|
|
7011
|
-
function
|
|
7041
|
+
var Ya = S(null);
|
|
7042
|
+
function Xa({ viewer: e, canvasRef: t, children: n }) {
|
|
7012
7043
|
let r = ee(() => ({
|
|
7013
7044
|
viewer: e,
|
|
7014
7045
|
canvasRef: t
|
|
7015
7046
|
}), [e, t]);
|
|
7016
|
-
return /* @__PURE__ */ U(
|
|
7047
|
+
return /* @__PURE__ */ U(Ya.Provider, {
|
|
7017
7048
|
value: r,
|
|
7018
7049
|
children: n
|
|
7019
7050
|
});
|
|
7020
7051
|
}
|
|
7021
|
-
function
|
|
7022
|
-
let e = T(
|
|
7052
|
+
function Za() {
|
|
7053
|
+
let e = T(Ya);
|
|
7023
7054
|
if (!e) throw Error("useViewerContext must be used within ViewerProvider");
|
|
7024
7055
|
return e;
|
|
7025
7056
|
}
|
|
7026
7057
|
//#endregion
|
|
7027
7058
|
//#region src/presentation/components/ViewerCanvas.tsx
|
|
7028
|
-
function
|
|
7029
|
-
let { canvasRef: e } =
|
|
7059
|
+
function Qa() {
|
|
7060
|
+
let { canvasRef: e } = Za();
|
|
7030
7061
|
return /* @__PURE__ */ U("canvas", {
|
|
7031
7062
|
ref: e,
|
|
7032
7063
|
style: {
|
|
@@ -7050,13 +7081,13 @@ function Ja() {
|
|
|
7050
7081
|
console.error("vite-plugin-css-injected-by-js", e);
|
|
7051
7082
|
}
|
|
7052
7083
|
})();
|
|
7053
|
-
var
|
|
7084
|
+
var $a = (e, t, n, r, i, a) => {
|
|
7054
7085
|
let o = performance.now(), s = () => {
|
|
7055
7086
|
let c = performance.now() - o, l = Math.min(c / i, 1);
|
|
7056
7087
|
e.position.lerpVectors(n, r, l), t?.update(), a(), l < 1 && requestAnimationFrame(s);
|
|
7057
7088
|
};
|
|
7058
7089
|
requestAnimationFrame(s);
|
|
7059
|
-
},
|
|
7090
|
+
}, 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
7091
|
NONE: -1,
|
|
7061
7092
|
ROTATE: 0,
|
|
7062
7093
|
DOLLY: 1,
|
|
@@ -7065,7 +7096,7 @@ var Ya = (e, t, n, r, i, a) => {
|
|
|
7065
7096
|
TOUCH_PAN: 4,
|
|
7066
7097
|
TOUCH_DOLLY_PAN: 5,
|
|
7067
7098
|
TOUCH_DOLLY_ROTATE: 6
|
|
7068
|
-
},
|
|
7099
|
+
}, oo = 1e-6, so = class extends fe {
|
|
7069
7100
|
constructor(e, t = null) {
|
|
7070
7101
|
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
7102
|
LEFT: "ArrowLeft",
|
|
@@ -7079,7 +7110,7 @@ var Ya = (e, t, n, r, i, a) => {
|
|
|
7079
7110
|
}, this.touches = {
|
|
7080
7111
|
ONE: B.ROTATE,
|
|
7081
7112
|
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 =
|
|
7113
|
+
}, 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
7114
|
}
|
|
7084
7115
|
connect(e) {
|
|
7085
7116
|
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 +7143,7 @@ var Ya = (e, t, n, r, i, a) => {
|
|
|
7112
7143
|
this.target0.copy(this.target), this.position0.copy(this.object.position), this.zoom0 = this.object.zoom;
|
|
7113
7144
|
}
|
|
7114
7145
|
reset() {
|
|
7115
|
-
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(
|
|
7146
|
+
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
7147
|
}
|
|
7117
7148
|
update(e = null) {
|
|
7118
7149
|
let t = this.object.position;
|
|
@@ -7140,12 +7171,12 @@ var Ya = (e, t, n, r, i, a) => {
|
|
|
7140
7171
|
let r = new H(this._mouse.x, this._mouse.y, 0);
|
|
7141
7172
|
r.unproject(this.object), this.object.position.sub(r).add(t), this.object.updateMatrixWorld(), e = X.length();
|
|
7142
7173
|
} 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) : (
|
|
7174
|
+
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
7175
|
} else if (this.object.isOrthographicCamera) {
|
|
7145
7176
|
let e = this.object.zoom;
|
|
7146
7177
|
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
7178
|
}
|
|
7148
|
-
return this._scale = 1, this._performCursorZoom = !1, i || this._lastPosition.distanceToSquared(this.object.position) >
|
|
7179
|
+
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
7180
|
}
|
|
7150
7181
|
_getAutoRotationAngle(e) {
|
|
7151
7182
|
return e === null ? Z / 60 / 60 * this.autoRotateSpeed : Z / 60 * this.autoRotateSpeed * e;
|
|
@@ -7324,16 +7355,16 @@ var Ya = (e, t, n, r, i, a) => {
|
|
|
7324
7355
|
return e.ctrlKey && !this._controlActive && (n.deltaY *= 10), n;
|
|
7325
7356
|
}
|
|
7326
7357
|
};
|
|
7327
|
-
function
|
|
7358
|
+
function co(e) {
|
|
7328
7359
|
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
7360
|
}
|
|
7330
|
-
function
|
|
7361
|
+
function lo(e) {
|
|
7331
7362
|
this.enabled !== !1 && (e.pointerType === "touch" ? this._onTouchMove(e) : this._onMouseMove(e));
|
|
7332
7363
|
}
|
|
7333
|
-
function
|
|
7364
|
+
function uo(e) {
|
|
7334
7365
|
switch (this._removePointer(e), this._pointers.length) {
|
|
7335
7366
|
case 0:
|
|
7336
|
-
this.domElement.releasePointerCapture(e.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(
|
|
7367
|
+
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
7368
|
break;
|
|
7338
7369
|
case 1:
|
|
7339
7370
|
let t = this._pointers[0], n = this._pointerPositions[t];
|
|
@@ -7345,7 +7376,7 @@ function oo(e) {
|
|
|
7345
7376
|
break;
|
|
7346
7377
|
}
|
|
7347
7378
|
}
|
|
7348
|
-
function
|
|
7379
|
+
function fo(e) {
|
|
7349
7380
|
let t;
|
|
7350
7381
|
switch (e.button) {
|
|
7351
7382
|
case 0:
|
|
@@ -7384,9 +7415,9 @@ function so(e) {
|
|
|
7384
7415
|
break;
|
|
7385
7416
|
default: this.state = Q.NONE;
|
|
7386
7417
|
}
|
|
7387
|
-
this.state !== Q.NONE && this.dispatchEvent(
|
|
7418
|
+
this.state !== Q.NONE && this.dispatchEvent(to);
|
|
7388
7419
|
}
|
|
7389
|
-
function
|
|
7420
|
+
function po(e) {
|
|
7390
7421
|
switch (this.state) {
|
|
7391
7422
|
case Q.ROTATE:
|
|
7392
7423
|
if (this.enableRotate === !1) return;
|
|
@@ -7402,13 +7433,13 @@ function co(e) {
|
|
|
7402
7433
|
break;
|
|
7403
7434
|
}
|
|
7404
7435
|
}
|
|
7405
|
-
function
|
|
7406
|
-
this.enabled === !1 || this.enableZoom === !1 || this.state !== Q.NONE || (e.preventDefault(), this.dispatchEvent(
|
|
7436
|
+
function mo(e) {
|
|
7437
|
+
this.enabled === !1 || this.enableZoom === !1 || this.state !== Q.NONE || (e.preventDefault(), this.dispatchEvent(to), this._handleMouseWheel(this._customWheelEvent(e)), this.dispatchEvent(no));
|
|
7407
7438
|
}
|
|
7408
|
-
function
|
|
7439
|
+
function ho(e) {
|
|
7409
7440
|
this.enabled !== !1 && this._handleKeyDown(e);
|
|
7410
7441
|
}
|
|
7411
|
-
function
|
|
7442
|
+
function go(e) {
|
|
7412
7443
|
switch (this._trackPointer(e), this._pointers.length) {
|
|
7413
7444
|
case 1:
|
|
7414
7445
|
switch (this.touches.ONE) {
|
|
@@ -7438,9 +7469,9 @@ function fo(e) {
|
|
|
7438
7469
|
break;
|
|
7439
7470
|
default: this.state = Q.NONE;
|
|
7440
7471
|
}
|
|
7441
|
-
this.state !== Q.NONE && this.dispatchEvent(
|
|
7472
|
+
this.state !== Q.NONE && this.dispatchEvent(to);
|
|
7442
7473
|
}
|
|
7443
|
-
function
|
|
7474
|
+
function _o(e) {
|
|
7444
7475
|
switch (this._trackPointer(e), this.state) {
|
|
7445
7476
|
case Q.TOUCH_ROTATE:
|
|
7446
7477
|
if (this.enableRotate === !1) return;
|
|
@@ -7461,22 +7492,22 @@ function po(e) {
|
|
|
7461
7492
|
default: this.state = Q.NONE;
|
|
7462
7493
|
}
|
|
7463
7494
|
}
|
|
7464
|
-
function
|
|
7495
|
+
function vo(e) {
|
|
7465
7496
|
this.enabled !== !1 && e.preventDefault();
|
|
7466
7497
|
}
|
|
7467
|
-
function
|
|
7498
|
+
function yo(e) {
|
|
7468
7499
|
e.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, {
|
|
7469
7500
|
passive: !0,
|
|
7470
7501
|
capture: !0
|
|
7471
7502
|
}));
|
|
7472
7503
|
}
|
|
7473
|
-
function
|
|
7504
|
+
function bo(e) {
|
|
7474
7505
|
e.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, {
|
|
7475
7506
|
passive: !0,
|
|
7476
7507
|
capture: !0
|
|
7477
7508
|
}));
|
|
7478
7509
|
}
|
|
7479
|
-
var
|
|
7510
|
+
var xo = class extends so {
|
|
7480
7511
|
constructor(e, t) {
|
|
7481
7512
|
super(e, t), this.screenSpacePanning = !1, this.mouseButtons = {
|
|
7482
7513
|
LEFT: L.PAN,
|
|
@@ -7501,39 +7532,39 @@ var _o = class extends ro {
|
|
|
7501
7532
|
EDGE_COLOR: "#EFF3F2",
|
|
7502
7533
|
CORNER_COLOR: "#EFF3F2",
|
|
7503
7534
|
LINE_COLOR: 0
|
|
7504
|
-
},
|
|
7535
|
+
}, So = /* @__PURE__ */ ((e) => (e.FRONT = "FRONT", e.BACK = "BACK", e.RIGHT = "RIGHT", e.LEFT = "LEFT", e.TOP = "TOP", e.BOTTOM = "BOTTOM", e))(So || {});
|
|
7505
7536
|
new k.Vector3(0, 1, 0);
|
|
7506
|
-
var
|
|
7537
|
+
var Co = "rotation-arrows-name", wo = "left-rotation-arrow-name", To = "right-rotation-arrow-name", Eo = "gizmo-group-name", Do = [To, wo], Oo = {
|
|
7507
7538
|
GIZMO_DISTANCE: 8,
|
|
7508
7539
|
DEFAULT_UP: new k.Vector3(0, 1, 0),
|
|
7509
7540
|
FORWARD: new k.Vector3(0, 0, -1)
|
|
7510
|
-
},
|
|
7511
|
-
constructor(e, t =
|
|
7541
|
+
}, ko = (e) => Oo.FORWARD.clone().applyQuaternion(e), Ao = (e, t, n = new k.Vector3()) => n.clone().add(e.multiplyScalar(-t)), jo = class {
|
|
7542
|
+
constructor(e, t = Co) {
|
|
7512
7543
|
this.gizmoScene = e, this.gizmoArrowsName = t;
|
|
7513
7544
|
}
|
|
7514
7545
|
syncGizmoWithMain(e, t) {
|
|
7515
7546
|
e.quaternion.copy(t.quaternion), e.up.copy(t.up);
|
|
7516
|
-
let n =
|
|
7517
|
-
e.position.copy(
|
|
7547
|
+
let n = ko(e.quaternion).normalize();
|
|
7548
|
+
e.position.copy(Ao(n, Oo.GIZMO_DISTANCE)), e.camera.updateMatrixWorld(!0);
|
|
7518
7549
|
let r = this.gizmoScene.getObjectByName(this.gizmoArrowsName);
|
|
7519
7550
|
r && r.rotation.copy(e.camera.rotation);
|
|
7520
7551
|
}
|
|
7521
7552
|
syncMainWithGizmo(e, t, n) {
|
|
7522
7553
|
let r = n.target.clone(), i = e.position.distanceTo(r), a = e.camera instanceof k.PerspectiveCamera;
|
|
7523
|
-
n instanceof
|
|
7554
|
+
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
7555
|
}
|
|
7525
7556
|
syncMapControls(e, t, n, r) {
|
|
7526
|
-
let i = e.position.y - n.y, a =
|
|
7557
|
+
let i = e.position.y - n.y, a = ko(t.quaternion);
|
|
7527
7558
|
a.y = 0, a.normalize();
|
|
7528
7559
|
let o = n.clone();
|
|
7529
|
-
o.y += i, o.add(a.multiplyScalar(-r)), e.position.copy(o), e.up.copy(
|
|
7560
|
+
o.y += i, o.add(a.multiplyScalar(-r)), e.position.copy(o), e.up.copy(Oo.DEFAULT_UP), e.camera.lookAt(n);
|
|
7530
7561
|
}
|
|
7531
7562
|
syncOrbitControls(e, t, n, r) {
|
|
7532
|
-
let i =
|
|
7563
|
+
let i = ko(t.quaternion), a = Oo.DEFAULT_UP.clone().applyQuaternion(t.quaternion), o = Ao(i, r, n);
|
|
7533
7564
|
e.position.copy(o), e.up.copy(a), e.camera.lookAt(n);
|
|
7534
7565
|
}
|
|
7535
|
-
},
|
|
7536
|
-
|
|
7566
|
+
}, Mo = (e) => new jo(e), No = (e, t, n) => {
|
|
7567
|
+
Mo(n).syncGizmoWithMain({
|
|
7537
7568
|
camera: e,
|
|
7538
7569
|
position: e.position,
|
|
7539
7570
|
quaternion: e.quaternion,
|
|
@@ -7544,8 +7575,8 @@ var yo = "rotation-arrows-name", bo = "left-rotation-arrow-name", xo = "right-ro
|
|
|
7544
7575
|
quaternion: t.quaternion,
|
|
7545
7576
|
up: t.up
|
|
7546
7577
|
});
|
|
7547
|
-
},
|
|
7548
|
-
|
|
7578
|
+
}, Po = (e, t, n) => {
|
|
7579
|
+
Mo(t.userData.scene).syncMainWithGizmo({
|
|
7549
7580
|
camera: e,
|
|
7550
7581
|
position: e.position,
|
|
7551
7582
|
quaternion: e.quaternion,
|
|
@@ -7556,17 +7587,17 @@ var yo = "rotation-arrows-name", bo = "left-rotation-arrow-name", xo = "right-ro
|
|
|
7556
7587
|
quaternion: t.quaternion,
|
|
7557
7588
|
up: t.up
|
|
7558
7589
|
}, n);
|
|
7559
|
-
},
|
|
7590
|
+
}, Fo = () => {
|
|
7560
7591
|
try {
|
|
7561
7592
|
let e = document.createElement("canvas");
|
|
7562
7593
|
return !!(window.WebGLRenderingContext && (e.getContext("webgl") || e.getContext("experimental-webgl")));
|
|
7563
7594
|
} catch {
|
|
7564
7595
|
return !1;
|
|
7565
7596
|
}
|
|
7566
|
-
},
|
|
7597
|
+
}, Io = () => Fo() ? new k.WebGLRenderer({
|
|
7567
7598
|
alpha: !0,
|
|
7568
7599
|
antialias: !1
|
|
7569
|
-
}) : (console.error("WebGL is not supported in this environment."), null),
|
|
7600
|
+
}) : (console.error("WebGL is not supported in this environment."), null), Lo = (e) => {
|
|
7570
7601
|
let t = new k.AmbientLight(16777215, 1);
|
|
7571
7602
|
e.add(t);
|
|
7572
7603
|
let n = new k.DirectionalLight(16777215, 1);
|
|
@@ -7575,14 +7606,14 @@ var yo = "rotation-arrows-name", bo = "left-rotation-arrow-name", xo = "right-ro
|
|
|
7575
7606
|
r.position.set(-5, -10, 5), e.add(r);
|
|
7576
7607
|
let i = new k.PointLight(16777215, 1, 100);
|
|
7577
7608
|
i.position.set(0, 0, 5), e.add(i), n.castShadow = !1, r.castShadow = !1, i.castShadow = !1;
|
|
7578
|
-
},
|
|
7609
|
+
}, Ro = class {
|
|
7579
7610
|
static createTextTexture(e) {
|
|
7580
7611
|
let t = document.createElement("canvas"), n = t.getContext("2d");
|
|
7581
7612
|
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
7613
|
let r = new k.CanvasTexture(t);
|
|
7583
7614
|
return r.needsUpdate = !0, r;
|
|
7584
7615
|
}
|
|
7585
|
-
},
|
|
7616
|
+
}, zo = class {
|
|
7586
7617
|
static createWireframe([e, t, n]) {
|
|
7587
7618
|
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
7619
|
return o.name = "Wireframe", o;
|
|
@@ -7605,20 +7636,20 @@ var yo = "rotation-arrows-name", bo = "left-rotation-arrow-name", xo = "right-ro
|
|
|
7605
7636
|
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
7637
|
o.name = `Face Box ${n}`, r.add(o);
|
|
7607
7638
|
let s = new k.PlaneGeometry($.CUBE_SIZE - $.EDGE_SECTION_SIZE, $.CUBE_SIZE - $.EDGE_SECTION_SIZE), c = new k.MeshStandardMaterial({
|
|
7608
|
-
map:
|
|
7639
|
+
map: Ro.createTextTexture(n),
|
|
7609
7640
|
transparent: !0,
|
|
7610
7641
|
depthWrite: !1
|
|
7611
7642
|
}), l = new k.Mesh(s, c);
|
|
7612
7643
|
return l.position.set(0, 0, $.FACE_THICKNESS / 2 + .01), r.add(l), r.position.copy(e), r.rotation.copy(t), r;
|
|
7613
7644
|
}
|
|
7614
|
-
},
|
|
7645
|
+
}, Bo = (e, t) => {
|
|
7615
7646
|
let n = document.createElement("canvas");
|
|
7616
7647
|
n.width = 64, n.height = 64;
|
|
7617
7648
|
let r = n.getContext("2d");
|
|
7618
7649
|
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
7650
|
let i = new k.CanvasTexture(n), a = new k.SpriteMaterial({ map: i }), o = new k.Sprite(a);
|
|
7620
7651
|
return o.scale.set(.5, .5, .5), o;
|
|
7621
|
-
},
|
|
7652
|
+
}, Vo = class {
|
|
7622
7653
|
constructor(e) {
|
|
7623
7654
|
this.hoveredObject = null, this.originalColor = null, this.config = e;
|
|
7624
7655
|
}
|
|
@@ -7627,17 +7658,17 @@ var yo = "rotation-arrows-name", bo = "left-rotation-arrow-name", xo = "right-ro
|
|
|
7627
7658
|
}
|
|
7628
7659
|
getInitialRotation() {
|
|
7629
7660
|
switch (this.config.initialFace) {
|
|
7630
|
-
case
|
|
7631
|
-
case
|
|
7632
|
-
case
|
|
7633
|
-
case
|
|
7634
|
-
case
|
|
7635
|
-
case
|
|
7661
|
+
case So.BACK: return new k.Euler(0, Math.PI, 0);
|
|
7662
|
+
case So.RIGHT: return new k.Euler(0, -Math.PI / 2, 0);
|
|
7663
|
+
case So.LEFT: return new k.Euler(0, Math.PI / 2, 0);
|
|
7664
|
+
case So.TOP: return new k.Euler(Math.PI / 2, 0, 0);
|
|
7665
|
+
case So.BOTTOM: return new k.Euler(-Math.PI / 2, 0, 0);
|
|
7666
|
+
case So.FRONT:
|
|
7636
7667
|
default: return new k.Euler(0, 0, 0);
|
|
7637
7668
|
}
|
|
7638
7669
|
}
|
|
7639
7670
|
createWireframe() {
|
|
7640
|
-
let e = $.CUBE_SIZE + $.EDGE_SECTION_SIZE, t =
|
|
7671
|
+
let e = $.CUBE_SIZE + $.EDGE_SECTION_SIZE, t = zo.createWireframe([
|
|
7641
7672
|
e,
|
|
7642
7673
|
e,
|
|
7643
7674
|
e
|
|
@@ -7645,15 +7676,15 @@ var yo = "rotation-arrows-name", bo = "left-rotation-arrow-name", xo = "right-ro
|
|
|
7645
7676
|
return t.userData.gizmoCube = this, t;
|
|
7646
7677
|
}
|
|
7647
7678
|
createEdgeBox(e, t, n) {
|
|
7648
|
-
let r =
|
|
7679
|
+
let r = zo.createEdgeBox(e, t, n);
|
|
7649
7680
|
return r.userData.gizmoCube = this, r;
|
|
7650
7681
|
}
|
|
7651
7682
|
createCornerCube(e, t) {
|
|
7652
|
-
let n =
|
|
7683
|
+
let n = zo.createCornerCube(e, t);
|
|
7653
7684
|
return n.userData.gizmoCube = this, n;
|
|
7654
7685
|
}
|
|
7655
7686
|
createFace(e, t, n) {
|
|
7656
|
-
let r =
|
|
7687
|
+
let r = zo.createFace(e, t, n), i = r.getObjectByName(`Face Box ${n}`);
|
|
7657
7688
|
return i.userData.gizmoCube = this, r;
|
|
7658
7689
|
}
|
|
7659
7690
|
createEdges(e) {
|
|
@@ -7773,7 +7804,7 @@ var yo = "rotation-arrows-name", bo = "left-rotation-arrow-name", xo = "right-ro
|
|
|
7773
7804
|
d.setRotationFromAxisAngle(e, t);
|
|
7774
7805
|
}
|
|
7775
7806
|
s.add(d);
|
|
7776
|
-
let f =
|
|
7807
|
+
let f = Bo(o, t);
|
|
7777
7808
|
return f.position.copy(i).add(n.clone().multiplyScalar(r + .1)), s.add(f), s;
|
|
7778
7809
|
}
|
|
7779
7810
|
createCoordinateAxes() {
|
|
@@ -7813,7 +7844,7 @@ var yo = "rotation-arrows-name", bo = "left-rotation-arrow-name", xo = "right-ro
|
|
|
7813
7844
|
}
|
|
7814
7845
|
create() {
|
|
7815
7846
|
let e = new k.Group();
|
|
7816
|
-
e.name =
|
|
7847
|
+
e.name = Eo;
|
|
7817
7848
|
let t = this.createWireframe();
|
|
7818
7849
|
e.add(t), this.createEdges(e), this.createCorners(e), this.createFaces(e);
|
|
7819
7850
|
let n = this.createCoordinateAxes();
|
|
@@ -7835,11 +7866,11 @@ var yo = "rotation-arrows-name", bo = "left-rotation-arrow-name", xo = "right-ro
|
|
|
7835
7866
|
this.hoveredObject.userData.vectorToCube = n;
|
|
7836
7867
|
}
|
|
7837
7868
|
}
|
|
7838
|
-
},
|
|
7869
|
+
}, Ho = class {
|
|
7839
7870
|
constructor(e) {
|
|
7840
7871
|
this.onChangeMainControlsListener = () => {}, this.onChangeGizmoControlsListener = () => {}, this.animationId = 0;
|
|
7841
7872
|
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
|
|
7873
|
+
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
7874
|
}
|
|
7844
7875
|
initializeRenderer() {
|
|
7845
7876
|
var e;
|
|
@@ -7848,12 +7879,12 @@ var yo = "rotation-arrows-name", bo = "left-rotation-arrow-name", xo = "right-ro
|
|
|
7848
7879
|
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
7880
|
}
|
|
7850
7881
|
initializeScene() {
|
|
7851
|
-
let e = new
|
|
7852
|
-
this.gizmoScene.add(e),
|
|
7882
|
+
let e = new Vo({ initialFace: this.options?.initialFace ?? So.FRONT }).create();
|
|
7883
|
+
this.gizmoScene.add(e), Lo(this.gizmoScene);
|
|
7853
7884
|
}
|
|
7854
7885
|
initializeControls() {
|
|
7855
7886
|
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(
|
|
7887
|
+
this.gizmoScene.getObjectByName(Co)?.rotation.copy(this.gizmoCamera.rotation), this.syncFunctions.syncMainCameraWithGizmo(this.mainCamera, this.gizmoCamera, this.mainControls), this.renderGizmo();
|
|
7857
7888
|
}, this.gizmoControls.addEventListener("change", this.onChangeGizmoControlsListener);
|
|
7858
7889
|
}
|
|
7859
7890
|
startAnimationLoop() {
|
|
@@ -7867,25 +7898,25 @@ var yo = "rotation-arrows-name", bo = "left-rotation-arrow-name", xo = "right-ro
|
|
|
7867
7898
|
dispose() {
|
|
7868
7899
|
this.mainControls.removeEventListener("change", this.onChangeMainControlsListener), this.gizmoControls.removeEventListener("change", this.onChangeGizmoControlsListener), this.gizmoScene.clear(), cancelAnimationFrame(this.animationId);
|
|
7869
7900
|
}
|
|
7870
|
-
},
|
|
7901
|
+
}, Uo = (e, t) => {
|
|
7871
7902
|
let n;
|
|
7872
7903
|
return function(...r) {
|
|
7873
7904
|
n || (e.apply(this, r), n = !0, setTimeout(() => n = !1, t));
|
|
7874
7905
|
};
|
|
7875
7906
|
};
|
|
7876
|
-
function
|
|
7907
|
+
function Wo(e, t, n) {
|
|
7877
7908
|
if (!t) return;
|
|
7878
7909
|
let r = t.domElement.getBoundingClientRect();
|
|
7879
7910
|
n.x = (e.clientX - r.left) / r.width * 2 - 1, n.y = -((e.clientY - r.top) / r.height) * 2 + 1;
|
|
7880
7911
|
}
|
|
7881
|
-
var
|
|
7912
|
+
var Go = (e, t, n, r) => (r.setFromCamera(e, t), r.intersectObjects(n.children, !0)), Ko = (e) => {
|
|
7882
7913
|
let t = ["Wireframe", ""];
|
|
7883
7914
|
return e.find((e) => !t.includes(e.object.name))?.object || null;
|
|
7884
7915
|
};
|
|
7885
|
-
function
|
|
7886
|
-
return !t || !n ? null :
|
|
7916
|
+
function qo(e, t, n, r) {
|
|
7917
|
+
return !t || !n ? null : Ko(Go(e, t, n, r));
|
|
7887
7918
|
}
|
|
7888
|
-
function
|
|
7919
|
+
function Jo(e, t) {
|
|
7889
7920
|
let n = e?.userData.gizmoCube;
|
|
7890
7921
|
if (e && n) {
|
|
7891
7922
|
n.handleClick();
|
|
@@ -7893,28 +7924,28 @@ function Wo(e, t) {
|
|
|
7893
7924
|
e && t(e);
|
|
7894
7925
|
}
|
|
7895
7926
|
}
|
|
7896
|
-
var
|
|
7927
|
+
var Yo = {
|
|
7897
7928
|
radius: 2.1,
|
|
7898
7929
|
color: 12369854,
|
|
7899
7930
|
tubeRadius: .1,
|
|
7900
7931
|
tubeSegments: 8,
|
|
7901
7932
|
numPoints: 64,
|
|
7902
7933
|
tubeOffset: 1.5
|
|
7903
|
-
},
|
|
7934
|
+
}, Xo = {
|
|
7904
7935
|
size: .2,
|
|
7905
7936
|
depth: .1,
|
|
7906
7937
|
heightRatio: 1.4,
|
|
7907
7938
|
segments: 1
|
|
7908
|
-
},
|
|
7939
|
+
}, Zo = class {
|
|
7909
7940
|
constructor(e = {}) {
|
|
7910
7941
|
this.config = {
|
|
7911
|
-
...
|
|
7942
|
+
...Yo,
|
|
7912
7943
|
...e
|
|
7913
7944
|
}, this.material = new k.MeshBasicMaterial({ color: this.config.color });
|
|
7914
7945
|
}
|
|
7915
7946
|
create() {
|
|
7916
7947
|
let e = new k.Group(), t = this.createQuarterCircleCurves();
|
|
7917
|
-
return e.add(...this.createTubes(t), ...this.createArrowHeads(t)), e.name =
|
|
7948
|
+
return e.add(...this.createTubes(t), ...this.createArrowHeads(t)), e.name = Co, e;
|
|
7918
7949
|
}
|
|
7919
7950
|
createQuarterCircleCurves() {
|
|
7920
7951
|
let e = this.generateQuarterCirclePoints(), t = Math.floor(e.length / 2);
|
|
@@ -7932,10 +7963,10 @@ var Go = {
|
|
|
7932
7963
|
let n = new k.TubeGeometry(e, this.config.numPoints, this.config.tubeRadius, this.config.tubeSegments, !1), r = new k.Mesh(n, this.material);
|
|
7933
7964
|
return r.name = t, r;
|
|
7934
7965
|
};
|
|
7935
|
-
return [n(e,
|
|
7966
|
+
return [n(e, wo), n(t, To)];
|
|
7936
7967
|
}
|
|
7937
7968
|
createArrowHeads([e, t]) {
|
|
7938
|
-
let { size: n, depth: r, heightRatio: i, segments: a } =
|
|
7969
|
+
let { size: n, depth: r, heightRatio: i, segments: a } = Xo, o = this.createArrowShape(n, i), s = new k.ExtrudeGeometry(o, {
|
|
7939
7970
|
steps: a,
|
|
7940
7971
|
depth: r,
|
|
7941
7972
|
bevelEnabled: !1
|
|
@@ -7943,7 +7974,7 @@ var Go = {
|
|
|
7943
7974
|
let r = new k.Mesh(s, this.material);
|
|
7944
7975
|
return r.position.copy(e), r.rotation.z = t, r.name = n, r;
|
|
7945
7976
|
};
|
|
7946
|
-
return [c(e.getPoint(0), this.calculateArrowRotation(e.getTangent(0)) + Math.PI / 2,
|
|
7977
|
+
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
7978
|
}
|
|
7948
7979
|
createArrowShape(e, t) {
|
|
7949
7980
|
return new k.Shape().moveTo(0, 0).lineTo(e, -e * t).lineTo(-e, -e * t).lineTo(0, 0);
|
|
@@ -7951,31 +7982,31 @@ var Go = {
|
|
|
7951
7982
|
calculateArrowRotation(e) {
|
|
7952
7983
|
return Math.atan2(e.y, e.x);
|
|
7953
7984
|
}
|
|
7954
|
-
},
|
|
7985
|
+
}, Qo = (e) => {
|
|
7955
7986
|
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
7987
|
return !(o || s);
|
|
7957
|
-
},
|
|
7958
|
-
function
|
|
7988
|
+
}, $o = 25, es = 200;
|
|
7989
|
+
function ts({ gizmoRenderer: e, gizmoScene: t, gizmoCamera: n, alignCameraWithVector: r, gizmoControlRef: i }) {
|
|
7959
7990
|
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(
|
|
7991
|
+
let e = t.getObjectByName(Co), r = Qo(n);
|
|
7961
7992
|
if (e && r) {
|
|
7962
7993
|
t.remove(e);
|
|
7963
7994
|
return;
|
|
7964
7995
|
}
|
|
7965
7996
|
if (e || r) return;
|
|
7966
|
-
let i = new
|
|
7997
|
+
let i = new Zo().create();
|
|
7967
7998
|
i.rotation.copy(n.rotation), t.add(i);
|
|
7968
7999
|
}, [t, n]), u = w(() => {
|
|
7969
|
-
let e = t.getObjectByName(
|
|
8000
|
+
let e = t.getObjectByName(Co);
|
|
7970
8001
|
e && t.remove(e);
|
|
7971
|
-
}, [t]), d = w(
|
|
8002
|
+
}, [t]), d = w(Uo((r) => {
|
|
7972
8003
|
if (!i.current || !e) return;
|
|
7973
|
-
|
|
7974
|
-
let a =
|
|
8004
|
+
Wo(r, e, c);
|
|
8005
|
+
let a = Go(c, n, t, s), o = Ko(a);
|
|
7975
8006
|
o != null && o.userData.gizmoCube ? o.userData.gizmoCube.highlightObject(o) : t.traverse((e) => {
|
|
7976
8007
|
e.userData.gizmoCube && e.userData.gizmoCube.highlightObject(null);
|
|
7977
8008
|
}), a.length > 0 ? l() : u();
|
|
7978
|
-
}, 1e3 /
|
|
8009
|
+
}, 1e3 / $o), [
|
|
7979
8010
|
i,
|
|
7980
8011
|
e,
|
|
7981
8012
|
n,
|
|
@@ -7991,17 +8022,17 @@ function Zo({ gizmoRenderer: e, gizmoScene: t, gizmoCamera: n, alignCameraWithVe
|
|
|
7991
8022
|
};
|
|
7992
8023
|
}, []), p = w((e) => {
|
|
7993
8024
|
var t;
|
|
7994
|
-
let r = e.name ===
|
|
8025
|
+
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
8026
|
c.makeRotationZ(s), n.up.applyMatrix4(c), n.lookAt(o), (t = i.current) == null || t.gizmoControls.update();
|
|
7996
8027
|
}, [n, i]);
|
|
7997
8028
|
return {
|
|
7998
8029
|
onMouseDown: f,
|
|
7999
8030
|
onMouseMove: d,
|
|
8000
8031
|
onMouseUp: w((i) => {
|
|
8001
|
-
if ((a.current ? Date.now() - a.current : 0) <
|
|
8002
|
-
|
|
8003
|
-
let a =
|
|
8004
|
-
a != null && a.name &&
|
|
8032
|
+
if ((a.current ? Date.now() - a.current : 0) < es) {
|
|
8033
|
+
Wo(i, e, c);
|
|
8034
|
+
let a = qo(c, n, t, s);
|
|
8035
|
+
a != null && a.name && Do.includes(a.name) ? p(a) : Jo(a, r);
|
|
8005
8036
|
}
|
|
8006
8037
|
a.current = null, o.current = null;
|
|
8007
8038
|
}, [
|
|
@@ -8016,15 +8047,15 @@ function Zo({ gizmoRenderer: e, gizmoScene: t, gizmoCamera: n, alignCameraWithVe
|
|
|
8016
8047
|
onMouseLeave: u
|
|
8017
8048
|
};
|
|
8018
8049
|
}
|
|
8019
|
-
var
|
|
8020
|
-
let a = O(null), o = O(new k.Scene()).current, [s] = te(() =>
|
|
8050
|
+
var ns = ({ camera: e, controls: t, className: n, render: r, options: i }) => {
|
|
8051
|
+
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
8052
|
s && (r(), s.render(o, c));
|
|
8022
8053
|
}, [
|
|
8023
8054
|
r,
|
|
8024
8055
|
s,
|
|
8025
8056
|
o,
|
|
8026
8057
|
c
|
|
8027
|
-
]), { onMouseDown: d, onMouseMove: f, onMouseUp: p, onMouseLeave: m } =
|
|
8058
|
+
]), { onMouseDown: d, onMouseMove: f, onMouseUp: p, onMouseLeave: m } = ts({
|
|
8028
8059
|
gizmoRenderer: s,
|
|
8029
8060
|
gizmoScene: o,
|
|
8030
8061
|
gizmoCamera: c,
|
|
@@ -8033,7 +8064,7 @@ var Qo = ({ camera: e, controls: t, className: n, render: r, options: i }) => {
|
|
|
8033
8064
|
let r = e.position.length(), i = n.clone().multiplyScalar(r), a = new k.Matrix4();
|
|
8034
8065
|
a.lookAt(i, new k.Vector3(0, 0, 0), new k.Vector3(0, 1, 0));
|
|
8035
8066
|
let o = new k.Quaternion();
|
|
8036
|
-
o.setFromRotationMatrix(a), e.quaternion.copy(o),
|
|
8067
|
+
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
8068
|
}, [
|
|
8038
8069
|
e,
|
|
8039
8070
|
t,
|
|
@@ -8044,7 +8075,7 @@ var Qo = ({ camera: e, controls: t, className: n, render: r, options: i }) => {
|
|
|
8044
8075
|
});
|
|
8045
8076
|
return E(() => {
|
|
8046
8077
|
let n = a.current;
|
|
8047
|
-
if (!(!n || !e || !t || !s)) return l.current && l.current.dispose(), l.current = new
|
|
8078
|
+
if (!(!n || !e || !t || !s)) return l.current && l.current.dispose(), l.current = new Ho({
|
|
8048
8079
|
gizmoParams: {
|
|
8049
8080
|
gizmoDiv: n,
|
|
8050
8081
|
gizmoScene: o,
|
|
@@ -8057,8 +8088,8 @@ var Qo = ({ camera: e, controls: t, className: n, render: r, options: i }) => {
|
|
|
8057
8088
|
renderGizmo: u
|
|
8058
8089
|
},
|
|
8059
8090
|
syncFunctions: {
|
|
8060
|
-
syncGizmoCameraWithMain:
|
|
8061
|
-
syncMainCameraWithGizmo:
|
|
8091
|
+
syncGizmoCameraWithMain: No,
|
|
8092
|
+
syncMainCameraWithGizmo: Po
|
|
8062
8093
|
},
|
|
8063
8094
|
options: i
|
|
8064
8095
|
}), n.addEventListener("mousedown", d), n.addEventListener("mousemove", f), n.addEventListener("mouseup", p), n.addEventListener("mouseleave", m), () => {
|
|
@@ -8072,17 +8103,17 @@ var Qo = ({ camera: e, controls: t, className: n, render: r, options: i }) => {
|
|
|
8072
8103
|
d,
|
|
8073
8104
|
p
|
|
8074
8105
|
]), E(() => {
|
|
8075
|
-
e && (
|
|
8106
|
+
e && (No(c, e, o), u());
|
|
8076
8107
|
}, [e, u]), /* @__PURE__ */ U("div", {
|
|
8077
8108
|
className: n ? `${n}` : "gizmo-default",
|
|
8078
8109
|
ref: a
|
|
8079
8110
|
});
|
|
8080
|
-
},
|
|
8081
|
-
top: e.startsWith("top") ?
|
|
8082
|
-
bottom: e.startsWith("bottom") ?
|
|
8083
|
-
left: e.endsWith("left") ?
|
|
8084
|
-
right: e.endsWith("right") ?
|
|
8085
|
-
}),
|
|
8111
|
+
}, rs = 10, is = (e) => ({
|
|
8112
|
+
top: e.startsWith("top") ? rs : "auto",
|
|
8113
|
+
bottom: e.startsWith("bottom") ? rs : "auto",
|
|
8114
|
+
left: e.endsWith("left") ? rs : "auto",
|
|
8115
|
+
right: e.endsWith("right") ? rs : "auto"
|
|
8116
|
+
}), as = ({ camera: e, controls: t, render: n, placement: r = "top-right", size: i = 128 }) => {
|
|
8086
8117
|
if (!e || !t) return null;
|
|
8087
8118
|
let a = t;
|
|
8088
8119
|
return /* @__PURE__ */ U("div", {
|
|
@@ -8092,15 +8123,15 @@ var Qo = ({ camera: e, controls: t, className: n, render: r, options: i }) => {
|
|
|
8092
8123
|
width: i,
|
|
8093
8124
|
height: i,
|
|
8094
8125
|
zIndex: 10,
|
|
8095
|
-
...
|
|
8126
|
+
...is(r)
|
|
8096
8127
|
},
|
|
8097
|
-
children: /* @__PURE__ */ U(
|
|
8128
|
+
children: /* @__PURE__ */ U(ns, {
|
|
8098
8129
|
camera: e,
|
|
8099
8130
|
controls: a,
|
|
8100
8131
|
render: n
|
|
8101
8132
|
})
|
|
8102
8133
|
});
|
|
8103
|
-
},
|
|
8134
|
+
}, os = class extends x {
|
|
8104
8135
|
constructor(e) {
|
|
8105
8136
|
super(e), this.reset = () => {
|
|
8106
8137
|
this.setState({
|
|
@@ -8146,13 +8177,13 @@ var Qo = ({ camera: e, controls: t, className: n, render: r, options: i }) => {
|
|
|
8146
8177
|
] })
|
|
8147
8178
|
}) : this.props.children;
|
|
8148
8179
|
}
|
|
8149
|
-
},
|
|
8150
|
-
if (!
|
|
8151
|
-
let t = window.matchMedia(
|
|
8180
|
+
}, ss = "(prefers-reduced-motion: reduce)", cs = () => typeof window < "u" && typeof window.matchMedia == "function", ls = (e) => {
|
|
8181
|
+
if (!cs()) return () => {};
|
|
8182
|
+
let t = window.matchMedia(ss);
|
|
8152
8183
|
return t.addEventListener("change", e), () => t.removeEventListener("change", e);
|
|
8153
|
-
},
|
|
8154
|
-
function
|
|
8155
|
-
let i = ne(
|
|
8184
|
+
}, us = () => cs() && window.matchMedia(ss).matches;
|
|
8185
|
+
function ds({ status: e, label: t, color: n, backdrop: r }) {
|
|
8186
|
+
let i = ne(ls, us, () => !1);
|
|
8156
8187
|
return /* @__PURE__ */ bt("div", {
|
|
8157
8188
|
"data-testid": "viewer-loading-overlay",
|
|
8158
8189
|
role: "status",
|
|
@@ -8239,14 +8270,14 @@ function ss({ status: e, label: t, color: n, backdrop: r }) {
|
|
|
8239
8270
|
}
|
|
8240
8271
|
//#endregion
|
|
8241
8272
|
//#region src/presentation/components/theme.ts
|
|
8242
|
-
var
|
|
8273
|
+
var fs = "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif", ps = {
|
|
8243
8274
|
background: "rgba(255,255,255,0.78)",
|
|
8244
8275
|
backdropFilter: "blur(16px)",
|
|
8245
8276
|
WebkitBackdropFilter: "blur(16px)",
|
|
8246
8277
|
border: "1px solid rgba(0,0,0,0.06)",
|
|
8247
8278
|
boxShadow: "0 8px 30px rgba(0,0,0,0.10)"
|
|
8248
|
-
},
|
|
8249
|
-
function
|
|
8279
|
+
}, ms = Object.keys(Pa);
|
|
8280
|
+
function hs({ active: e, onSelect: t }) {
|
|
8250
8281
|
return /* @__PURE__ */ U("div", {
|
|
8251
8282
|
"data-testid": "viewer-preset-picker",
|
|
8252
8283
|
role: "group",
|
|
@@ -8263,9 +8294,9 @@ function ds({ active: e, onSelect: t }) {
|
|
|
8263
8294
|
borderRadius: 999,
|
|
8264
8295
|
maxWidth: "calc(100% - 16px)",
|
|
8265
8296
|
overflowX: "auto",
|
|
8266
|
-
...
|
|
8297
|
+
...ps
|
|
8267
8298
|
},
|
|
8268
|
-
children:
|
|
8299
|
+
children: ms.map((n) => /* @__PURE__ */ U("button", {
|
|
8269
8300
|
type: "button",
|
|
8270
8301
|
"aria-pressed": n === e,
|
|
8271
8302
|
onClick: () => t(n),
|
|
@@ -8275,7 +8306,7 @@ function ds({ active: e, onSelect: t }) {
|
|
|
8275
8306
|
border: n === e ? "1px solid #111318" : "1px solid transparent",
|
|
8276
8307
|
background: n === e ? "#111318" : "transparent",
|
|
8277
8308
|
color: n === e ? "#fff" : "#3f3f4a",
|
|
8278
|
-
fontFamily:
|
|
8309
|
+
fontFamily: fs,
|
|
8279
8310
|
fontSize: 13,
|
|
8280
8311
|
fontWeight: 500,
|
|
8281
8312
|
lineHeight: 1,
|
|
@@ -8291,32 +8322,32 @@ function ds({ active: e, onSelect: t }) {
|
|
|
8291
8322
|
}
|
|
8292
8323
|
//#endregion
|
|
8293
8324
|
//#region src/presentation/components/loadingIndicatorConfig.ts
|
|
8294
|
-
var
|
|
8325
|
+
var gs = {
|
|
8295
8326
|
enabled: !0,
|
|
8296
8327
|
label: "Loading…",
|
|
8297
8328
|
color: "#ffffff",
|
|
8298
8329
|
backdrop: "rgba(15,16,20,0.6)"
|
|
8299
8330
|
};
|
|
8300
|
-
function
|
|
8301
|
-
return e === void 0 || e === !0 ?
|
|
8302
|
-
...
|
|
8331
|
+
function _s(e) {
|
|
8332
|
+
return e === void 0 || e === !0 ? gs : e === !1 ? {
|
|
8333
|
+
...gs,
|
|
8303
8334
|
enabled: !1
|
|
8304
8335
|
} : {
|
|
8305
8336
|
enabled: e.enabled ?? !0,
|
|
8306
|
-
label: e.label ??
|
|
8337
|
+
label: e.label ?? gs.label,
|
|
8307
8338
|
errorLabel: e.errorLabel,
|
|
8308
|
-
color: e.color ??
|
|
8309
|
-
backdrop: e.backdrop ??
|
|
8339
|
+
color: e.color ?? gs.color,
|
|
8340
|
+
backdrop: e.backdrop ?? gs.backdrop
|
|
8310
8341
|
};
|
|
8311
8342
|
}
|
|
8312
8343
|
//#endregion
|
|
8313
8344
|
//#region src/presentation/components/SimpleViewer.tsx
|
|
8314
|
-
var
|
|
8315
|
-
let l = O(null), { activePreset: d, pickerEnabled: f, selectPreset: p } =
|
|
8316
|
-
|
|
8345
|
+
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) => {
|
|
8346
|
+
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);
|
|
8347
|
+
Ja(h, _, t);
|
|
8317
8348
|
let x = h ? y(h.getCamera()) : null, S = h ? m(h.getControls()) : null, C = h ? u(h.getRenderer()) : null, T = w(() => {
|
|
8318
8349
|
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(() =>
|
|
8350
|
+
}, [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
8351
|
return D(c, () => ({
|
|
8321
8352
|
scene: h ? a(h.getScene()) : null,
|
|
8322
8353
|
camera: x,
|
|
@@ -8324,25 +8355,25 @@ var ms = () => new e("Viewer is not ready yet", d.COMPONENT_NOT_MOUNTED), hs = C
|
|
|
8324
8355
|
controls: S,
|
|
8325
8356
|
events: b,
|
|
8326
8357
|
loadModel: async (e) => {
|
|
8327
|
-
if (!h) throw
|
|
8358
|
+
if (!h) throw vs();
|
|
8328
8359
|
let t = typeof e == "string" ? e : new Kt(e), n = await h.loadModel(t);
|
|
8329
8360
|
if (!n.ok) throw n.error;
|
|
8330
8361
|
},
|
|
8331
8362
|
captureStill: async (e) => {
|
|
8332
|
-
if (!h) throw
|
|
8363
|
+
if (!h) throw vs();
|
|
8333
8364
|
let t = await h.captureStill(e);
|
|
8334
8365
|
if (!t.ok) throw t.error;
|
|
8335
8366
|
return t.value;
|
|
8336
8367
|
},
|
|
8337
8368
|
captureVideo: async (e) => {
|
|
8338
|
-
if (!h) throw
|
|
8369
|
+
if (!h) throw vs();
|
|
8339
8370
|
let t = await h.captureVideo(e);
|
|
8340
8371
|
if (!t.ok) throw t.error;
|
|
8341
8372
|
return t.value;
|
|
8342
8373
|
},
|
|
8343
8374
|
getAnimationNames: () => h?.getAnimationNames() ?? [],
|
|
8344
8375
|
playAnimations: (e) => {
|
|
8345
|
-
if (!h) throw
|
|
8376
|
+
if (!h) throw vs();
|
|
8346
8377
|
let t = h.playAnimations(e);
|
|
8347
8378
|
if (!t.ok) throw t.error;
|
|
8348
8379
|
},
|
|
@@ -8350,22 +8381,22 @@ var ms = () => new e("Viewer is not ready yet", d.COMPONENT_NOT_MOUNTED), hs = C
|
|
|
8350
8381
|
h?.pauseAnimations();
|
|
8351
8382
|
},
|
|
8352
8383
|
setEnvironmentMap: async (e) => {
|
|
8353
|
-
if (!h) throw
|
|
8384
|
+
if (!h) throw vs();
|
|
8354
8385
|
let t = await h.setEnvironmentMap(e);
|
|
8355
8386
|
if (!t.ok) throw t.error;
|
|
8356
8387
|
},
|
|
8357
8388
|
resetEnvironment: () => {
|
|
8358
|
-
if (!h) throw
|
|
8389
|
+
if (!h) throw vs();
|
|
8359
8390
|
let e = h.resetEnvironment();
|
|
8360
8391
|
if (!e.ok) throw e.error;
|
|
8361
8392
|
},
|
|
8362
8393
|
setBackgroundImage: async (e) => {
|
|
8363
|
-
if (!h) throw
|
|
8394
|
+
if (!h) throw vs();
|
|
8364
8395
|
let t = await h.setBackgroundImage(e);
|
|
8365
8396
|
if (!t.ok) throw t.error;
|
|
8366
8397
|
},
|
|
8367
8398
|
setBackgroundColor: (e) => {
|
|
8368
|
-
if (!h) throw
|
|
8399
|
+
if (!h) throw vs();
|
|
8369
8400
|
let t = h.setBackgroundColor(e);
|
|
8370
8401
|
if (!t.ok) throw t.error;
|
|
8371
8402
|
},
|
|
@@ -8378,7 +8409,7 @@ var ms = () => new e("Viewer is not ready yet", d.COMPONENT_NOT_MOUNTED), hs = C
|
|
|
8378
8409
|
C,
|
|
8379
8410
|
S,
|
|
8380
8411
|
b
|
|
8381
|
-
]), /* @__PURE__ */ U(
|
|
8412
|
+
]), /* @__PURE__ */ U(os, { children: /* @__PURE__ */ U(Xa, {
|
|
8382
8413
|
viewer: h,
|
|
8383
8414
|
canvasRef: l,
|
|
8384
8415
|
children: /* @__PURE__ */ bt("div", {
|
|
@@ -8388,21 +8419,21 @@ var ms = () => new e("Viewer is not ready yet", d.COMPONENT_NOT_MOUNTED), hs = C
|
|
|
8388
8419
|
height: "100%"
|
|
8389
8420
|
},
|
|
8390
8421
|
children: [
|
|
8391
|
-
/* @__PURE__ */ U(
|
|
8392
|
-
E && g && x && S && /* @__PURE__ */ U(
|
|
8422
|
+
/* @__PURE__ */ U(Qa, {}),
|
|
8423
|
+
E && g && x && S && /* @__PURE__ */ U(as, {
|
|
8393
8424
|
camera: x,
|
|
8394
8425
|
controls: S,
|
|
8395
8426
|
render: T,
|
|
8396
8427
|
placement: te.placement,
|
|
8397
8428
|
size: te.size
|
|
8398
8429
|
}),
|
|
8399
|
-
re && /* @__PURE__ */ U(
|
|
8430
|
+
re && /* @__PURE__ */ U(ds, {
|
|
8400
8431
|
status: k ? "error" : "loading",
|
|
8401
8432
|
label: k ? ne.errorLabel ?? _?.message ?? v.error ?? "Failed to load model" : ne.label,
|
|
8402
8433
|
color: ne.color,
|
|
8403
8434
|
backdrop: ne.backdrop
|
|
8404
8435
|
}),
|
|
8405
|
-
f && /* @__PURE__ */ U(
|
|
8436
|
+
f && /* @__PURE__ */ U(hs, {
|
|
8406
8437
|
active: d ?? "studio",
|
|
8407
8438
|
onSelect: p
|
|
8408
8439
|
}),
|
|
@@ -8411,17 +8442,17 @@ var ms = () => new e("Viewer is not ready yet", d.COMPONENT_NOT_MOUNTED), hs = C
|
|
|
8411
8442
|
})
|
|
8412
8443
|
}) });
|
|
8413
8444
|
});
|
|
8414
|
-
|
|
8445
|
+
ys.displayName = "SimpleViewer";
|
|
8415
8446
|
//#endregion
|
|
8416
8447
|
//#region src/SimpleViewerWrapper.tsx
|
|
8417
|
-
var
|
|
8448
|
+
var bs = C((e, t) => /* @__PURE__ */ U(ys, {
|
|
8418
8449
|
ref: t,
|
|
8419
8450
|
...e
|
|
8420
8451
|
}));
|
|
8421
|
-
|
|
8452
|
+
bs.displayName = "SimpleViewer";
|
|
8422
8453
|
//#endregion
|
|
8423
8454
|
//#region src/presentation/components/Hotspot.tsx
|
|
8424
|
-
var
|
|
8455
|
+
var xs = () => /* @__PURE__ */ U("span", {
|
|
8425
8456
|
"aria-hidden": "true",
|
|
8426
8457
|
style: {
|
|
8427
8458
|
display: "block",
|
|
@@ -8433,8 +8464,8 @@ var _s = () => /* @__PURE__ */ U("span", {
|
|
|
8433
8464
|
boxShadow: "0 2px 8px rgba(0,0,0,0.35)"
|
|
8434
8465
|
}
|
|
8435
8466
|
});
|
|
8436
|
-
function
|
|
8437
|
-
let { viewer: r } =
|
|
8467
|
+
function Ss({ position: e, occlude: t = !1, children: n }) {
|
|
8468
|
+
let { viewer: r } = Za(), i = O(null), [a, o, s] = e;
|
|
8438
8469
|
E(() => {
|
|
8439
8470
|
if (!r) return;
|
|
8440
8471
|
let e = i.current;
|
|
@@ -8486,8 +8517,8 @@ function vs({ position: e, occlude: t = !1, children: n }) {
|
|
|
8486
8517
|
zIndex: 5,
|
|
8487
8518
|
pointerEvents: c ? "auto" : "none"
|
|
8488
8519
|
},
|
|
8489
|
-
children: c ? n : /* @__PURE__ */ U(
|
|
8520
|
+
children: c ? n : /* @__PURE__ */ U(xs, {})
|
|
8490
8521
|
});
|
|
8491
8522
|
}
|
|
8492
8523
|
//#endregion
|
|
8493
|
-
export {
|
|
8524
|
+
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 };
|