@ericchen1990/pano-view 2.4.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -61
- package/README.zh-CN.md +63 -61
- package/dist/index.cjs +356 -271
- 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 +230 -146
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -9178,9 +9178,92 @@ var WebVR = forwardRef4(function WebVR2({
|
|
|
9178
9178
|
] });
|
|
9179
9179
|
});
|
|
9180
9180
|
|
|
9181
|
+
// src/use-pano-viewer.ts
|
|
9182
|
+
import { useMemo as useMemo12, useRef as useRef19 } from "react";
|
|
9183
|
+
function createPanoViewerHandle(ref) {
|
|
9184
|
+
return {
|
|
9185
|
+
getView: () => ref.current?.getView() ?? { yaw: 0, pitch: 0, fov: 75 },
|
|
9186
|
+
setView: (view, options) => {
|
|
9187
|
+
ref.current?.setView(view, options);
|
|
9188
|
+
},
|
|
9189
|
+
reset: () => {
|
|
9190
|
+
ref.current?.reset();
|
|
9191
|
+
},
|
|
9192
|
+
enterFullscreen: () => ref.current?.enterFullscreen() ?? Promise.resolve(),
|
|
9193
|
+
exitFullscreen: () => ref.current?.exitFullscreen() ?? Promise.resolve(),
|
|
9194
|
+
toggleFullscreen: () => ref.current?.toggleFullscreen() ?? Promise.resolve(),
|
|
9195
|
+
isFullscreen: () => ref.current?.isFullscreen() ?? false,
|
|
9196
|
+
setScene: (id) => ref.current?.setScene(id) ?? false,
|
|
9197
|
+
nextScene: () => ref.current?.nextScene() ?? false,
|
|
9198
|
+
previousScene: () => ref.current?.previousScene() ?? false,
|
|
9199
|
+
getActiveSceneId: () => ref.current?.getActiveSceneId() ?? null,
|
|
9200
|
+
getSceneIds: () => ref.current?.getSceneIds() ?? [],
|
|
9201
|
+
isSceneTransitioning: () => ref.current?.isSceneTransitioning() ?? false,
|
|
9202
|
+
enterVR: () => ref.current?.enterVR() ?? Promise.resolve(false),
|
|
9203
|
+
exitVR: () => ref.current?.exitVR() ?? Promise.resolve(),
|
|
9204
|
+
toggleVR: () => ref.current?.toggleVR() ?? Promise.resolve(false),
|
|
9205
|
+
isVRAvailable: () => ref.current?.isVRAvailable() ?? false,
|
|
9206
|
+
isVREnabled: () => ref.current?.isVREnabled() ?? false,
|
|
9207
|
+
getVRMode: () => ref.current?.getVRMode() ?? null,
|
|
9208
|
+
requestVRPermission: () => ref.current?.requestVRPermission() ?? Promise.resolve(false),
|
|
9209
|
+
getVideo: () => ref.current?.getVideo() ?? null,
|
|
9210
|
+
subscribeVideo: (onStoreChange) => ref.current?.subscribeVideo(onStoreChange) ?? (() => {
|
|
9211
|
+
}),
|
|
9212
|
+
playVideo: () => ref.current?.playVideo() ?? Promise.resolve(),
|
|
9213
|
+
pauseVideo: () => {
|
|
9214
|
+
ref.current?.pauseVideo();
|
|
9215
|
+
},
|
|
9216
|
+
toggleVideo: () => {
|
|
9217
|
+
ref.current?.toggleVideo();
|
|
9218
|
+
},
|
|
9219
|
+
seekVideo: (time) => {
|
|
9220
|
+
ref.current?.seekVideo(time);
|
|
9221
|
+
},
|
|
9222
|
+
setVideoVolume: (volume) => {
|
|
9223
|
+
ref.current?.setVideoVolume(volume);
|
|
9224
|
+
},
|
|
9225
|
+
setVideoMuted: (muted) => {
|
|
9226
|
+
ref.current?.setVideoMuted(muted);
|
|
9227
|
+
},
|
|
9228
|
+
toggleVideoMuted: () => {
|
|
9229
|
+
ref.current?.toggleVideoMuted();
|
|
9230
|
+
},
|
|
9231
|
+
getBackgroundAudio: () => ref.current?.getBackgroundAudio() ?? null,
|
|
9232
|
+
subscribeBackgroundAudio: (onStoreChange) => ref.current?.subscribeBackgroundAudio(onStoreChange) ?? (() => {
|
|
9233
|
+
}),
|
|
9234
|
+
playBackgroundAudio: () => ref.current?.playBackgroundAudio() ?? Promise.resolve(),
|
|
9235
|
+
pauseBackgroundAudio: () => {
|
|
9236
|
+
ref.current?.pauseBackgroundAudio();
|
|
9237
|
+
},
|
|
9238
|
+
toggleBackgroundAudio: () => {
|
|
9239
|
+
ref.current?.toggleBackgroundAudio();
|
|
9240
|
+
},
|
|
9241
|
+
setBackgroundAudioVolume: (volume) => {
|
|
9242
|
+
ref.current?.setBackgroundAudioVolume(volume);
|
|
9243
|
+
},
|
|
9244
|
+
setBackgroundAudioMuted: (muted) => {
|
|
9245
|
+
ref.current?.setBackgroundAudioMuted(muted);
|
|
9246
|
+
},
|
|
9247
|
+
toggleBackgroundAudioMuted: () => {
|
|
9248
|
+
ref.current?.toggleBackgroundAudioMuted();
|
|
9249
|
+
},
|
|
9250
|
+
startAutoRotate: () => {
|
|
9251
|
+
ref.current?.startAutoRotate();
|
|
9252
|
+
},
|
|
9253
|
+
stopAutoRotate: () => {
|
|
9254
|
+
ref.current?.stopAutoRotate();
|
|
9255
|
+
}
|
|
9256
|
+
};
|
|
9257
|
+
}
|
|
9258
|
+
function usePanoViewer() {
|
|
9259
|
+
const ref = useRef19(null);
|
|
9260
|
+
const handle = useMemo12(() => createPanoViewerHandle(ref), []);
|
|
9261
|
+
return useMemo12(() => ({ ref, ...handle }), [handle]);
|
|
9262
|
+
}
|
|
9263
|
+
|
|
9181
9264
|
// src/sphere.tsx
|
|
9182
9265
|
import { useThree as useThree13 } from "@react-three/fiber";
|
|
9183
|
-
import { useEffect as useEffect20, useMemo as
|
|
9266
|
+
import { useEffect as useEffect20, useMemo as useMemo14, useRef as useRef21, useState as useState9 } from "react";
|
|
9184
9267
|
import {
|
|
9185
9268
|
BackSide as BackSide2,
|
|
9186
9269
|
LinearFilter,
|
|
@@ -9213,7 +9296,7 @@ function resolveUrlAgainstFile(fileUrl, path) {
|
|
|
9213
9296
|
}
|
|
9214
9297
|
|
|
9215
9298
|
// src/pano-filter/pano-basic-material.tsx
|
|
9216
|
-
import { useLayoutEffect as useLayoutEffect2, useMemo as
|
|
9299
|
+
import { useLayoutEffect as useLayoutEffect2, useMemo as useMemo13, useRef as useRef20 } from "react";
|
|
9217
9300
|
|
|
9218
9301
|
// src/pano-filter/shaders.ts
|
|
9219
9302
|
var GLSL_FILTER_COMMON = `
|
|
@@ -9373,13 +9456,13 @@ function PanoBasicMaterial({
|
|
|
9373
9456
|
toneMapped = false
|
|
9374
9457
|
}) {
|
|
9375
9458
|
const snapshot = usePanoFilterSnapshot();
|
|
9376
|
-
const materialRef =
|
|
9377
|
-
const intensityRef =
|
|
9378
|
-
const intensityUniformRef =
|
|
9459
|
+
const materialRef = useRef20(null);
|
|
9460
|
+
const intensityRef = useRef20(snapshot.intensity);
|
|
9461
|
+
const intensityUniformRef = useRef20(null);
|
|
9379
9462
|
intensityRef.current = snapshot.intensity;
|
|
9380
9463
|
const active = isPanoFilterActive(snapshot);
|
|
9381
9464
|
const preset = snapshot.preset;
|
|
9382
|
-
const onBeforeCompile =
|
|
9465
|
+
const onBeforeCompile = useMemo13(() => {
|
|
9383
9466
|
if (!active || preset === "none") {
|
|
9384
9467
|
return void 0;
|
|
9385
9468
|
}
|
|
@@ -9430,8 +9513,8 @@ function PanoBasicMaterial({
|
|
|
9430
9513
|
import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
9431
9514
|
function useEquirectTexture(url, anisotropy, generateMipmaps, onLoad, onError) {
|
|
9432
9515
|
const [texture, setTexture] = useState9(null);
|
|
9433
|
-
const onLoadRef =
|
|
9434
|
-
const onErrorRef =
|
|
9516
|
+
const onLoadRef = useRef21(onLoad);
|
|
9517
|
+
const onErrorRef = useRef21(onError);
|
|
9435
9518
|
onLoadRef.current = onLoad;
|
|
9436
9519
|
onErrorRef.current = onError;
|
|
9437
9520
|
useEffect20(() => {
|
|
@@ -9493,7 +9576,7 @@ function Sphere({
|
|
|
9493
9576
|
}) {
|
|
9494
9577
|
const gl = useThree13((state) => state.gl);
|
|
9495
9578
|
const anisotropy = gl.capabilities.getMaxAnisotropy();
|
|
9496
|
-
const resolvedPreviewUrl =
|
|
9579
|
+
const resolvedPreviewUrl = useMemo14(
|
|
9497
9580
|
() => resolveUrlAgainstFile(src, previewUrl),
|
|
9498
9581
|
[previewUrl, src]
|
|
9499
9582
|
);
|
|
@@ -9512,7 +9595,7 @@ function Sphere({
|
|
|
9512
9595
|
onPreviewError
|
|
9513
9596
|
);
|
|
9514
9597
|
const displayTexture = texture ?? previewTexture;
|
|
9515
|
-
const readyRef =
|
|
9598
|
+
const readyRef = useRef21(false);
|
|
9516
9599
|
useEffect20(() => {
|
|
9517
9600
|
readyRef.current = false;
|
|
9518
9601
|
}, [resolvedPreviewUrl, src]);
|
|
@@ -9553,8 +9636,8 @@ import {
|
|
|
9553
9636
|
useContext as useContext20,
|
|
9554
9637
|
useEffect as useEffect21,
|
|
9555
9638
|
useLayoutEffect as useLayoutEffect3,
|
|
9556
|
-
useMemo as
|
|
9557
|
-
useRef as
|
|
9639
|
+
useMemo as useMemo15,
|
|
9640
|
+
useRef as useRef22,
|
|
9558
9641
|
useState as useState10
|
|
9559
9642
|
} from "react";
|
|
9560
9643
|
import {
|
|
@@ -9653,7 +9736,7 @@ function applyEquirectangularLayout(texture, anisotropy) {
|
|
|
9653
9736
|
function usePosterTexture(poster, onError) {
|
|
9654
9737
|
const gl = useThree14((state) => state.gl);
|
|
9655
9738
|
const [texture, setTexture] = useState10(null);
|
|
9656
|
-
const onErrorRef =
|
|
9739
|
+
const onErrorRef = useRef22(onError);
|
|
9657
9740
|
onErrorRef.current = onError;
|
|
9658
9741
|
useEffect21(() => {
|
|
9659
9742
|
let active = true;
|
|
@@ -9752,13 +9835,13 @@ function PanoVideo({
|
|
|
9752
9835
|
const gl = useThree14((state) => state.gl);
|
|
9753
9836
|
const host = useContext20(PanoVideoHostContext);
|
|
9754
9837
|
const overlay = useContext20(PanoChromeOverlayContext);
|
|
9755
|
-
const variants =
|
|
9838
|
+
const variants = useMemo15(
|
|
9756
9839
|
() => resolvePanoVideoVariants({ poster, src, variants: variantsProp }),
|
|
9757
9840
|
[poster, src, variantsProp]
|
|
9758
9841
|
);
|
|
9759
9842
|
const tracks = tracksProp ?? EMPTY_TRACKS;
|
|
9760
9843
|
const captionsEnabled = captions !== false;
|
|
9761
|
-
const captionAppearance =
|
|
9844
|
+
const captionAppearance = useMemo15(
|
|
9762
9845
|
() => resolvePanoVideoCaptionAppearance(
|
|
9763
9846
|
typeof captions === "object" ? captions : void 0
|
|
9764
9847
|
),
|
|
@@ -9771,17 +9854,17 @@ function PanoVideo({
|
|
|
9771
9854
|
() => captionsEnabled ? defaultPanoVideoTrackId(tracks) : null
|
|
9772
9855
|
);
|
|
9773
9856
|
const [ready, setReady] = useState10(false);
|
|
9774
|
-
const autoPlayRef =
|
|
9857
|
+
const autoPlayRef = useRef22(autoPlay);
|
|
9775
9858
|
autoPlayRef.current = autoPlay;
|
|
9776
|
-
const blockedRef =
|
|
9777
|
-
const captionAppearanceOverrideRef =
|
|
9859
|
+
const blockedRef = useRef22(false);
|
|
9860
|
+
const captionAppearanceOverrideRef = useRef22(
|
|
9778
9861
|
{}
|
|
9779
9862
|
);
|
|
9780
|
-
const mediaCapabilitiesRef =
|
|
9863
|
+
const mediaCapabilitiesRef = useRef22({
|
|
9781
9864
|
volumeAdjustable: true,
|
|
9782
9865
|
playbackRates: [...DEFAULT_PANO_VIDEO_PLAYBACK_RATES]
|
|
9783
9866
|
});
|
|
9784
|
-
const storeRef =
|
|
9867
|
+
const storeRef = useRef22(null);
|
|
9785
9868
|
if (!storeRef.current) {
|
|
9786
9869
|
storeRef.current = {
|
|
9787
9870
|
snapshot: {
|
|
@@ -9791,7 +9874,7 @@ function PanoVideo({
|
|
|
9791
9874
|
listeners: /* @__PURE__ */ new Set()
|
|
9792
9875
|
};
|
|
9793
9876
|
}
|
|
9794
|
-
const actionsRef =
|
|
9877
|
+
const actionsRef = useRef22({
|
|
9795
9878
|
play: async () => {
|
|
9796
9879
|
},
|
|
9797
9880
|
pause: () => {
|
|
@@ -9811,19 +9894,19 @@ function PanoVideo({
|
|
|
9811
9894
|
setCaptionAppearance: (_appearance) => {
|
|
9812
9895
|
}
|
|
9813
9896
|
});
|
|
9814
|
-
const onLoadRef =
|
|
9815
|
-
const onErrorRef =
|
|
9816
|
-
const onPlaybackStateChangeRef =
|
|
9817
|
-
const onEndedRef =
|
|
9818
|
-
const onVariantChangeRef =
|
|
9819
|
-
const onTrackChangeRef =
|
|
9897
|
+
const onLoadRef = useRef22(onLoad);
|
|
9898
|
+
const onErrorRef = useRef22(onError);
|
|
9899
|
+
const onPlaybackStateChangeRef = useRef22(onPlaybackStateChange);
|
|
9900
|
+
const onEndedRef = useRef22(onEnded);
|
|
9901
|
+
const onVariantChangeRef = useRef22(onVariantChange);
|
|
9902
|
+
const onTrackChangeRef = useRef22(onTrackChange);
|
|
9820
9903
|
onLoadRef.current = onLoad;
|
|
9821
9904
|
onErrorRef.current = onError;
|
|
9822
9905
|
onPlaybackStateChangeRef.current = onPlaybackStateChange;
|
|
9823
9906
|
onEndedRef.current = onEnded;
|
|
9824
9907
|
onVariantChangeRef.current = onVariantChange;
|
|
9825
9908
|
onTrackChangeRef.current = onTrackChange;
|
|
9826
|
-
const resource =
|
|
9909
|
+
const resource = useMemo15(() => {
|
|
9827
9910
|
if (typeof document === "undefined") {
|
|
9828
9911
|
return null;
|
|
9829
9912
|
}
|
|
@@ -9936,7 +10019,7 @@ function PanoVideo({
|
|
|
9936
10019
|
captionAppearance
|
|
9937
10020
|
]
|
|
9938
10021
|
);
|
|
9939
|
-
const controller =
|
|
10022
|
+
const controller = useMemo15(
|
|
9940
10023
|
() => ({
|
|
9941
10024
|
subscribe: (onStoreChange) => {
|
|
9942
10025
|
const store = storeRef.current;
|
|
@@ -10303,8 +10386,8 @@ import {
|
|
|
10303
10386
|
useCallback as useCallback10,
|
|
10304
10387
|
useContext as useContext22,
|
|
10305
10388
|
useEffect as useEffect26,
|
|
10306
|
-
useMemo as
|
|
10307
|
-
useRef as
|
|
10389
|
+
useMemo as useMemo20,
|
|
10390
|
+
useRef as useRef26,
|
|
10308
10391
|
useState as useState12
|
|
10309
10392
|
} from "react";
|
|
10310
10393
|
import {
|
|
@@ -10361,7 +10444,7 @@ function isSnapshotTransition(preset) {
|
|
|
10361
10444
|
|
|
10362
10445
|
// src/scene-transitions/particle-overlay.tsx
|
|
10363
10446
|
import { useFrame as useFrame9, useThree as useThree15 } from "@react-three/fiber";
|
|
10364
|
-
import { useEffect as useEffect22, useMemo as
|
|
10447
|
+
import { useEffect as useEffect22, useMemo as useMemo16, useRef as useRef23 } from "react";
|
|
10365
10448
|
import {
|
|
10366
10449
|
DoubleSide as DoubleSide2,
|
|
10367
10450
|
InstancedBufferAttribute,
|
|
@@ -10501,12 +10584,12 @@ function ParticleOverlay({
|
|
|
10501
10584
|
onFinish
|
|
10502
10585
|
}) {
|
|
10503
10586
|
const { camera } = useThree15();
|
|
10504
|
-
const meshRef =
|
|
10505
|
-
const startRef =
|
|
10506
|
-
const finishedRef =
|
|
10507
|
-
const directionRef =
|
|
10508
|
-
const geometry =
|
|
10509
|
-
const material =
|
|
10587
|
+
const meshRef = useRef23(null);
|
|
10588
|
+
const startRef = useRef23(null);
|
|
10589
|
+
const finishedRef = useRef23(false);
|
|
10590
|
+
const directionRef = useRef23(new Vector39());
|
|
10591
|
+
const geometry = useMemo16(() => createParticleGeometry(), []);
|
|
10592
|
+
const material = useMemo16(
|
|
10510
10593
|
() => new ShaderMaterial2({
|
|
10511
10594
|
transparent: true,
|
|
10512
10595
|
depthTest: false,
|
|
@@ -10560,7 +10643,7 @@ function ParticleOverlay({
|
|
|
10560
10643
|
|
|
10561
10644
|
// src/scene-transitions/snapshot-overlay.tsx
|
|
10562
10645
|
import { useFrame as useFrame10, useThree as useThree16 } from "@react-three/fiber";
|
|
10563
|
-
import { useEffect as useEffect23, useMemo as
|
|
10646
|
+
import { useEffect as useEffect23, useMemo as useMemo17, useRef as useRef24 } from "react";
|
|
10564
10647
|
import { Vector3 as Vector310 } from "three";
|
|
10565
10648
|
|
|
10566
10649
|
// src/scene-transitions/snapshot-shaders.ts
|
|
@@ -10849,11 +10932,11 @@ function SnapshotOverlay({
|
|
|
10849
10932
|
onFinish
|
|
10850
10933
|
}) {
|
|
10851
10934
|
const { camera, gl } = useThree16();
|
|
10852
|
-
const meshRef =
|
|
10853
|
-
const startRef =
|
|
10854
|
-
const finishedRef =
|
|
10855
|
-
const directionRef =
|
|
10856
|
-
const material =
|
|
10935
|
+
const meshRef = useRef24(null);
|
|
10936
|
+
const startRef = useRef24(null);
|
|
10937
|
+
const finishedRef = useRef24(false);
|
|
10938
|
+
const directionRef = useRef24(new Vector310());
|
|
10939
|
+
const material = useMemo17(() => {
|
|
10857
10940
|
if (!isSnapshotTransition(transition.preset)) {
|
|
10858
10941
|
return null;
|
|
10859
10942
|
}
|
|
@@ -10946,7 +11029,7 @@ import {
|
|
|
10946
11029
|
createContext as createContext13,
|
|
10947
11030
|
useContext as useContext21,
|
|
10948
11031
|
useEffect as useEffect24,
|
|
10949
|
-
useMemo as
|
|
11032
|
+
useMemo as useMemo18
|
|
10950
11033
|
} from "react";
|
|
10951
11034
|
|
|
10952
11035
|
// src/tile/texture-manager.ts
|
|
@@ -11187,7 +11270,7 @@ function TileTextureManagerProvider({
|
|
|
11187
11270
|
}) {
|
|
11188
11271
|
const gl = useThree17((state) => state.gl);
|
|
11189
11272
|
const anisotropy = gl.capabilities.getMaxAnisotropy();
|
|
11190
|
-
const manager =
|
|
11273
|
+
const manager = useMemo18(
|
|
11191
11274
|
() => new TileTextureManager({
|
|
11192
11275
|
anisotropy,
|
|
11193
11276
|
maxBytes: Math.max(1, maxTextureMemoryMb) * 1024 * 1024,
|
|
@@ -11211,8 +11294,8 @@ import { useFrame as useFrame11, useThree as useThree18 } from "@react-three/fib
|
|
|
11211
11294
|
import {
|
|
11212
11295
|
memo,
|
|
11213
11296
|
useEffect as useEffect25,
|
|
11214
|
-
useMemo as
|
|
11215
|
-
useRef as
|
|
11297
|
+
useMemo as useMemo19,
|
|
11298
|
+
useRef as useRef25,
|
|
11216
11299
|
useState as useState11
|
|
11217
11300
|
} from "react";
|
|
11218
11301
|
import {
|
|
@@ -11419,7 +11502,7 @@ var PREVIEW_RADIUS = CUBE_RADIUS + 0.05;
|
|
|
11419
11502
|
var SHARED_TILE_GEOMETRY = new PlaneGeometry4(1, 1);
|
|
11420
11503
|
function usePreviewTexture(url, anisotropy, onError) {
|
|
11421
11504
|
const [texture, setTexture] = useState11(null);
|
|
11422
|
-
const onErrorRef =
|
|
11505
|
+
const onErrorRef = useRef25(onError);
|
|
11423
11506
|
onErrorRef.current = onError;
|
|
11424
11507
|
useEffect25(() => {
|
|
11425
11508
|
if (!url) {
|
|
@@ -11471,7 +11554,7 @@ function PreviewFace({
|
|
|
11471
11554
|
texture,
|
|
11472
11555
|
faceOrder
|
|
11473
11556
|
}) {
|
|
11474
|
-
const geometry =
|
|
11557
|
+
const geometry = useMemo19(() => {
|
|
11475
11558
|
const nextGeometry = new PlaneGeometry4(
|
|
11476
11559
|
PREVIEW_RADIUS * 2,
|
|
11477
11560
|
PREVIEW_RADIUS * 2
|
|
@@ -11757,10 +11840,10 @@ function Tile({
|
|
|
11757
11840
|
onLevelChange
|
|
11758
11841
|
}) {
|
|
11759
11842
|
const { camera, gl, size } = useThree18();
|
|
11760
|
-
const multiresConfig =
|
|
11843
|
+
const multiresConfig = useMemo19(() => parseMultires(multires), [multires]);
|
|
11761
11844
|
const { levels, tileSize } = multiresConfig;
|
|
11762
11845
|
const multiresToken = `${tileSize}:${levels.join(",")}`;
|
|
11763
|
-
const candidatesByLevel =
|
|
11846
|
+
const candidatesByLevel = useMemo19(
|
|
11764
11847
|
() => buildTileCandidates(levels, tileSize),
|
|
11765
11848
|
[levels, tileSize]
|
|
11766
11849
|
);
|
|
@@ -11772,13 +11855,13 @@ function Tile({
|
|
|
11772
11855
|
onPreviewError
|
|
11773
11856
|
);
|
|
11774
11857
|
const sharedManager = useSharedTileTextureManager();
|
|
11775
|
-
const progressRef =
|
|
11776
|
-
const errorRef =
|
|
11777
|
-
const levelChangeRef =
|
|
11858
|
+
const progressRef = useRef25(onLoadProgress);
|
|
11859
|
+
const errorRef = useRef25(onTileError);
|
|
11860
|
+
const levelChangeRef = useRef25(onLevelChange);
|
|
11778
11861
|
progressRef.current = onLoadProgress;
|
|
11779
11862
|
errorRef.current = onTileError;
|
|
11780
11863
|
levelChangeRef.current = onLevelChange;
|
|
11781
|
-
const ownedManager =
|
|
11864
|
+
const ownedManager = useMemo19(
|
|
11782
11865
|
() => new TileTextureManager({
|
|
11783
11866
|
anisotropy,
|
|
11784
11867
|
maxBytes: Math.max(1, maxTextureMemoryMb) * 1024 * 1024,
|
|
@@ -11809,7 +11892,7 @@ function Tile({
|
|
|
11809
11892
|
queueMicrotask(() => manager.releaseUnused());
|
|
11810
11893
|
};
|
|
11811
11894
|
}, [manager, ownedManager]);
|
|
11812
|
-
const readyRef =
|
|
11895
|
+
const readyRef = useRef25(false);
|
|
11813
11896
|
useEffect25(() => {
|
|
11814
11897
|
readyRef.current = false;
|
|
11815
11898
|
}, [effectivePreviewUrl]);
|
|
@@ -11821,7 +11904,7 @@ function Tile({
|
|
|
11821
11904
|
onReady?.();
|
|
11822
11905
|
}, [onReady, previewTexture]);
|
|
11823
11906
|
const template = urlTemplate ?? buildDefaultTileUrlTemplate();
|
|
11824
|
-
const resolveUrl =
|
|
11907
|
+
const resolveUrl = useMemo19(
|
|
11825
11908
|
() => (address) => {
|
|
11826
11909
|
const relativePath = resolveTileUrl ? resolveTileUrl(address) : resolveTemplateUrl(template, address);
|
|
11827
11910
|
return resolveRelativeTileUrl(baseUrl, relativePath);
|
|
@@ -11829,16 +11912,16 @@ function Tile({
|
|
|
11829
11912
|
[baseUrl, resolveTileUrl, template]
|
|
11830
11913
|
);
|
|
11831
11914
|
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 =
|
|
11915
|
+
const layerTokenRef = useRef25("");
|
|
11916
|
+
const currentLevelRef = useRef25(1);
|
|
11917
|
+
const lastUpdateAtRef = useRef25(-Infinity);
|
|
11918
|
+
const visibilityDirtyRef = useRef25(true);
|
|
11919
|
+
const lastVisibilityQuaternionRef = useRef25(camera.quaternion.clone());
|
|
11920
|
+
const lastVisibilityFovRef = useRef25(Number.NaN);
|
|
11921
|
+
const lastViewportRef = useRef25({ width: 0, height: 0, dpr: 0 });
|
|
11922
|
+
const frustumRef = useRef25(new Frustum());
|
|
11923
|
+
const projectionMatrixRef = useRef25(new Matrix4());
|
|
11924
|
+
const visibilityCameraRef = useRef25(new PerspectiveCamera4());
|
|
11842
11925
|
useEffect25(() => {
|
|
11843
11926
|
currentLevelRef.current = 1;
|
|
11844
11927
|
layerTokenRef.current = "";
|
|
@@ -11996,8 +12079,8 @@ function SnapshotCapture({
|
|
|
11996
12079
|
onCaptured
|
|
11997
12080
|
}) {
|
|
11998
12081
|
const { camera, gl, scene, size } = useThree19();
|
|
11999
|
-
const capturedRequestRef =
|
|
12000
|
-
const renderTargetRef =
|
|
12082
|
+
const capturedRequestRef = useRef26(0);
|
|
12083
|
+
const renderTargetRef = useRef26(null);
|
|
12001
12084
|
useEffect26(
|
|
12002
12085
|
() => () => {
|
|
12003
12086
|
renderTargetRef.current?.dispose();
|
|
@@ -12056,11 +12139,11 @@ function ScenesController({
|
|
|
12056
12139
|
}) {
|
|
12057
12140
|
const controlsRef = useContext22(PanoramaViewContext);
|
|
12058
12141
|
const manager = useSharedTileTextureManager();
|
|
12059
|
-
const transition =
|
|
12142
|
+
const transition = useMemo20(
|
|
12060
12143
|
() => resolveTransition(transitionInput),
|
|
12061
12144
|
[transitionInput]
|
|
12062
12145
|
);
|
|
12063
|
-
const sceneMap =
|
|
12146
|
+
const sceneMap = useMemo20(
|
|
12064
12147
|
() => new Map(scenes.map((scene) => [scene.id, scene])),
|
|
12065
12148
|
[scenes]
|
|
12066
12149
|
);
|
|
@@ -12077,13 +12160,13 @@ function ScenesController({
|
|
|
12077
12160
|
const [transitionRunId, setTransitionRunId] = useState12(0);
|
|
12078
12161
|
const [snapshot, setSnapshot] = useState12(null);
|
|
12079
12162
|
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 =
|
|
12163
|
+
const requestedSceneIdRef = useRef26(activeSceneId);
|
|
12164
|
+
const captureReasonRef = useRef26("start");
|
|
12165
|
+
const interactionReleaseRef = useRef26(null);
|
|
12166
|
+
const slotsRef = useRef26(slots);
|
|
12167
|
+
const phaseRef = useRef26(phase);
|
|
12168
|
+
const liveSlotRef = useRef26(liveSlot);
|
|
12169
|
+
const transitionFromRef = useRef26(initialScene);
|
|
12087
12170
|
slotsRef.current = slots;
|
|
12088
12171
|
phaseRef.current = phase;
|
|
12089
12172
|
if (externalPhaseRef) {
|
|
@@ -12305,12 +12388,12 @@ function Scenes({
|
|
|
12305
12388
|
},
|
|
12306
12389
|
[isControlled, onActiveSceneIdChange]
|
|
12307
12390
|
);
|
|
12308
|
-
const scenesRef =
|
|
12391
|
+
const scenesRef = useRef26(scenes);
|
|
12309
12392
|
scenesRef.current = scenes;
|
|
12310
|
-
const resolvedIdRef =
|
|
12393
|
+
const resolvedIdRef = useRef26(resolvedId);
|
|
12311
12394
|
resolvedIdRef.current = resolvedId;
|
|
12312
12395
|
const host = useContext22(ScenesHostContext);
|
|
12313
|
-
const phaseRef =
|
|
12396
|
+
const phaseRef = useRef26("idle");
|
|
12314
12397
|
useEffect26(() => {
|
|
12315
12398
|
if (!host) {
|
|
12316
12399
|
return;
|
|
@@ -12381,7 +12464,7 @@ function Scenes({
|
|
|
12381
12464
|
|
|
12382
12465
|
// src/hotspot/image-hotspot.tsx
|
|
12383
12466
|
import { useThree as useThree21 } from "@react-three/fiber";
|
|
12384
|
-
import { useEffect as useEffect29, useRef as
|
|
12467
|
+
import { useEffect as useEffect29, useRef as useRef28, useState as useState15 } from "react";
|
|
12385
12468
|
import {
|
|
12386
12469
|
ClampToEdgeWrapping as ClampToEdgeWrapping3,
|
|
12387
12470
|
LinearFilter as LinearFilter6,
|
|
@@ -12396,8 +12479,8 @@ import {
|
|
|
12396
12479
|
useContext as useContext24,
|
|
12397
12480
|
useEffect as useEffect28,
|
|
12398
12481
|
useLayoutEffect as useLayoutEffect4,
|
|
12399
|
-
useMemo as
|
|
12400
|
-
useRef as
|
|
12482
|
+
useMemo as useMemo22,
|
|
12483
|
+
useRef as useRef27,
|
|
12401
12484
|
useState as useState14
|
|
12402
12485
|
} from "react";
|
|
12403
12486
|
import {
|
|
@@ -12414,7 +12497,7 @@ import {
|
|
|
12414
12497
|
} from "three";
|
|
12415
12498
|
|
|
12416
12499
|
// src/hotspot/hotspot-tooltip.tsx
|
|
12417
|
-
import { useEffect as useEffect27, useMemo as
|
|
12500
|
+
import { useEffect as useEffect27, useMemo as useMemo21, useState as useState13 } from "react";
|
|
12418
12501
|
|
|
12419
12502
|
// src/webvr/stereo-html.tsx
|
|
12420
12503
|
import { Html } from "@react-three/drei";
|
|
@@ -12542,11 +12625,11 @@ function HotspotTooltip({
|
|
|
12542
12625
|
setImageFailed(false);
|
|
12543
12626
|
}, [content.image]);
|
|
12544
12627
|
const showImage = Boolean(content.image) && !imageFailed;
|
|
12545
|
-
const resolvedAppearance =
|
|
12628
|
+
const resolvedAppearance = useMemo21(
|
|
12546
12629
|
() => resolveHotspotTooltipAppearance(appearance),
|
|
12547
12630
|
[appearance]
|
|
12548
12631
|
);
|
|
12549
|
-
const bubbleStyle =
|
|
12632
|
+
const bubbleStyle = useMemo21(
|
|
12550
12633
|
() => ({
|
|
12551
12634
|
background: resolvedAppearance.background,
|
|
12552
12635
|
border: resolvedAppearance.border,
|
|
@@ -12929,14 +13012,14 @@ function HotspotAnchor({
|
|
|
12929
13012
|
const eventBus = useContext24(PanoEventBusContext);
|
|
12930
13013
|
const cursorApi = usePanoCursor();
|
|
12931
13014
|
const { camera, size } = useThree20();
|
|
12932
|
-
const groupRef =
|
|
12933
|
-
const tooltipAnchorRef =
|
|
12934
|
-
const dragStateRef =
|
|
12935
|
-
const suppressNextClickRef =
|
|
13015
|
+
const groupRef = useRef27(null);
|
|
13016
|
+
const tooltipAnchorRef = useRef27(null);
|
|
13017
|
+
const dragStateRef = useRef27(null);
|
|
13018
|
+
const suppressNextClickRef = useRef27(false);
|
|
12936
13019
|
const [hovered, setHovered] = useState14(false);
|
|
12937
13020
|
const [dragging, setDragging] = useState14(false);
|
|
12938
13021
|
const [pinned, setPinned] = useState14(false);
|
|
12939
|
-
const tooltipContent =
|
|
13022
|
+
const tooltipContent = useMemo22(
|
|
12940
13023
|
() => resolveHotspotTooltipContent(tooltip),
|
|
12941
13024
|
[tooltip]
|
|
12942
13025
|
);
|
|
@@ -12952,17 +13035,17 @@ function HotspotAnchor({
|
|
|
12952
13035
|
scaledWidth,
|
|
12953
13036
|
scaledHeight
|
|
12954
13037
|
);
|
|
12955
|
-
const worldPosition =
|
|
13038
|
+
const worldPosition = useMemo22(
|
|
12956
13039
|
() => panoPositionToVector3(normalizedPosition, resolvedDistance),
|
|
12957
13040
|
[normalizedPosition.pitch, normalizedPosition.yaw, resolvedDistance]
|
|
12958
13041
|
);
|
|
12959
|
-
const surfaceQuaternion3 =
|
|
13042
|
+
const surfaceQuaternion3 = useMemo22(
|
|
12960
13043
|
() => createSurfaceQuaternion(normalizedPosition),
|
|
12961
13044
|
[normalizedPosition.pitch, normalizedPosition.yaw]
|
|
12962
13045
|
);
|
|
12963
13046
|
const worldWidth = angularSizeToWorldSize(scaledWidth, resolvedDistance);
|
|
12964
13047
|
const worldHeight = angularSizeToWorldSize(scaledHeight, resolvedDistance);
|
|
12965
|
-
const focusGeometry =
|
|
13048
|
+
const focusGeometry = useMemo22(() => {
|
|
12966
13049
|
const planeGeometry = new PlaneGeometry5(1, 1);
|
|
12967
13050
|
const geometry = new EdgesGeometry(planeGeometry);
|
|
12968
13051
|
planeGeometry.dispose();
|
|
@@ -13384,8 +13467,8 @@ import { jsx as jsx27 } from "react/jsx-runtime";
|
|
|
13384
13467
|
function useHotspotImageTexture(src, onLoad, onError) {
|
|
13385
13468
|
const gl = useThree21((state) => state.gl);
|
|
13386
13469
|
const [texture, setTexture] = useState15(null);
|
|
13387
|
-
const onLoadRef =
|
|
13388
|
-
const onErrorRef =
|
|
13470
|
+
const onLoadRef = useRef28(onLoad);
|
|
13471
|
+
const onErrorRef = useRef28(onError);
|
|
13389
13472
|
onLoadRef.current = onLoad;
|
|
13390
13473
|
onErrorRef.current = onError;
|
|
13391
13474
|
useEffect29(() => {
|
|
@@ -13448,7 +13531,7 @@ function ImageHotspot({
|
|
|
13448
13531
|
}
|
|
13449
13532
|
|
|
13450
13533
|
// src/hotspot/polygon-hotspot.tsx
|
|
13451
|
-
import { useEffect as useEffect30, useMemo as
|
|
13534
|
+
import { useEffect as useEffect30, useMemo as useMemo23, useRef as useRef30 } from "react";
|
|
13452
13535
|
import {
|
|
13453
13536
|
BufferGeometry,
|
|
13454
13537
|
DoubleSide as DoubleSide5,
|
|
@@ -13463,7 +13546,7 @@ import {
|
|
|
13463
13546
|
// src/hotspot/hotspot-stroke-line.tsx
|
|
13464
13547
|
import { Line } from "@react-three/drei";
|
|
13465
13548
|
import { useFrame as useFrame14, useThree as useThree22 } from "@react-three/fiber";
|
|
13466
|
-
import { useLayoutEffect as useLayoutEffect5, useRef as
|
|
13549
|
+
import { useLayoutEffect as useLayoutEffect5, useRef as useRef29 } from "react";
|
|
13467
13550
|
import {
|
|
13468
13551
|
MathUtils as MathUtils8,
|
|
13469
13552
|
PerspectiveCamera as PerspectiveCamera6,
|
|
@@ -13500,7 +13583,7 @@ function HotspotStrokeLine({
|
|
|
13500
13583
|
dashSize,
|
|
13501
13584
|
gapSize
|
|
13502
13585
|
}) {
|
|
13503
|
-
const lineRef =
|
|
13586
|
+
const lineRef = useRef29(null);
|
|
13504
13587
|
const { camera, size } = useThree22();
|
|
13505
13588
|
const dash = resolveDash(dashSize, gapSize);
|
|
13506
13589
|
useLayoutEffect5(() => {
|
|
@@ -13793,19 +13876,19 @@ function PolygonHotspot({
|
|
|
13793
13876
|
onInvalid,
|
|
13794
13877
|
...anchorProps
|
|
13795
13878
|
}) {
|
|
13796
|
-
const issues =
|
|
13879
|
+
const issues = useMemo23(() => validatePolygonVertices(vertices), [vertices]);
|
|
13797
13880
|
const valid = issues.length === 0;
|
|
13798
|
-
const center =
|
|
13799
|
-
const fillGeometry =
|
|
13881
|
+
const center = useMemo23(() => valid ? polygonCenter(vertices) : null, [valid, vertices]);
|
|
13882
|
+
const fillGeometry = useMemo23(
|
|
13800
13883
|
() => valid && center ? makeFillGeometry(vertices, center) : null,
|
|
13801
13884
|
[center, valid, vertices]
|
|
13802
13885
|
);
|
|
13803
|
-
const strokePoints =
|
|
13886
|
+
const strokePoints = useMemo23(
|
|
13804
13887
|
() => valid && center ? makeStrokePositions(vertices, center) : null,
|
|
13805
13888
|
[center, valid, vertices]
|
|
13806
13889
|
);
|
|
13807
13890
|
const resolvedStrokeOpacity = Math.max(0, Math.min(strokeOpacity, 1));
|
|
13808
|
-
const startVerticesRef =
|
|
13891
|
+
const startVerticesRef = useRef30(null);
|
|
13809
13892
|
const issuesKey = issues.map((issue) => issue.code).join(",");
|
|
13810
13893
|
useEffect30(() => {
|
|
13811
13894
|
if (!valid) onInvalid?.(issues);
|
|
@@ -13890,7 +13973,7 @@ function PolygonHotspot({
|
|
|
13890
13973
|
}
|
|
13891
13974
|
|
|
13892
13975
|
// src/hotspot/polyline-hotspot.tsx
|
|
13893
|
-
import { useEffect as useEffect31, useMemo as
|
|
13976
|
+
import { useEffect as useEffect31, useMemo as useMemo24, useRef as useRef31 } from "react";
|
|
13894
13977
|
import {
|
|
13895
13978
|
MathUtils as MathUtils9,
|
|
13896
13979
|
Matrix4 as Matrix44,
|
|
@@ -14014,15 +14097,15 @@ function PolylineHotspot({
|
|
|
14014
14097
|
onInvalid,
|
|
14015
14098
|
...anchorProps
|
|
14016
14099
|
}) {
|
|
14017
|
-
const issues =
|
|
14100
|
+
const issues = useMemo24(() => validatePolylineVertices(vertices), [vertices]);
|
|
14018
14101
|
const valid = issues.length === 0;
|
|
14019
|
-
const center =
|
|
14020
|
-
const linePoints =
|
|
14102
|
+
const center = useMemo24(() => valid ? polylineCenter(vertices) : null, [valid, vertices]);
|
|
14103
|
+
const linePoints = useMemo24(
|
|
14021
14104
|
() => valid && center ? makeLinePositions(vertices, center) : null,
|
|
14022
14105
|
[center, valid, vertices]
|
|
14023
14106
|
);
|
|
14024
14107
|
const opacity = Math.max(0, Math.min(strokeOpacity, 1));
|
|
14025
|
-
const startVerticesRef =
|
|
14108
|
+
const startVerticesRef = useRef31(null);
|
|
14026
14109
|
useEffect31(() => {
|
|
14027
14110
|
if (!valid) onInvalid?.(issues);
|
|
14028
14111
|
}, [issues, onInvalid, valid]);
|
|
@@ -14089,7 +14172,7 @@ function PolylineHotspot({
|
|
|
14089
14172
|
}
|
|
14090
14173
|
|
|
14091
14174
|
// src/hotspot/graphic-hotspot.tsx
|
|
14092
|
-
import { useEffect as useEffect32, useRef as
|
|
14175
|
+
import { useEffect as useEffect32, useRef as useRef32, useState as useState16 } from "react";
|
|
14093
14176
|
import {
|
|
14094
14177
|
CanvasTexture,
|
|
14095
14178
|
ClampToEdgeWrapping as ClampToEdgeWrapping4,
|
|
@@ -14287,8 +14370,8 @@ function createGraphicTexture(graphic, aspectWidth, aspectHeight) {
|
|
|
14287
14370
|
}
|
|
14288
14371
|
function useGraphicTexture(graphic, aspectWidth, aspectHeight, onLoad, onError) {
|
|
14289
14372
|
const [texture, setTexture] = useState16(null);
|
|
14290
|
-
const onLoadRef =
|
|
14291
|
-
const onErrorRef =
|
|
14373
|
+
const onLoadRef = useRef32(onLoad);
|
|
14374
|
+
const onErrorRef = useRef32(onError);
|
|
14292
14375
|
onLoadRef.current = onLoad;
|
|
14293
14376
|
onErrorRef.current = onError;
|
|
14294
14377
|
useEffect32(() => {
|
|
@@ -14330,7 +14413,7 @@ function GraphicHotspot(props) {
|
|
|
14330
14413
|
|
|
14331
14414
|
// src/hotspot/sequence-hotspot.tsx
|
|
14332
14415
|
import { useFrame as useFrame15, useThree as useThree23 } from "@react-three/fiber";
|
|
14333
|
-
import { useEffect as useEffect33, useRef as
|
|
14416
|
+
import { useEffect as useEffect33, useRef as useRef33, useState as useState17 } from "react";
|
|
14334
14417
|
import {
|
|
14335
14418
|
ClampToEdgeWrapping as ClampToEdgeWrapping5,
|
|
14336
14419
|
LinearFilter as LinearFilter8,
|
|
@@ -14354,8 +14437,8 @@ function useSpriteTexture({
|
|
|
14354
14437
|
}) {
|
|
14355
14438
|
const gl = useThree23((state) => state.gl);
|
|
14356
14439
|
const [texture, setTexture] = useState17(null);
|
|
14357
|
-
const onErrorRef =
|
|
14358
|
-
const onLoadProgressRef =
|
|
14440
|
+
const onErrorRef = useRef33(onError);
|
|
14441
|
+
const onLoadProgressRef = useRef33(onLoadProgress);
|
|
14359
14442
|
onErrorRef.current = onError;
|
|
14360
14443
|
onLoadProgressRef.current = onLoadProgress;
|
|
14361
14444
|
useEffect33(() => {
|
|
@@ -14429,13 +14512,13 @@ function SequenceHotspot({
|
|
|
14429
14512
|
const frameCount = resolveFrameCount(requestedFrameCount);
|
|
14430
14513
|
const safeFps = resolveFps(fps);
|
|
14431
14514
|
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 =
|
|
14515
|
+
const elapsedRef = useRef33(0);
|
|
14516
|
+
const frameIndexRef = useRef33(0);
|
|
14517
|
+
const endedRef = useRef33(false);
|
|
14518
|
+
const lastPlaybackStateRef = useRef33(null);
|
|
14519
|
+
const onFrameChangeRef = useRef33(onFrameChange);
|
|
14520
|
+
const onPlaybackStateChangeRef = useRef33(onPlaybackStateChange);
|
|
14521
|
+
const onEndedRef = useRef33(onEnded);
|
|
14439
14522
|
onFrameChangeRef.current = onFrameChange;
|
|
14440
14523
|
onPlaybackStateChangeRef.current = onPlaybackStateChange;
|
|
14441
14524
|
onEndedRef.current = onEnded;
|
|
@@ -14519,7 +14602,7 @@ function SequenceHotspot({
|
|
|
14519
14602
|
|
|
14520
14603
|
// src/hotspot/video-hotspot.tsx
|
|
14521
14604
|
import { useThree as useThree24 } from "@react-three/fiber";
|
|
14522
|
-
import { useEffect as useEffect34, useRef as
|
|
14605
|
+
import { useEffect as useEffect34, useRef as useRef34, useState as useState18 } from "react";
|
|
14523
14606
|
import {
|
|
14524
14607
|
ClampToEdgeWrapping as ClampToEdgeWrapping6,
|
|
14525
14608
|
LinearFilter as LinearFilter9,
|
|
@@ -14538,7 +14621,7 @@ function clampVolume2(volume) {
|
|
|
14538
14621
|
function usePosterTexture2(id, poster, onError) {
|
|
14539
14622
|
const gl = useThree24((state) => state.gl);
|
|
14540
14623
|
const [texture, setTexture] = useState18(null);
|
|
14541
|
-
const onErrorRef =
|
|
14624
|
+
const onErrorRef = useRef34(onError);
|
|
14542
14625
|
onErrorRef.current = onError;
|
|
14543
14626
|
useEffect34(() => {
|
|
14544
14627
|
let active = true;
|
|
@@ -14596,9 +14679,9 @@ function useVideoResource({
|
|
|
14596
14679
|
src
|
|
14597
14680
|
}) {
|
|
14598
14681
|
const [resource, setResource] = useState18(null);
|
|
14599
|
-
const onEndedRef =
|
|
14600
|
-
const onErrorRef =
|
|
14601
|
-
const onPlaybackStateChangeRef =
|
|
14682
|
+
const onEndedRef = useRef34(onEnded);
|
|
14683
|
+
const onErrorRef = useRef34(onError);
|
|
14684
|
+
const onPlaybackStateChangeRef = useRef34(onPlaybackStateChange);
|
|
14602
14685
|
onEndedRef.current = onEnded;
|
|
14603
14686
|
onErrorRef.current = onError;
|
|
14604
14687
|
onPlaybackStateChangeRef.current = onPlaybackStateChange;
|
|
@@ -14703,8 +14786,8 @@ function VideoHotspot({
|
|
|
14703
14786
|
src
|
|
14704
14787
|
});
|
|
14705
14788
|
const posterTexture = usePosterTexture2(id, poster, onError);
|
|
14706
|
-
const onPlaybackErrorRef =
|
|
14707
|
-
const onPlaybackStateChangeRef =
|
|
14789
|
+
const onPlaybackErrorRef = useRef34(onPlaybackError);
|
|
14790
|
+
const onPlaybackStateChangeRef = useRef34(onPlaybackStateChange);
|
|
14708
14791
|
onPlaybackErrorRef.current = onPlaybackError;
|
|
14709
14792
|
onPlaybackStateChangeRef.current = onPlaybackStateChange;
|
|
14710
14793
|
useEffect34(() => {
|
|
@@ -14745,7 +14828,7 @@ function VideoHotspot({
|
|
|
14745
14828
|
|
|
14746
14829
|
// src/hotspot/audio-hotspot.tsx
|
|
14747
14830
|
import { useFrame as useFrame16, useThree as useThree25 } from "@react-three/fiber";
|
|
14748
|
-
import { useEffect as useEffect35, useRef as
|
|
14831
|
+
import { useEffect as useEffect35, useRef as useRef35, useState as useState19 } from "react";
|
|
14749
14832
|
import {
|
|
14750
14833
|
CanvasTexture as CanvasTexture2,
|
|
14751
14834
|
ClampToEdgeWrapping as ClampToEdgeWrapping7,
|
|
@@ -14837,7 +14920,7 @@ function useSpeakerTextures(enabled) {
|
|
|
14837
14920
|
function useIconTexture(icon, enabled, onError, id) {
|
|
14838
14921
|
const gl = useThree25((state) => state.gl);
|
|
14839
14922
|
const [texture, setTexture] = useState19(null);
|
|
14840
|
-
const onErrorRef =
|
|
14923
|
+
const onErrorRef = useRef35(onError);
|
|
14841
14924
|
onErrorRef.current = onError;
|
|
14842
14925
|
useEffect35(() => {
|
|
14843
14926
|
let active = true;
|
|
@@ -14896,12 +14979,12 @@ function useAudioHowl({
|
|
|
14896
14979
|
src
|
|
14897
14980
|
}) {
|
|
14898
14981
|
const [howl, setHowl] = useState19(null);
|
|
14899
|
-
const playingRef =
|
|
14900
|
-
const loopRef =
|
|
14901
|
-
const onEndedRef =
|
|
14902
|
-
const onErrorRef =
|
|
14903
|
-
const onPlaybackErrorRef =
|
|
14904
|
-
const onPlaybackStateChangeRef =
|
|
14982
|
+
const playingRef = useRef35(playing);
|
|
14983
|
+
const loopRef = useRef35(loop ?? false);
|
|
14984
|
+
const onEndedRef = useRef35(onEnded);
|
|
14985
|
+
const onErrorRef = useRef35(onError);
|
|
14986
|
+
const onPlaybackErrorRef = useRef35(onPlaybackError);
|
|
14987
|
+
const onPlaybackStateChangeRef = useRef35(onPlaybackStateChange);
|
|
14905
14988
|
playingRef.current = playing;
|
|
14906
14989
|
loopRef.current = loop ?? false;
|
|
14907
14990
|
onEndedRef.current = onEnded;
|
|
@@ -14989,11 +15072,11 @@ function AudioHotspot({
|
|
|
14989
15072
|
const stoppedIconTexture = useIconTexture(icon, marker, onError, id);
|
|
14990
15073
|
const playingIconTexture = useIconTexture(playingIcon, marker, onError, id);
|
|
14991
15074
|
const markerTexture = playing ? playingIconTexture ?? stoppedIconTexture ?? speakerTextures.playing : stoppedIconTexture ?? speakerTextures.stopped;
|
|
14992
|
-
const playingRef =
|
|
15075
|
+
const playingRef = useRef35(playing);
|
|
14993
15076
|
playingRef.current = playing;
|
|
14994
|
-
const mutedRef =
|
|
14995
|
-
const volumeRef =
|
|
14996
|
-
const rangeRef =
|
|
15077
|
+
const mutedRef = useRef35(muted);
|
|
15078
|
+
const volumeRef = useRef35(volume);
|
|
15079
|
+
const rangeRef = useRef35(range);
|
|
14997
15080
|
mutedRef.current = muted;
|
|
14998
15081
|
volumeRef.current = volume;
|
|
14999
15082
|
rangeRef.current = range;
|
|
@@ -15042,7 +15125,7 @@ function AudioHotspot({
|
|
|
15042
15125
|
}
|
|
15043
15126
|
|
|
15044
15127
|
// src/hotspot/text-hotspot.tsx
|
|
15045
|
-
import { useEffect as useEffect36, useRef as
|
|
15128
|
+
import { useEffect as useEffect36, useRef as useRef36, useState as useState20 } from "react";
|
|
15046
15129
|
import {
|
|
15047
15130
|
CanvasTexture as CanvasTexture3,
|
|
15048
15131
|
ClampToEdgeWrapping as ClampToEdgeWrapping8,
|
|
@@ -15271,8 +15354,8 @@ function createTextTexture(text, width, height, style) {
|
|
|
15271
15354
|
}
|
|
15272
15355
|
function useTextTexture(text, width, height, style, onLoad, onError) {
|
|
15273
15356
|
const [texture, setTexture] = useState20(null);
|
|
15274
|
-
const onLoadRef =
|
|
15275
|
-
const onErrorRef =
|
|
15357
|
+
const onLoadRef = useRef36(onLoad);
|
|
15358
|
+
const onErrorRef = useRef36(onError);
|
|
15276
15359
|
onLoadRef.current = onLoad;
|
|
15277
15360
|
onErrorRef.current = onError;
|
|
15278
15361
|
useEffect36(() => {
|
|
@@ -15538,6 +15621,7 @@ export {
|
|
|
15538
15621
|
resolvePanoContextMenuEntries,
|
|
15539
15622
|
unwrapPolygonVertices,
|
|
15540
15623
|
usePanoEvents,
|
|
15624
|
+
usePanoViewer,
|
|
15541
15625
|
validatePolygonVertices,
|
|
15542
15626
|
validatePolylineVertices,
|
|
15543
15627
|
vector3ToPanoPosition
|