@ericchen1990/pano-view 2.4.0 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -61
- package/README.zh-CN.md +63 -61
- package/dist/index.cjs +416 -292
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.mjs +290 -167
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2296,6 +2296,7 @@ __export(index_exports, {
|
|
|
2296
2296
|
resolvePanoContextMenuEntries: () => resolvePanoContextMenuEntries,
|
|
2297
2297
|
unwrapPolygonVertices: () => unwrapPolygonVertices,
|
|
2298
2298
|
usePanoEvents: () => usePanoEvents,
|
|
2299
|
+
usePanoViewer: () => usePanoViewer,
|
|
2299
2300
|
validatePolygonVertices: () => validatePolygonVertices,
|
|
2300
2301
|
validatePolylineVertices: () => validatePolylineVertices,
|
|
2301
2302
|
vector3ToPanoPosition: () => vector3ToPanoPosition
|
|
@@ -2329,6 +2330,20 @@ function subscribeBackgroundAudioHost(host, listener) {
|
|
|
2329
2330
|
host.listeners.delete(listener);
|
|
2330
2331
|
};
|
|
2331
2332
|
}
|
|
2333
|
+
function subscribeBackgroundAudioStore(host, onStoreChange) {
|
|
2334
|
+
let unsubscribeController = host.controller?.subscribe(onStoreChange) ?? (() => {
|
|
2335
|
+
});
|
|
2336
|
+
const unsubscribeHost = subscribeBackgroundAudioHost(host, () => {
|
|
2337
|
+
unsubscribeController();
|
|
2338
|
+
unsubscribeController = host.controller?.subscribe(onStoreChange) ?? (() => {
|
|
2339
|
+
});
|
|
2340
|
+
onStoreChange();
|
|
2341
|
+
});
|
|
2342
|
+
return () => {
|
|
2343
|
+
unsubscribeController();
|
|
2344
|
+
unsubscribeHost();
|
|
2345
|
+
};
|
|
2346
|
+
}
|
|
2332
2347
|
|
|
2333
2348
|
// src/cn.ts
|
|
2334
2349
|
function cn(...values) {
|
|
@@ -5046,6 +5061,20 @@ function subscribePanoVideoHost(host, onStoreChange) {
|
|
|
5046
5061
|
host.listeners.delete(onStoreChange);
|
|
5047
5062
|
};
|
|
5048
5063
|
}
|
|
5064
|
+
function subscribePanoVideoStore(host, onStoreChange) {
|
|
5065
|
+
let unsubscribeController = host.controller?.subscribe(onStoreChange) ?? (() => {
|
|
5066
|
+
});
|
|
5067
|
+
const unsubscribeHost = subscribePanoVideoHost(host, () => {
|
|
5068
|
+
unsubscribeController();
|
|
5069
|
+
unsubscribeController = host.controller?.subscribe(onStoreChange) ?? (() => {
|
|
5070
|
+
});
|
|
5071
|
+
onStoreChange();
|
|
5072
|
+
});
|
|
5073
|
+
return () => {
|
|
5074
|
+
unsubscribeController();
|
|
5075
|
+
unsubscribeHost();
|
|
5076
|
+
};
|
|
5077
|
+
}
|
|
5049
5078
|
function getPanoVideoHostRevision(host) {
|
|
5050
5079
|
return host.revision;
|
|
5051
5080
|
}
|
|
@@ -6968,7 +6997,7 @@ var PanoViewer = (0, import_react24.forwardRef)(
|
|
|
6968
6997
|
requestVRPermission: () => webVRHost.controller?.requestPermission() ?? Promise.resolve(false),
|
|
6969
6998
|
// -- Video --
|
|
6970
6999
|
getVideo: () => videoHost.controller,
|
|
6971
|
-
subscribeVideo: (onStoreChange) =>
|
|
7000
|
+
subscribeVideo: (onStoreChange) => subscribePanoVideoStore(videoHost, onStoreChange),
|
|
6972
7001
|
playVideo: () => videoHost.controller?.play() ?? Promise.resolve(),
|
|
6973
7002
|
pauseVideo: () => videoHost.controller?.pause(),
|
|
6974
7003
|
toggleVideo: () => videoHost.controller?.togglePlay(),
|
|
@@ -6978,7 +7007,7 @@ var PanoViewer = (0, import_react24.forwardRef)(
|
|
|
6978
7007
|
toggleVideoMuted: () => videoHost.controller?.toggleMuted(),
|
|
6979
7008
|
// -- Background Audio --
|
|
6980
7009
|
getBackgroundAudio: () => bgmHost.controller,
|
|
6981
|
-
subscribeBackgroundAudio: (onStoreChange) =>
|
|
7010
|
+
subscribeBackgroundAudio: (onStoreChange) => subscribeBackgroundAudioStore(bgmHost, onStoreChange),
|
|
6982
7011
|
playBackgroundAudio: () => {
|
|
6983
7012
|
bgmHost.controller?.play();
|
|
6984
7013
|
return Promise.resolve();
|
|
@@ -7342,6 +7371,8 @@ function BackgroundAudio({
|
|
|
7342
7371
|
const loopRef = (0, import_react25.useRef)(loop);
|
|
7343
7372
|
const mutedRef = (0, import_react25.useRef)(muted);
|
|
7344
7373
|
const volumeRef = (0, import_react25.useRef)(volume);
|
|
7374
|
+
const mutedPropRef = (0, import_react25.useRef)(muted);
|
|
7375
|
+
const volumePropRef = (0, import_react25.useRef)(volume);
|
|
7345
7376
|
const fadeMsRef = (0, import_react25.useRef)(resolveFadeMs(fadeMs));
|
|
7346
7377
|
const onPlaybackStateChangeRef = (0, import_react25.useRef)(onPlaybackStateChange);
|
|
7347
7378
|
const onPlaybackErrorRef = (0, import_react25.useRef)(onPlaybackError);
|
|
@@ -7349,9 +7380,15 @@ function BackgroundAudio({
|
|
|
7349
7380
|
const onErrorRef = (0, import_react25.useRef)(onError);
|
|
7350
7381
|
playingRef.current = playing;
|
|
7351
7382
|
loopRef.current = loop;
|
|
7352
|
-
mutedRef.current = muted;
|
|
7353
|
-
volumeRef.current = volume;
|
|
7354
7383
|
fadeMsRef.current = resolveFadeMs(fadeMs);
|
|
7384
|
+
if (mutedPropRef.current !== muted) {
|
|
7385
|
+
mutedPropRef.current = muted;
|
|
7386
|
+
mutedRef.current = muted;
|
|
7387
|
+
}
|
|
7388
|
+
if (volumePropRef.current !== volume) {
|
|
7389
|
+
volumePropRef.current = volume;
|
|
7390
|
+
volumeRef.current = volume;
|
|
7391
|
+
}
|
|
7355
7392
|
onPlaybackStateChangeRef.current = onPlaybackStateChange;
|
|
7356
7393
|
onPlaybackErrorRef.current = onPlaybackError;
|
|
7357
7394
|
onEndedRef.current = onEnded;
|
|
@@ -7405,20 +7442,17 @@ function BackgroundAudio({
|
|
|
7405
7442
|
if (isControlledRef.current) {
|
|
7406
7443
|
return;
|
|
7407
7444
|
}
|
|
7408
|
-
const
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
}
|
|
7412
|
-
notifySnapshot({ volume: clampAudioVolume(vol) });
|
|
7445
|
+
const next = clampAudioVolume(vol);
|
|
7446
|
+
volumeRef.current = next;
|
|
7447
|
+
currentRef.current?.handle.howl.volume(next);
|
|
7448
|
+
notifySnapshot({ volume: next });
|
|
7413
7449
|
},
|
|
7414
7450
|
setMuted: (m) => {
|
|
7415
7451
|
if (isControlledRef.current) {
|
|
7416
7452
|
return;
|
|
7417
7453
|
}
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
howl.mute(m);
|
|
7421
|
-
}
|
|
7454
|
+
mutedRef.current = m;
|
|
7455
|
+
currentRef.current?.handle.howl.mute(m);
|
|
7422
7456
|
notifySnapshot({ muted: m });
|
|
7423
7457
|
},
|
|
7424
7458
|
toggleMuted: () => {
|
|
@@ -7426,10 +7460,8 @@ function BackgroundAudio({
|
|
|
7426
7460
|
return;
|
|
7427
7461
|
}
|
|
7428
7462
|
const next = !snapshotRef.current.muted;
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
howl.mute(next);
|
|
7432
|
-
}
|
|
7463
|
+
mutedRef.current = next;
|
|
7464
|
+
currentRef.current?.handle.howl.mute(next);
|
|
7433
7465
|
notifySnapshot({ muted: next });
|
|
7434
7466
|
}
|
|
7435
7467
|
}),
|
|
@@ -7496,6 +7528,9 @@ function BackgroundAudio({
|
|
|
7496
7528
|
shouldRetryPlay: () => currentRef.current?.key === trackKey && playingRef.current,
|
|
7497
7529
|
onEnded: () => {
|
|
7498
7530
|
notifySnapshot({ playing: false, ended: true });
|
|
7531
|
+
if (!isControlledRef.current) {
|
|
7532
|
+
setInternalPlaying(false);
|
|
7533
|
+
}
|
|
7499
7534
|
onPlaybackStateChangeRef.current?.("ended");
|
|
7500
7535
|
onEndedRef.current?.();
|
|
7501
7536
|
},
|
|
@@ -7568,7 +7603,9 @@ function BackgroundAudio({
|
|
|
7568
7603
|
}
|
|
7569
7604
|
if (!playing) {
|
|
7570
7605
|
fadingInRef.current = false;
|
|
7571
|
-
howl.
|
|
7606
|
+
if (howl.playing()) {
|
|
7607
|
+
howl.pause();
|
|
7608
|
+
}
|
|
7572
7609
|
for (const slot of outgoingRef.current) {
|
|
7573
7610
|
slot.handle.dispose();
|
|
7574
7611
|
}
|
|
@@ -7583,11 +7620,14 @@ function BackgroundAudio({
|
|
|
7583
7620
|
return;
|
|
7584
7621
|
}
|
|
7585
7622
|
slot.handle.howl.loop(loop);
|
|
7586
|
-
slot.handle.howl.mute(
|
|
7623
|
+
slot.handle.howl.mute(mutedRef.current);
|
|
7587
7624
|
if (!fadingInRef.current) {
|
|
7588
|
-
slot.handle.howl.volume(clampAudioVolume(
|
|
7625
|
+
slot.handle.howl.volume(clampAudioVolume(volumeRef.current));
|
|
7589
7626
|
}
|
|
7590
|
-
notifySnapshot({
|
|
7627
|
+
notifySnapshot({
|
|
7628
|
+
muted: mutedRef.current,
|
|
7629
|
+
volume: clampAudioVolume(volumeRef.current)
|
|
7630
|
+
});
|
|
7591
7631
|
}, [loop, muted, trackKey, volume]);
|
|
7592
7632
|
(0, import_react25.useEffect)(() => {
|
|
7593
7633
|
if (!pauseWhenHidden) {
|
|
@@ -9160,9 +9200,92 @@ var WebVR = (0, import_react32.forwardRef)(function WebVR2({
|
|
|
9160
9200
|
] });
|
|
9161
9201
|
});
|
|
9162
9202
|
|
|
9203
|
+
// src/use-pano-viewer.ts
|
|
9204
|
+
var import_react33 = require("react");
|
|
9205
|
+
function createPanoViewerHandle(ref) {
|
|
9206
|
+
return {
|
|
9207
|
+
getView: () => ref.current?.getView() ?? { yaw: 0, pitch: 0, fov: 75 },
|
|
9208
|
+
setView: (view, options) => {
|
|
9209
|
+
ref.current?.setView(view, options);
|
|
9210
|
+
},
|
|
9211
|
+
reset: () => {
|
|
9212
|
+
ref.current?.reset();
|
|
9213
|
+
},
|
|
9214
|
+
enterFullscreen: () => ref.current?.enterFullscreen() ?? Promise.resolve(),
|
|
9215
|
+
exitFullscreen: () => ref.current?.exitFullscreen() ?? Promise.resolve(),
|
|
9216
|
+
toggleFullscreen: () => ref.current?.toggleFullscreen() ?? Promise.resolve(),
|
|
9217
|
+
isFullscreen: () => ref.current?.isFullscreen() ?? false,
|
|
9218
|
+
setScene: (id) => ref.current?.setScene(id) ?? false,
|
|
9219
|
+
nextScene: () => ref.current?.nextScene() ?? false,
|
|
9220
|
+
previousScene: () => ref.current?.previousScene() ?? false,
|
|
9221
|
+
getActiveSceneId: () => ref.current?.getActiveSceneId() ?? null,
|
|
9222
|
+
getSceneIds: () => ref.current?.getSceneIds() ?? [],
|
|
9223
|
+
isSceneTransitioning: () => ref.current?.isSceneTransitioning() ?? false,
|
|
9224
|
+
enterVR: () => ref.current?.enterVR() ?? Promise.resolve(false),
|
|
9225
|
+
exitVR: () => ref.current?.exitVR() ?? Promise.resolve(),
|
|
9226
|
+
toggleVR: () => ref.current?.toggleVR() ?? Promise.resolve(false),
|
|
9227
|
+
isVRAvailable: () => ref.current?.isVRAvailable() ?? false,
|
|
9228
|
+
isVREnabled: () => ref.current?.isVREnabled() ?? false,
|
|
9229
|
+
getVRMode: () => ref.current?.getVRMode() ?? null,
|
|
9230
|
+
requestVRPermission: () => ref.current?.requestVRPermission() ?? Promise.resolve(false),
|
|
9231
|
+
getVideo: () => ref.current?.getVideo() ?? null,
|
|
9232
|
+
subscribeVideo: (onStoreChange) => ref.current?.subscribeVideo(onStoreChange) ?? (() => {
|
|
9233
|
+
}),
|
|
9234
|
+
playVideo: () => ref.current?.playVideo() ?? Promise.resolve(),
|
|
9235
|
+
pauseVideo: () => {
|
|
9236
|
+
ref.current?.pauseVideo();
|
|
9237
|
+
},
|
|
9238
|
+
toggleVideo: () => {
|
|
9239
|
+
ref.current?.toggleVideo();
|
|
9240
|
+
},
|
|
9241
|
+
seekVideo: (time) => {
|
|
9242
|
+
ref.current?.seekVideo(time);
|
|
9243
|
+
},
|
|
9244
|
+
setVideoVolume: (volume) => {
|
|
9245
|
+
ref.current?.setVideoVolume(volume);
|
|
9246
|
+
},
|
|
9247
|
+
setVideoMuted: (muted) => {
|
|
9248
|
+
ref.current?.setVideoMuted(muted);
|
|
9249
|
+
},
|
|
9250
|
+
toggleVideoMuted: () => {
|
|
9251
|
+
ref.current?.toggleVideoMuted();
|
|
9252
|
+
},
|
|
9253
|
+
getBackgroundAudio: () => ref.current?.getBackgroundAudio() ?? null,
|
|
9254
|
+
subscribeBackgroundAudio: (onStoreChange) => ref.current?.subscribeBackgroundAudio(onStoreChange) ?? (() => {
|
|
9255
|
+
}),
|
|
9256
|
+
playBackgroundAudio: () => ref.current?.playBackgroundAudio() ?? Promise.resolve(),
|
|
9257
|
+
pauseBackgroundAudio: () => {
|
|
9258
|
+
ref.current?.pauseBackgroundAudio();
|
|
9259
|
+
},
|
|
9260
|
+
toggleBackgroundAudio: () => {
|
|
9261
|
+
ref.current?.toggleBackgroundAudio();
|
|
9262
|
+
},
|
|
9263
|
+
setBackgroundAudioVolume: (volume) => {
|
|
9264
|
+
ref.current?.setBackgroundAudioVolume(volume);
|
|
9265
|
+
},
|
|
9266
|
+
setBackgroundAudioMuted: (muted) => {
|
|
9267
|
+
ref.current?.setBackgroundAudioMuted(muted);
|
|
9268
|
+
},
|
|
9269
|
+
toggleBackgroundAudioMuted: () => {
|
|
9270
|
+
ref.current?.toggleBackgroundAudioMuted();
|
|
9271
|
+
},
|
|
9272
|
+
startAutoRotate: () => {
|
|
9273
|
+
ref.current?.startAutoRotate();
|
|
9274
|
+
},
|
|
9275
|
+
stopAutoRotate: () => {
|
|
9276
|
+
ref.current?.stopAutoRotate();
|
|
9277
|
+
}
|
|
9278
|
+
};
|
|
9279
|
+
}
|
|
9280
|
+
function usePanoViewer() {
|
|
9281
|
+
const ref = (0, import_react33.useRef)(null);
|
|
9282
|
+
const handle = (0, import_react33.useMemo)(() => createPanoViewerHandle(ref), []);
|
|
9283
|
+
return (0, import_react33.useMemo)(() => ({ ref, ...handle }), [handle]);
|
|
9284
|
+
}
|
|
9285
|
+
|
|
9163
9286
|
// src/sphere.tsx
|
|
9164
9287
|
var import_fiber15 = require("@react-three/fiber");
|
|
9165
|
-
var
|
|
9288
|
+
var import_react35 = require("react");
|
|
9166
9289
|
var import_three10 = require("three");
|
|
9167
9290
|
|
|
9168
9291
|
// src/asset-url.ts
|
|
@@ -9187,7 +9310,7 @@ function resolveUrlAgainstFile(fileUrl, path) {
|
|
|
9187
9310
|
}
|
|
9188
9311
|
|
|
9189
9312
|
// src/pano-filter/pano-basic-material.tsx
|
|
9190
|
-
var
|
|
9313
|
+
var import_react34 = require("react");
|
|
9191
9314
|
|
|
9192
9315
|
// src/pano-filter/shaders.ts
|
|
9193
9316
|
var GLSL_FILTER_COMMON = `
|
|
@@ -9347,13 +9470,13 @@ function PanoBasicMaterial({
|
|
|
9347
9470
|
toneMapped = false
|
|
9348
9471
|
}) {
|
|
9349
9472
|
const snapshot = usePanoFilterSnapshot();
|
|
9350
|
-
const materialRef = (0,
|
|
9351
|
-
const intensityRef = (0,
|
|
9352
|
-
const intensityUniformRef = (0,
|
|
9473
|
+
const materialRef = (0, import_react34.useRef)(null);
|
|
9474
|
+
const intensityRef = (0, import_react34.useRef)(snapshot.intensity);
|
|
9475
|
+
const intensityUniformRef = (0, import_react34.useRef)(null);
|
|
9353
9476
|
intensityRef.current = snapshot.intensity;
|
|
9354
9477
|
const active = isPanoFilterActive(snapshot);
|
|
9355
9478
|
const preset = snapshot.preset;
|
|
9356
|
-
const onBeforeCompile = (0,
|
|
9479
|
+
const onBeforeCompile = (0, import_react34.useMemo)(() => {
|
|
9357
9480
|
if (!active || preset === "none") {
|
|
9358
9481
|
return void 0;
|
|
9359
9482
|
}
|
|
@@ -9370,7 +9493,7 @@ function PanoBasicMaterial({
|
|
|
9370
9493
|
compile.toString = () => `pano-filter:${preset}`;
|
|
9371
9494
|
return compile;
|
|
9372
9495
|
}, [active, preset]);
|
|
9373
|
-
(0,
|
|
9496
|
+
(0, import_react34.useLayoutEffect)(() => {
|
|
9374
9497
|
if (!active) {
|
|
9375
9498
|
intensityUniformRef.current = null;
|
|
9376
9499
|
}
|
|
@@ -9380,7 +9503,7 @@ function PanoBasicMaterial({
|
|
|
9380
9503
|
}
|
|
9381
9504
|
material.needsUpdate = true;
|
|
9382
9505
|
}, [active, preset]);
|
|
9383
|
-
(0,
|
|
9506
|
+
(0, import_react34.useLayoutEffect)(() => {
|
|
9384
9507
|
if (intensityUniformRef.current) {
|
|
9385
9508
|
intensityUniformRef.current.value = snapshot.intensity;
|
|
9386
9509
|
}
|
|
@@ -9403,12 +9526,12 @@ function PanoBasicMaterial({
|
|
|
9403
9526
|
// src/sphere.tsx
|
|
9404
9527
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
9405
9528
|
function useEquirectTexture(url, anisotropy, generateMipmaps, onLoad, onError) {
|
|
9406
|
-
const [texture, setTexture] = (0,
|
|
9407
|
-
const onLoadRef = (0,
|
|
9408
|
-
const onErrorRef = (0,
|
|
9529
|
+
const [texture, setTexture] = (0, import_react35.useState)(null);
|
|
9530
|
+
const onLoadRef = (0, import_react35.useRef)(onLoad);
|
|
9531
|
+
const onErrorRef = (0, import_react35.useRef)(onError);
|
|
9409
9532
|
onLoadRef.current = onLoad;
|
|
9410
9533
|
onErrorRef.current = onError;
|
|
9411
|
-
(0,
|
|
9534
|
+
(0, import_react35.useEffect)(() => {
|
|
9412
9535
|
if (!url) {
|
|
9413
9536
|
setTexture(null);
|
|
9414
9537
|
return;
|
|
@@ -9447,7 +9570,7 @@ function useEquirectTexture(url, anisotropy, generateMipmaps, onLoad, onError) {
|
|
|
9447
9570
|
active = false;
|
|
9448
9571
|
};
|
|
9449
9572
|
}, [anisotropy, generateMipmaps, url]);
|
|
9450
|
-
(0,
|
|
9573
|
+
(0, import_react35.useEffect)(
|
|
9451
9574
|
() => () => {
|
|
9452
9575
|
texture?.dispose();
|
|
9453
9576
|
},
|
|
@@ -9467,7 +9590,7 @@ function Sphere({
|
|
|
9467
9590
|
}) {
|
|
9468
9591
|
const gl = (0, import_fiber15.useThree)((state) => state.gl);
|
|
9469
9592
|
const anisotropy = gl.capabilities.getMaxAnisotropy();
|
|
9470
|
-
const resolvedPreviewUrl = (0,
|
|
9593
|
+
const resolvedPreviewUrl = (0, import_react35.useMemo)(
|
|
9471
9594
|
() => resolveUrlAgainstFile(src, previewUrl),
|
|
9472
9595
|
[previewUrl, src]
|
|
9473
9596
|
);
|
|
@@ -9486,11 +9609,11 @@ function Sphere({
|
|
|
9486
9609
|
onPreviewError
|
|
9487
9610
|
);
|
|
9488
9611
|
const displayTexture = texture ?? previewTexture;
|
|
9489
|
-
const readyRef = (0,
|
|
9490
|
-
(0,
|
|
9612
|
+
const readyRef = (0, import_react35.useRef)(false);
|
|
9613
|
+
(0, import_react35.useEffect)(() => {
|
|
9491
9614
|
readyRef.current = false;
|
|
9492
9615
|
}, [resolvedPreviewUrl, src]);
|
|
9493
|
-
(0,
|
|
9616
|
+
(0, import_react35.useEffect)(() => {
|
|
9494
9617
|
if (!displayTexture || readyRef.current) {
|
|
9495
9618
|
return;
|
|
9496
9619
|
}
|
|
@@ -9522,7 +9645,7 @@ function Sphere({
|
|
|
9522
9645
|
|
|
9523
9646
|
// src/video/pano-video.tsx
|
|
9524
9647
|
var import_fiber16 = require("@react-three/fiber");
|
|
9525
|
-
var
|
|
9648
|
+
var import_react36 = require("react");
|
|
9526
9649
|
var import_three11 = require("three");
|
|
9527
9650
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
9528
9651
|
var EMPTY_TRACKS = [];
|
|
@@ -9609,10 +9732,10 @@ function applyEquirectangularLayout(texture, anisotropy) {
|
|
|
9609
9732
|
}
|
|
9610
9733
|
function usePosterTexture(poster, onError) {
|
|
9611
9734
|
const gl = (0, import_fiber16.useThree)((state) => state.gl);
|
|
9612
|
-
const [texture, setTexture] = (0,
|
|
9613
|
-
const onErrorRef = (0,
|
|
9735
|
+
const [texture, setTexture] = (0, import_react36.useState)(null);
|
|
9736
|
+
const onErrorRef = (0, import_react36.useRef)(onError);
|
|
9614
9737
|
onErrorRef.current = onError;
|
|
9615
|
-
(0,
|
|
9738
|
+
(0, import_react36.useEffect)(() => {
|
|
9616
9739
|
let active = true;
|
|
9617
9740
|
setTexture(null);
|
|
9618
9741
|
if (!poster) {
|
|
@@ -9649,7 +9772,7 @@ function usePosterTexture(poster, onError) {
|
|
|
9649
9772
|
active = false;
|
|
9650
9773
|
};
|
|
9651
9774
|
}, [gl, poster]);
|
|
9652
|
-
(0,
|
|
9775
|
+
(0, import_react36.useEffect)(
|
|
9653
9776
|
() => () => {
|
|
9654
9777
|
texture?.dispose();
|
|
9655
9778
|
},
|
|
@@ -9707,38 +9830,38 @@ function PanoVideo({
|
|
|
9707
9830
|
onTrackChange
|
|
9708
9831
|
}) {
|
|
9709
9832
|
const gl = (0, import_fiber16.useThree)((state) => state.gl);
|
|
9710
|
-
const host = (0,
|
|
9711
|
-
const overlay = (0,
|
|
9712
|
-
const variants = (0,
|
|
9833
|
+
const host = (0, import_react36.useContext)(PanoVideoHostContext);
|
|
9834
|
+
const overlay = (0, import_react36.useContext)(PanoChromeOverlayContext);
|
|
9835
|
+
const variants = (0, import_react36.useMemo)(
|
|
9713
9836
|
() => resolvePanoVideoVariants({ poster, src, variants: variantsProp }),
|
|
9714
9837
|
[poster, src, variantsProp]
|
|
9715
9838
|
);
|
|
9716
9839
|
const tracks = tracksProp ?? EMPTY_TRACKS;
|
|
9717
9840
|
const captionsEnabled = captions !== false;
|
|
9718
|
-
const captionAppearance = (0,
|
|
9841
|
+
const captionAppearance = (0, import_react36.useMemo)(
|
|
9719
9842
|
() => resolvePanoVideoCaptionAppearance(
|
|
9720
9843
|
typeof captions === "object" ? captions : void 0
|
|
9721
9844
|
),
|
|
9722
9845
|
[captions]
|
|
9723
9846
|
);
|
|
9724
|
-
const [variantId, setVariantId] = (0,
|
|
9847
|
+
const [variantId, setVariantId] = (0, import_react36.useState)(
|
|
9725
9848
|
() => resolvePanoVideoVariantId(variants, defaultVariantId)
|
|
9726
9849
|
);
|
|
9727
|
-
const [trackId, setTrackId] = (0,
|
|
9850
|
+
const [trackId, setTrackId] = (0, import_react36.useState)(
|
|
9728
9851
|
() => captionsEnabled ? defaultPanoVideoTrackId(tracks) : null
|
|
9729
9852
|
);
|
|
9730
|
-
const [ready, setReady] = (0,
|
|
9731
|
-
const autoPlayRef = (0,
|
|
9853
|
+
const [ready, setReady] = (0, import_react36.useState)(false);
|
|
9854
|
+
const autoPlayRef = (0, import_react36.useRef)(autoPlay);
|
|
9732
9855
|
autoPlayRef.current = autoPlay;
|
|
9733
|
-
const blockedRef = (0,
|
|
9734
|
-
const captionAppearanceOverrideRef = (0,
|
|
9856
|
+
const blockedRef = (0, import_react36.useRef)(false);
|
|
9857
|
+
const captionAppearanceOverrideRef = (0, import_react36.useRef)(
|
|
9735
9858
|
{}
|
|
9736
9859
|
);
|
|
9737
|
-
const mediaCapabilitiesRef = (0,
|
|
9860
|
+
const mediaCapabilitiesRef = (0, import_react36.useRef)({
|
|
9738
9861
|
volumeAdjustable: true,
|
|
9739
9862
|
playbackRates: [...DEFAULT_PANO_VIDEO_PLAYBACK_RATES]
|
|
9740
9863
|
});
|
|
9741
|
-
const storeRef = (0,
|
|
9864
|
+
const storeRef = (0, import_react36.useRef)(null);
|
|
9742
9865
|
if (!storeRef.current) {
|
|
9743
9866
|
storeRef.current = {
|
|
9744
9867
|
snapshot: {
|
|
@@ -9748,7 +9871,7 @@ function PanoVideo({
|
|
|
9748
9871
|
listeners: /* @__PURE__ */ new Set()
|
|
9749
9872
|
};
|
|
9750
9873
|
}
|
|
9751
|
-
const actionsRef = (0,
|
|
9874
|
+
const actionsRef = (0, import_react36.useRef)({
|
|
9752
9875
|
play: async () => {
|
|
9753
9876
|
},
|
|
9754
9877
|
pause: () => {
|
|
@@ -9768,19 +9891,19 @@ function PanoVideo({
|
|
|
9768
9891
|
setCaptionAppearance: (_appearance) => {
|
|
9769
9892
|
}
|
|
9770
9893
|
});
|
|
9771
|
-
const onLoadRef = (0,
|
|
9772
|
-
const onErrorRef = (0,
|
|
9773
|
-
const onPlaybackStateChangeRef = (0,
|
|
9774
|
-
const onEndedRef = (0,
|
|
9775
|
-
const onVariantChangeRef = (0,
|
|
9776
|
-
const onTrackChangeRef = (0,
|
|
9894
|
+
const onLoadRef = (0, import_react36.useRef)(onLoad);
|
|
9895
|
+
const onErrorRef = (0, import_react36.useRef)(onError);
|
|
9896
|
+
const onPlaybackStateChangeRef = (0, import_react36.useRef)(onPlaybackStateChange);
|
|
9897
|
+
const onEndedRef = (0, import_react36.useRef)(onEnded);
|
|
9898
|
+
const onVariantChangeRef = (0, import_react36.useRef)(onVariantChange);
|
|
9899
|
+
const onTrackChangeRef = (0, import_react36.useRef)(onTrackChange);
|
|
9777
9900
|
onLoadRef.current = onLoad;
|
|
9778
9901
|
onErrorRef.current = onError;
|
|
9779
9902
|
onPlaybackStateChangeRef.current = onPlaybackStateChange;
|
|
9780
9903
|
onEndedRef.current = onEnded;
|
|
9781
9904
|
onVariantChangeRef.current = onVariantChange;
|
|
9782
9905
|
onTrackChangeRef.current = onTrackChange;
|
|
9783
|
-
const resource = (0,
|
|
9906
|
+
const resource = (0, import_react36.useMemo)(() => {
|
|
9784
9907
|
if (typeof document === "undefined") {
|
|
9785
9908
|
return null;
|
|
9786
9909
|
}
|
|
@@ -9797,7 +9920,7 @@ function PanoVideo({
|
|
|
9797
9920
|
texture.generateMipmaps = false;
|
|
9798
9921
|
return { video, texture };
|
|
9799
9922
|
}, []);
|
|
9800
|
-
(0,
|
|
9923
|
+
(0, import_react36.useEffect)(
|
|
9801
9924
|
() => () => {
|
|
9802
9925
|
if (!resource) {
|
|
9803
9926
|
return;
|
|
@@ -9812,13 +9935,13 @@ function PanoVideo({
|
|
|
9812
9935
|
},
|
|
9813
9936
|
[resource]
|
|
9814
9937
|
);
|
|
9815
|
-
(0,
|
|
9938
|
+
(0, import_react36.useEffect)(() => {
|
|
9816
9939
|
if (!resource) {
|
|
9817
9940
|
return;
|
|
9818
9941
|
}
|
|
9819
9942
|
resource.texture.anisotropy = gl.capabilities.getMaxAnisotropy();
|
|
9820
9943
|
}, [gl, resource]);
|
|
9821
|
-
(0,
|
|
9944
|
+
(0, import_react36.useEffect)(() => {
|
|
9822
9945
|
if (!resource || !overlay?.overlayElement) {
|
|
9823
9946
|
return;
|
|
9824
9947
|
}
|
|
@@ -9841,7 +9964,7 @@ function PanoVideo({
|
|
|
9841
9964
|
activeVariant?.poster ?? poster,
|
|
9842
9965
|
onError
|
|
9843
9966
|
);
|
|
9844
|
-
const emitSnapshot = (0,
|
|
9967
|
+
const emitSnapshot = (0, import_react36.useCallback)(
|
|
9845
9968
|
(patch) => {
|
|
9846
9969
|
const store = storeRef.current;
|
|
9847
9970
|
const video = resource?.video;
|
|
@@ -9893,7 +10016,7 @@ function PanoVideo({
|
|
|
9893
10016
|
captionAppearance
|
|
9894
10017
|
]
|
|
9895
10018
|
);
|
|
9896
|
-
const controller = (0,
|
|
10019
|
+
const controller = (0, import_react36.useMemo)(
|
|
9897
10020
|
() => ({
|
|
9898
10021
|
subscribe: (onStoreChange) => {
|
|
9899
10022
|
const store = storeRef.current;
|
|
@@ -9945,7 +10068,7 @@ function PanoVideo({
|
|
|
9945
10068
|
}),
|
|
9946
10069
|
[]
|
|
9947
10070
|
);
|
|
9948
|
-
(0,
|
|
10071
|
+
(0, import_react36.useLayoutEffect)(() => {
|
|
9949
10072
|
if (!host || variants.length === 0) {
|
|
9950
10073
|
return;
|
|
9951
10074
|
}
|
|
@@ -9958,7 +10081,7 @@ function PanoVideo({
|
|
|
9958
10081
|
notifyPanoVideoHost(host);
|
|
9959
10082
|
};
|
|
9960
10083
|
}, [captionsEnabled, controller, controls, host, variants.length]);
|
|
9961
|
-
(0,
|
|
10084
|
+
(0, import_react36.useLayoutEffect)(() => {
|
|
9962
10085
|
if (!resource) {
|
|
9963
10086
|
return;
|
|
9964
10087
|
}
|
|
@@ -9971,10 +10094,10 @@ function PanoVideo({
|
|
|
9971
10094
|
};
|
|
9972
10095
|
emitSnapshot();
|
|
9973
10096
|
}, [emitSnapshot, playbackRates, resource]);
|
|
9974
|
-
(0,
|
|
10097
|
+
(0, import_react36.useEffect)(() => {
|
|
9975
10098
|
emitSnapshot();
|
|
9976
10099
|
}, [emitSnapshot]);
|
|
9977
|
-
(0,
|
|
10100
|
+
(0, import_react36.useEffect)(() => {
|
|
9978
10101
|
if (!resource || !activeVariant || !mediaKey) {
|
|
9979
10102
|
return;
|
|
9980
10103
|
}
|
|
@@ -10031,7 +10154,7 @@ function PanoVideo({
|
|
|
10031
10154
|
video.removeEventListener("error", handleError);
|
|
10032
10155
|
};
|
|
10033
10156
|
}, [mediaKey, resource]);
|
|
10034
|
-
(0,
|
|
10157
|
+
(0, import_react36.useEffect)(() => {
|
|
10035
10158
|
if (!resource) {
|
|
10036
10159
|
return;
|
|
10037
10160
|
}
|
|
@@ -10121,7 +10244,7 @@ function PanoVideo({
|
|
|
10121
10244
|
}
|
|
10122
10245
|
};
|
|
10123
10246
|
}, [emitSnapshot, resource]);
|
|
10124
|
-
(0,
|
|
10247
|
+
(0, import_react36.useEffect)(() => {
|
|
10125
10248
|
if (!resource) {
|
|
10126
10249
|
return;
|
|
10127
10250
|
}
|
|
@@ -10134,7 +10257,7 @@ function PanoVideo({
|
|
|
10134
10257
|
video.playsInline = playsInline;
|
|
10135
10258
|
video.preload = preload;
|
|
10136
10259
|
}, [loop, muted, playsInline, preload, resource, volume]);
|
|
10137
|
-
(0,
|
|
10260
|
+
(0, import_react36.useEffect)(() => {
|
|
10138
10261
|
if (!resource) {
|
|
10139
10262
|
return;
|
|
10140
10263
|
}
|
|
@@ -10184,7 +10307,7 @@ function PanoVideo({
|
|
|
10184
10307
|
video.removeEventListener("ratechange", handleVolume);
|
|
10185
10308
|
};
|
|
10186
10309
|
}, [emitSnapshot, resource]);
|
|
10187
|
-
(0,
|
|
10310
|
+
(0, import_react36.useEffect)(() => {
|
|
10188
10311
|
if (!resource) {
|
|
10189
10312
|
return;
|
|
10190
10313
|
}
|
|
@@ -10219,7 +10342,7 @@ function PanoVideo({
|
|
|
10219
10342
|
video.textTracks.removeEventListener("change", applyModes);
|
|
10220
10343
|
};
|
|
10221
10344
|
}, [emitSnapshot, resource, trackId, tracks]);
|
|
10222
|
-
(0,
|
|
10345
|
+
(0, import_react36.useEffect)(() => {
|
|
10223
10346
|
if (!captionsEnabled) {
|
|
10224
10347
|
setTrackId(null);
|
|
10225
10348
|
return;
|
|
@@ -10255,7 +10378,7 @@ function PanoVideo({
|
|
|
10255
10378
|
|
|
10256
10379
|
// src/scenes.tsx
|
|
10257
10380
|
var import_fiber21 = require("@react-three/fiber");
|
|
10258
|
-
var
|
|
10381
|
+
var import_react41 = require("react");
|
|
10259
10382
|
var import_three19 = require("three");
|
|
10260
10383
|
|
|
10261
10384
|
// src/scene-transitions/presets.ts
|
|
@@ -10306,7 +10429,7 @@ function isSnapshotTransition(preset) {
|
|
|
10306
10429
|
|
|
10307
10430
|
// src/scene-transitions/particle-overlay.tsx
|
|
10308
10431
|
var import_fiber17 = require("@react-three/fiber");
|
|
10309
|
-
var
|
|
10432
|
+
var import_react37 = require("react");
|
|
10310
10433
|
var import_three13 = require("three");
|
|
10311
10434
|
|
|
10312
10435
|
// src/scene-transitions/glsl.ts
|
|
@@ -10438,12 +10561,12 @@ function ParticleOverlay({
|
|
|
10438
10561
|
onFinish
|
|
10439
10562
|
}) {
|
|
10440
10563
|
const { camera } = (0, import_fiber17.useThree)();
|
|
10441
|
-
const meshRef = (0,
|
|
10442
|
-
const startRef = (0,
|
|
10443
|
-
const finishedRef = (0,
|
|
10444
|
-
const directionRef = (0,
|
|
10445
|
-
const geometry = (0,
|
|
10446
|
-
const material = (0,
|
|
10564
|
+
const meshRef = (0, import_react37.useRef)(null);
|
|
10565
|
+
const startRef = (0, import_react37.useRef)(null);
|
|
10566
|
+
const finishedRef = (0, import_react37.useRef)(false);
|
|
10567
|
+
const directionRef = (0, import_react37.useRef)(new import_three13.Vector3());
|
|
10568
|
+
const geometry = (0, import_react37.useMemo)(() => createParticleGeometry(), []);
|
|
10569
|
+
const material = (0, import_react37.useMemo)(
|
|
10447
10570
|
() => new import_three13.ShaderMaterial({
|
|
10448
10571
|
transparent: true,
|
|
10449
10572
|
depthTest: false,
|
|
@@ -10459,9 +10582,9 @@ function ParticleOverlay({
|
|
|
10459
10582
|
}),
|
|
10460
10583
|
[snapshot.texture]
|
|
10461
10584
|
);
|
|
10462
|
-
(0,
|
|
10463
|
-
(0,
|
|
10464
|
-
(0,
|
|
10585
|
+
(0, import_react37.useEffect)(() => () => geometry.dispose(), [geometry]);
|
|
10586
|
+
(0, import_react37.useEffect)(() => () => material.dispose(), [material]);
|
|
10587
|
+
(0, import_react37.useEffect)(() => {
|
|
10465
10588
|
startRef.current = null;
|
|
10466
10589
|
finishedRef.current = false;
|
|
10467
10590
|
material.uniforms.progress.value = 0;
|
|
@@ -10497,7 +10620,7 @@ function ParticleOverlay({
|
|
|
10497
10620
|
|
|
10498
10621
|
// src/scene-transitions/snapshot-overlay.tsx
|
|
10499
10622
|
var import_fiber18 = require("@react-three/fiber");
|
|
10500
|
-
var
|
|
10623
|
+
var import_react38 = require("react");
|
|
10501
10624
|
var import_three15 = require("three");
|
|
10502
10625
|
|
|
10503
10626
|
// src/scene-transitions/snapshot-shaders.ts
|
|
@@ -10786,18 +10909,18 @@ function SnapshotOverlay({
|
|
|
10786
10909
|
onFinish
|
|
10787
10910
|
}) {
|
|
10788
10911
|
const { camera, gl } = (0, import_fiber18.useThree)();
|
|
10789
|
-
const meshRef = (0,
|
|
10790
|
-
const startRef = (0,
|
|
10791
|
-
const finishedRef = (0,
|
|
10792
|
-
const directionRef = (0,
|
|
10793
|
-
const material = (0,
|
|
10912
|
+
const meshRef = (0, import_react38.useRef)(null);
|
|
10913
|
+
const startRef = (0, import_react38.useRef)(null);
|
|
10914
|
+
const finishedRef = (0, import_react38.useRef)(false);
|
|
10915
|
+
const directionRef = (0, import_react38.useRef)(new import_three15.Vector3());
|
|
10916
|
+
const material = (0, import_react38.useMemo)(() => {
|
|
10794
10917
|
if (!isSnapshotTransition(transition.preset)) {
|
|
10795
10918
|
return null;
|
|
10796
10919
|
}
|
|
10797
10920
|
return createSnapshotMaterial(transition.preset, snapshot.texture);
|
|
10798
10921
|
}, [snapshot.texture, transition.preset]);
|
|
10799
|
-
(0,
|
|
10800
|
-
(0,
|
|
10922
|
+
(0, import_react38.useEffect)(() => () => material?.dispose(), [material]);
|
|
10923
|
+
(0, import_react38.useEffect)(() => {
|
|
10801
10924
|
startRef.current = null;
|
|
10802
10925
|
finishedRef.current = false;
|
|
10803
10926
|
if (material) {
|
|
@@ -10879,7 +11002,7 @@ function TransitionOverlay(props) {
|
|
|
10879
11002
|
|
|
10880
11003
|
// src/tile/texture-manager-context.tsx
|
|
10881
11004
|
var import_fiber19 = require("@react-three/fiber");
|
|
10882
|
-
var
|
|
11005
|
+
var import_react39 = require("react");
|
|
10883
11006
|
|
|
10884
11007
|
// src/tile/texture-manager.ts
|
|
10885
11008
|
var import_three16 = require("three");
|
|
@@ -11104,7 +11227,7 @@ var TileTextureManager = class {
|
|
|
11104
11227
|
|
|
11105
11228
|
// src/tile/texture-manager-context.tsx
|
|
11106
11229
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
11107
|
-
var TileTextureManagerContext = (0,
|
|
11230
|
+
var TileTextureManagerContext = (0, import_react39.createContext)(
|
|
11108
11231
|
null
|
|
11109
11232
|
);
|
|
11110
11233
|
function TileTextureManagerProvider({
|
|
@@ -11114,7 +11237,7 @@ function TileTextureManagerProvider({
|
|
|
11114
11237
|
}) {
|
|
11115
11238
|
const gl = (0, import_fiber19.useThree)((state) => state.gl);
|
|
11116
11239
|
const anisotropy = gl.capabilities.getMaxAnisotropy();
|
|
11117
|
-
const manager = (0,
|
|
11240
|
+
const manager = (0, import_react39.useMemo)(
|
|
11118
11241
|
() => new TileTextureManager({
|
|
11119
11242
|
anisotropy,
|
|
11120
11243
|
maxBytes: Math.max(1, maxTextureMemoryMb) * 1024 * 1024,
|
|
@@ -11123,19 +11246,19 @@ function TileTextureManagerProvider({
|
|
|
11123
11246
|
}),
|
|
11124
11247
|
[anisotropy, maxConcurrentLoads, maxTextureMemoryMb]
|
|
11125
11248
|
);
|
|
11126
|
-
(0,
|
|
11249
|
+
(0, import_react39.useEffect)(() => {
|
|
11127
11250
|
manager.resume();
|
|
11128
11251
|
return () => manager.dispose();
|
|
11129
11252
|
}, [manager]);
|
|
11130
11253
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TileTextureManagerContext.Provider, { value: manager, children });
|
|
11131
11254
|
}
|
|
11132
11255
|
function useSharedTileTextureManager() {
|
|
11133
|
-
return (0,
|
|
11256
|
+
return (0, import_react39.useContext)(TileTextureManagerContext);
|
|
11134
11257
|
}
|
|
11135
11258
|
|
|
11136
11259
|
// src/tile/tile.tsx
|
|
11137
11260
|
var import_fiber20 = require("@react-three/fiber");
|
|
11138
|
-
var
|
|
11261
|
+
var import_react40 = require("react");
|
|
11139
11262
|
var import_three18 = require("three");
|
|
11140
11263
|
|
|
11141
11264
|
// src/tile/face-layout.ts
|
|
@@ -11324,10 +11447,10 @@ var VISIBILITY_FOV_PADDING_DEGREES = 8;
|
|
|
11324
11447
|
var PREVIEW_RADIUS = CUBE_RADIUS + 0.05;
|
|
11325
11448
|
var SHARED_TILE_GEOMETRY = new import_three18.PlaneGeometry(1, 1);
|
|
11326
11449
|
function usePreviewTexture(url, anisotropy, onError) {
|
|
11327
|
-
const [texture, setTexture] = (0,
|
|
11328
|
-
const onErrorRef = (0,
|
|
11450
|
+
const [texture, setTexture] = (0, import_react40.useState)(null);
|
|
11451
|
+
const onErrorRef = (0, import_react40.useRef)(onError);
|
|
11329
11452
|
onErrorRef.current = onError;
|
|
11330
|
-
(0,
|
|
11453
|
+
(0, import_react40.useEffect)(() => {
|
|
11331
11454
|
if (!url) {
|
|
11332
11455
|
setTexture(null);
|
|
11333
11456
|
return;
|
|
@@ -11364,7 +11487,7 @@ function usePreviewTexture(url, anisotropy, onError) {
|
|
|
11364
11487
|
active = false;
|
|
11365
11488
|
};
|
|
11366
11489
|
}, [anisotropy, url]);
|
|
11367
|
-
(0,
|
|
11490
|
+
(0, import_react40.useEffect)(
|
|
11368
11491
|
() => () => {
|
|
11369
11492
|
texture?.dispose();
|
|
11370
11493
|
},
|
|
@@ -11377,7 +11500,7 @@ function PreviewFace({
|
|
|
11377
11500
|
texture,
|
|
11378
11501
|
faceOrder
|
|
11379
11502
|
}) {
|
|
11380
|
-
const geometry = (0,
|
|
11503
|
+
const geometry = (0, import_react40.useMemo)(() => {
|
|
11381
11504
|
const nextGeometry = new import_three18.PlaneGeometry(
|
|
11382
11505
|
PREVIEW_RADIUS * 2,
|
|
11383
11506
|
PREVIEW_RADIUS * 2
|
|
@@ -11395,7 +11518,7 @@ function PreviewFace({
|
|
|
11395
11518
|
uv.needsUpdate = true;
|
|
11396
11519
|
return nextGeometry;
|
|
11397
11520
|
}, [face, faceOrder]);
|
|
11398
|
-
(0,
|
|
11521
|
+
(0, import_react40.useEffect)(
|
|
11399
11522
|
() => () => {
|
|
11400
11523
|
geometry.dispose();
|
|
11401
11524
|
},
|
|
@@ -11436,14 +11559,14 @@ function PreviewCube({
|
|
|
11436
11559
|
));
|
|
11437
11560
|
}
|
|
11438
11561
|
function useManagedTexture(manager, key, url, address) {
|
|
11439
|
-
const [managedState, setManagedState] = (0,
|
|
11562
|
+
const [managedState, setManagedState] = (0, import_react40.useState)(() => ({
|
|
11440
11563
|
manager,
|
|
11441
11564
|
key,
|
|
11442
11565
|
url,
|
|
11443
11566
|
snapshot: manager.getSnapshot(key)
|
|
11444
11567
|
}));
|
|
11445
11568
|
const snapshot = managedState.manager === manager && managedState.key === key && managedState.url === url ? managedState.snapshot : manager.getSnapshot(key);
|
|
11446
|
-
(0,
|
|
11569
|
+
(0, import_react40.useEffect)(
|
|
11447
11570
|
() => manager.acquire(key, url, address, (nextSnapshot) => {
|
|
11448
11571
|
setManagedState({
|
|
11449
11572
|
manager,
|
|
@@ -11456,7 +11579,7 @@ function useManagedTexture(manager, key, url, address) {
|
|
|
11456
11579
|
);
|
|
11457
11580
|
return snapshot;
|
|
11458
11581
|
}
|
|
11459
|
-
var TileMesh = (0,
|
|
11582
|
+
var TileMesh = (0, import_react40.memo)(function TileMesh2({
|
|
11460
11583
|
address,
|
|
11461
11584
|
manager,
|
|
11462
11585
|
renderOrder,
|
|
@@ -11489,7 +11612,7 @@ var TileMesh = (0, import_react39.memo)(function TileMesh2({
|
|
|
11489
11612
|
}
|
|
11490
11613
|
) });
|
|
11491
11614
|
});
|
|
11492
|
-
var TileLayerMeshes = (0,
|
|
11615
|
+
var TileLayerMeshes = (0, import_react40.memo)(function TileLayerMeshes2({
|
|
11493
11616
|
layer,
|
|
11494
11617
|
manager,
|
|
11495
11618
|
resolveUrl
|
|
@@ -11663,10 +11786,10 @@ function Tile({
|
|
|
11663
11786
|
onLevelChange
|
|
11664
11787
|
}) {
|
|
11665
11788
|
const { camera, gl, size } = (0, import_fiber20.useThree)();
|
|
11666
|
-
const multiresConfig = (0,
|
|
11789
|
+
const multiresConfig = (0, import_react40.useMemo)(() => parseMultires(multires), [multires]);
|
|
11667
11790
|
const { levels, tileSize } = multiresConfig;
|
|
11668
11791
|
const multiresToken = `${tileSize}:${levels.join(",")}`;
|
|
11669
|
-
const candidatesByLevel = (0,
|
|
11792
|
+
const candidatesByLevel = (0, import_react40.useMemo)(
|
|
11670
11793
|
() => buildTileCandidates(levels, tileSize),
|
|
11671
11794
|
[levels, tileSize]
|
|
11672
11795
|
);
|
|
@@ -11678,13 +11801,13 @@ function Tile({
|
|
|
11678
11801
|
onPreviewError
|
|
11679
11802
|
);
|
|
11680
11803
|
const sharedManager = useSharedTileTextureManager();
|
|
11681
|
-
const progressRef = (0,
|
|
11682
|
-
const errorRef = (0,
|
|
11683
|
-
const levelChangeRef = (0,
|
|
11804
|
+
const progressRef = (0, import_react40.useRef)(onLoadProgress);
|
|
11805
|
+
const errorRef = (0, import_react40.useRef)(onTileError);
|
|
11806
|
+
const levelChangeRef = (0, import_react40.useRef)(onLevelChange);
|
|
11684
11807
|
progressRef.current = onLoadProgress;
|
|
11685
11808
|
errorRef.current = onTileError;
|
|
11686
11809
|
levelChangeRef.current = onLevelChange;
|
|
11687
|
-
const ownedManager = (0,
|
|
11810
|
+
const ownedManager = (0, import_react40.useMemo)(
|
|
11688
11811
|
() => new TileTextureManager({
|
|
11689
11812
|
anisotropy,
|
|
11690
11813
|
maxBytes: Math.max(1, maxTextureMemoryMb) * 1024 * 1024,
|
|
@@ -11705,7 +11828,7 @@ function Tile({
|
|
|
11705
11828
|
]
|
|
11706
11829
|
);
|
|
11707
11830
|
const manager = sharedManager ?? ownedManager;
|
|
11708
|
-
(0,
|
|
11831
|
+
(0, import_react40.useEffect)(() => {
|
|
11709
11832
|
manager.resume();
|
|
11710
11833
|
return () => {
|
|
11711
11834
|
if (manager === ownedManager) {
|
|
@@ -11715,11 +11838,11 @@ function Tile({
|
|
|
11715
11838
|
queueMicrotask(() => manager.releaseUnused());
|
|
11716
11839
|
};
|
|
11717
11840
|
}, [manager, ownedManager]);
|
|
11718
|
-
const readyRef = (0,
|
|
11719
|
-
(0,
|
|
11841
|
+
const readyRef = (0, import_react40.useRef)(false);
|
|
11842
|
+
(0, import_react40.useEffect)(() => {
|
|
11720
11843
|
readyRef.current = false;
|
|
11721
11844
|
}, [effectivePreviewUrl]);
|
|
11722
|
-
(0,
|
|
11845
|
+
(0, import_react40.useEffect)(() => {
|
|
11723
11846
|
if (!previewTexture || readyRef.current) {
|
|
11724
11847
|
return;
|
|
11725
11848
|
}
|
|
@@ -11727,31 +11850,31 @@ function Tile({
|
|
|
11727
11850
|
onReady?.();
|
|
11728
11851
|
}, [onReady, previewTexture]);
|
|
11729
11852
|
const template = urlTemplate ?? buildDefaultTileUrlTemplate();
|
|
11730
|
-
const resolveUrl = (0,
|
|
11853
|
+
const resolveUrl = (0, import_react40.useMemo)(
|
|
11731
11854
|
() => (address) => {
|
|
11732
11855
|
const relativePath = resolveTileUrl ? resolveTileUrl(address) : resolveTemplateUrl(template, address);
|
|
11733
11856
|
return resolveRelativeTileUrl(baseUrl, relativePath);
|
|
11734
11857
|
},
|
|
11735
11858
|
[baseUrl, resolveTileUrl, template]
|
|
11736
11859
|
);
|
|
11737
|
-
const [layers, setLayers] = (0,
|
|
11738
|
-
const layerTokenRef = (0,
|
|
11739
|
-
const currentLevelRef = (0,
|
|
11740
|
-
const lastUpdateAtRef = (0,
|
|
11741
|
-
const visibilityDirtyRef = (0,
|
|
11742
|
-
const lastVisibilityQuaternionRef = (0,
|
|
11743
|
-
const lastVisibilityFovRef = (0,
|
|
11744
|
-
const lastViewportRef = (0,
|
|
11745
|
-
const frustumRef = (0,
|
|
11746
|
-
const projectionMatrixRef = (0,
|
|
11747
|
-
const visibilityCameraRef = (0,
|
|
11748
|
-
(0,
|
|
11860
|
+
const [layers, setLayers] = (0, import_react40.useState)([]);
|
|
11861
|
+
const layerTokenRef = (0, import_react40.useRef)("");
|
|
11862
|
+
const currentLevelRef = (0, import_react40.useRef)(1);
|
|
11863
|
+
const lastUpdateAtRef = (0, import_react40.useRef)(-Infinity);
|
|
11864
|
+
const visibilityDirtyRef = (0, import_react40.useRef)(true);
|
|
11865
|
+
const lastVisibilityQuaternionRef = (0, import_react40.useRef)(camera.quaternion.clone());
|
|
11866
|
+
const lastVisibilityFovRef = (0, import_react40.useRef)(Number.NaN);
|
|
11867
|
+
const lastViewportRef = (0, import_react40.useRef)({ width: 0, height: 0, dpr: 0 });
|
|
11868
|
+
const frustumRef = (0, import_react40.useRef)(new import_three18.Frustum());
|
|
11869
|
+
const projectionMatrixRef = (0, import_react40.useRef)(new import_three18.Matrix4());
|
|
11870
|
+
const visibilityCameraRef = (0, import_react40.useRef)(new import_three18.PerspectiveCamera());
|
|
11871
|
+
(0, import_react40.useEffect)(() => {
|
|
11749
11872
|
currentLevelRef.current = 1;
|
|
11750
11873
|
layerTokenRef.current = "";
|
|
11751
11874
|
visibilityDirtyRef.current = true;
|
|
11752
11875
|
setLayers([]);
|
|
11753
11876
|
}, [manager, multiresToken]);
|
|
11754
|
-
(0,
|
|
11877
|
+
(0, import_react40.useEffect)(() => {
|
|
11755
11878
|
if (loadMode !== "preview") {
|
|
11756
11879
|
return;
|
|
11757
11880
|
}
|
|
@@ -11902,9 +12025,9 @@ function SnapshotCapture({
|
|
|
11902
12025
|
onCaptured
|
|
11903
12026
|
}) {
|
|
11904
12027
|
const { camera, gl, scene, size } = (0, import_fiber21.useThree)();
|
|
11905
|
-
const capturedRequestRef = (0,
|
|
11906
|
-
const renderTargetRef = (0,
|
|
11907
|
-
(0,
|
|
12028
|
+
const capturedRequestRef = (0, import_react41.useRef)(0);
|
|
12029
|
+
const renderTargetRef = (0, import_react41.useRef)(null);
|
|
12030
|
+
(0, import_react41.useEffect)(
|
|
11908
12031
|
() => () => {
|
|
11909
12032
|
renderTargetRef.current?.dispose();
|
|
11910
12033
|
renderTargetRef.current = null;
|
|
@@ -11960,50 +12083,50 @@ function ScenesController({
|
|
|
11960
12083
|
snapshotMaxPixels = 3686400,
|
|
11961
12084
|
phaseRef: externalPhaseRef
|
|
11962
12085
|
}) {
|
|
11963
|
-
const controlsRef = (0,
|
|
12086
|
+
const controlsRef = (0, import_react41.useContext)(PanoramaViewContext);
|
|
11964
12087
|
const manager = useSharedTileTextureManager();
|
|
11965
|
-
const transition = (0,
|
|
12088
|
+
const transition = (0, import_react41.useMemo)(
|
|
11966
12089
|
() => resolveTransition(transitionInput),
|
|
11967
12090
|
[transitionInput]
|
|
11968
12091
|
);
|
|
11969
|
-
const sceneMap = (0,
|
|
12092
|
+
const sceneMap = (0, import_react41.useMemo)(
|
|
11970
12093
|
() => new Map(scenes.map((scene) => [scene.id, scene])),
|
|
11971
12094
|
[scenes]
|
|
11972
12095
|
);
|
|
11973
12096
|
const initialScene = sceneMap.get(activeSceneId) ?? null;
|
|
11974
|
-
const [slots, setSlots] = (0,
|
|
12097
|
+
const [slots, setSlots] = (0, import_react41.useState)([
|
|
11975
12098
|
initialScene,
|
|
11976
12099
|
null
|
|
11977
12100
|
]);
|
|
11978
|
-
const [activeSlot, setActiveSlot] = (0,
|
|
11979
|
-
const [liveSlot, setLiveSlot] = (0,
|
|
11980
|
-
const [pendingSlot, setPendingSlot] = (0,
|
|
11981
|
-
const [phase, setPhase] = (0,
|
|
11982
|
-
const [captureRequestId, setCaptureRequestId] = (0,
|
|
11983
|
-
const [transitionRunId, setTransitionRunId] = (0,
|
|
11984
|
-
const [snapshot, setSnapshot] = (0,
|
|
11985
|
-
const [recoveryKey, setRecoveryKey] = (0,
|
|
11986
|
-
const requestedSceneIdRef = (0,
|
|
11987
|
-
const captureReasonRef = (0,
|
|
11988
|
-
const interactionReleaseRef = (0,
|
|
11989
|
-
const slotsRef = (0,
|
|
11990
|
-
const phaseRef = (0,
|
|
11991
|
-
const liveSlotRef = (0,
|
|
11992
|
-
const transitionFromRef = (0,
|
|
12101
|
+
const [activeSlot, setActiveSlot] = (0, import_react41.useState)(0);
|
|
12102
|
+
const [liveSlot, setLiveSlot] = (0, import_react41.useState)(0);
|
|
12103
|
+
const [pendingSlot, setPendingSlot] = (0, import_react41.useState)(null);
|
|
12104
|
+
const [phase, setPhase] = (0, import_react41.useState)(initialScene ? "idle" : "preloading");
|
|
12105
|
+
const [captureRequestId, setCaptureRequestId] = (0, import_react41.useState)(0);
|
|
12106
|
+
const [transitionRunId, setTransitionRunId] = (0, import_react41.useState)(0);
|
|
12107
|
+
const [snapshot, setSnapshot] = (0, import_react41.useState)(null);
|
|
12108
|
+
const [recoveryKey, setRecoveryKey] = (0, import_react41.useState)(0);
|
|
12109
|
+
const requestedSceneIdRef = (0, import_react41.useRef)(activeSceneId);
|
|
12110
|
+
const captureReasonRef = (0, import_react41.useRef)("start");
|
|
12111
|
+
const interactionReleaseRef = (0, import_react41.useRef)(null);
|
|
12112
|
+
const slotsRef = (0, import_react41.useRef)(slots);
|
|
12113
|
+
const phaseRef = (0, import_react41.useRef)(phase);
|
|
12114
|
+
const liveSlotRef = (0, import_react41.useRef)(liveSlot);
|
|
12115
|
+
const transitionFromRef = (0, import_react41.useRef)(initialScene);
|
|
11993
12116
|
slotsRef.current = slots;
|
|
11994
12117
|
phaseRef.current = phase;
|
|
11995
12118
|
if (externalPhaseRef) {
|
|
11996
12119
|
externalPhaseRef.current = phase;
|
|
11997
12120
|
}
|
|
11998
12121
|
liveSlotRef.current = liveSlot;
|
|
11999
|
-
const releaseInteraction = (0,
|
|
12122
|
+
const releaseInteraction = (0, import_react41.useCallback)(() => {
|
|
12000
12123
|
interactionReleaseRef.current?.();
|
|
12001
12124
|
interactionReleaseRef.current = null;
|
|
12002
12125
|
}, []);
|
|
12003
|
-
const reportError = (0,
|
|
12126
|
+
const reportError = (0, import_react41.useCallback)((sceneId, error) => {
|
|
12004
12127
|
onTransitionError?.({ sceneId, error });
|
|
12005
12128
|
}, [onTransitionError]);
|
|
12006
|
-
const startPreload = (0,
|
|
12129
|
+
const startPreload = (0, import_react41.useCallback)((scene) => {
|
|
12007
12130
|
const nextSlot = 1 - liveSlotRef.current;
|
|
12008
12131
|
requestedSceneIdRef.current = scene.id;
|
|
12009
12132
|
setSlots((current) => {
|
|
@@ -12014,7 +12137,7 @@ function ScenesController({
|
|
|
12014
12137
|
setPendingSlot(nextSlot);
|
|
12015
12138
|
setPhase("preloading");
|
|
12016
12139
|
}, []);
|
|
12017
|
-
(0,
|
|
12140
|
+
(0, import_react41.useEffect)(() => {
|
|
12018
12141
|
const requested = sceneMap.get(activeSceneId);
|
|
12019
12142
|
if (!requested) {
|
|
12020
12143
|
reportError(activeSceneId, new Error(`Unknown panorama scene: ${activeSceneId}`));
|
|
@@ -12038,7 +12161,7 @@ function ScenesController({
|
|
|
12038
12161
|
}
|
|
12039
12162
|
startPreload(requested);
|
|
12040
12163
|
}, [activeSceneId, pendingSlot, reportError, sceneMap, startPreload]);
|
|
12041
|
-
const handleReady = (0,
|
|
12164
|
+
const handleReady = (0, import_react41.useCallback)((slot) => {
|
|
12042
12165
|
if (slot !== pendingSlot || phaseRef.current !== "preloading") {
|
|
12043
12166
|
return;
|
|
12044
12167
|
}
|
|
@@ -12069,7 +12192,7 @@ function ScenesController({
|
|
|
12069
12192
|
setPhase("capturing");
|
|
12070
12193
|
setCaptureRequestId((current) => current + 1);
|
|
12071
12194
|
}, [controlsRef, onTransitionEnd, pendingSlot, transition.preset]);
|
|
12072
|
-
const handleCaptured = (0,
|
|
12195
|
+
const handleCaptured = (0, import_react41.useCallback)((nextSnapshot) => {
|
|
12073
12196
|
setSnapshot((current) => {
|
|
12074
12197
|
current?.dispose();
|
|
12075
12198
|
return nextSnapshot;
|
|
@@ -12091,7 +12214,7 @@ function ScenesController({
|
|
|
12091
12214
|
setPhase("transitioning");
|
|
12092
12215
|
setTransitionRunId((current) => current + 1);
|
|
12093
12216
|
}, [manager, pendingSlot, sceneMap, startPreload]);
|
|
12094
|
-
const finishTransition = (0,
|
|
12217
|
+
const finishTransition = (0, import_react41.useCallback)(() => {
|
|
12095
12218
|
const nextSlot = pendingSlot;
|
|
12096
12219
|
const previousScene = transitionFromRef.current;
|
|
12097
12220
|
const nextScene = nextSlot === null ? null : slotsRef.current[nextSlot];
|
|
@@ -12116,12 +12239,12 @@ function ScenesController({
|
|
|
12116
12239
|
});
|
|
12117
12240
|
}
|
|
12118
12241
|
}, [onTransitionEnd, pendingSlot, releaseInteraction, snapshot, transition.preset]);
|
|
12119
|
-
(0,
|
|
12242
|
+
(0, import_react41.useEffect)(() => () => {
|
|
12120
12243
|
releaseInteraction();
|
|
12121
12244
|
snapshot?.dispose();
|
|
12122
12245
|
}, [releaseInteraction, snapshot]);
|
|
12123
12246
|
const { gl } = (0, import_fiber21.useThree)();
|
|
12124
|
-
(0,
|
|
12247
|
+
(0, import_react41.useEffect)(() => {
|
|
12125
12248
|
const canvas = gl.domElement;
|
|
12126
12249
|
const onContextLost = (event) => {
|
|
12127
12250
|
event.preventDefault();
|
|
@@ -12145,7 +12268,7 @@ function ScenesController({
|
|
|
12145
12268
|
}, [gl, manager, releaseInteraction, snapshot]);
|
|
12146
12269
|
const renderedScene = slots[liveSlot];
|
|
12147
12270
|
const snapshotVisible = snapshot !== null && (phase === "transitioning" || phase === "recapturing" || phase === "preloading");
|
|
12148
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
12271
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_react41.Fragment, { children: [
|
|
12149
12272
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
12150
12273
|
SnapshotCapture,
|
|
12151
12274
|
{
|
|
@@ -12197,11 +12320,11 @@ function Scenes({
|
|
|
12197
12320
|
...rest
|
|
12198
12321
|
}) {
|
|
12199
12322
|
const isControlled = controlledId !== void 0;
|
|
12200
|
-
const [internalId, setInternalId] = (0,
|
|
12323
|
+
const [internalId, setInternalId] = (0, import_react41.useState)(
|
|
12201
12324
|
() => controlledId ?? defaultActiveSceneId ?? scenes[0]?.id ?? ""
|
|
12202
12325
|
);
|
|
12203
12326
|
const resolvedId = isControlled ? controlledId : internalId;
|
|
12204
|
-
const requestSceneChange = (0,
|
|
12327
|
+
const requestSceneChange = (0, import_react41.useCallback)(
|
|
12205
12328
|
(id) => {
|
|
12206
12329
|
if (isControlled) {
|
|
12207
12330
|
onActiveSceneIdChange?.(id);
|
|
@@ -12211,13 +12334,13 @@ function Scenes({
|
|
|
12211
12334
|
},
|
|
12212
12335
|
[isControlled, onActiveSceneIdChange]
|
|
12213
12336
|
);
|
|
12214
|
-
const scenesRef = (0,
|
|
12337
|
+
const scenesRef = (0, import_react41.useRef)(scenes);
|
|
12215
12338
|
scenesRef.current = scenes;
|
|
12216
|
-
const resolvedIdRef = (0,
|
|
12339
|
+
const resolvedIdRef = (0, import_react41.useRef)(resolvedId);
|
|
12217
12340
|
resolvedIdRef.current = resolvedId;
|
|
12218
|
-
const host = (0,
|
|
12219
|
-
const phaseRef = (0,
|
|
12220
|
-
(0,
|
|
12341
|
+
const host = (0, import_react41.useContext)(ScenesHostContext);
|
|
12342
|
+
const phaseRef = (0, import_react41.useRef)("idle");
|
|
12343
|
+
(0, import_react41.useEffect)(() => {
|
|
12221
12344
|
if (!host) {
|
|
12222
12345
|
return;
|
|
12223
12346
|
}
|
|
@@ -12287,25 +12410,25 @@ function Scenes({
|
|
|
12287
12410
|
|
|
12288
12411
|
// src/hotspot/image-hotspot.tsx
|
|
12289
12412
|
var import_fiber23 = require("@react-three/fiber");
|
|
12290
|
-
var
|
|
12413
|
+
var import_react45 = require("react");
|
|
12291
12414
|
var import_three22 = require("three");
|
|
12292
12415
|
|
|
12293
12416
|
// src/hotspot/hotspot-anchor.tsx
|
|
12294
12417
|
var import_fiber22 = require("@react-three/fiber");
|
|
12295
|
-
var
|
|
12418
|
+
var import_react44 = require("react");
|
|
12296
12419
|
var import_three20 = require("three");
|
|
12297
12420
|
|
|
12298
12421
|
// src/hotspot/hotspot-tooltip.tsx
|
|
12299
|
-
var
|
|
12422
|
+
var import_react43 = require("react");
|
|
12300
12423
|
|
|
12301
12424
|
// src/webvr/stereo-html.tsx
|
|
12302
12425
|
var import_drei = require("@react-three/drei");
|
|
12303
|
-
var
|
|
12426
|
+
var import_react42 = require("react");
|
|
12304
12427
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
12305
12428
|
function useFallbackStereoView() {
|
|
12306
|
-
const runtime = (0,
|
|
12429
|
+
const runtime = (0, import_react42.useContext)(WebVRRuntimeContext);
|
|
12307
12430
|
const host = runtime?.host ?? null;
|
|
12308
|
-
const fallback = (0,
|
|
12431
|
+
const fallback = (0, import_react42.useSyncExternalStore)(
|
|
12309
12432
|
(onStoreChange) => host ? subscribeWebVRHost(host, onStoreChange) : () => void 0,
|
|
12310
12433
|
() => isFallbackStereoMode(host?.snapshot.mode ?? null),
|
|
12311
12434
|
() => false
|
|
@@ -12419,16 +12542,16 @@ function HotspotTooltip({
|
|
|
12419
12542
|
offset = DEFAULT_HOTSPOT_TOOLTIP_OFFSET,
|
|
12420
12543
|
appearance
|
|
12421
12544
|
}) {
|
|
12422
|
-
const [imageFailed, setImageFailed] = (0,
|
|
12423
|
-
(0,
|
|
12545
|
+
const [imageFailed, setImageFailed] = (0, import_react43.useState)(false);
|
|
12546
|
+
(0, import_react43.useEffect)(() => {
|
|
12424
12547
|
setImageFailed(false);
|
|
12425
12548
|
}, [content.image]);
|
|
12426
12549
|
const showImage = Boolean(content.image) && !imageFailed;
|
|
12427
|
-
const resolvedAppearance = (0,
|
|
12550
|
+
const resolvedAppearance = (0, import_react43.useMemo)(
|
|
12428
12551
|
() => resolveHotspotTooltipAppearance(appearance),
|
|
12429
12552
|
[appearance]
|
|
12430
12553
|
);
|
|
12431
|
-
const bubbleStyle = (0,
|
|
12554
|
+
const bubbleStyle = (0, import_react43.useMemo)(
|
|
12432
12555
|
() => ({
|
|
12433
12556
|
background: resolvedAppearance.background,
|
|
12434
12557
|
border: resolvedAppearance.border,
|
|
@@ -12807,18 +12930,18 @@ function HotspotAnchor({
|
|
|
12807
12930
|
onPositionChange,
|
|
12808
12931
|
onDragEnd
|
|
12809
12932
|
}) {
|
|
12810
|
-
const controlsRef = (0,
|
|
12811
|
-
const eventBus = (0,
|
|
12933
|
+
const controlsRef = (0, import_react44.useContext)(PanoramaViewContext);
|
|
12934
|
+
const eventBus = (0, import_react44.useContext)(PanoEventBusContext);
|
|
12812
12935
|
const cursorApi = usePanoCursor();
|
|
12813
12936
|
const { camera, size } = (0, import_fiber22.useThree)();
|
|
12814
|
-
const groupRef = (0,
|
|
12815
|
-
const tooltipAnchorRef = (0,
|
|
12816
|
-
const dragStateRef = (0,
|
|
12817
|
-
const suppressNextClickRef = (0,
|
|
12818
|
-
const [hovered, setHovered] = (0,
|
|
12819
|
-
const [dragging, setDragging] = (0,
|
|
12820
|
-
const [pinned, setPinned] = (0,
|
|
12821
|
-
const tooltipContent = (0,
|
|
12937
|
+
const groupRef = (0, import_react44.useRef)(null);
|
|
12938
|
+
const tooltipAnchorRef = (0, import_react44.useRef)(null);
|
|
12939
|
+
const dragStateRef = (0, import_react44.useRef)(null);
|
|
12940
|
+
const suppressNextClickRef = (0, import_react44.useRef)(false);
|
|
12941
|
+
const [hovered, setHovered] = (0, import_react44.useState)(false);
|
|
12942
|
+
const [dragging, setDragging] = (0, import_react44.useState)(false);
|
|
12943
|
+
const [pinned, setPinned] = (0, import_react44.useState)(false);
|
|
12944
|
+
const tooltipContent = (0, import_react44.useMemo)(
|
|
12822
12945
|
() => resolveHotspotTooltipContent(tooltip),
|
|
12823
12946
|
[tooltip]
|
|
12824
12947
|
);
|
|
@@ -12834,17 +12957,17 @@ function HotspotAnchor({
|
|
|
12834
12957
|
scaledWidth,
|
|
12835
12958
|
scaledHeight
|
|
12836
12959
|
);
|
|
12837
|
-
const worldPosition = (0,
|
|
12960
|
+
const worldPosition = (0, import_react44.useMemo)(
|
|
12838
12961
|
() => panoPositionToVector3(normalizedPosition, resolvedDistance),
|
|
12839
12962
|
[normalizedPosition.pitch, normalizedPosition.yaw, resolvedDistance]
|
|
12840
12963
|
);
|
|
12841
|
-
const surfaceQuaternion3 = (0,
|
|
12964
|
+
const surfaceQuaternion3 = (0, import_react44.useMemo)(
|
|
12842
12965
|
() => createSurfaceQuaternion(normalizedPosition),
|
|
12843
12966
|
[normalizedPosition.pitch, normalizedPosition.yaw]
|
|
12844
12967
|
);
|
|
12845
12968
|
const worldWidth = angularSizeToWorldSize(scaledWidth, resolvedDistance);
|
|
12846
12969
|
const worldHeight = angularSizeToWorldSize(scaledHeight, resolvedDistance);
|
|
12847
|
-
const focusGeometry = (0,
|
|
12970
|
+
const focusGeometry = (0, import_react44.useMemo)(() => {
|
|
12848
12971
|
const planeGeometry = new import_three20.PlaneGeometry(1, 1);
|
|
12849
12972
|
const geometry = new import_three20.EdgesGeometry(planeGeometry);
|
|
12850
12973
|
planeGeometry.dispose();
|
|
@@ -12871,14 +12994,14 @@ function HotspotAnchor({
|
|
|
12871
12994
|
});
|
|
12872
12995
|
const tooltipOpen = visible && tooltipContent !== null && isTooltipOpen(tooltipTrigger, hovered, focused, pinned);
|
|
12873
12996
|
const cursorClaimId = hotspotCursorClaimId(id);
|
|
12874
|
-
(0,
|
|
12997
|
+
(0, import_react44.useEffect)(
|
|
12875
12998
|
() => () => {
|
|
12876
12999
|
dragStateRef.current?.releaseInteractionLock();
|
|
12877
13000
|
dragStateRef.current = null;
|
|
12878
13001
|
},
|
|
12879
13002
|
[]
|
|
12880
13003
|
);
|
|
12881
|
-
(0,
|
|
13004
|
+
(0, import_react44.useEffect)(() => {
|
|
12882
13005
|
if (!cursorApi) {
|
|
12883
13006
|
return;
|
|
12884
13007
|
}
|
|
@@ -12900,14 +13023,14 @@ function HotspotAnchor({
|
|
|
12900
13023
|
hovered,
|
|
12901
13024
|
visible
|
|
12902
13025
|
]);
|
|
12903
|
-
(0,
|
|
13026
|
+
(0, import_react44.useEffect)(
|
|
12904
13027
|
() => () => {
|
|
12905
13028
|
cursorApi?.release(cursorClaimId);
|
|
12906
13029
|
},
|
|
12907
13030
|
[cursorApi, cursorClaimId]
|
|
12908
13031
|
);
|
|
12909
|
-
(0,
|
|
12910
|
-
(0,
|
|
13032
|
+
(0, import_react44.useEffect)(() => () => focusGeometry.dispose(), [focusGeometry]);
|
|
13033
|
+
(0, import_react44.useEffect)(() => {
|
|
12911
13034
|
if (tooltipTrigger !== "click") {
|
|
12912
13035
|
setPinned(false);
|
|
12913
13036
|
return;
|
|
@@ -12916,12 +13039,12 @@ function HotspotAnchor({
|
|
|
12916
13039
|
setPinned(false);
|
|
12917
13040
|
});
|
|
12918
13041
|
}, [eventBus, tooltipTrigger]);
|
|
12919
|
-
(0,
|
|
13042
|
+
(0, import_react44.useEffect)(() => {
|
|
12920
13043
|
if (tooltipTrigger !== "hover") {
|
|
12921
13044
|
setHovered(false);
|
|
12922
13045
|
}
|
|
12923
13046
|
}, [tooltipTrigger]);
|
|
12924
|
-
(0,
|
|
13047
|
+
(0, import_react44.useEffect)(() => {
|
|
12925
13048
|
if (acceptsPointer) {
|
|
12926
13049
|
return;
|
|
12927
13050
|
}
|
|
@@ -12934,7 +13057,7 @@ function HotspotAnchor({
|
|
|
12934
13057
|
dragStateRef.current = null;
|
|
12935
13058
|
setDragging(false);
|
|
12936
13059
|
}, [acceptsPointer]);
|
|
12937
|
-
(0,
|
|
13060
|
+
(0, import_react44.useLayoutEffect)(() => {
|
|
12938
13061
|
const group = groupRef.current;
|
|
12939
13062
|
if (!group) {
|
|
12940
13063
|
return;
|
|
@@ -13260,12 +13383,12 @@ function HotspotPlane({
|
|
|
13260
13383
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
13261
13384
|
function useHotspotImageTexture(src, onLoad, onError) {
|
|
13262
13385
|
const gl = (0, import_fiber23.useThree)((state) => state.gl);
|
|
13263
|
-
const [texture, setTexture] = (0,
|
|
13264
|
-
const onLoadRef = (0,
|
|
13265
|
-
const onErrorRef = (0,
|
|
13386
|
+
const [texture, setTexture] = (0, import_react45.useState)(null);
|
|
13387
|
+
const onLoadRef = (0, import_react45.useRef)(onLoad);
|
|
13388
|
+
const onErrorRef = (0, import_react45.useRef)(onError);
|
|
13266
13389
|
onLoadRef.current = onLoad;
|
|
13267
13390
|
onErrorRef.current = onError;
|
|
13268
|
-
(0,
|
|
13391
|
+
(0, import_react45.useEffect)(() => {
|
|
13269
13392
|
let active = true;
|
|
13270
13393
|
setTexture(null);
|
|
13271
13394
|
if (!src) {
|
|
@@ -13303,7 +13426,7 @@ function useHotspotImageTexture(src, onLoad, onError) {
|
|
|
13303
13426
|
active = false;
|
|
13304
13427
|
};
|
|
13305
13428
|
}, [gl, src]);
|
|
13306
|
-
(0,
|
|
13429
|
+
(0, import_react45.useEffect)(
|
|
13307
13430
|
() => () => {
|
|
13308
13431
|
texture?.dispose();
|
|
13309
13432
|
},
|
|
@@ -13325,13 +13448,13 @@ function ImageHotspot({
|
|
|
13325
13448
|
}
|
|
13326
13449
|
|
|
13327
13450
|
// src/hotspot/polygon-hotspot.tsx
|
|
13328
|
-
var
|
|
13451
|
+
var import_react47 = require("react");
|
|
13329
13452
|
var import_three24 = require("three");
|
|
13330
13453
|
|
|
13331
13454
|
// src/hotspot/hotspot-stroke-line.tsx
|
|
13332
13455
|
var import_drei2 = require("@react-three/drei");
|
|
13333
13456
|
var import_fiber24 = require("@react-three/fiber");
|
|
13334
|
-
var
|
|
13457
|
+
var import_react46 = require("react");
|
|
13335
13458
|
var import_three23 = require("three");
|
|
13336
13459
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
13337
13460
|
var LINE_WORLD_POSITION = new import_three23.Vector3();
|
|
@@ -13364,10 +13487,10 @@ function HotspotStrokeLine({
|
|
|
13364
13487
|
dashSize,
|
|
13365
13488
|
gapSize
|
|
13366
13489
|
}) {
|
|
13367
|
-
const lineRef = (0,
|
|
13490
|
+
const lineRef = (0, import_react46.useRef)(null);
|
|
13368
13491
|
const { camera, size } = (0, import_fiber24.useThree)();
|
|
13369
13492
|
const dash = resolveDash(dashSize, gapSize);
|
|
13370
|
-
(0,
|
|
13493
|
+
(0, import_react46.useLayoutEffect)(() => {
|
|
13371
13494
|
if (!dash.dashed) {
|
|
13372
13495
|
return;
|
|
13373
13496
|
}
|
|
@@ -13657,24 +13780,24 @@ function PolygonHotspot({
|
|
|
13657
13780
|
onInvalid,
|
|
13658
13781
|
...anchorProps
|
|
13659
13782
|
}) {
|
|
13660
|
-
const issues = (0,
|
|
13783
|
+
const issues = (0, import_react47.useMemo)(() => validatePolygonVertices(vertices), [vertices]);
|
|
13661
13784
|
const valid = issues.length === 0;
|
|
13662
|
-
const center = (0,
|
|
13663
|
-
const fillGeometry = (0,
|
|
13785
|
+
const center = (0, import_react47.useMemo)(() => valid ? polygonCenter(vertices) : null, [valid, vertices]);
|
|
13786
|
+
const fillGeometry = (0, import_react47.useMemo)(
|
|
13664
13787
|
() => valid && center ? makeFillGeometry(vertices, center) : null,
|
|
13665
13788
|
[center, valid, vertices]
|
|
13666
13789
|
);
|
|
13667
|
-
const strokePoints = (0,
|
|
13790
|
+
const strokePoints = (0, import_react47.useMemo)(
|
|
13668
13791
|
() => valid && center ? makeStrokePositions(vertices, center) : null,
|
|
13669
13792
|
[center, valid, vertices]
|
|
13670
13793
|
);
|
|
13671
13794
|
const resolvedStrokeOpacity = Math.max(0, Math.min(strokeOpacity, 1));
|
|
13672
|
-
const startVerticesRef = (0,
|
|
13795
|
+
const startVerticesRef = (0, import_react47.useRef)(null);
|
|
13673
13796
|
const issuesKey = issues.map((issue) => issue.code).join(",");
|
|
13674
|
-
(0,
|
|
13797
|
+
(0, import_react47.useEffect)(() => {
|
|
13675
13798
|
if (!valid) onInvalid?.(issues);
|
|
13676
13799
|
}, [issues, issuesKey, onInvalid, valid]);
|
|
13677
|
-
(0,
|
|
13800
|
+
(0, import_react47.useEffect)(() => () => fillGeometry?.dispose(), [fillGeometry]);
|
|
13678
13801
|
if (!valid || !center || !fillGeometry || !strokePoints || strokePoints.length < 2) {
|
|
13679
13802
|
return null;
|
|
13680
13803
|
}
|
|
@@ -13754,7 +13877,7 @@ function PolygonHotspot({
|
|
|
13754
13877
|
}
|
|
13755
13878
|
|
|
13756
13879
|
// src/hotspot/polyline-hotspot.tsx
|
|
13757
|
-
var
|
|
13880
|
+
var import_react48 = require("react");
|
|
13758
13881
|
var import_three25 = require("three");
|
|
13759
13882
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
13760
13883
|
var POLYLINE_RADIUS = 990;
|
|
@@ -13873,16 +13996,16 @@ function PolylineHotspot({
|
|
|
13873
13996
|
onInvalid,
|
|
13874
13997
|
...anchorProps
|
|
13875
13998
|
}) {
|
|
13876
|
-
const issues = (0,
|
|
13999
|
+
const issues = (0, import_react48.useMemo)(() => validatePolylineVertices(vertices), [vertices]);
|
|
13877
14000
|
const valid = issues.length === 0;
|
|
13878
|
-
const center = (0,
|
|
13879
|
-
const linePoints = (0,
|
|
14001
|
+
const center = (0, import_react48.useMemo)(() => valid ? polylineCenter(vertices) : null, [valid, vertices]);
|
|
14002
|
+
const linePoints = (0, import_react48.useMemo)(
|
|
13880
14003
|
() => valid && center ? makeLinePositions(vertices, center) : null,
|
|
13881
14004
|
[center, valid, vertices]
|
|
13882
14005
|
);
|
|
13883
14006
|
const opacity = Math.max(0, Math.min(strokeOpacity, 1));
|
|
13884
|
-
const startVerticesRef = (0,
|
|
13885
|
-
(0,
|
|
14007
|
+
const startVerticesRef = (0, import_react48.useRef)(null);
|
|
14008
|
+
(0, import_react48.useEffect)(() => {
|
|
13886
14009
|
if (!valid) onInvalid?.(issues);
|
|
13887
14010
|
}, [issues, onInvalid, valid]);
|
|
13888
14011
|
if (!valid || !center || !linePoints || linePoints.length < 2) return null;
|
|
@@ -13948,7 +14071,7 @@ function PolylineHotspot({
|
|
|
13948
14071
|
}
|
|
13949
14072
|
|
|
13950
14073
|
// src/hotspot/graphic-hotspot.tsx
|
|
13951
|
-
var
|
|
14074
|
+
var import_react49 = require("react");
|
|
13952
14075
|
var import_three26 = require("three");
|
|
13953
14076
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
13954
14077
|
var GRAPHIC_TEXTURE_SIZE = 512;
|
|
@@ -14139,12 +14262,12 @@ function createGraphicTexture(graphic, aspectWidth, aspectHeight) {
|
|
|
14139
14262
|
return texture;
|
|
14140
14263
|
}
|
|
14141
14264
|
function useGraphicTexture(graphic, aspectWidth, aspectHeight, onLoad, onError) {
|
|
14142
|
-
const [texture, setTexture] = (0,
|
|
14143
|
-
const onLoadRef = (0,
|
|
14144
|
-
const onErrorRef = (0,
|
|
14265
|
+
const [texture, setTexture] = (0, import_react49.useState)(null);
|
|
14266
|
+
const onLoadRef = (0, import_react49.useRef)(onLoad);
|
|
14267
|
+
const onErrorRef = (0, import_react49.useRef)(onError);
|
|
14145
14268
|
onLoadRef.current = onLoad;
|
|
14146
14269
|
onErrorRef.current = onError;
|
|
14147
|
-
(0,
|
|
14270
|
+
(0, import_react49.useEffect)(() => {
|
|
14148
14271
|
let nextTexture = null;
|
|
14149
14272
|
try {
|
|
14150
14273
|
nextTexture = createGraphicTexture(graphic, aspectWidth, aspectHeight);
|
|
@@ -14183,7 +14306,7 @@ function GraphicHotspot(props) {
|
|
|
14183
14306
|
|
|
14184
14307
|
// src/hotspot/sequence-hotspot.tsx
|
|
14185
14308
|
var import_fiber25 = require("@react-three/fiber");
|
|
14186
|
-
var
|
|
14309
|
+
var import_react50 = require("react");
|
|
14187
14310
|
var import_three27 = require("three");
|
|
14188
14311
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
14189
14312
|
var DEFAULT_SEQUENCE_FPS = 12;
|
|
@@ -14200,12 +14323,12 @@ function useSpriteTexture({
|
|
|
14200
14323
|
onLoadProgress
|
|
14201
14324
|
}) {
|
|
14202
14325
|
const gl = (0, import_fiber25.useThree)((state) => state.gl);
|
|
14203
|
-
const [texture, setTexture] = (0,
|
|
14204
|
-
const onErrorRef = (0,
|
|
14205
|
-
const onLoadProgressRef = (0,
|
|
14326
|
+
const [texture, setTexture] = (0, import_react50.useState)(null);
|
|
14327
|
+
const onErrorRef = (0, import_react50.useRef)(onError);
|
|
14328
|
+
const onLoadProgressRef = (0, import_react50.useRef)(onLoadProgress);
|
|
14206
14329
|
onErrorRef.current = onError;
|
|
14207
14330
|
onLoadProgressRef.current = onLoadProgress;
|
|
14208
|
-
(0,
|
|
14331
|
+
(0, import_react50.useEffect)(() => {
|
|
14209
14332
|
let active = true;
|
|
14210
14333
|
setTexture(null);
|
|
14211
14334
|
if (!src) {
|
|
@@ -14246,7 +14369,7 @@ function useSpriteTexture({
|
|
|
14246
14369
|
active = false;
|
|
14247
14370
|
};
|
|
14248
14371
|
}, [gl, id, src]);
|
|
14249
|
-
(0,
|
|
14372
|
+
(0, import_react50.useEffect)(
|
|
14250
14373
|
() => () => {
|
|
14251
14374
|
texture?.dispose();
|
|
14252
14375
|
},
|
|
@@ -14275,24 +14398,24 @@ function SequenceHotspot({
|
|
|
14275
14398
|
const texture = useSpriteTexture({ id, src, onError, onLoadProgress });
|
|
14276
14399
|
const frameCount = resolveFrameCount(requestedFrameCount);
|
|
14277
14400
|
const safeFps = resolveFps(fps);
|
|
14278
|
-
const [frameIndex, setFrameIndex] = (0,
|
|
14279
|
-
const elapsedRef = (0,
|
|
14280
|
-
const frameIndexRef = (0,
|
|
14281
|
-
const endedRef = (0,
|
|
14282
|
-
const lastPlaybackStateRef = (0,
|
|
14283
|
-
const onFrameChangeRef = (0,
|
|
14284
|
-
const onPlaybackStateChangeRef = (0,
|
|
14285
|
-
const onEndedRef = (0,
|
|
14401
|
+
const [frameIndex, setFrameIndex] = (0, import_react50.useState)(0);
|
|
14402
|
+
const elapsedRef = (0, import_react50.useRef)(0);
|
|
14403
|
+
const frameIndexRef = (0, import_react50.useRef)(0);
|
|
14404
|
+
const endedRef = (0, import_react50.useRef)(false);
|
|
14405
|
+
const lastPlaybackStateRef = (0, import_react50.useRef)(null);
|
|
14406
|
+
const onFrameChangeRef = (0, import_react50.useRef)(onFrameChange);
|
|
14407
|
+
const onPlaybackStateChangeRef = (0, import_react50.useRef)(onPlaybackStateChange);
|
|
14408
|
+
const onEndedRef = (0, import_react50.useRef)(onEnded);
|
|
14286
14409
|
onFrameChangeRef.current = onFrameChange;
|
|
14287
14410
|
onPlaybackStateChangeRef.current = onPlaybackStateChange;
|
|
14288
14411
|
onEndedRef.current = onEnded;
|
|
14289
|
-
(0,
|
|
14412
|
+
(0, import_react50.useEffect)(() => {
|
|
14290
14413
|
elapsedRef.current = 0;
|
|
14291
14414
|
frameIndexRef.current = 0;
|
|
14292
14415
|
endedRef.current = false;
|
|
14293
14416
|
setFrameIndex(0);
|
|
14294
14417
|
}, [frameCount, frameDirection, src]);
|
|
14295
|
-
(0,
|
|
14418
|
+
(0, import_react50.useEffect)(() => {
|
|
14296
14419
|
if (!texture) {
|
|
14297
14420
|
return;
|
|
14298
14421
|
}
|
|
@@ -14306,13 +14429,13 @@ function SequenceHotspot({
|
|
|
14306
14429
|
);
|
|
14307
14430
|
texture.needsUpdate = true;
|
|
14308
14431
|
}, [frameCount, frameDirection, frameIndex, texture]);
|
|
14309
|
-
(0,
|
|
14432
|
+
(0, import_react50.useEffect)(() => {
|
|
14310
14433
|
if (!texture) {
|
|
14311
14434
|
return;
|
|
14312
14435
|
}
|
|
14313
14436
|
onFrameChangeRef.current?.({ id, index: 0, src });
|
|
14314
14437
|
}, [id, src, texture]);
|
|
14315
|
-
(0,
|
|
14438
|
+
(0, import_react50.useEffect)(() => {
|
|
14316
14439
|
if (!texture) {
|
|
14317
14440
|
return;
|
|
14318
14441
|
}
|
|
@@ -14366,7 +14489,7 @@ function SequenceHotspot({
|
|
|
14366
14489
|
|
|
14367
14490
|
// src/hotspot/video-hotspot.tsx
|
|
14368
14491
|
var import_fiber26 = require("@react-three/fiber");
|
|
14369
|
-
var
|
|
14492
|
+
var import_react51 = require("react");
|
|
14370
14493
|
var import_three28 = require("three");
|
|
14371
14494
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
14372
14495
|
function clampVolume2(volume) {
|
|
@@ -14377,10 +14500,10 @@ function clampVolume2(volume) {
|
|
|
14377
14500
|
}
|
|
14378
14501
|
function usePosterTexture2(id, poster, onError) {
|
|
14379
14502
|
const gl = (0, import_fiber26.useThree)((state) => state.gl);
|
|
14380
|
-
const [texture, setTexture] = (0,
|
|
14381
|
-
const onErrorRef = (0,
|
|
14503
|
+
const [texture, setTexture] = (0, import_react51.useState)(null);
|
|
14504
|
+
const onErrorRef = (0, import_react51.useRef)(onError);
|
|
14382
14505
|
onErrorRef.current = onError;
|
|
14383
|
-
(0,
|
|
14506
|
+
(0, import_react51.useEffect)(() => {
|
|
14384
14507
|
let active = true;
|
|
14385
14508
|
setTexture(null);
|
|
14386
14509
|
if (!poster) {
|
|
@@ -14417,7 +14540,7 @@ function usePosterTexture2(id, poster, onError) {
|
|
|
14417
14540
|
active = false;
|
|
14418
14541
|
};
|
|
14419
14542
|
}, [gl, id, poster]);
|
|
14420
|
-
(0,
|
|
14543
|
+
(0, import_react51.useEffect)(
|
|
14421
14544
|
() => () => {
|
|
14422
14545
|
texture?.dispose();
|
|
14423
14546
|
},
|
|
@@ -14435,14 +14558,14 @@ function useVideoResource({
|
|
|
14435
14558
|
poster,
|
|
14436
14559
|
src
|
|
14437
14560
|
}) {
|
|
14438
|
-
const [resource, setResource] = (0,
|
|
14439
|
-
const onEndedRef = (0,
|
|
14440
|
-
const onErrorRef = (0,
|
|
14441
|
-
const onPlaybackStateChangeRef = (0,
|
|
14561
|
+
const [resource, setResource] = (0, import_react51.useState)(null);
|
|
14562
|
+
const onEndedRef = (0, import_react51.useRef)(onEnded);
|
|
14563
|
+
const onErrorRef = (0, import_react51.useRef)(onError);
|
|
14564
|
+
const onPlaybackStateChangeRef = (0, import_react51.useRef)(onPlaybackStateChange);
|
|
14442
14565
|
onEndedRef.current = onEnded;
|
|
14443
14566
|
onErrorRef.current = onError;
|
|
14444
14567
|
onPlaybackStateChangeRef.current = onPlaybackStateChange;
|
|
14445
|
-
(0,
|
|
14568
|
+
(0, import_react51.useEffect)(() => {
|
|
14446
14569
|
if (!src) {
|
|
14447
14570
|
setResource(null);
|
|
14448
14571
|
return;
|
|
@@ -14543,11 +14666,11 @@ function VideoHotspot({
|
|
|
14543
14666
|
src
|
|
14544
14667
|
});
|
|
14545
14668
|
const posterTexture = usePosterTexture2(id, poster, onError);
|
|
14546
|
-
const onPlaybackErrorRef = (0,
|
|
14547
|
-
const onPlaybackStateChangeRef = (0,
|
|
14669
|
+
const onPlaybackErrorRef = (0, import_react51.useRef)(onPlaybackError);
|
|
14670
|
+
const onPlaybackStateChangeRef = (0, import_react51.useRef)(onPlaybackStateChange);
|
|
14548
14671
|
onPlaybackErrorRef.current = onPlaybackError;
|
|
14549
14672
|
onPlaybackStateChangeRef.current = onPlaybackStateChange;
|
|
14550
|
-
(0,
|
|
14673
|
+
(0, import_react51.useEffect)(() => {
|
|
14551
14674
|
if (!resource) {
|
|
14552
14675
|
return;
|
|
14553
14676
|
}
|
|
@@ -14557,7 +14680,7 @@ function VideoHotspot({
|
|
|
14557
14680
|
resource.video.playsInline = playsInline;
|
|
14558
14681
|
resource.video.preload = preload;
|
|
14559
14682
|
}, [loop, muted, playsInline, preload, resource, volume]);
|
|
14560
|
-
(0,
|
|
14683
|
+
(0, import_react51.useEffect)(() => {
|
|
14561
14684
|
if (!resource) {
|
|
14562
14685
|
return;
|
|
14563
14686
|
}
|
|
@@ -14585,7 +14708,7 @@ function VideoHotspot({
|
|
|
14585
14708
|
|
|
14586
14709
|
// src/hotspot/audio-hotspot.tsx
|
|
14587
14710
|
var import_fiber27 = require("@react-three/fiber");
|
|
14588
|
-
var
|
|
14711
|
+
var import_react52 = require("react");
|
|
14589
14712
|
var import_three29 = require("three");
|
|
14590
14713
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
14591
14714
|
var SPEAKER_TEXTURE_SIZE = 512;
|
|
@@ -14651,8 +14774,8 @@ function createSpeakerTexture(state) {
|
|
|
14651
14774
|
return texture;
|
|
14652
14775
|
}
|
|
14653
14776
|
function useSpeakerTextures(enabled) {
|
|
14654
|
-
const [textures, setTextures] = (0,
|
|
14655
|
-
(0,
|
|
14777
|
+
const [textures, setTextures] = (0, import_react52.useState)({ playing: null, stopped: null });
|
|
14778
|
+
(0, import_react52.useEffect)(() => {
|
|
14656
14779
|
if (!enabled) {
|
|
14657
14780
|
setTextures({ playing: null, stopped: null });
|
|
14658
14781
|
return;
|
|
@@ -14669,10 +14792,10 @@ function useSpeakerTextures(enabled) {
|
|
|
14669
14792
|
}
|
|
14670
14793
|
function useIconTexture(icon, enabled, onError, id) {
|
|
14671
14794
|
const gl = (0, import_fiber27.useThree)((state) => state.gl);
|
|
14672
|
-
const [texture, setTexture] = (0,
|
|
14673
|
-
const onErrorRef = (0,
|
|
14795
|
+
const [texture, setTexture] = (0, import_react52.useState)(null);
|
|
14796
|
+
const onErrorRef = (0, import_react52.useRef)(onError);
|
|
14674
14797
|
onErrorRef.current = onError;
|
|
14675
|
-
(0,
|
|
14798
|
+
(0, import_react52.useEffect)(() => {
|
|
14676
14799
|
let active = true;
|
|
14677
14800
|
setTexture(null);
|
|
14678
14801
|
if (!enabled || !icon) {
|
|
@@ -14709,7 +14832,7 @@ function useIconTexture(icon, enabled, onError, id) {
|
|
|
14709
14832
|
active = false;
|
|
14710
14833
|
};
|
|
14711
14834
|
}, [enabled, gl, icon, id]);
|
|
14712
|
-
(0,
|
|
14835
|
+
(0, import_react52.useEffect)(
|
|
14713
14836
|
() => () => {
|
|
14714
14837
|
texture?.dispose();
|
|
14715
14838
|
},
|
|
@@ -14728,13 +14851,13 @@ function useAudioHowl({
|
|
|
14728
14851
|
playing,
|
|
14729
14852
|
src
|
|
14730
14853
|
}) {
|
|
14731
|
-
const [howl, setHowl] = (0,
|
|
14732
|
-
const playingRef = (0,
|
|
14733
|
-
const loopRef = (0,
|
|
14734
|
-
const onEndedRef = (0,
|
|
14735
|
-
const onErrorRef = (0,
|
|
14736
|
-
const onPlaybackErrorRef = (0,
|
|
14737
|
-
const onPlaybackStateChangeRef = (0,
|
|
14854
|
+
const [howl, setHowl] = (0, import_react52.useState)(null);
|
|
14855
|
+
const playingRef = (0, import_react52.useRef)(playing);
|
|
14856
|
+
const loopRef = (0, import_react52.useRef)(loop ?? false);
|
|
14857
|
+
const onEndedRef = (0, import_react52.useRef)(onEnded);
|
|
14858
|
+
const onErrorRef = (0, import_react52.useRef)(onError);
|
|
14859
|
+
const onPlaybackErrorRef = (0, import_react52.useRef)(onPlaybackError);
|
|
14860
|
+
const onPlaybackStateChangeRef = (0, import_react52.useRef)(onPlaybackStateChange);
|
|
14738
14861
|
playingRef.current = playing;
|
|
14739
14862
|
loopRef.current = loop ?? false;
|
|
14740
14863
|
onEndedRef.current = onEnded;
|
|
@@ -14742,7 +14865,7 @@ function useAudioHowl({
|
|
|
14742
14865
|
onPlaybackErrorRef.current = onPlaybackError;
|
|
14743
14866
|
onPlaybackStateChangeRef.current = onPlaybackStateChange;
|
|
14744
14867
|
const sourcesKey = sourceList(src).join("\0");
|
|
14745
|
-
(0,
|
|
14868
|
+
(0, import_react52.useEffect)(() => {
|
|
14746
14869
|
const sources = sourcesKey.length > 0 ? sourcesKey.split("\0") : [];
|
|
14747
14870
|
if (sources.length === 0) {
|
|
14748
14871
|
setHowl(null);
|
|
@@ -14779,7 +14902,7 @@ function useAudioHowl({
|
|
|
14779
14902
|
handle.dispose();
|
|
14780
14903
|
};
|
|
14781
14904
|
}, [crossOrigin, id, sourcesKey]);
|
|
14782
|
-
(0,
|
|
14905
|
+
(0, import_react52.useEffect)(() => {
|
|
14783
14906
|
howl?.loop(loop ?? false);
|
|
14784
14907
|
}, [howl, loop]);
|
|
14785
14908
|
return howl;
|
|
@@ -14822,15 +14945,15 @@ function AudioHotspot({
|
|
|
14822
14945
|
const stoppedIconTexture = useIconTexture(icon, marker, onError, id);
|
|
14823
14946
|
const playingIconTexture = useIconTexture(playingIcon, marker, onError, id);
|
|
14824
14947
|
const markerTexture = playing ? playingIconTexture ?? stoppedIconTexture ?? speakerTextures.playing : stoppedIconTexture ?? speakerTextures.stopped;
|
|
14825
|
-
const playingRef = (0,
|
|
14948
|
+
const playingRef = (0, import_react52.useRef)(playing);
|
|
14826
14949
|
playingRef.current = playing;
|
|
14827
|
-
const mutedRef = (0,
|
|
14828
|
-
const volumeRef = (0,
|
|
14829
|
-
const rangeRef = (0,
|
|
14950
|
+
const mutedRef = (0, import_react52.useRef)(muted);
|
|
14951
|
+
const volumeRef = (0, import_react52.useRef)(volume);
|
|
14952
|
+
const rangeRef = (0, import_react52.useRef)(range);
|
|
14830
14953
|
mutedRef.current = muted;
|
|
14831
14954
|
volumeRef.current = volume;
|
|
14832
14955
|
rangeRef.current = range;
|
|
14833
|
-
(0,
|
|
14956
|
+
(0, import_react52.useEffect)(() => {
|
|
14834
14957
|
if (!howl) {
|
|
14835
14958
|
return;
|
|
14836
14959
|
}
|
|
@@ -14840,7 +14963,7 @@ function AudioHotspot({
|
|
|
14840
14963
|
}
|
|
14841
14964
|
howl.play();
|
|
14842
14965
|
}, [howl, playing]);
|
|
14843
|
-
(0,
|
|
14966
|
+
(0, import_react52.useEffect)(() => {
|
|
14844
14967
|
if (!howl || !pauseWhenHidden) {
|
|
14845
14968
|
return;
|
|
14846
14969
|
}
|
|
@@ -14875,7 +14998,7 @@ function AudioHotspot({
|
|
|
14875
14998
|
}
|
|
14876
14999
|
|
|
14877
15000
|
// src/hotspot/text-hotspot.tsx
|
|
14878
|
-
var
|
|
15001
|
+
var import_react53 = require("react");
|
|
14879
15002
|
var import_three30 = require("three");
|
|
14880
15003
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
14881
15004
|
var TEXT_TEXTURE_LONG_SIDE = 1024;
|
|
@@ -15097,12 +15220,12 @@ function createTextTexture(text, width, height, style) {
|
|
|
15097
15220
|
return texture;
|
|
15098
15221
|
}
|
|
15099
15222
|
function useTextTexture(text, width, height, style, onLoad, onError) {
|
|
15100
|
-
const [texture, setTexture] = (0,
|
|
15101
|
-
const onLoadRef = (0,
|
|
15102
|
-
const onErrorRef = (0,
|
|
15223
|
+
const [texture, setTexture] = (0, import_react53.useState)(null);
|
|
15224
|
+
const onLoadRef = (0, import_react53.useRef)(onLoad);
|
|
15225
|
+
const onErrorRef = (0, import_react53.useRef)(onError);
|
|
15103
15226
|
onLoadRef.current = onLoad;
|
|
15104
15227
|
onErrorRef.current = onError;
|
|
15105
|
-
(0,
|
|
15228
|
+
(0, import_react53.useEffect)(() => {
|
|
15106
15229
|
let cancelled = false;
|
|
15107
15230
|
let nextTexture = null;
|
|
15108
15231
|
const run = async () => {
|
|
@@ -15366,6 +15489,7 @@ function IframeHotspot({
|
|
|
15366
15489
|
resolvePanoContextMenuEntries,
|
|
15367
15490
|
unwrapPolygonVertices,
|
|
15368
15491
|
usePanoEvents,
|
|
15492
|
+
usePanoViewer,
|
|
15369
15493
|
validatePolygonVertices,
|
|
15370
15494
|
validatePolylineVertices,
|
|
15371
15495
|
vector3ToPanoPosition
|