@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.mjs
CHANGED
|
@@ -2274,6 +2274,20 @@ function subscribeBackgroundAudioHost(host, listener) {
|
|
|
2274
2274
|
host.listeners.delete(listener);
|
|
2275
2275
|
};
|
|
2276
2276
|
}
|
|
2277
|
+
function subscribeBackgroundAudioStore(host, onStoreChange) {
|
|
2278
|
+
let unsubscribeController = host.controller?.subscribe(onStoreChange) ?? (() => {
|
|
2279
|
+
});
|
|
2280
|
+
const unsubscribeHost = subscribeBackgroundAudioHost(host, () => {
|
|
2281
|
+
unsubscribeController();
|
|
2282
|
+
unsubscribeController = host.controller?.subscribe(onStoreChange) ?? (() => {
|
|
2283
|
+
});
|
|
2284
|
+
onStoreChange();
|
|
2285
|
+
});
|
|
2286
|
+
return () => {
|
|
2287
|
+
unsubscribeController();
|
|
2288
|
+
unsubscribeHost();
|
|
2289
|
+
};
|
|
2290
|
+
}
|
|
2277
2291
|
|
|
2278
2292
|
// src/cn.ts
|
|
2279
2293
|
function cn(...values) {
|
|
@@ -5022,6 +5036,20 @@ function subscribePanoVideoHost(host, onStoreChange) {
|
|
|
5022
5036
|
host.listeners.delete(onStoreChange);
|
|
5023
5037
|
};
|
|
5024
5038
|
}
|
|
5039
|
+
function subscribePanoVideoStore(host, onStoreChange) {
|
|
5040
|
+
let unsubscribeController = host.controller?.subscribe(onStoreChange) ?? (() => {
|
|
5041
|
+
});
|
|
5042
|
+
const unsubscribeHost = subscribePanoVideoHost(host, () => {
|
|
5043
|
+
unsubscribeController();
|
|
5044
|
+
unsubscribeController = host.controller?.subscribe(onStoreChange) ?? (() => {
|
|
5045
|
+
});
|
|
5046
|
+
onStoreChange();
|
|
5047
|
+
});
|
|
5048
|
+
return () => {
|
|
5049
|
+
unsubscribeController();
|
|
5050
|
+
unsubscribeHost();
|
|
5051
|
+
};
|
|
5052
|
+
}
|
|
5025
5053
|
function getPanoVideoHostRevision(host) {
|
|
5026
5054
|
return host.revision;
|
|
5027
5055
|
}
|
|
@@ -6953,7 +6981,7 @@ var PanoViewer = forwardRef2(
|
|
|
6953
6981
|
requestVRPermission: () => webVRHost.controller?.requestPermission() ?? Promise.resolve(false),
|
|
6954
6982
|
// -- Video --
|
|
6955
6983
|
getVideo: () => videoHost.controller,
|
|
6956
|
-
subscribeVideo: (onStoreChange) =>
|
|
6984
|
+
subscribeVideo: (onStoreChange) => subscribePanoVideoStore(videoHost, onStoreChange),
|
|
6957
6985
|
playVideo: () => videoHost.controller?.play() ?? Promise.resolve(),
|
|
6958
6986
|
pauseVideo: () => videoHost.controller?.pause(),
|
|
6959
6987
|
toggleVideo: () => videoHost.controller?.togglePlay(),
|
|
@@ -6963,7 +6991,7 @@ var PanoViewer = forwardRef2(
|
|
|
6963
6991
|
toggleVideoMuted: () => videoHost.controller?.toggleMuted(),
|
|
6964
6992
|
// -- Background Audio --
|
|
6965
6993
|
getBackgroundAudio: () => bgmHost.controller,
|
|
6966
|
-
subscribeBackgroundAudio: (onStoreChange) =>
|
|
6994
|
+
subscribeBackgroundAudio: (onStoreChange) => subscribeBackgroundAudioStore(bgmHost, onStoreChange),
|
|
6967
6995
|
playBackgroundAudio: () => {
|
|
6968
6996
|
bgmHost.controller?.play();
|
|
6969
6997
|
return Promise.resolve();
|
|
@@ -7327,6 +7355,8 @@ function BackgroundAudio({
|
|
|
7327
7355
|
const loopRef = useRef13(loop);
|
|
7328
7356
|
const mutedRef = useRef13(muted);
|
|
7329
7357
|
const volumeRef = useRef13(volume);
|
|
7358
|
+
const mutedPropRef = useRef13(muted);
|
|
7359
|
+
const volumePropRef = useRef13(volume);
|
|
7330
7360
|
const fadeMsRef = useRef13(resolveFadeMs(fadeMs));
|
|
7331
7361
|
const onPlaybackStateChangeRef = useRef13(onPlaybackStateChange);
|
|
7332
7362
|
const onPlaybackErrorRef = useRef13(onPlaybackError);
|
|
@@ -7334,9 +7364,15 @@ function BackgroundAudio({
|
|
|
7334
7364
|
const onErrorRef = useRef13(onError);
|
|
7335
7365
|
playingRef.current = playing;
|
|
7336
7366
|
loopRef.current = loop;
|
|
7337
|
-
mutedRef.current = muted;
|
|
7338
|
-
volumeRef.current = volume;
|
|
7339
7367
|
fadeMsRef.current = resolveFadeMs(fadeMs);
|
|
7368
|
+
if (mutedPropRef.current !== muted) {
|
|
7369
|
+
mutedPropRef.current = muted;
|
|
7370
|
+
mutedRef.current = muted;
|
|
7371
|
+
}
|
|
7372
|
+
if (volumePropRef.current !== volume) {
|
|
7373
|
+
volumePropRef.current = volume;
|
|
7374
|
+
volumeRef.current = volume;
|
|
7375
|
+
}
|
|
7340
7376
|
onPlaybackStateChangeRef.current = onPlaybackStateChange;
|
|
7341
7377
|
onPlaybackErrorRef.current = onPlaybackError;
|
|
7342
7378
|
onEndedRef.current = onEnded;
|
|
@@ -7390,20 +7426,17 @@ function BackgroundAudio({
|
|
|
7390
7426
|
if (isControlledRef.current) {
|
|
7391
7427
|
return;
|
|
7392
7428
|
}
|
|
7393
|
-
const
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
}
|
|
7397
|
-
notifySnapshot({ volume: clampAudioVolume(vol) });
|
|
7429
|
+
const next = clampAudioVolume(vol);
|
|
7430
|
+
volumeRef.current = next;
|
|
7431
|
+
currentRef.current?.handle.howl.volume(next);
|
|
7432
|
+
notifySnapshot({ volume: next });
|
|
7398
7433
|
},
|
|
7399
7434
|
setMuted: (m) => {
|
|
7400
7435
|
if (isControlledRef.current) {
|
|
7401
7436
|
return;
|
|
7402
7437
|
}
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
howl.mute(m);
|
|
7406
|
-
}
|
|
7438
|
+
mutedRef.current = m;
|
|
7439
|
+
currentRef.current?.handle.howl.mute(m);
|
|
7407
7440
|
notifySnapshot({ muted: m });
|
|
7408
7441
|
},
|
|
7409
7442
|
toggleMuted: () => {
|
|
@@ -7411,10 +7444,8 @@ function BackgroundAudio({
|
|
|
7411
7444
|
return;
|
|
7412
7445
|
}
|
|
7413
7446
|
const next = !snapshotRef.current.muted;
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
howl.mute(next);
|
|
7417
|
-
}
|
|
7447
|
+
mutedRef.current = next;
|
|
7448
|
+
currentRef.current?.handle.howl.mute(next);
|
|
7418
7449
|
notifySnapshot({ muted: next });
|
|
7419
7450
|
}
|
|
7420
7451
|
}),
|
|
@@ -7481,6 +7512,9 @@ function BackgroundAudio({
|
|
|
7481
7512
|
shouldRetryPlay: () => currentRef.current?.key === trackKey && playingRef.current,
|
|
7482
7513
|
onEnded: () => {
|
|
7483
7514
|
notifySnapshot({ playing: false, ended: true });
|
|
7515
|
+
if (!isControlledRef.current) {
|
|
7516
|
+
setInternalPlaying(false);
|
|
7517
|
+
}
|
|
7484
7518
|
onPlaybackStateChangeRef.current?.("ended");
|
|
7485
7519
|
onEndedRef.current?.();
|
|
7486
7520
|
},
|
|
@@ -7553,7 +7587,9 @@ function BackgroundAudio({
|
|
|
7553
7587
|
}
|
|
7554
7588
|
if (!playing) {
|
|
7555
7589
|
fadingInRef.current = false;
|
|
7556
|
-
howl.
|
|
7590
|
+
if (howl.playing()) {
|
|
7591
|
+
howl.pause();
|
|
7592
|
+
}
|
|
7557
7593
|
for (const slot of outgoingRef.current) {
|
|
7558
7594
|
slot.handle.dispose();
|
|
7559
7595
|
}
|
|
@@ -7568,11 +7604,14 @@ function BackgroundAudio({
|
|
|
7568
7604
|
return;
|
|
7569
7605
|
}
|
|
7570
7606
|
slot.handle.howl.loop(loop);
|
|
7571
|
-
slot.handle.howl.mute(
|
|
7607
|
+
slot.handle.howl.mute(mutedRef.current);
|
|
7572
7608
|
if (!fadingInRef.current) {
|
|
7573
|
-
slot.handle.howl.volume(clampAudioVolume(
|
|
7609
|
+
slot.handle.howl.volume(clampAudioVolume(volumeRef.current));
|
|
7574
7610
|
}
|
|
7575
|
-
notifySnapshot({
|
|
7611
|
+
notifySnapshot({
|
|
7612
|
+
muted: mutedRef.current,
|
|
7613
|
+
volume: clampAudioVolume(volumeRef.current)
|
|
7614
|
+
});
|
|
7576
7615
|
}, [loop, muted, trackKey, volume]);
|
|
7577
7616
|
useEffect13(() => {
|
|
7578
7617
|
if (!pauseWhenHidden) {
|
|
@@ -9178,9 +9217,92 @@ var WebVR = forwardRef4(function WebVR2({
|
|
|
9178
9217
|
] });
|
|
9179
9218
|
});
|
|
9180
9219
|
|
|
9220
|
+
// src/use-pano-viewer.ts
|
|
9221
|
+
import { useMemo as useMemo12, useRef as useRef19 } from "react";
|
|
9222
|
+
function createPanoViewerHandle(ref) {
|
|
9223
|
+
return {
|
|
9224
|
+
getView: () => ref.current?.getView() ?? { yaw: 0, pitch: 0, fov: 75 },
|
|
9225
|
+
setView: (view, options) => {
|
|
9226
|
+
ref.current?.setView(view, options);
|
|
9227
|
+
},
|
|
9228
|
+
reset: () => {
|
|
9229
|
+
ref.current?.reset();
|
|
9230
|
+
},
|
|
9231
|
+
enterFullscreen: () => ref.current?.enterFullscreen() ?? Promise.resolve(),
|
|
9232
|
+
exitFullscreen: () => ref.current?.exitFullscreen() ?? Promise.resolve(),
|
|
9233
|
+
toggleFullscreen: () => ref.current?.toggleFullscreen() ?? Promise.resolve(),
|
|
9234
|
+
isFullscreen: () => ref.current?.isFullscreen() ?? false,
|
|
9235
|
+
setScene: (id) => ref.current?.setScene(id) ?? false,
|
|
9236
|
+
nextScene: () => ref.current?.nextScene() ?? false,
|
|
9237
|
+
previousScene: () => ref.current?.previousScene() ?? false,
|
|
9238
|
+
getActiveSceneId: () => ref.current?.getActiveSceneId() ?? null,
|
|
9239
|
+
getSceneIds: () => ref.current?.getSceneIds() ?? [],
|
|
9240
|
+
isSceneTransitioning: () => ref.current?.isSceneTransitioning() ?? false,
|
|
9241
|
+
enterVR: () => ref.current?.enterVR() ?? Promise.resolve(false),
|
|
9242
|
+
exitVR: () => ref.current?.exitVR() ?? Promise.resolve(),
|
|
9243
|
+
toggleVR: () => ref.current?.toggleVR() ?? Promise.resolve(false),
|
|
9244
|
+
isVRAvailable: () => ref.current?.isVRAvailable() ?? false,
|
|
9245
|
+
isVREnabled: () => ref.current?.isVREnabled() ?? false,
|
|
9246
|
+
getVRMode: () => ref.current?.getVRMode() ?? null,
|
|
9247
|
+
requestVRPermission: () => ref.current?.requestVRPermission() ?? Promise.resolve(false),
|
|
9248
|
+
getVideo: () => ref.current?.getVideo() ?? null,
|
|
9249
|
+
subscribeVideo: (onStoreChange) => ref.current?.subscribeVideo(onStoreChange) ?? (() => {
|
|
9250
|
+
}),
|
|
9251
|
+
playVideo: () => ref.current?.playVideo() ?? Promise.resolve(),
|
|
9252
|
+
pauseVideo: () => {
|
|
9253
|
+
ref.current?.pauseVideo();
|
|
9254
|
+
},
|
|
9255
|
+
toggleVideo: () => {
|
|
9256
|
+
ref.current?.toggleVideo();
|
|
9257
|
+
},
|
|
9258
|
+
seekVideo: (time) => {
|
|
9259
|
+
ref.current?.seekVideo(time);
|
|
9260
|
+
},
|
|
9261
|
+
setVideoVolume: (volume) => {
|
|
9262
|
+
ref.current?.setVideoVolume(volume);
|
|
9263
|
+
},
|
|
9264
|
+
setVideoMuted: (muted) => {
|
|
9265
|
+
ref.current?.setVideoMuted(muted);
|
|
9266
|
+
},
|
|
9267
|
+
toggleVideoMuted: () => {
|
|
9268
|
+
ref.current?.toggleVideoMuted();
|
|
9269
|
+
},
|
|
9270
|
+
getBackgroundAudio: () => ref.current?.getBackgroundAudio() ?? null,
|
|
9271
|
+
subscribeBackgroundAudio: (onStoreChange) => ref.current?.subscribeBackgroundAudio(onStoreChange) ?? (() => {
|
|
9272
|
+
}),
|
|
9273
|
+
playBackgroundAudio: () => ref.current?.playBackgroundAudio() ?? Promise.resolve(),
|
|
9274
|
+
pauseBackgroundAudio: () => {
|
|
9275
|
+
ref.current?.pauseBackgroundAudio();
|
|
9276
|
+
},
|
|
9277
|
+
toggleBackgroundAudio: () => {
|
|
9278
|
+
ref.current?.toggleBackgroundAudio();
|
|
9279
|
+
},
|
|
9280
|
+
setBackgroundAudioVolume: (volume) => {
|
|
9281
|
+
ref.current?.setBackgroundAudioVolume(volume);
|
|
9282
|
+
},
|
|
9283
|
+
setBackgroundAudioMuted: (muted) => {
|
|
9284
|
+
ref.current?.setBackgroundAudioMuted(muted);
|
|
9285
|
+
},
|
|
9286
|
+
toggleBackgroundAudioMuted: () => {
|
|
9287
|
+
ref.current?.toggleBackgroundAudioMuted();
|
|
9288
|
+
},
|
|
9289
|
+
startAutoRotate: () => {
|
|
9290
|
+
ref.current?.startAutoRotate();
|
|
9291
|
+
},
|
|
9292
|
+
stopAutoRotate: () => {
|
|
9293
|
+
ref.current?.stopAutoRotate();
|
|
9294
|
+
}
|
|
9295
|
+
};
|
|
9296
|
+
}
|
|
9297
|
+
function usePanoViewer() {
|
|
9298
|
+
const ref = useRef19(null);
|
|
9299
|
+
const handle = useMemo12(() => createPanoViewerHandle(ref), []);
|
|
9300
|
+
return useMemo12(() => ({ ref, ...handle }), [handle]);
|
|
9301
|
+
}
|
|
9302
|
+
|
|
9181
9303
|
// src/sphere.tsx
|
|
9182
9304
|
import { useThree as useThree13 } from "@react-three/fiber";
|
|
9183
|
-
import { useEffect as useEffect20, useMemo as
|
|
9305
|
+
import { useEffect as useEffect20, useMemo as useMemo14, useRef as useRef21, useState as useState9 } from "react";
|
|
9184
9306
|
import {
|
|
9185
9307
|
BackSide as BackSide2,
|
|
9186
9308
|
LinearFilter,
|
|
@@ -9213,7 +9335,7 @@ function resolveUrlAgainstFile(fileUrl, path) {
|
|
|
9213
9335
|
}
|
|
9214
9336
|
|
|
9215
9337
|
// src/pano-filter/pano-basic-material.tsx
|
|
9216
|
-
import { useLayoutEffect as useLayoutEffect2, useMemo as
|
|
9338
|
+
import { useLayoutEffect as useLayoutEffect2, useMemo as useMemo13, useRef as useRef20 } from "react";
|
|
9217
9339
|
|
|
9218
9340
|
// src/pano-filter/shaders.ts
|
|
9219
9341
|
var GLSL_FILTER_COMMON = `
|
|
@@ -9373,13 +9495,13 @@ function PanoBasicMaterial({
|
|
|
9373
9495
|
toneMapped = false
|
|
9374
9496
|
}) {
|
|
9375
9497
|
const snapshot = usePanoFilterSnapshot();
|
|
9376
|
-
const materialRef =
|
|
9377
|
-
const intensityRef =
|
|
9378
|
-
const intensityUniformRef =
|
|
9498
|
+
const materialRef = useRef20(null);
|
|
9499
|
+
const intensityRef = useRef20(snapshot.intensity);
|
|
9500
|
+
const intensityUniformRef = useRef20(null);
|
|
9379
9501
|
intensityRef.current = snapshot.intensity;
|
|
9380
9502
|
const active = isPanoFilterActive(snapshot);
|
|
9381
9503
|
const preset = snapshot.preset;
|
|
9382
|
-
const onBeforeCompile =
|
|
9504
|
+
const onBeforeCompile = useMemo13(() => {
|
|
9383
9505
|
if (!active || preset === "none") {
|
|
9384
9506
|
return void 0;
|
|
9385
9507
|
}
|
|
@@ -9430,8 +9552,8 @@ function PanoBasicMaterial({
|
|
|
9430
9552
|
import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
9431
9553
|
function useEquirectTexture(url, anisotropy, generateMipmaps, onLoad, onError) {
|
|
9432
9554
|
const [texture, setTexture] = useState9(null);
|
|
9433
|
-
const onLoadRef =
|
|
9434
|
-
const onErrorRef =
|
|
9555
|
+
const onLoadRef = useRef21(onLoad);
|
|
9556
|
+
const onErrorRef = useRef21(onError);
|
|
9435
9557
|
onLoadRef.current = onLoad;
|
|
9436
9558
|
onErrorRef.current = onError;
|
|
9437
9559
|
useEffect20(() => {
|
|
@@ -9493,7 +9615,7 @@ function Sphere({
|
|
|
9493
9615
|
}) {
|
|
9494
9616
|
const gl = useThree13((state) => state.gl);
|
|
9495
9617
|
const anisotropy = gl.capabilities.getMaxAnisotropy();
|
|
9496
|
-
const resolvedPreviewUrl =
|
|
9618
|
+
const resolvedPreviewUrl = useMemo14(
|
|
9497
9619
|
() => resolveUrlAgainstFile(src, previewUrl),
|
|
9498
9620
|
[previewUrl, src]
|
|
9499
9621
|
);
|
|
@@ -9512,7 +9634,7 @@ function Sphere({
|
|
|
9512
9634
|
onPreviewError
|
|
9513
9635
|
);
|
|
9514
9636
|
const displayTexture = texture ?? previewTexture;
|
|
9515
|
-
const readyRef =
|
|
9637
|
+
const readyRef = useRef21(false);
|
|
9516
9638
|
useEffect20(() => {
|
|
9517
9639
|
readyRef.current = false;
|
|
9518
9640
|
}, [resolvedPreviewUrl, src]);
|
|
@@ -9553,8 +9675,8 @@ import {
|
|
|
9553
9675
|
useContext as useContext20,
|
|
9554
9676
|
useEffect as useEffect21,
|
|
9555
9677
|
useLayoutEffect as useLayoutEffect3,
|
|
9556
|
-
useMemo as
|
|
9557
|
-
useRef as
|
|
9678
|
+
useMemo as useMemo15,
|
|
9679
|
+
useRef as useRef22,
|
|
9558
9680
|
useState as useState10
|
|
9559
9681
|
} from "react";
|
|
9560
9682
|
import {
|
|
@@ -9653,7 +9775,7 @@ function applyEquirectangularLayout(texture, anisotropy) {
|
|
|
9653
9775
|
function usePosterTexture(poster, onError) {
|
|
9654
9776
|
const gl = useThree14((state) => state.gl);
|
|
9655
9777
|
const [texture, setTexture] = useState10(null);
|
|
9656
|
-
const onErrorRef =
|
|
9778
|
+
const onErrorRef = useRef22(onError);
|
|
9657
9779
|
onErrorRef.current = onError;
|
|
9658
9780
|
useEffect21(() => {
|
|
9659
9781
|
let active = true;
|
|
@@ -9752,13 +9874,13 @@ function PanoVideo({
|
|
|
9752
9874
|
const gl = useThree14((state) => state.gl);
|
|
9753
9875
|
const host = useContext20(PanoVideoHostContext);
|
|
9754
9876
|
const overlay = useContext20(PanoChromeOverlayContext);
|
|
9755
|
-
const variants =
|
|
9877
|
+
const variants = useMemo15(
|
|
9756
9878
|
() => resolvePanoVideoVariants({ poster, src, variants: variantsProp }),
|
|
9757
9879
|
[poster, src, variantsProp]
|
|
9758
9880
|
);
|
|
9759
9881
|
const tracks = tracksProp ?? EMPTY_TRACKS;
|
|
9760
9882
|
const captionsEnabled = captions !== false;
|
|
9761
|
-
const captionAppearance =
|
|
9883
|
+
const captionAppearance = useMemo15(
|
|
9762
9884
|
() => resolvePanoVideoCaptionAppearance(
|
|
9763
9885
|
typeof captions === "object" ? captions : void 0
|
|
9764
9886
|
),
|
|
@@ -9771,17 +9893,17 @@ function PanoVideo({
|
|
|
9771
9893
|
() => captionsEnabled ? defaultPanoVideoTrackId(tracks) : null
|
|
9772
9894
|
);
|
|
9773
9895
|
const [ready, setReady] = useState10(false);
|
|
9774
|
-
const autoPlayRef =
|
|
9896
|
+
const autoPlayRef = useRef22(autoPlay);
|
|
9775
9897
|
autoPlayRef.current = autoPlay;
|
|
9776
|
-
const blockedRef =
|
|
9777
|
-
const captionAppearanceOverrideRef =
|
|
9898
|
+
const blockedRef = useRef22(false);
|
|
9899
|
+
const captionAppearanceOverrideRef = useRef22(
|
|
9778
9900
|
{}
|
|
9779
9901
|
);
|
|
9780
|
-
const mediaCapabilitiesRef =
|
|
9902
|
+
const mediaCapabilitiesRef = useRef22({
|
|
9781
9903
|
volumeAdjustable: true,
|
|
9782
9904
|
playbackRates: [...DEFAULT_PANO_VIDEO_PLAYBACK_RATES]
|
|
9783
9905
|
});
|
|
9784
|
-
const storeRef =
|
|
9906
|
+
const storeRef = useRef22(null);
|
|
9785
9907
|
if (!storeRef.current) {
|
|
9786
9908
|
storeRef.current = {
|
|
9787
9909
|
snapshot: {
|
|
@@ -9791,7 +9913,7 @@ function PanoVideo({
|
|
|
9791
9913
|
listeners: /* @__PURE__ */ new Set()
|
|
9792
9914
|
};
|
|
9793
9915
|
}
|
|
9794
|
-
const actionsRef =
|
|
9916
|
+
const actionsRef = useRef22({
|
|
9795
9917
|
play: async () => {
|
|
9796
9918
|
},
|
|
9797
9919
|
pause: () => {
|
|
@@ -9811,19 +9933,19 @@ function PanoVideo({
|
|
|
9811
9933
|
setCaptionAppearance: (_appearance) => {
|
|
9812
9934
|
}
|
|
9813
9935
|
});
|
|
9814
|
-
const onLoadRef =
|
|
9815
|
-
const onErrorRef =
|
|
9816
|
-
const onPlaybackStateChangeRef =
|
|
9817
|
-
const onEndedRef =
|
|
9818
|
-
const onVariantChangeRef =
|
|
9819
|
-
const onTrackChangeRef =
|
|
9936
|
+
const onLoadRef = useRef22(onLoad);
|
|
9937
|
+
const onErrorRef = useRef22(onError);
|
|
9938
|
+
const onPlaybackStateChangeRef = useRef22(onPlaybackStateChange);
|
|
9939
|
+
const onEndedRef = useRef22(onEnded);
|
|
9940
|
+
const onVariantChangeRef = useRef22(onVariantChange);
|
|
9941
|
+
const onTrackChangeRef = useRef22(onTrackChange);
|
|
9820
9942
|
onLoadRef.current = onLoad;
|
|
9821
9943
|
onErrorRef.current = onError;
|
|
9822
9944
|
onPlaybackStateChangeRef.current = onPlaybackStateChange;
|
|
9823
9945
|
onEndedRef.current = onEnded;
|
|
9824
9946
|
onVariantChangeRef.current = onVariantChange;
|
|
9825
9947
|
onTrackChangeRef.current = onTrackChange;
|
|
9826
|
-
const resource =
|
|
9948
|
+
const resource = useMemo15(() => {
|
|
9827
9949
|
if (typeof document === "undefined") {
|
|
9828
9950
|
return null;
|
|
9829
9951
|
}
|
|
@@ -9936,7 +10058,7 @@ function PanoVideo({
|
|
|
9936
10058
|
captionAppearance
|
|
9937
10059
|
]
|
|
9938
10060
|
);
|
|
9939
|
-
const controller =
|
|
10061
|
+
const controller = useMemo15(
|
|
9940
10062
|
() => ({
|
|
9941
10063
|
subscribe: (onStoreChange) => {
|
|
9942
10064
|
const store = storeRef.current;
|
|
@@ -10303,8 +10425,8 @@ import {
|
|
|
10303
10425
|
useCallback as useCallback10,
|
|
10304
10426
|
useContext as useContext22,
|
|
10305
10427
|
useEffect as useEffect26,
|
|
10306
|
-
useMemo as
|
|
10307
|
-
useRef as
|
|
10428
|
+
useMemo as useMemo20,
|
|
10429
|
+
useRef as useRef26,
|
|
10308
10430
|
useState as useState12
|
|
10309
10431
|
} from "react";
|
|
10310
10432
|
import {
|
|
@@ -10361,7 +10483,7 @@ function isSnapshotTransition(preset) {
|
|
|
10361
10483
|
|
|
10362
10484
|
// src/scene-transitions/particle-overlay.tsx
|
|
10363
10485
|
import { useFrame as useFrame9, useThree as useThree15 } from "@react-three/fiber";
|
|
10364
|
-
import { useEffect as useEffect22, useMemo as
|
|
10486
|
+
import { useEffect as useEffect22, useMemo as useMemo16, useRef as useRef23 } from "react";
|
|
10365
10487
|
import {
|
|
10366
10488
|
DoubleSide as DoubleSide2,
|
|
10367
10489
|
InstancedBufferAttribute,
|
|
@@ -10501,12 +10623,12 @@ function ParticleOverlay({
|
|
|
10501
10623
|
onFinish
|
|
10502
10624
|
}) {
|
|
10503
10625
|
const { camera } = useThree15();
|
|
10504
|
-
const meshRef =
|
|
10505
|
-
const startRef =
|
|
10506
|
-
const finishedRef =
|
|
10507
|
-
const directionRef =
|
|
10508
|
-
const geometry =
|
|
10509
|
-
const material =
|
|
10626
|
+
const meshRef = useRef23(null);
|
|
10627
|
+
const startRef = useRef23(null);
|
|
10628
|
+
const finishedRef = useRef23(false);
|
|
10629
|
+
const directionRef = useRef23(new Vector39());
|
|
10630
|
+
const geometry = useMemo16(() => createParticleGeometry(), []);
|
|
10631
|
+
const material = useMemo16(
|
|
10510
10632
|
() => new ShaderMaterial2({
|
|
10511
10633
|
transparent: true,
|
|
10512
10634
|
depthTest: false,
|
|
@@ -10560,7 +10682,7 @@ function ParticleOverlay({
|
|
|
10560
10682
|
|
|
10561
10683
|
// src/scene-transitions/snapshot-overlay.tsx
|
|
10562
10684
|
import { useFrame as useFrame10, useThree as useThree16 } from "@react-three/fiber";
|
|
10563
|
-
import { useEffect as useEffect23, useMemo as
|
|
10685
|
+
import { useEffect as useEffect23, useMemo as useMemo17, useRef as useRef24 } from "react";
|
|
10564
10686
|
import { Vector3 as Vector310 } from "three";
|
|
10565
10687
|
|
|
10566
10688
|
// src/scene-transitions/snapshot-shaders.ts
|
|
@@ -10849,11 +10971,11 @@ function SnapshotOverlay({
|
|
|
10849
10971
|
onFinish
|
|
10850
10972
|
}) {
|
|
10851
10973
|
const { camera, gl } = useThree16();
|
|
10852
|
-
const meshRef =
|
|
10853
|
-
const startRef =
|
|
10854
|
-
const finishedRef =
|
|
10855
|
-
const directionRef =
|
|
10856
|
-
const material =
|
|
10974
|
+
const meshRef = useRef24(null);
|
|
10975
|
+
const startRef = useRef24(null);
|
|
10976
|
+
const finishedRef = useRef24(false);
|
|
10977
|
+
const directionRef = useRef24(new Vector310());
|
|
10978
|
+
const material = useMemo17(() => {
|
|
10857
10979
|
if (!isSnapshotTransition(transition.preset)) {
|
|
10858
10980
|
return null;
|
|
10859
10981
|
}
|
|
@@ -10946,7 +11068,7 @@ import {
|
|
|
10946
11068
|
createContext as createContext13,
|
|
10947
11069
|
useContext as useContext21,
|
|
10948
11070
|
useEffect as useEffect24,
|
|
10949
|
-
useMemo as
|
|
11071
|
+
useMemo as useMemo18
|
|
10950
11072
|
} from "react";
|
|
10951
11073
|
|
|
10952
11074
|
// src/tile/texture-manager.ts
|
|
@@ -11187,7 +11309,7 @@ function TileTextureManagerProvider({
|
|
|
11187
11309
|
}) {
|
|
11188
11310
|
const gl = useThree17((state) => state.gl);
|
|
11189
11311
|
const anisotropy = gl.capabilities.getMaxAnisotropy();
|
|
11190
|
-
const manager =
|
|
11312
|
+
const manager = useMemo18(
|
|
11191
11313
|
() => new TileTextureManager({
|
|
11192
11314
|
anisotropy,
|
|
11193
11315
|
maxBytes: Math.max(1, maxTextureMemoryMb) * 1024 * 1024,
|
|
@@ -11211,8 +11333,8 @@ import { useFrame as useFrame11, useThree as useThree18 } from "@react-three/fib
|
|
|
11211
11333
|
import {
|
|
11212
11334
|
memo,
|
|
11213
11335
|
useEffect as useEffect25,
|
|
11214
|
-
useMemo as
|
|
11215
|
-
useRef as
|
|
11336
|
+
useMemo as useMemo19,
|
|
11337
|
+
useRef as useRef25,
|
|
11216
11338
|
useState as useState11
|
|
11217
11339
|
} from "react";
|
|
11218
11340
|
import {
|
|
@@ -11419,7 +11541,7 @@ var PREVIEW_RADIUS = CUBE_RADIUS + 0.05;
|
|
|
11419
11541
|
var SHARED_TILE_GEOMETRY = new PlaneGeometry4(1, 1);
|
|
11420
11542
|
function usePreviewTexture(url, anisotropy, onError) {
|
|
11421
11543
|
const [texture, setTexture] = useState11(null);
|
|
11422
|
-
const onErrorRef =
|
|
11544
|
+
const onErrorRef = useRef25(onError);
|
|
11423
11545
|
onErrorRef.current = onError;
|
|
11424
11546
|
useEffect25(() => {
|
|
11425
11547
|
if (!url) {
|
|
@@ -11471,7 +11593,7 @@ function PreviewFace({
|
|
|
11471
11593
|
texture,
|
|
11472
11594
|
faceOrder
|
|
11473
11595
|
}) {
|
|
11474
|
-
const geometry =
|
|
11596
|
+
const geometry = useMemo19(() => {
|
|
11475
11597
|
const nextGeometry = new PlaneGeometry4(
|
|
11476
11598
|
PREVIEW_RADIUS * 2,
|
|
11477
11599
|
PREVIEW_RADIUS * 2
|
|
@@ -11757,10 +11879,10 @@ function Tile({
|
|
|
11757
11879
|
onLevelChange
|
|
11758
11880
|
}) {
|
|
11759
11881
|
const { camera, gl, size } = useThree18();
|
|
11760
|
-
const multiresConfig =
|
|
11882
|
+
const multiresConfig = useMemo19(() => parseMultires(multires), [multires]);
|
|
11761
11883
|
const { levels, tileSize } = multiresConfig;
|
|
11762
11884
|
const multiresToken = `${tileSize}:${levels.join(",")}`;
|
|
11763
|
-
const candidatesByLevel =
|
|
11885
|
+
const candidatesByLevel = useMemo19(
|
|
11764
11886
|
() => buildTileCandidates(levels, tileSize),
|
|
11765
11887
|
[levels, tileSize]
|
|
11766
11888
|
);
|
|
@@ -11772,13 +11894,13 @@ function Tile({
|
|
|
11772
11894
|
onPreviewError
|
|
11773
11895
|
);
|
|
11774
11896
|
const sharedManager = useSharedTileTextureManager();
|
|
11775
|
-
const progressRef =
|
|
11776
|
-
const errorRef =
|
|
11777
|
-
const levelChangeRef =
|
|
11897
|
+
const progressRef = useRef25(onLoadProgress);
|
|
11898
|
+
const errorRef = useRef25(onTileError);
|
|
11899
|
+
const levelChangeRef = useRef25(onLevelChange);
|
|
11778
11900
|
progressRef.current = onLoadProgress;
|
|
11779
11901
|
errorRef.current = onTileError;
|
|
11780
11902
|
levelChangeRef.current = onLevelChange;
|
|
11781
|
-
const ownedManager =
|
|
11903
|
+
const ownedManager = useMemo19(
|
|
11782
11904
|
() => new TileTextureManager({
|
|
11783
11905
|
anisotropy,
|
|
11784
11906
|
maxBytes: Math.max(1, maxTextureMemoryMb) * 1024 * 1024,
|
|
@@ -11809,7 +11931,7 @@ function Tile({
|
|
|
11809
11931
|
queueMicrotask(() => manager.releaseUnused());
|
|
11810
11932
|
};
|
|
11811
11933
|
}, [manager, ownedManager]);
|
|
11812
|
-
const readyRef =
|
|
11934
|
+
const readyRef = useRef25(false);
|
|
11813
11935
|
useEffect25(() => {
|
|
11814
11936
|
readyRef.current = false;
|
|
11815
11937
|
}, [effectivePreviewUrl]);
|
|
@@ -11821,7 +11943,7 @@ function Tile({
|
|
|
11821
11943
|
onReady?.();
|
|
11822
11944
|
}, [onReady, previewTexture]);
|
|
11823
11945
|
const template = urlTemplate ?? buildDefaultTileUrlTemplate();
|
|
11824
|
-
const resolveUrl =
|
|
11946
|
+
const resolveUrl = useMemo19(
|
|
11825
11947
|
() => (address) => {
|
|
11826
11948
|
const relativePath = resolveTileUrl ? resolveTileUrl(address) : resolveTemplateUrl(template, address);
|
|
11827
11949
|
return resolveRelativeTileUrl(baseUrl, relativePath);
|
|
@@ -11829,16 +11951,16 @@ function Tile({
|
|
|
11829
11951
|
[baseUrl, resolveTileUrl, template]
|
|
11830
11952
|
);
|
|
11831
11953
|
const [layers, setLayers] = useState11([]);
|
|
11832
|
-
const layerTokenRef =
|
|
11833
|
-
const currentLevelRef =
|
|
11834
|
-
const lastUpdateAtRef =
|
|
11835
|
-
const visibilityDirtyRef =
|
|
11836
|
-
const lastVisibilityQuaternionRef =
|
|
11837
|
-
const lastVisibilityFovRef =
|
|
11838
|
-
const lastViewportRef =
|
|
11839
|
-
const frustumRef =
|
|
11840
|
-
const projectionMatrixRef =
|
|
11841
|
-
const visibilityCameraRef =
|
|
11954
|
+
const layerTokenRef = useRef25("");
|
|
11955
|
+
const currentLevelRef = useRef25(1);
|
|
11956
|
+
const lastUpdateAtRef = useRef25(-Infinity);
|
|
11957
|
+
const visibilityDirtyRef = useRef25(true);
|
|
11958
|
+
const lastVisibilityQuaternionRef = useRef25(camera.quaternion.clone());
|
|
11959
|
+
const lastVisibilityFovRef = useRef25(Number.NaN);
|
|
11960
|
+
const lastViewportRef = useRef25({ width: 0, height: 0, dpr: 0 });
|
|
11961
|
+
const frustumRef = useRef25(new Frustum());
|
|
11962
|
+
const projectionMatrixRef = useRef25(new Matrix4());
|
|
11963
|
+
const visibilityCameraRef = useRef25(new PerspectiveCamera4());
|
|
11842
11964
|
useEffect25(() => {
|
|
11843
11965
|
currentLevelRef.current = 1;
|
|
11844
11966
|
layerTokenRef.current = "";
|
|
@@ -11996,8 +12118,8 @@ function SnapshotCapture({
|
|
|
11996
12118
|
onCaptured
|
|
11997
12119
|
}) {
|
|
11998
12120
|
const { camera, gl, scene, size } = useThree19();
|
|
11999
|
-
const capturedRequestRef =
|
|
12000
|
-
const renderTargetRef =
|
|
12121
|
+
const capturedRequestRef = useRef26(0);
|
|
12122
|
+
const renderTargetRef = useRef26(null);
|
|
12001
12123
|
useEffect26(
|
|
12002
12124
|
() => () => {
|
|
12003
12125
|
renderTargetRef.current?.dispose();
|
|
@@ -12056,11 +12178,11 @@ function ScenesController({
|
|
|
12056
12178
|
}) {
|
|
12057
12179
|
const controlsRef = useContext22(PanoramaViewContext);
|
|
12058
12180
|
const manager = useSharedTileTextureManager();
|
|
12059
|
-
const transition =
|
|
12181
|
+
const transition = useMemo20(
|
|
12060
12182
|
() => resolveTransition(transitionInput),
|
|
12061
12183
|
[transitionInput]
|
|
12062
12184
|
);
|
|
12063
|
-
const sceneMap =
|
|
12185
|
+
const sceneMap = useMemo20(
|
|
12064
12186
|
() => new Map(scenes.map((scene) => [scene.id, scene])),
|
|
12065
12187
|
[scenes]
|
|
12066
12188
|
);
|
|
@@ -12077,13 +12199,13 @@ function ScenesController({
|
|
|
12077
12199
|
const [transitionRunId, setTransitionRunId] = useState12(0);
|
|
12078
12200
|
const [snapshot, setSnapshot] = useState12(null);
|
|
12079
12201
|
const [recoveryKey, setRecoveryKey] = useState12(0);
|
|
12080
|
-
const requestedSceneIdRef =
|
|
12081
|
-
const captureReasonRef =
|
|
12082
|
-
const interactionReleaseRef =
|
|
12083
|
-
const slotsRef =
|
|
12084
|
-
const phaseRef =
|
|
12085
|
-
const liveSlotRef =
|
|
12086
|
-
const transitionFromRef =
|
|
12202
|
+
const requestedSceneIdRef = useRef26(activeSceneId);
|
|
12203
|
+
const captureReasonRef = useRef26("start");
|
|
12204
|
+
const interactionReleaseRef = useRef26(null);
|
|
12205
|
+
const slotsRef = useRef26(slots);
|
|
12206
|
+
const phaseRef = useRef26(phase);
|
|
12207
|
+
const liveSlotRef = useRef26(liveSlot);
|
|
12208
|
+
const transitionFromRef = useRef26(initialScene);
|
|
12087
12209
|
slotsRef.current = slots;
|
|
12088
12210
|
phaseRef.current = phase;
|
|
12089
12211
|
if (externalPhaseRef) {
|
|
@@ -12305,12 +12427,12 @@ function Scenes({
|
|
|
12305
12427
|
},
|
|
12306
12428
|
[isControlled, onActiveSceneIdChange]
|
|
12307
12429
|
);
|
|
12308
|
-
const scenesRef =
|
|
12430
|
+
const scenesRef = useRef26(scenes);
|
|
12309
12431
|
scenesRef.current = scenes;
|
|
12310
|
-
const resolvedIdRef =
|
|
12432
|
+
const resolvedIdRef = useRef26(resolvedId);
|
|
12311
12433
|
resolvedIdRef.current = resolvedId;
|
|
12312
12434
|
const host = useContext22(ScenesHostContext);
|
|
12313
|
-
const phaseRef =
|
|
12435
|
+
const phaseRef = useRef26("idle");
|
|
12314
12436
|
useEffect26(() => {
|
|
12315
12437
|
if (!host) {
|
|
12316
12438
|
return;
|
|
@@ -12381,7 +12503,7 @@ function Scenes({
|
|
|
12381
12503
|
|
|
12382
12504
|
// src/hotspot/image-hotspot.tsx
|
|
12383
12505
|
import { useThree as useThree21 } from "@react-three/fiber";
|
|
12384
|
-
import { useEffect as useEffect29, useRef as
|
|
12506
|
+
import { useEffect as useEffect29, useRef as useRef28, useState as useState15 } from "react";
|
|
12385
12507
|
import {
|
|
12386
12508
|
ClampToEdgeWrapping as ClampToEdgeWrapping3,
|
|
12387
12509
|
LinearFilter as LinearFilter6,
|
|
@@ -12396,8 +12518,8 @@ import {
|
|
|
12396
12518
|
useContext as useContext24,
|
|
12397
12519
|
useEffect as useEffect28,
|
|
12398
12520
|
useLayoutEffect as useLayoutEffect4,
|
|
12399
|
-
useMemo as
|
|
12400
|
-
useRef as
|
|
12521
|
+
useMemo as useMemo22,
|
|
12522
|
+
useRef as useRef27,
|
|
12401
12523
|
useState as useState14
|
|
12402
12524
|
} from "react";
|
|
12403
12525
|
import {
|
|
@@ -12414,7 +12536,7 @@ import {
|
|
|
12414
12536
|
} from "three";
|
|
12415
12537
|
|
|
12416
12538
|
// src/hotspot/hotspot-tooltip.tsx
|
|
12417
|
-
import { useEffect as useEffect27, useMemo as
|
|
12539
|
+
import { useEffect as useEffect27, useMemo as useMemo21, useState as useState13 } from "react";
|
|
12418
12540
|
|
|
12419
12541
|
// src/webvr/stereo-html.tsx
|
|
12420
12542
|
import { Html } from "@react-three/drei";
|
|
@@ -12542,11 +12664,11 @@ function HotspotTooltip({
|
|
|
12542
12664
|
setImageFailed(false);
|
|
12543
12665
|
}, [content.image]);
|
|
12544
12666
|
const showImage = Boolean(content.image) && !imageFailed;
|
|
12545
|
-
const resolvedAppearance =
|
|
12667
|
+
const resolvedAppearance = useMemo21(
|
|
12546
12668
|
() => resolveHotspotTooltipAppearance(appearance),
|
|
12547
12669
|
[appearance]
|
|
12548
12670
|
);
|
|
12549
|
-
const bubbleStyle =
|
|
12671
|
+
const bubbleStyle = useMemo21(
|
|
12550
12672
|
() => ({
|
|
12551
12673
|
background: resolvedAppearance.background,
|
|
12552
12674
|
border: resolvedAppearance.border,
|
|
@@ -12929,14 +13051,14 @@ function HotspotAnchor({
|
|
|
12929
13051
|
const eventBus = useContext24(PanoEventBusContext);
|
|
12930
13052
|
const cursorApi = usePanoCursor();
|
|
12931
13053
|
const { camera, size } = useThree20();
|
|
12932
|
-
const groupRef =
|
|
12933
|
-
const tooltipAnchorRef =
|
|
12934
|
-
const dragStateRef =
|
|
12935
|
-
const suppressNextClickRef =
|
|
13054
|
+
const groupRef = useRef27(null);
|
|
13055
|
+
const tooltipAnchorRef = useRef27(null);
|
|
13056
|
+
const dragStateRef = useRef27(null);
|
|
13057
|
+
const suppressNextClickRef = useRef27(false);
|
|
12936
13058
|
const [hovered, setHovered] = useState14(false);
|
|
12937
13059
|
const [dragging, setDragging] = useState14(false);
|
|
12938
13060
|
const [pinned, setPinned] = useState14(false);
|
|
12939
|
-
const tooltipContent =
|
|
13061
|
+
const tooltipContent = useMemo22(
|
|
12940
13062
|
() => resolveHotspotTooltipContent(tooltip),
|
|
12941
13063
|
[tooltip]
|
|
12942
13064
|
);
|
|
@@ -12952,17 +13074,17 @@ function HotspotAnchor({
|
|
|
12952
13074
|
scaledWidth,
|
|
12953
13075
|
scaledHeight
|
|
12954
13076
|
);
|
|
12955
|
-
const worldPosition =
|
|
13077
|
+
const worldPosition = useMemo22(
|
|
12956
13078
|
() => panoPositionToVector3(normalizedPosition, resolvedDistance),
|
|
12957
13079
|
[normalizedPosition.pitch, normalizedPosition.yaw, resolvedDistance]
|
|
12958
13080
|
);
|
|
12959
|
-
const surfaceQuaternion3 =
|
|
13081
|
+
const surfaceQuaternion3 = useMemo22(
|
|
12960
13082
|
() => createSurfaceQuaternion(normalizedPosition),
|
|
12961
13083
|
[normalizedPosition.pitch, normalizedPosition.yaw]
|
|
12962
13084
|
);
|
|
12963
13085
|
const worldWidth = angularSizeToWorldSize(scaledWidth, resolvedDistance);
|
|
12964
13086
|
const worldHeight = angularSizeToWorldSize(scaledHeight, resolvedDistance);
|
|
12965
|
-
const focusGeometry =
|
|
13087
|
+
const focusGeometry = useMemo22(() => {
|
|
12966
13088
|
const planeGeometry = new PlaneGeometry5(1, 1);
|
|
12967
13089
|
const geometry = new EdgesGeometry(planeGeometry);
|
|
12968
13090
|
planeGeometry.dispose();
|
|
@@ -13384,8 +13506,8 @@ import { jsx as jsx27 } from "react/jsx-runtime";
|
|
|
13384
13506
|
function useHotspotImageTexture(src, onLoad, onError) {
|
|
13385
13507
|
const gl = useThree21((state) => state.gl);
|
|
13386
13508
|
const [texture, setTexture] = useState15(null);
|
|
13387
|
-
const onLoadRef =
|
|
13388
|
-
const onErrorRef =
|
|
13509
|
+
const onLoadRef = useRef28(onLoad);
|
|
13510
|
+
const onErrorRef = useRef28(onError);
|
|
13389
13511
|
onLoadRef.current = onLoad;
|
|
13390
13512
|
onErrorRef.current = onError;
|
|
13391
13513
|
useEffect29(() => {
|
|
@@ -13448,7 +13570,7 @@ function ImageHotspot({
|
|
|
13448
13570
|
}
|
|
13449
13571
|
|
|
13450
13572
|
// src/hotspot/polygon-hotspot.tsx
|
|
13451
|
-
import { useEffect as useEffect30, useMemo as
|
|
13573
|
+
import { useEffect as useEffect30, useMemo as useMemo23, useRef as useRef30 } from "react";
|
|
13452
13574
|
import {
|
|
13453
13575
|
BufferGeometry,
|
|
13454
13576
|
DoubleSide as DoubleSide5,
|
|
@@ -13463,7 +13585,7 @@ import {
|
|
|
13463
13585
|
// src/hotspot/hotspot-stroke-line.tsx
|
|
13464
13586
|
import { Line } from "@react-three/drei";
|
|
13465
13587
|
import { useFrame as useFrame14, useThree as useThree22 } from "@react-three/fiber";
|
|
13466
|
-
import { useLayoutEffect as useLayoutEffect5, useRef as
|
|
13588
|
+
import { useLayoutEffect as useLayoutEffect5, useRef as useRef29 } from "react";
|
|
13467
13589
|
import {
|
|
13468
13590
|
MathUtils as MathUtils8,
|
|
13469
13591
|
PerspectiveCamera as PerspectiveCamera6,
|
|
@@ -13500,7 +13622,7 @@ function HotspotStrokeLine({
|
|
|
13500
13622
|
dashSize,
|
|
13501
13623
|
gapSize
|
|
13502
13624
|
}) {
|
|
13503
|
-
const lineRef =
|
|
13625
|
+
const lineRef = useRef29(null);
|
|
13504
13626
|
const { camera, size } = useThree22();
|
|
13505
13627
|
const dash = resolveDash(dashSize, gapSize);
|
|
13506
13628
|
useLayoutEffect5(() => {
|
|
@@ -13793,19 +13915,19 @@ function PolygonHotspot({
|
|
|
13793
13915
|
onInvalid,
|
|
13794
13916
|
...anchorProps
|
|
13795
13917
|
}) {
|
|
13796
|
-
const issues =
|
|
13918
|
+
const issues = useMemo23(() => validatePolygonVertices(vertices), [vertices]);
|
|
13797
13919
|
const valid = issues.length === 0;
|
|
13798
|
-
const center =
|
|
13799
|
-
const fillGeometry =
|
|
13920
|
+
const center = useMemo23(() => valid ? polygonCenter(vertices) : null, [valid, vertices]);
|
|
13921
|
+
const fillGeometry = useMemo23(
|
|
13800
13922
|
() => valid && center ? makeFillGeometry(vertices, center) : null,
|
|
13801
13923
|
[center, valid, vertices]
|
|
13802
13924
|
);
|
|
13803
|
-
const strokePoints =
|
|
13925
|
+
const strokePoints = useMemo23(
|
|
13804
13926
|
() => valid && center ? makeStrokePositions(vertices, center) : null,
|
|
13805
13927
|
[center, valid, vertices]
|
|
13806
13928
|
);
|
|
13807
13929
|
const resolvedStrokeOpacity = Math.max(0, Math.min(strokeOpacity, 1));
|
|
13808
|
-
const startVerticesRef =
|
|
13930
|
+
const startVerticesRef = useRef30(null);
|
|
13809
13931
|
const issuesKey = issues.map((issue) => issue.code).join(",");
|
|
13810
13932
|
useEffect30(() => {
|
|
13811
13933
|
if (!valid) onInvalid?.(issues);
|
|
@@ -13890,7 +14012,7 @@ function PolygonHotspot({
|
|
|
13890
14012
|
}
|
|
13891
14013
|
|
|
13892
14014
|
// src/hotspot/polyline-hotspot.tsx
|
|
13893
|
-
import { useEffect as useEffect31, useMemo as
|
|
14015
|
+
import { useEffect as useEffect31, useMemo as useMemo24, useRef as useRef31 } from "react";
|
|
13894
14016
|
import {
|
|
13895
14017
|
MathUtils as MathUtils9,
|
|
13896
14018
|
Matrix4 as Matrix44,
|
|
@@ -14014,15 +14136,15 @@ function PolylineHotspot({
|
|
|
14014
14136
|
onInvalid,
|
|
14015
14137
|
...anchorProps
|
|
14016
14138
|
}) {
|
|
14017
|
-
const issues =
|
|
14139
|
+
const issues = useMemo24(() => validatePolylineVertices(vertices), [vertices]);
|
|
14018
14140
|
const valid = issues.length === 0;
|
|
14019
|
-
const center =
|
|
14020
|
-
const linePoints =
|
|
14141
|
+
const center = useMemo24(() => valid ? polylineCenter(vertices) : null, [valid, vertices]);
|
|
14142
|
+
const linePoints = useMemo24(
|
|
14021
14143
|
() => valid && center ? makeLinePositions(vertices, center) : null,
|
|
14022
14144
|
[center, valid, vertices]
|
|
14023
14145
|
);
|
|
14024
14146
|
const opacity = Math.max(0, Math.min(strokeOpacity, 1));
|
|
14025
|
-
const startVerticesRef =
|
|
14147
|
+
const startVerticesRef = useRef31(null);
|
|
14026
14148
|
useEffect31(() => {
|
|
14027
14149
|
if (!valid) onInvalid?.(issues);
|
|
14028
14150
|
}, [issues, onInvalid, valid]);
|
|
@@ -14089,7 +14211,7 @@ function PolylineHotspot({
|
|
|
14089
14211
|
}
|
|
14090
14212
|
|
|
14091
14213
|
// src/hotspot/graphic-hotspot.tsx
|
|
14092
|
-
import { useEffect as useEffect32, useRef as
|
|
14214
|
+
import { useEffect as useEffect32, useRef as useRef32, useState as useState16 } from "react";
|
|
14093
14215
|
import {
|
|
14094
14216
|
CanvasTexture,
|
|
14095
14217
|
ClampToEdgeWrapping as ClampToEdgeWrapping4,
|
|
@@ -14287,8 +14409,8 @@ function createGraphicTexture(graphic, aspectWidth, aspectHeight) {
|
|
|
14287
14409
|
}
|
|
14288
14410
|
function useGraphicTexture(graphic, aspectWidth, aspectHeight, onLoad, onError) {
|
|
14289
14411
|
const [texture, setTexture] = useState16(null);
|
|
14290
|
-
const onLoadRef =
|
|
14291
|
-
const onErrorRef =
|
|
14412
|
+
const onLoadRef = useRef32(onLoad);
|
|
14413
|
+
const onErrorRef = useRef32(onError);
|
|
14292
14414
|
onLoadRef.current = onLoad;
|
|
14293
14415
|
onErrorRef.current = onError;
|
|
14294
14416
|
useEffect32(() => {
|
|
@@ -14330,7 +14452,7 @@ function GraphicHotspot(props) {
|
|
|
14330
14452
|
|
|
14331
14453
|
// src/hotspot/sequence-hotspot.tsx
|
|
14332
14454
|
import { useFrame as useFrame15, useThree as useThree23 } from "@react-three/fiber";
|
|
14333
|
-
import { useEffect as useEffect33, useRef as
|
|
14455
|
+
import { useEffect as useEffect33, useRef as useRef33, useState as useState17 } from "react";
|
|
14334
14456
|
import {
|
|
14335
14457
|
ClampToEdgeWrapping as ClampToEdgeWrapping5,
|
|
14336
14458
|
LinearFilter as LinearFilter8,
|
|
@@ -14354,8 +14476,8 @@ function useSpriteTexture({
|
|
|
14354
14476
|
}) {
|
|
14355
14477
|
const gl = useThree23((state) => state.gl);
|
|
14356
14478
|
const [texture, setTexture] = useState17(null);
|
|
14357
|
-
const onErrorRef =
|
|
14358
|
-
const onLoadProgressRef =
|
|
14479
|
+
const onErrorRef = useRef33(onError);
|
|
14480
|
+
const onLoadProgressRef = useRef33(onLoadProgress);
|
|
14359
14481
|
onErrorRef.current = onError;
|
|
14360
14482
|
onLoadProgressRef.current = onLoadProgress;
|
|
14361
14483
|
useEffect33(() => {
|
|
@@ -14429,13 +14551,13 @@ function SequenceHotspot({
|
|
|
14429
14551
|
const frameCount = resolveFrameCount(requestedFrameCount);
|
|
14430
14552
|
const safeFps = resolveFps(fps);
|
|
14431
14553
|
const [frameIndex, setFrameIndex] = useState17(0);
|
|
14432
|
-
const elapsedRef =
|
|
14433
|
-
const frameIndexRef =
|
|
14434
|
-
const endedRef =
|
|
14435
|
-
const lastPlaybackStateRef =
|
|
14436
|
-
const onFrameChangeRef =
|
|
14437
|
-
const onPlaybackStateChangeRef =
|
|
14438
|
-
const onEndedRef =
|
|
14554
|
+
const elapsedRef = useRef33(0);
|
|
14555
|
+
const frameIndexRef = useRef33(0);
|
|
14556
|
+
const endedRef = useRef33(false);
|
|
14557
|
+
const lastPlaybackStateRef = useRef33(null);
|
|
14558
|
+
const onFrameChangeRef = useRef33(onFrameChange);
|
|
14559
|
+
const onPlaybackStateChangeRef = useRef33(onPlaybackStateChange);
|
|
14560
|
+
const onEndedRef = useRef33(onEnded);
|
|
14439
14561
|
onFrameChangeRef.current = onFrameChange;
|
|
14440
14562
|
onPlaybackStateChangeRef.current = onPlaybackStateChange;
|
|
14441
14563
|
onEndedRef.current = onEnded;
|
|
@@ -14519,7 +14641,7 @@ function SequenceHotspot({
|
|
|
14519
14641
|
|
|
14520
14642
|
// src/hotspot/video-hotspot.tsx
|
|
14521
14643
|
import { useThree as useThree24 } from "@react-three/fiber";
|
|
14522
|
-
import { useEffect as useEffect34, useRef as
|
|
14644
|
+
import { useEffect as useEffect34, useRef as useRef34, useState as useState18 } from "react";
|
|
14523
14645
|
import {
|
|
14524
14646
|
ClampToEdgeWrapping as ClampToEdgeWrapping6,
|
|
14525
14647
|
LinearFilter as LinearFilter9,
|
|
@@ -14538,7 +14660,7 @@ function clampVolume2(volume) {
|
|
|
14538
14660
|
function usePosterTexture2(id, poster, onError) {
|
|
14539
14661
|
const gl = useThree24((state) => state.gl);
|
|
14540
14662
|
const [texture, setTexture] = useState18(null);
|
|
14541
|
-
const onErrorRef =
|
|
14663
|
+
const onErrorRef = useRef34(onError);
|
|
14542
14664
|
onErrorRef.current = onError;
|
|
14543
14665
|
useEffect34(() => {
|
|
14544
14666
|
let active = true;
|
|
@@ -14596,9 +14718,9 @@ function useVideoResource({
|
|
|
14596
14718
|
src
|
|
14597
14719
|
}) {
|
|
14598
14720
|
const [resource, setResource] = useState18(null);
|
|
14599
|
-
const onEndedRef =
|
|
14600
|
-
const onErrorRef =
|
|
14601
|
-
const onPlaybackStateChangeRef =
|
|
14721
|
+
const onEndedRef = useRef34(onEnded);
|
|
14722
|
+
const onErrorRef = useRef34(onError);
|
|
14723
|
+
const onPlaybackStateChangeRef = useRef34(onPlaybackStateChange);
|
|
14602
14724
|
onEndedRef.current = onEnded;
|
|
14603
14725
|
onErrorRef.current = onError;
|
|
14604
14726
|
onPlaybackStateChangeRef.current = onPlaybackStateChange;
|
|
@@ -14703,8 +14825,8 @@ function VideoHotspot({
|
|
|
14703
14825
|
src
|
|
14704
14826
|
});
|
|
14705
14827
|
const posterTexture = usePosterTexture2(id, poster, onError);
|
|
14706
|
-
const onPlaybackErrorRef =
|
|
14707
|
-
const onPlaybackStateChangeRef =
|
|
14828
|
+
const onPlaybackErrorRef = useRef34(onPlaybackError);
|
|
14829
|
+
const onPlaybackStateChangeRef = useRef34(onPlaybackStateChange);
|
|
14708
14830
|
onPlaybackErrorRef.current = onPlaybackError;
|
|
14709
14831
|
onPlaybackStateChangeRef.current = onPlaybackStateChange;
|
|
14710
14832
|
useEffect34(() => {
|
|
@@ -14745,7 +14867,7 @@ function VideoHotspot({
|
|
|
14745
14867
|
|
|
14746
14868
|
// src/hotspot/audio-hotspot.tsx
|
|
14747
14869
|
import { useFrame as useFrame16, useThree as useThree25 } from "@react-three/fiber";
|
|
14748
|
-
import { useEffect as useEffect35, useRef as
|
|
14870
|
+
import { useEffect as useEffect35, useRef as useRef35, useState as useState19 } from "react";
|
|
14749
14871
|
import {
|
|
14750
14872
|
CanvasTexture as CanvasTexture2,
|
|
14751
14873
|
ClampToEdgeWrapping as ClampToEdgeWrapping7,
|
|
@@ -14837,7 +14959,7 @@ function useSpeakerTextures(enabled) {
|
|
|
14837
14959
|
function useIconTexture(icon, enabled, onError, id) {
|
|
14838
14960
|
const gl = useThree25((state) => state.gl);
|
|
14839
14961
|
const [texture, setTexture] = useState19(null);
|
|
14840
|
-
const onErrorRef =
|
|
14962
|
+
const onErrorRef = useRef35(onError);
|
|
14841
14963
|
onErrorRef.current = onError;
|
|
14842
14964
|
useEffect35(() => {
|
|
14843
14965
|
let active = true;
|
|
@@ -14896,12 +15018,12 @@ function useAudioHowl({
|
|
|
14896
15018
|
src
|
|
14897
15019
|
}) {
|
|
14898
15020
|
const [howl, setHowl] = useState19(null);
|
|
14899
|
-
const playingRef =
|
|
14900
|
-
const loopRef =
|
|
14901
|
-
const onEndedRef =
|
|
14902
|
-
const onErrorRef =
|
|
14903
|
-
const onPlaybackErrorRef =
|
|
14904
|
-
const onPlaybackStateChangeRef =
|
|
15021
|
+
const playingRef = useRef35(playing);
|
|
15022
|
+
const loopRef = useRef35(loop ?? false);
|
|
15023
|
+
const onEndedRef = useRef35(onEnded);
|
|
15024
|
+
const onErrorRef = useRef35(onError);
|
|
15025
|
+
const onPlaybackErrorRef = useRef35(onPlaybackError);
|
|
15026
|
+
const onPlaybackStateChangeRef = useRef35(onPlaybackStateChange);
|
|
14905
15027
|
playingRef.current = playing;
|
|
14906
15028
|
loopRef.current = loop ?? false;
|
|
14907
15029
|
onEndedRef.current = onEnded;
|
|
@@ -14989,11 +15111,11 @@ function AudioHotspot({
|
|
|
14989
15111
|
const stoppedIconTexture = useIconTexture(icon, marker, onError, id);
|
|
14990
15112
|
const playingIconTexture = useIconTexture(playingIcon, marker, onError, id);
|
|
14991
15113
|
const markerTexture = playing ? playingIconTexture ?? stoppedIconTexture ?? speakerTextures.playing : stoppedIconTexture ?? speakerTextures.stopped;
|
|
14992
|
-
const playingRef =
|
|
15114
|
+
const playingRef = useRef35(playing);
|
|
14993
15115
|
playingRef.current = playing;
|
|
14994
|
-
const mutedRef =
|
|
14995
|
-
const volumeRef =
|
|
14996
|
-
const rangeRef =
|
|
15116
|
+
const mutedRef = useRef35(muted);
|
|
15117
|
+
const volumeRef = useRef35(volume);
|
|
15118
|
+
const rangeRef = useRef35(range);
|
|
14997
15119
|
mutedRef.current = muted;
|
|
14998
15120
|
volumeRef.current = volume;
|
|
14999
15121
|
rangeRef.current = range;
|
|
@@ -15042,7 +15164,7 @@ function AudioHotspot({
|
|
|
15042
15164
|
}
|
|
15043
15165
|
|
|
15044
15166
|
// src/hotspot/text-hotspot.tsx
|
|
15045
|
-
import { useEffect as useEffect36, useRef as
|
|
15167
|
+
import { useEffect as useEffect36, useRef as useRef36, useState as useState20 } from "react";
|
|
15046
15168
|
import {
|
|
15047
15169
|
CanvasTexture as CanvasTexture3,
|
|
15048
15170
|
ClampToEdgeWrapping as ClampToEdgeWrapping8,
|
|
@@ -15271,8 +15393,8 @@ function createTextTexture(text, width, height, style) {
|
|
|
15271
15393
|
}
|
|
15272
15394
|
function useTextTexture(text, width, height, style, onLoad, onError) {
|
|
15273
15395
|
const [texture, setTexture] = useState20(null);
|
|
15274
|
-
const onLoadRef =
|
|
15275
|
-
const onErrorRef =
|
|
15396
|
+
const onLoadRef = useRef36(onLoad);
|
|
15397
|
+
const onErrorRef = useRef36(onError);
|
|
15276
15398
|
onLoadRef.current = onLoad;
|
|
15277
15399
|
onErrorRef.current = onError;
|
|
15278
15400
|
useEffect36(() => {
|
|
@@ -15538,6 +15660,7 @@ export {
|
|
|
15538
15660
|
resolvePanoContextMenuEntries,
|
|
15539
15661
|
unwrapPolygonVertices,
|
|
15540
15662
|
usePanoEvents,
|
|
15663
|
+
usePanoViewer,
|
|
15541
15664
|
validatePolygonVertices,
|
|
15542
15665
|
validatePolylineVertices,
|
|
15543
15666
|
vector3ToPanoPosition
|