@ericchen1990/pano-view 2.5.1 → 3.0.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 +27 -3
- package/README.zh-CN.md +21 -1
- package/dist/index.cjs +1060 -902
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +38 -2
- package/dist/index.d.ts +38 -2
- package/dist/index.mjs +884 -725
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +90 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2306,7 +2306,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
2306
2306
|
// src/pano-viewer.tsx
|
|
2307
2307
|
var import_fiber10 = require("@react-three/fiber");
|
|
2308
2308
|
var import_xr3 = require("@react-three/xr");
|
|
2309
|
-
var
|
|
2309
|
+
var import_react25 = require("react");
|
|
2310
2310
|
|
|
2311
2311
|
// src/background-audio-host.ts
|
|
2312
2312
|
var import_react = require("react");
|
|
@@ -2350,6 +2350,107 @@ function cn(...values) {
|
|
|
2350
2350
|
return values.filter(Boolean).join(" ");
|
|
2351
2351
|
}
|
|
2352
2352
|
|
|
2353
|
+
// src/audio/howl.ts
|
|
2354
|
+
var import_howler = __toESM(require_howler());
|
|
2355
|
+
import_howler.Howler.autoUnlock = true;
|
|
2356
|
+
function resumePanoAudio() {
|
|
2357
|
+
if (!import_howler.Howler.ctx || import_howler.Howler.ctx.state === "running") {
|
|
2358
|
+
return Promise.resolve();
|
|
2359
|
+
}
|
|
2360
|
+
return import_howler.Howler.ctx.resume();
|
|
2361
|
+
}
|
|
2362
|
+
function sourceList(src) {
|
|
2363
|
+
if (src == null) {
|
|
2364
|
+
return [];
|
|
2365
|
+
}
|
|
2366
|
+
if (typeof src === "string") {
|
|
2367
|
+
return src ? [src] : [];
|
|
2368
|
+
}
|
|
2369
|
+
return src.filter((item) => Boolean(item));
|
|
2370
|
+
}
|
|
2371
|
+
function createUnlockingHowl({
|
|
2372
|
+
src,
|
|
2373
|
+
loop,
|
|
2374
|
+
crossOrigin,
|
|
2375
|
+
isActive,
|
|
2376
|
+
shouldRetryPlay,
|
|
2377
|
+
onEnded,
|
|
2378
|
+
onPlay,
|
|
2379
|
+
onPause,
|
|
2380
|
+
onLoadError,
|
|
2381
|
+
onPlayError
|
|
2382
|
+
}) {
|
|
2383
|
+
let disposed = false;
|
|
2384
|
+
let blockedNotified = false;
|
|
2385
|
+
const unlockListeners = [];
|
|
2386
|
+
const removeUnlockListeners = () => {
|
|
2387
|
+
for (const { type, listener } of unlockListeners) {
|
|
2388
|
+
window.removeEventListener(type, listener, true);
|
|
2389
|
+
}
|
|
2390
|
+
unlockListeners.length = 0;
|
|
2391
|
+
};
|
|
2392
|
+
const instance = new import_howler.Howl({
|
|
2393
|
+
src: [...src],
|
|
2394
|
+
html5: false,
|
|
2395
|
+
preload: true,
|
|
2396
|
+
loop,
|
|
2397
|
+
xhr: crossOrigin === "use-credentials" ? { withCredentials: true } : void 0,
|
|
2398
|
+
onend: () => {
|
|
2399
|
+
if (disposed || !isActive() || instance.loop()) {
|
|
2400
|
+
return;
|
|
2401
|
+
}
|
|
2402
|
+
onEnded?.();
|
|
2403
|
+
},
|
|
2404
|
+
onplay: () => {
|
|
2405
|
+
if (!disposed && isActive()) {
|
|
2406
|
+
onPlay?.();
|
|
2407
|
+
}
|
|
2408
|
+
},
|
|
2409
|
+
onpause: () => {
|
|
2410
|
+
if (!disposed && isActive()) {
|
|
2411
|
+
onPause?.();
|
|
2412
|
+
}
|
|
2413
|
+
},
|
|
2414
|
+
onloaderror: (_soundId, error) => {
|
|
2415
|
+
if (!disposed && isActive()) {
|
|
2416
|
+
onLoadError?.(error);
|
|
2417
|
+
}
|
|
2418
|
+
},
|
|
2419
|
+
onplayerror: (_soundId, error) => {
|
|
2420
|
+
if (disposed || !isActive()) {
|
|
2421
|
+
return;
|
|
2422
|
+
}
|
|
2423
|
+
if (!blockedNotified) {
|
|
2424
|
+
blockedNotified = true;
|
|
2425
|
+
onPlayError?.(error);
|
|
2426
|
+
}
|
|
2427
|
+
const retry = () => {
|
|
2428
|
+
removeUnlockListeners();
|
|
2429
|
+
if (!disposed && isActive() && shouldRetryPlay()) {
|
|
2430
|
+
void resumePanoAudio();
|
|
2431
|
+
instance.play();
|
|
2432
|
+
}
|
|
2433
|
+
};
|
|
2434
|
+
removeUnlockListeners();
|
|
2435
|
+
unlockListeners.push({ type: "pointerdown", listener: retry });
|
|
2436
|
+
unlockListeners.push({ type: "keydown", listener: retry });
|
|
2437
|
+
window.addEventListener("pointerdown", retry, { capture: true });
|
|
2438
|
+
window.addEventListener("keydown", retry, { capture: true });
|
|
2439
|
+
}
|
|
2440
|
+
});
|
|
2441
|
+
return {
|
|
2442
|
+
howl: instance,
|
|
2443
|
+
dispose: () => {
|
|
2444
|
+
if (disposed) {
|
|
2445
|
+
return;
|
|
2446
|
+
}
|
|
2447
|
+
disposed = true;
|
|
2448
|
+
removeUnlockListeners();
|
|
2449
|
+
instance.unload();
|
|
2450
|
+
}
|
|
2451
|
+
};
|
|
2452
|
+
}
|
|
2453
|
+
|
|
2353
2454
|
// src/auto-rotate.tsx
|
|
2354
2455
|
var import_fiber2 = require("@react-three/fiber");
|
|
2355
2456
|
var import_react4 = require("react");
|
|
@@ -3581,13 +3682,75 @@ function isProduction2() {
|
|
|
3581
3682
|
return nodeEnv === "production";
|
|
3582
3683
|
}
|
|
3583
3684
|
|
|
3584
|
-
// src/
|
|
3685
|
+
// src/media-activation.tsx
|
|
3585
3686
|
var import_react10 = require("react");
|
|
3586
3687
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
3688
|
+
var PanoMediaActivationHostContext = (0, import_react10.createContext)(null);
|
|
3689
|
+
function createPanoMediaActivationHost() {
|
|
3690
|
+
return { intents: /* @__PURE__ */ new Set(), listeners: /* @__PURE__ */ new Set(), revision: 0 };
|
|
3691
|
+
}
|
|
3692
|
+
function notify(host) {
|
|
3693
|
+
host.revision += 1;
|
|
3694
|
+
for (const listener of host.listeners) {
|
|
3695
|
+
listener();
|
|
3696
|
+
}
|
|
3697
|
+
}
|
|
3698
|
+
function getPanoMediaActivationRevision(host) {
|
|
3699
|
+
return host.revision;
|
|
3700
|
+
}
|
|
3701
|
+
function subscribePanoMediaActivation(host, listener) {
|
|
3702
|
+
host.listeners.add(listener);
|
|
3703
|
+
return () => {
|
|
3704
|
+
host.listeners.delete(listener);
|
|
3705
|
+
};
|
|
3706
|
+
}
|
|
3707
|
+
function hasPanoMediaActivationIntent(host) {
|
|
3708
|
+
return host.intents.size > 0;
|
|
3709
|
+
}
|
|
3710
|
+
function usePanoMediaActivationIntent(required) {
|
|
3711
|
+
const host = (0, import_react10.useContext)(PanoMediaActivationHostContext);
|
|
3712
|
+
const keyRef = (0, import_react10.useRef)(null);
|
|
3713
|
+
if (keyRef.current === null) {
|
|
3714
|
+
keyRef.current = /* @__PURE__ */ Symbol("pano-media-intent");
|
|
3715
|
+
}
|
|
3716
|
+
(0, import_react10.useEffect)(() => {
|
|
3717
|
+
if (!host || !required) {
|
|
3718
|
+
return;
|
|
3719
|
+
}
|
|
3720
|
+
const key = keyRef.current;
|
|
3721
|
+
host.intents.add(key);
|
|
3722
|
+
notify(host);
|
|
3723
|
+
return () => {
|
|
3724
|
+
host.intents.delete(key);
|
|
3725
|
+
notify(host);
|
|
3726
|
+
};
|
|
3727
|
+
}, [host, required]);
|
|
3728
|
+
}
|
|
3729
|
+
function PanoMediaActivationOverlay({
|
|
3730
|
+
ariaLabel = "Enable sound",
|
|
3731
|
+
className,
|
|
3732
|
+
message = "Tap to enable sound",
|
|
3733
|
+
onActivate
|
|
3734
|
+
}) {
|
|
3735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: cn("pano-media-activation", className), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3736
|
+
"button",
|
|
3737
|
+
{
|
|
3738
|
+
"aria-label": ariaLabel,
|
|
3739
|
+
className: "pano-media-activation-button",
|
|
3740
|
+
onClick: onActivate,
|
|
3741
|
+
type: "button",
|
|
3742
|
+
children: message
|
|
3743
|
+
}
|
|
3744
|
+
) });
|
|
3745
|
+
}
|
|
3746
|
+
|
|
3747
|
+
// src/pano-context-menu.tsx
|
|
3748
|
+
var import_react11 = require("react");
|
|
3749
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
3587
3750
|
var DEFAULT_ICON_SIZE = 16;
|
|
3588
3751
|
var MENU_EDGE_PADDING = 8;
|
|
3589
3752
|
var MIN_PANO_CONTEXT_MENU_BACKGROUND_OPACITY = 0.4;
|
|
3590
|
-
var PanoContextMenuOverlayContext = (0,
|
|
3753
|
+
var PanoContextMenuOverlayContext = (0, import_react11.createContext)(null);
|
|
3591
3754
|
var DEFAULT_APPEARANCE = {
|
|
3592
3755
|
background: "#161616",
|
|
3593
3756
|
color: "#f4f4f4",
|
|
@@ -3627,11 +3790,11 @@ function DefaultContextMenuPanel({
|
|
|
3627
3790
|
selectContext,
|
|
3628
3791
|
onRequestClose
|
|
3629
3792
|
}) {
|
|
3630
|
-
const menuRef = (0,
|
|
3631
|
-
const [activeIndex, setActiveIndex] = (0,
|
|
3793
|
+
const menuRef = (0, import_react11.useRef)(null);
|
|
3794
|
+
const [activeIndex, setActiveIndex] = (0, import_react11.useState)(0);
|
|
3632
3795
|
const resolved = { ...DEFAULT_APPEARANCE, ...appearance };
|
|
3633
3796
|
const iconSize = Number.isFinite(resolved.iconSize) ? Math.max(0, resolved.iconSize) : DEFAULT_ICON_SIZE;
|
|
3634
|
-
const visibleItems = (0,
|
|
3797
|
+
const visibleItems = (0, import_react11.useMemo)(
|
|
3635
3798
|
() => items.filter((item) => {
|
|
3636
3799
|
if (!isActionItem(item)) {
|
|
3637
3800
|
return true;
|
|
@@ -3640,7 +3803,7 @@ function DefaultContextMenuPanel({
|
|
|
3640
3803
|
}),
|
|
3641
3804
|
[items]
|
|
3642
3805
|
);
|
|
3643
|
-
const focusableIndices = (0,
|
|
3806
|
+
const focusableIndices = (0, import_react11.useMemo)(() => {
|
|
3644
3807
|
const indices = [];
|
|
3645
3808
|
visibleItems.forEach((item, index) => {
|
|
3646
3809
|
if (isActionItem(item) && !item.disabled) {
|
|
@@ -3649,7 +3812,7 @@ function DefaultContextMenuPanel({
|
|
|
3649
3812
|
});
|
|
3650
3813
|
return indices;
|
|
3651
3814
|
}, [visibleItems]);
|
|
3652
|
-
(0,
|
|
3815
|
+
(0, import_react11.useEffect)(() => {
|
|
3653
3816
|
const first = focusableIndices[0];
|
|
3654
3817
|
setActiveIndex(first ?? 0);
|
|
3655
3818
|
const frame = requestAnimationFrame(() => {
|
|
@@ -3660,7 +3823,7 @@ function DefaultContextMenuPanel({
|
|
|
3660
3823
|
});
|
|
3661
3824
|
return () => cancelAnimationFrame(frame);
|
|
3662
3825
|
}, [focusableIndices]);
|
|
3663
|
-
const activateItem = (0,
|
|
3826
|
+
const activateItem = (0, import_react11.useCallback)(
|
|
3664
3827
|
(item) => {
|
|
3665
3828
|
if (item.disabled) {
|
|
3666
3829
|
return;
|
|
@@ -3746,7 +3909,7 @@ function DefaultContextMenuPanel({
|
|
|
3746
3909
|
padding: resolved.padding,
|
|
3747
3910
|
...style
|
|
3748
3911
|
};
|
|
3749
|
-
return /* @__PURE__ */ (0,
|
|
3912
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
3750
3913
|
"div",
|
|
3751
3914
|
{
|
|
3752
3915
|
ref: menuRef,
|
|
@@ -3757,7 +3920,7 @@ function DefaultContextMenuPanel({
|
|
|
3757
3920
|
style: panelStyle,
|
|
3758
3921
|
tabIndex: -1,
|
|
3759
3922
|
children: [
|
|
3760
|
-
/* @__PURE__ */ (0,
|
|
3923
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3761
3924
|
"div",
|
|
3762
3925
|
{
|
|
3763
3926
|
"aria-hidden": true,
|
|
@@ -3769,9 +3932,9 @@ function DefaultContextMenuPanel({
|
|
|
3769
3932
|
}
|
|
3770
3933
|
}
|
|
3771
3934
|
),
|
|
3772
|
-
/* @__PURE__ */ (0,
|
|
3935
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "pano-context-menu-items", children: visibleItems.map((item, index) => {
|
|
3773
3936
|
if (!isActionItem(item)) {
|
|
3774
|
-
return /* @__PURE__ */ (0,
|
|
3937
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3775
3938
|
"div",
|
|
3776
3939
|
{
|
|
3777
3940
|
"aria-hidden": true,
|
|
@@ -3788,7 +3951,7 @@ function DefaultContextMenuPanel({
|
|
|
3788
3951
|
);
|
|
3789
3952
|
}
|
|
3790
3953
|
const disabled = item.disabled === true;
|
|
3791
|
-
const iconNode = item.icon ?? (item.image ? /* @__PURE__ */ (0,
|
|
3954
|
+
const iconNode = item.icon ?? (item.image ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3792
3955
|
"img",
|
|
3793
3956
|
{
|
|
3794
3957
|
alt: item.imageAlt ?? "",
|
|
@@ -3802,7 +3965,7 @@ function DefaultContextMenuPanel({
|
|
|
3802
3965
|
}
|
|
3803
3966
|
}
|
|
3804
3967
|
) : null);
|
|
3805
|
-
return /* @__PURE__ */ (0,
|
|
3968
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
3806
3969
|
"button",
|
|
3807
3970
|
{
|
|
3808
3971
|
"aria-disabled": disabled || void 0,
|
|
@@ -3838,7 +4001,7 @@ function DefaultContextMenuPanel({
|
|
|
3838
4001
|
tabIndex: disabled ? -1 : activeIndex === index ? 0 : -1,
|
|
3839
4002
|
type: "button",
|
|
3840
4003
|
children: [
|
|
3841
|
-
/* @__PURE__ */ (0,
|
|
4004
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3842
4005
|
"span",
|
|
3843
4006
|
{
|
|
3844
4007
|
"aria-hidden": true,
|
|
@@ -3850,7 +4013,7 @@ function DefaultContextMenuPanel({
|
|
|
3850
4013
|
children: iconNode
|
|
3851
4014
|
}
|
|
3852
4015
|
),
|
|
3853
|
-
/* @__PURE__ */ (0,
|
|
4016
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { flex: 1 }, children: item.label })
|
|
3854
4017
|
]
|
|
3855
4018
|
},
|
|
3856
4019
|
item.id
|
|
@@ -3866,9 +4029,22 @@ function PositionedMenuShell({
|
|
|
3866
4029
|
overlayElement,
|
|
3867
4030
|
children
|
|
3868
4031
|
}) {
|
|
3869
|
-
const shellRef = (0,
|
|
3870
|
-
const [offset, setOffset] = (0,
|
|
3871
|
-
(0,
|
|
4032
|
+
const shellRef = (0, import_react11.useRef)(null);
|
|
4033
|
+
const [offset, setOffset] = (0, import_react11.useState)({ left: 0, top: 0 });
|
|
4034
|
+
const [viewportRevision, setViewportRevision] = (0, import_react11.useState)(0);
|
|
4035
|
+
(0, import_react11.useEffect)(() => {
|
|
4036
|
+
const refresh = () => setViewportRevision((revision) => revision + 1);
|
|
4037
|
+
const viewport = window.visualViewport;
|
|
4038
|
+
window.addEventListener("resize", refresh);
|
|
4039
|
+
window.addEventListener("orientationchange", refresh);
|
|
4040
|
+
viewport?.addEventListener("resize", refresh);
|
|
4041
|
+
return () => {
|
|
4042
|
+
window.removeEventListener("resize", refresh);
|
|
4043
|
+
window.removeEventListener("orientationchange", refresh);
|
|
4044
|
+
viewport?.removeEventListener("resize", refresh);
|
|
4045
|
+
};
|
|
4046
|
+
}, []);
|
|
4047
|
+
(0, import_react11.useLayoutEffect)(() => {
|
|
3872
4048
|
const shell = shellRef.current;
|
|
3873
4049
|
if (!overlayElement || !shell) {
|
|
3874
4050
|
return;
|
|
@@ -3889,8 +4065,8 @@ function PositionedMenuShell({
|
|
|
3889
4065
|
left: Math.min(Math.max(rawLeft, MENU_EDGE_PADDING), maxLeft),
|
|
3890
4066
|
top: Math.min(Math.max(rawTop, MENU_EDGE_PADDING), maxTop)
|
|
3891
4067
|
});
|
|
3892
|
-
}, [clientX, clientY, overlayElement, children]);
|
|
3893
|
-
return /* @__PURE__ */ (0,
|
|
4068
|
+
}, [clientX, clientY, overlayElement, children, viewportRevision]);
|
|
4069
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3894
4070
|
"div",
|
|
3895
4071
|
{
|
|
3896
4072
|
className: "pano-context-menu-shell",
|
|
@@ -3904,20 +4080,20 @@ function PositionedMenuShell({
|
|
|
3904
4080
|
);
|
|
3905
4081
|
}
|
|
3906
4082
|
function usePanoContextMenuOverlay() {
|
|
3907
|
-
const [session2, setSession] = (0,
|
|
3908
|
-
const overlayRef = (0,
|
|
3909
|
-
const [overlayElement, setOverlayElement] = (0,
|
|
4083
|
+
const [session2, setSession] = (0, import_react11.useState)(null);
|
|
4084
|
+
const overlayRef = (0, import_react11.useRef)(null);
|
|
4085
|
+
const [overlayElement, setOverlayElement] = (0, import_react11.useState)(
|
|
3910
4086
|
null
|
|
3911
4087
|
);
|
|
3912
|
-
const api = (0,
|
|
4088
|
+
const api = (0, import_react11.useMemo)(
|
|
3913
4089
|
() => ({ setSession, overlayRef }),
|
|
3914
4090
|
[]
|
|
3915
4091
|
);
|
|
3916
|
-
const setOverlayNode = (0,
|
|
4092
|
+
const setOverlayNode = (0, import_react11.useCallback)((node) => {
|
|
3917
4093
|
overlayRef.current = node;
|
|
3918
4094
|
setOverlayElement(node);
|
|
3919
4095
|
}, []);
|
|
3920
|
-
(0,
|
|
4096
|
+
(0, import_react11.useEffect)(() => {
|
|
3921
4097
|
if (!session2) {
|
|
3922
4098
|
return;
|
|
3923
4099
|
}
|
|
@@ -3949,7 +4125,7 @@ function usePanoContextMenuOverlay() {
|
|
|
3949
4125
|
document.removeEventListener("keydown", handleKeyDown);
|
|
3950
4126
|
};
|
|
3951
4127
|
}, [session2]);
|
|
3952
|
-
const overlay = /* @__PURE__ */ (0,
|
|
4128
|
+
const overlay = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3953
4129
|
"div",
|
|
3954
4130
|
{
|
|
3955
4131
|
ref: setOverlayNode,
|
|
@@ -3960,7 +4136,7 @@ function usePanoContextMenuOverlay() {
|
|
|
3960
4136
|
position: "absolute",
|
|
3961
4137
|
zIndex: 20
|
|
3962
4138
|
},
|
|
3963
|
-
children: session2 ? /* @__PURE__ */ (0,
|
|
4139
|
+
children: session2 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3964
4140
|
PositionedMenuShell,
|
|
3965
4141
|
{
|
|
3966
4142
|
clientX: session2.event.clientX,
|
|
@@ -3985,13 +4161,13 @@ function PanoContextMenu({
|
|
|
3985
4161
|
separatorClassName,
|
|
3986
4162
|
children
|
|
3987
4163
|
}) {
|
|
3988
|
-
const eventBus = (0,
|
|
3989
|
-
const controlsRef = (0,
|
|
3990
|
-
const overlayApi = (0,
|
|
3991
|
-
const actions = (0,
|
|
3992
|
-
const instanceId = (0,
|
|
3993
|
-
const sessionKeyRef = (0,
|
|
3994
|
-
const propsRef = (0,
|
|
4164
|
+
const eventBus = (0, import_react11.useContext)(PanoEventBusContext);
|
|
4165
|
+
const controlsRef = (0, import_react11.useContext)(PanoramaViewContext);
|
|
4166
|
+
const overlayApi = (0, import_react11.useContext)(PanoContextMenuOverlayContext);
|
|
4167
|
+
const actions = (0, import_react11.useContext)(PanoContextMenuActionsContext);
|
|
4168
|
+
const instanceId = (0, import_react11.useId)();
|
|
4169
|
+
const sessionKeyRef = (0, import_react11.useRef)(0);
|
|
4170
|
+
const propsRef = (0, import_react11.useRef)({
|
|
3995
4171
|
items,
|
|
3996
4172
|
prepend,
|
|
3997
4173
|
append,
|
|
@@ -4021,10 +4197,10 @@ function PanoContextMenu({
|
|
|
4021
4197
|
"<PanoContextMenu> requires the PanoViewer context-menu overlay host."
|
|
4022
4198
|
);
|
|
4023
4199
|
}
|
|
4024
|
-
const close = (0,
|
|
4200
|
+
const close = (0, import_react11.useCallback)(() => {
|
|
4025
4201
|
overlayApi.setSession(null);
|
|
4026
4202
|
}, [overlayApi]);
|
|
4027
|
-
const openMenu = (0,
|
|
4203
|
+
const openMenu = (0, import_react11.useCallback)(
|
|
4028
4204
|
(event) => {
|
|
4029
4205
|
event.nativeEvent.preventDefault();
|
|
4030
4206
|
const view = controlsRef.current?.getView() ?? {
|
|
@@ -4053,9 +4229,9 @@ function PanoContextMenu({
|
|
|
4053
4229
|
view,
|
|
4054
4230
|
render: () => {
|
|
4055
4231
|
if (hasCustomChildren && current.children) {
|
|
4056
|
-
return /* @__PURE__ */ (0,
|
|
4232
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { "data-pano-context-menu": true, style: { pointerEvents: "auto" }, children: current.children({ event, view, close }) });
|
|
4057
4233
|
}
|
|
4058
|
-
return /* @__PURE__ */ (0,
|
|
4234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4059
4235
|
DefaultContextMenuPanel,
|
|
4060
4236
|
{
|
|
4061
4237
|
appearance: current.appearance,
|
|
@@ -4073,7 +4249,7 @@ function PanoContextMenu({
|
|
|
4073
4249
|
},
|
|
4074
4250
|
[actions, close, controlsRef, instanceId, overlayApi]
|
|
4075
4251
|
);
|
|
4076
|
-
(0,
|
|
4252
|
+
(0, import_react11.useEffect)(() => {
|
|
4077
4253
|
const unsubscribeContextMenu = eventBus.subscribe(
|
|
4078
4254
|
"contextmenu",
|
|
4079
4255
|
openMenu
|
|
@@ -4093,7 +4269,7 @@ function PanoContextMenu({
|
|
|
4093
4269
|
return null;
|
|
4094
4270
|
}
|
|
4095
4271
|
function ResetViewIcon() {
|
|
4096
|
-
return /* @__PURE__ */ (0,
|
|
4272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
4097
4273
|
"svg",
|
|
4098
4274
|
{
|
|
4099
4275
|
"aria-hidden": true,
|
|
@@ -4106,14 +4282,14 @@ function ResetViewIcon() {
|
|
|
4106
4282
|
viewBox: "0 0 16 16",
|
|
4107
4283
|
width: "100%",
|
|
4108
4284
|
children: [
|
|
4109
|
-
/* @__PURE__ */ (0,
|
|
4110
|
-
/* @__PURE__ */ (0,
|
|
4285
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M3.5 6.5A4.5 4.5 0 1 1 4 10" }),
|
|
4286
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M3.5 3.5v3h3" })
|
|
4111
4287
|
]
|
|
4112
4288
|
}
|
|
4113
4289
|
);
|
|
4114
4290
|
}
|
|
4115
4291
|
function FullscreenIcon() {
|
|
4116
|
-
return /* @__PURE__ */ (0,
|
|
4292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4117
4293
|
"svg",
|
|
4118
4294
|
{
|
|
4119
4295
|
"aria-hidden": true,
|
|
@@ -4125,12 +4301,12 @@ function FullscreenIcon() {
|
|
|
4125
4301
|
strokeWidth: "1.75",
|
|
4126
4302
|
viewBox: "0 0 16 16",
|
|
4127
4303
|
width: "100%",
|
|
4128
|
-
children: /* @__PURE__ */ (0,
|
|
4304
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M3 6V3h3M10 3h3v3M13 10v3h-3M6 13H3v-3" })
|
|
4129
4305
|
}
|
|
4130
4306
|
);
|
|
4131
4307
|
}
|
|
4132
4308
|
function ExitFullscreenIcon() {
|
|
4133
|
-
return /* @__PURE__ */ (0,
|
|
4309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4134
4310
|
"svg",
|
|
4135
4311
|
{
|
|
4136
4312
|
"aria-hidden": true,
|
|
@@ -4142,7 +4318,7 @@ function ExitFullscreenIcon() {
|
|
|
4142
4318
|
strokeWidth: "1.75",
|
|
4143
4319
|
viewBox: "0 0 16 16",
|
|
4144
4320
|
width: "100%",
|
|
4145
|
-
children: /* @__PURE__ */ (0,
|
|
4321
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M6 3v3H3M10 3v3h3M3 10h3v3M10 10h3v3" })
|
|
4146
4322
|
}
|
|
4147
4323
|
);
|
|
4148
4324
|
}
|
|
@@ -4151,7 +4327,7 @@ function createPanoContextMenuPresets(actions) {
|
|
|
4151
4327
|
const resetView = {
|
|
4152
4328
|
id: "pano-reset-view",
|
|
4153
4329
|
label: "Reset view",
|
|
4154
|
-
icon: /* @__PURE__ */ (0,
|
|
4330
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ResetViewIcon, {}),
|
|
4155
4331
|
onSelect: () => {
|
|
4156
4332
|
actions.reset();
|
|
4157
4333
|
}
|
|
@@ -4159,7 +4335,7 @@ function createPanoContextMenuPresets(actions) {
|
|
|
4159
4335
|
const fullscreen = {
|
|
4160
4336
|
id: "pano-fullscreen",
|
|
4161
4337
|
label: isFullscreen ? "Exit fullscreen" : "Enter fullscreen",
|
|
4162
|
-
icon: isFullscreen ? /* @__PURE__ */ (0,
|
|
4338
|
+
icon: isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ExitFullscreenIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FullscreenIcon, {}),
|
|
4163
4339
|
onSelect: () => {
|
|
4164
4340
|
actions.toggleFullscreen();
|
|
4165
4341
|
}
|
|
@@ -4252,12 +4428,12 @@ function composePanoContextMenuItems(props, presets) {
|
|
|
4252
4428
|
...resolvePanoContextMenuEntries(props.append ?? [], presets)
|
|
4253
4429
|
];
|
|
4254
4430
|
}
|
|
4255
|
-
var PanoContextMenuActionsContext = (0,
|
|
4431
|
+
var PanoContextMenuActionsContext = (0, import_react11.createContext)(null);
|
|
4256
4432
|
|
|
4257
4433
|
// src/pano-cursor.tsx
|
|
4258
4434
|
var import_fiber5 = require("@react-three/fiber");
|
|
4259
|
-
var
|
|
4260
|
-
var
|
|
4435
|
+
var import_react12 = require("react");
|
|
4436
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
4261
4437
|
var DEFAULT_PANO_CURSORS = {
|
|
4262
4438
|
default: "grab",
|
|
4263
4439
|
dragging: "grabbing",
|
|
@@ -4271,9 +4447,9 @@ var LAYER_PRIORITY = {
|
|
|
4271
4447
|
hotspotDragging: 3,
|
|
4272
4448
|
hidden: 4
|
|
4273
4449
|
};
|
|
4274
|
-
var PanoCursorContext = (0,
|
|
4450
|
+
var PanoCursorContext = (0, import_react12.createContext)(null);
|
|
4275
4451
|
function usePanoCursor() {
|
|
4276
|
-
return (0,
|
|
4452
|
+
return (0, import_react12.useContext)(PanoCursorContext);
|
|
4277
4453
|
}
|
|
4278
4454
|
function hotspotCursorClaimId(id) {
|
|
4279
4455
|
return `pano-cursor:hotspot:${id}`;
|
|
@@ -4325,12 +4501,12 @@ function PanoCursorController({
|
|
|
4325
4501
|
children
|
|
4326
4502
|
}) {
|
|
4327
4503
|
const { gl } = (0, import_fiber5.useThree)();
|
|
4328
|
-
const eventBus = (0,
|
|
4329
|
-
const claimsRef = (0,
|
|
4330
|
-
const cursorsRef = (0,
|
|
4331
|
-
const appliedCursorRef = (0,
|
|
4504
|
+
const eventBus = (0, import_react12.useContext)(PanoEventBusContext);
|
|
4505
|
+
const claimsRef = (0, import_react12.useRef)(/* @__PURE__ */ new Map());
|
|
4506
|
+
const cursorsRef = (0, import_react12.useRef)(cursors);
|
|
4507
|
+
const appliedCursorRef = (0, import_react12.useRef)(null);
|
|
4332
4508
|
cursorsRef.current = cursors;
|
|
4333
|
-
const applyCursor = (0,
|
|
4509
|
+
const applyCursor = (0, import_react12.useCallback)(() => {
|
|
4334
4510
|
const next = resolveHighestCursor(claimsRef.current, cursorsRef.current);
|
|
4335
4511
|
const element = gl.domElement;
|
|
4336
4512
|
if (appliedCursorRef.current === next && element.style.cursor === next) {
|
|
@@ -4339,14 +4515,14 @@ function PanoCursorController({
|
|
|
4339
4515
|
element.style.cursor = next;
|
|
4340
4516
|
appliedCursorRef.current = next;
|
|
4341
4517
|
}, [gl]);
|
|
4342
|
-
const claim = (0,
|
|
4518
|
+
const claim = (0, import_react12.useCallback)(
|
|
4343
4519
|
(id, layer, cursor) => {
|
|
4344
4520
|
claimsRef.current.set(id, { layer, cursor });
|
|
4345
4521
|
applyCursor();
|
|
4346
4522
|
},
|
|
4347
4523
|
[applyCursor]
|
|
4348
4524
|
);
|
|
4349
|
-
const release = (0,
|
|
4525
|
+
const release = (0, import_react12.useCallback)(
|
|
4350
4526
|
(id) => {
|
|
4351
4527
|
if (claimsRef.current.delete(id)) {
|
|
4352
4528
|
applyCursor();
|
|
@@ -4354,7 +4530,7 @@ function PanoCursorController({
|
|
|
4354
4530
|
},
|
|
4355
4531
|
[applyCursor]
|
|
4356
4532
|
);
|
|
4357
|
-
const api = (0,
|
|
4533
|
+
const api = (0, import_react12.useMemo)(
|
|
4358
4534
|
() => ({
|
|
4359
4535
|
cursors,
|
|
4360
4536
|
claim,
|
|
@@ -4362,7 +4538,7 @@ function PanoCursorController({
|
|
|
4362
4538
|
}),
|
|
4363
4539
|
[claim, cursors, release]
|
|
4364
4540
|
);
|
|
4365
|
-
(0,
|
|
4541
|
+
(0, import_react12.useEffect)(() => {
|
|
4366
4542
|
const element = gl.domElement;
|
|
4367
4543
|
const previous = element.style.cursor;
|
|
4368
4544
|
return () => {
|
|
@@ -4371,10 +4547,10 @@ function PanoCursorController({
|
|
|
4371
4547
|
element.style.cursor = previous;
|
|
4372
4548
|
};
|
|
4373
4549
|
}, [gl]);
|
|
4374
|
-
(0,
|
|
4550
|
+
(0, import_react12.useEffect)(() => {
|
|
4375
4551
|
applyCursor();
|
|
4376
4552
|
}, [applyCursor, cursors]);
|
|
4377
|
-
(0,
|
|
4553
|
+
(0, import_react12.useEffect)(() => {
|
|
4378
4554
|
if (!eventBus) {
|
|
4379
4555
|
return;
|
|
4380
4556
|
}
|
|
@@ -4399,12 +4575,12 @@ function PanoCursorController({
|
|
|
4399
4575
|
release(PANO_DRAG_CLAIM_ID);
|
|
4400
4576
|
};
|
|
4401
4577
|
}, [claim, eventBus, release]);
|
|
4402
|
-
return /* @__PURE__ */ (0,
|
|
4578
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PanoCursorContext.Provider, { value: api, children });
|
|
4403
4579
|
}
|
|
4404
4580
|
|
|
4405
4581
|
// src/pano-events.tsx
|
|
4406
4582
|
var import_fiber6 = require("@react-three/fiber");
|
|
4407
|
-
var
|
|
4583
|
+
var import_react13 = require("react");
|
|
4408
4584
|
var DEFAULT_IDLE_TIME_MS = 2e3;
|
|
4409
4585
|
function resolveIdleTime(value) {
|
|
4410
4586
|
return Number.isFinite(value) && value >= 0 ? value : DEFAULT_IDLE_TIME_MS;
|
|
@@ -4442,13 +4618,13 @@ function usePanoEvents({
|
|
|
4442
4618
|
onVRDenied,
|
|
4443
4619
|
onVRUnknownDevice
|
|
4444
4620
|
}) {
|
|
4445
|
-
const eventBus = (0,
|
|
4446
|
-
const controlsRef = (0,
|
|
4621
|
+
const eventBus = (0, import_react13.useContext)(PanoEventBusContext);
|
|
4622
|
+
const controlsRef = (0, import_react13.useContext)(PanoramaViewContext);
|
|
4447
4623
|
const { gl } = (0, import_fiber6.useThree)();
|
|
4448
4624
|
if (!eventBus || !controlsRef) {
|
|
4449
4625
|
throw new Error("usePanoEvents must be used inside <PanoViewer>.");
|
|
4450
4626
|
}
|
|
4451
|
-
const callbacksRef = (0,
|
|
4627
|
+
const callbacksRef = (0, import_react13.useRef)({
|
|
4452
4628
|
onViewChange,
|
|
4453
4629
|
onViewSettled,
|
|
4454
4630
|
onViewInteractionStart,
|
|
@@ -4512,15 +4688,15 @@ function usePanoEvents({
|
|
|
4512
4688
|
onVRDenied,
|
|
4513
4689
|
onVRUnknownDevice
|
|
4514
4690
|
};
|
|
4515
|
-
const idleElapsedRef = (0,
|
|
4516
|
-
const isIdleRef = (0,
|
|
4517
|
-
const idleTimeRef = (0,
|
|
4691
|
+
const idleElapsedRef = (0, import_react13.useRef)(0);
|
|
4692
|
+
const isIdleRef = (0, import_react13.useRef)(false);
|
|
4693
|
+
const idleTimeRef = (0, import_react13.useRef)(resolveIdleTime(idleTime));
|
|
4518
4694
|
idleTimeRef.current = resolveIdleTime(idleTime);
|
|
4519
|
-
(0,
|
|
4695
|
+
(0, import_react13.useEffect)(() => {
|
|
4520
4696
|
idleElapsedRef.current = 0;
|
|
4521
4697
|
isIdleRef.current = false;
|
|
4522
4698
|
}, [idleTime]);
|
|
4523
|
-
(0,
|
|
4699
|
+
(0, import_react13.useEffect)(() => {
|
|
4524
4700
|
const unsubscribers = [
|
|
4525
4701
|
eventBus.subscribe("viewchange", (view) => {
|
|
4526
4702
|
callbacksRef.current.onViewChange?.(view);
|
|
@@ -4601,7 +4777,7 @@ function usePanoEvents({
|
|
|
4601
4777
|
}
|
|
4602
4778
|
};
|
|
4603
4779
|
}, [eventBus]);
|
|
4604
|
-
(0,
|
|
4780
|
+
(0, import_react13.useEffect)(() => {
|
|
4605
4781
|
const element = gl.domElement;
|
|
4606
4782
|
const handleWheel = (nativeEvent) => {
|
|
4607
4783
|
callbacksRef.current.onWheel?.({
|
|
@@ -4614,7 +4790,7 @@ function usePanoEvents({
|
|
|
4614
4790
|
element.removeEventListener("wheel", handleWheel);
|
|
4615
4791
|
};
|
|
4616
4792
|
}, [gl]);
|
|
4617
|
-
(0,
|
|
4793
|
+
(0, import_react13.useEffect)(() => {
|
|
4618
4794
|
if (typeof document === "undefined") {
|
|
4619
4795
|
return;
|
|
4620
4796
|
}
|
|
@@ -4640,7 +4816,7 @@ function usePanoEvents({
|
|
|
4640
4816
|
wasFullscreenRef.current = isViewerFullscreen();
|
|
4641
4817
|
return subscribeFullscreenChange(handleFullscreenChange);
|
|
4642
4818
|
}, [gl]);
|
|
4643
|
-
(0,
|
|
4819
|
+
(0, import_react13.useEffect)(() => {
|
|
4644
4820
|
const element = gl.domElement;
|
|
4645
4821
|
if (typeof ResizeObserver === "undefined") {
|
|
4646
4822
|
return;
|
|
@@ -4682,7 +4858,7 @@ function PanoEvents(props) {
|
|
|
4682
4858
|
|
|
4683
4859
|
// src/panorama-event-surface.tsx
|
|
4684
4860
|
var import_fiber7 = require("@react-three/fiber");
|
|
4685
|
-
var
|
|
4861
|
+
var import_react14 = require("react");
|
|
4686
4862
|
var import_three3 = require("three");
|
|
4687
4863
|
|
|
4688
4864
|
// src/hotspot/coordinates.ts
|
|
@@ -4760,7 +4936,7 @@ var DEFAULT_PANORAMA_CAMERA_NEAR = 0.1;
|
|
|
4760
4936
|
var DEFAULT_PANORAMA_CAMERA_FAR = DEFAULT_PANORAMA_RADIUS * 2;
|
|
4761
4937
|
|
|
4762
4938
|
// src/panorama-event-surface.tsx
|
|
4763
|
-
var
|
|
4939
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
4764
4940
|
var EVENT_SURFACE_RADIUS = DEFAULT_PANORAMA_RADIUS - 1;
|
|
4765
4941
|
function makePanoramaPointerEvent(event) {
|
|
4766
4942
|
const nativeEvent = event.nativeEvent;
|
|
@@ -4775,9 +4951,9 @@ function makePanoramaPointerEvent(event) {
|
|
|
4775
4951
|
};
|
|
4776
4952
|
}
|
|
4777
4953
|
function PanoramaEventSurface() {
|
|
4778
|
-
const eventBus = (0,
|
|
4954
|
+
const eventBus = (0, import_react14.useContext)(PanoEventBusContext);
|
|
4779
4955
|
const { camera, gl } = (0, import_fiber7.useThree)();
|
|
4780
|
-
(0,
|
|
4956
|
+
(0, import_react14.useEffect)(() => {
|
|
4781
4957
|
if (!eventBus) {
|
|
4782
4958
|
return;
|
|
4783
4959
|
}
|
|
@@ -4818,7 +4994,7 @@ function PanoramaEventSurface() {
|
|
|
4818
4994
|
event.stopPropagation();
|
|
4819
4995
|
eventBus.emit(type, makePanoramaPointerEvent(event));
|
|
4820
4996
|
};
|
|
4821
|
-
return /* @__PURE__ */ (0,
|
|
4997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4822
4998
|
"mesh",
|
|
4823
4999
|
{
|
|
4824
5000
|
renderOrder: -200,
|
|
@@ -4828,8 +5004,8 @@ function PanoramaEventSurface() {
|
|
|
4828
5004
|
onPointerUp: (event) => emit("pointerup", event),
|
|
4829
5005
|
onPointerMove: (event) => emit("pointermove", event),
|
|
4830
5006
|
children: [
|
|
4831
|
-
/* @__PURE__ */ (0,
|
|
4832
|
-
/* @__PURE__ */ (0,
|
|
5007
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("sphereGeometry", { args: [EVENT_SURFACE_RADIUS, 64, 32] }),
|
|
5008
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4833
5009
|
"meshBasicMaterial",
|
|
4834
5010
|
{
|
|
4835
5011
|
colorWrite: false,
|
|
@@ -4846,8 +5022,8 @@ function PanoramaEventSurface() {
|
|
|
4846
5022
|
}
|
|
4847
5023
|
|
|
4848
5024
|
// src/scenes-host.ts
|
|
4849
|
-
var
|
|
4850
|
-
var ScenesHostContext = (0,
|
|
5025
|
+
var import_react15 = require("react");
|
|
5026
|
+
var ScenesHostContext = (0, import_react15.createContext)(null);
|
|
4851
5027
|
function createScenesHost() {
|
|
4852
5028
|
return {
|
|
4853
5029
|
controller: null,
|
|
@@ -4864,7 +5040,7 @@ function notifyScenesHost(host) {
|
|
|
4864
5040
|
|
|
4865
5041
|
// src/touch-controls.tsx
|
|
4866
5042
|
var import_fiber8 = require("@react-three/fiber");
|
|
4867
|
-
var
|
|
5043
|
+
var import_react16 = require("react");
|
|
4868
5044
|
var DEFAULT_ROTATE_SPEED3 = 0.35;
|
|
4869
5045
|
function resolveSpeed3(value, fallback) {
|
|
4870
5046
|
return Number.isFinite(value) && value >= 0 ? value : fallback;
|
|
@@ -4879,16 +5055,16 @@ function TouchControls({
|
|
|
4879
5055
|
pinchZoom = true
|
|
4880
5056
|
}) {
|
|
4881
5057
|
useClaimControlChannel("touch");
|
|
4882
|
-
const controlsRef = (0,
|
|
5058
|
+
const controlsRef = (0, import_react16.useContext)(PanoramaViewContext);
|
|
4883
5059
|
const { gl } = (0, import_fiber8.useThree)();
|
|
4884
|
-
const pointersRef = (0,
|
|
4885
|
-
const pinchDistanceRef = (0,
|
|
4886
|
-
const optionsRef = (0,
|
|
5060
|
+
const pointersRef = (0, import_react16.useRef)(/* @__PURE__ */ new Map());
|
|
5061
|
+
const pinchDistanceRef = (0, import_react16.useRef)(null);
|
|
5062
|
+
const optionsRef = (0, import_react16.useRef)({ rotateSpeed, invert, pinchZoom });
|
|
4887
5063
|
if (!controlsRef) {
|
|
4888
5064
|
throw new Error("<TouchControls> must be rendered inside <PanoViewer>.");
|
|
4889
5065
|
}
|
|
4890
5066
|
optionsRef.current = { rotateSpeed, invert, pinchZoom };
|
|
4891
|
-
(0,
|
|
5067
|
+
(0, import_react16.useEffect)(() => {
|
|
4892
5068
|
const element = gl.domElement;
|
|
4893
5069
|
const clearPointers = () => {
|
|
4894
5070
|
for (const pointerId of pointersRef.current.keys()) {
|
|
@@ -5010,21 +5186,21 @@ function TouchControls({
|
|
|
5010
5186
|
}
|
|
5011
5187
|
|
|
5012
5188
|
// src/video/chrome-overlay.tsx
|
|
5013
|
-
var
|
|
5014
|
-
var
|
|
5015
|
-
var PanoChromeOverlayContext = (0,
|
|
5189
|
+
var import_react17 = require("react");
|
|
5190
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
5191
|
+
var PanoChromeOverlayContext = (0, import_react17.createContext)(null);
|
|
5016
5192
|
function usePanoChromeOverlay() {
|
|
5017
|
-
const [overlayElement, setOverlayElement] = (0,
|
|
5193
|
+
const [overlayElement, setOverlayElement] = (0, import_react17.useState)(
|
|
5018
5194
|
null
|
|
5019
5195
|
);
|
|
5020
|
-
const setOverlayNode = (0,
|
|
5196
|
+
const setOverlayNode = (0, import_react17.useCallback)((node) => {
|
|
5021
5197
|
setOverlayElement(node);
|
|
5022
5198
|
}, []);
|
|
5023
|
-
const api = (0,
|
|
5199
|
+
const api = (0, import_react17.useMemo)(
|
|
5024
5200
|
() => ({ overlayElement }),
|
|
5025
5201
|
[overlayElement]
|
|
5026
5202
|
);
|
|
5027
|
-
const overlay = /* @__PURE__ */ (0,
|
|
5203
|
+
const overlay = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
5028
5204
|
"div",
|
|
5029
5205
|
{
|
|
5030
5206
|
className: "pano-chrome-overlay",
|
|
@@ -5036,9 +5212,9 @@ function usePanoChromeOverlay() {
|
|
|
5036
5212
|
}
|
|
5037
5213
|
|
|
5038
5214
|
// src/video/host.ts
|
|
5039
|
-
var
|
|
5040
|
-
var PanoVideoHostContext = (0,
|
|
5041
|
-
var DefaultPanoVideoControlsContext = (0,
|
|
5215
|
+
var import_react18 = require("react");
|
|
5216
|
+
var PanoVideoHostContext = (0, import_react18.createContext)(null);
|
|
5217
|
+
var DefaultPanoVideoControlsContext = (0, import_react18.createContext)(false);
|
|
5042
5218
|
function createPanoVideoHost() {
|
|
5043
5219
|
return {
|
|
5044
5220
|
controller: null,
|
|
@@ -5083,8 +5259,8 @@ function isProduction3() {
|
|
|
5083
5259
|
return nodeEnv === "production";
|
|
5084
5260
|
}
|
|
5085
5261
|
function useClaimPanoVideoControls() {
|
|
5086
|
-
const host = (0,
|
|
5087
|
-
const isDefault = (0,
|
|
5262
|
+
const host = (0, import_react18.useContext)(PanoVideoHostContext);
|
|
5263
|
+
const isDefault = (0, import_react18.useContext)(DefaultPanoVideoControlsContext);
|
|
5088
5264
|
if (!host || isDefault) {
|
|
5089
5265
|
return;
|
|
5090
5266
|
}
|
|
@@ -5097,11 +5273,11 @@ function useClaimPanoVideoControls() {
|
|
|
5097
5273
|
}
|
|
5098
5274
|
|
|
5099
5275
|
// src/video/pano-video-chrome-bridge.tsx
|
|
5100
|
-
var
|
|
5276
|
+
var import_react21 = require("react");
|
|
5101
5277
|
|
|
5102
5278
|
// src/video/pano-video-captions.tsx
|
|
5103
|
-
var
|
|
5104
|
-
var
|
|
5279
|
+
var import_react19 = require("react");
|
|
5280
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
5105
5281
|
var DEFAULT_PANO_VIDEO_CAPTION_APPEARANCE = {
|
|
5106
5282
|
color: "#ffffff",
|
|
5107
5283
|
background: "rgba(0, 0, 0, 0.55)",
|
|
@@ -5124,7 +5300,7 @@ function resolvePanoVideoCaptionAppearance(appearance) {
|
|
|
5124
5300
|
function PanoVideoCaptionsOverlay({
|
|
5125
5301
|
controller
|
|
5126
5302
|
}) {
|
|
5127
|
-
const snapshot = (0,
|
|
5303
|
+
const snapshot = (0, import_react19.useSyncExternalStore)(
|
|
5128
5304
|
controller.subscribe,
|
|
5129
5305
|
controller.getSnapshot,
|
|
5130
5306
|
controller.getSnapshot
|
|
@@ -5149,13 +5325,13 @@ function PanoVideoCaptionsOverlay({
|
|
|
5149
5325
|
textShadow: snapshot.captionAppearance.textShadow,
|
|
5150
5326
|
whiteSpace: "pre-wrap"
|
|
5151
5327
|
};
|
|
5152
|
-
return /* @__PURE__ */ (0,
|
|
5328
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
5153
5329
|
"div",
|
|
5154
5330
|
{
|
|
5155
5331
|
className: "pano-video-captions",
|
|
5156
5332
|
"data-pano-video-captions": "",
|
|
5157
5333
|
style: wrapperStyle,
|
|
5158
|
-
children: /* @__PURE__ */ (0,
|
|
5334
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { style: textStyle, children: snapshot.captionText })
|
|
5159
5335
|
}
|
|
5160
5336
|
);
|
|
5161
5337
|
}
|
|
@@ -5166,7 +5342,7 @@ function PanoVideoCaptions({
|
|
|
5166
5342
|
}
|
|
5167
5343
|
|
|
5168
5344
|
// src/video/pano-video-controls.tsx
|
|
5169
|
-
var
|
|
5345
|
+
var import_react20 = require("react");
|
|
5170
5346
|
|
|
5171
5347
|
// src/video/format.ts
|
|
5172
5348
|
var DEFAULT_PANO_VIDEO_PLAYBACK_RATES = [0.5, 1, 1.25, 1.5, 2];
|
|
@@ -5298,7 +5474,7 @@ function cueText(cue) {
|
|
|
5298
5474
|
}
|
|
5299
5475
|
|
|
5300
5476
|
// src/video/pano-video-controls.tsx
|
|
5301
|
-
var
|
|
5477
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
5302
5478
|
var DEFAULT_PANO_VIDEO_CONTROLS_APPEARANCE = {
|
|
5303
5479
|
background: "rgba(16, 16, 16, 0.88)",
|
|
5304
5480
|
color: "#f4f4f4",
|
|
@@ -5359,7 +5535,7 @@ function volumeFromClientY(clientY, track) {
|
|
|
5359
5535
|
return Math.max(0, Math.min(1, (rect.bottom - clientY) / rect.height));
|
|
5360
5536
|
}
|
|
5361
5537
|
function Icon({ path }) {
|
|
5362
|
-
return /* @__PURE__ */ (0,
|
|
5538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5363
5539
|
"svg",
|
|
5364
5540
|
{
|
|
5365
5541
|
"aria-hidden": true,
|
|
@@ -5371,7 +5547,7 @@ function Icon({ path }) {
|
|
|
5371
5547
|
strokeWidth: "1.75",
|
|
5372
5548
|
viewBox: "0 0 16 16",
|
|
5373
5549
|
width: "16",
|
|
5374
|
-
children: /* @__PURE__ */ (0,
|
|
5550
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: path })
|
|
5375
5551
|
}
|
|
5376
5552
|
);
|
|
5377
5553
|
}
|
|
@@ -5383,7 +5559,7 @@ function ChromeButton({
|
|
|
5383
5559
|
label,
|
|
5384
5560
|
onClick
|
|
5385
5561
|
}) {
|
|
5386
|
-
return /* @__PURE__ */ (0,
|
|
5562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5387
5563
|
"button",
|
|
5388
5564
|
{
|
|
5389
5565
|
"aria-label": label,
|
|
@@ -5409,14 +5585,14 @@ function ChromeMenu({
|
|
|
5409
5585
|
labelledBy,
|
|
5410
5586
|
items
|
|
5411
5587
|
}) {
|
|
5412
|
-
return /* @__PURE__ */ (0,
|
|
5588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5413
5589
|
ChromeMenuSurface,
|
|
5414
5590
|
{
|
|
5415
5591
|
appearance,
|
|
5416
5592
|
id,
|
|
5417
5593
|
labelledBy,
|
|
5418
5594
|
role: "menu",
|
|
5419
|
-
children: items.map((item) => /* @__PURE__ */ (0,
|
|
5595
|
+
children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5420
5596
|
ChromeMenuRadioItem,
|
|
5421
5597
|
{
|
|
5422
5598
|
active: item.active,
|
|
@@ -5436,7 +5612,7 @@ function ChromeMenuSurface({
|
|
|
5436
5612
|
labelledBy,
|
|
5437
5613
|
role
|
|
5438
5614
|
}) {
|
|
5439
|
-
return /* @__PURE__ */ (0,
|
|
5615
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5440
5616
|
"div",
|
|
5441
5617
|
{
|
|
5442
5618
|
"aria-labelledby": labelledBy,
|
|
@@ -5460,7 +5636,7 @@ function ChromeMenuRadioItem({
|
|
|
5460
5636
|
label,
|
|
5461
5637
|
onClick
|
|
5462
5638
|
}) {
|
|
5463
|
-
return /* @__PURE__ */ (0,
|
|
5639
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5464
5640
|
"button",
|
|
5465
5641
|
{
|
|
5466
5642
|
"aria-checked": active,
|
|
@@ -5485,7 +5661,7 @@ function ChromeMenuActionItem({
|
|
|
5485
5661
|
onClick,
|
|
5486
5662
|
secondary
|
|
5487
5663
|
}) {
|
|
5488
|
-
return /* @__PURE__ */ (0,
|
|
5664
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
5489
5665
|
"button",
|
|
5490
5666
|
{
|
|
5491
5667
|
className: "pano-video-chrome-menu-action",
|
|
@@ -5500,7 +5676,7 @@ function ChromeMenuActionItem({
|
|
|
5500
5676
|
},
|
|
5501
5677
|
type: "button",
|
|
5502
5678
|
children: [
|
|
5503
|
-
/* @__PURE__ */ (0,
|
|
5679
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: label }),
|
|
5504
5680
|
secondary
|
|
5505
5681
|
]
|
|
5506
5682
|
}
|
|
@@ -5509,10 +5685,10 @@ function ChromeMenuActionItem({
|
|
|
5509
5685
|
function ChromeMenuSectionLabel({
|
|
5510
5686
|
children
|
|
5511
5687
|
}) {
|
|
5512
|
-
return /* @__PURE__ */ (0,
|
|
5688
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "pano-video-chrome-menu-label", children });
|
|
5513
5689
|
}
|
|
5514
5690
|
function ChromeMenuDivider() {
|
|
5515
|
-
return /* @__PURE__ */ (0,
|
|
5691
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "pano-video-chrome-menu-divider" });
|
|
5516
5692
|
}
|
|
5517
5693
|
function CaptionsMenu({
|
|
5518
5694
|
appearance,
|
|
@@ -5525,16 +5701,16 @@ function CaptionsMenu({
|
|
|
5525
5701
|
panel,
|
|
5526
5702
|
snapshot
|
|
5527
5703
|
}) {
|
|
5528
|
-
return /* @__PURE__ */ (0,
|
|
5704
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5529
5705
|
ChromeMenuSurface,
|
|
5530
5706
|
{
|
|
5531
5707
|
appearance,
|
|
5532
5708
|
id,
|
|
5533
5709
|
labelledBy,
|
|
5534
5710
|
role: "menu",
|
|
5535
|
-
children: panel === "tracks" ? /* @__PURE__ */ (0,
|
|
5536
|
-
/* @__PURE__ */ (0,
|
|
5537
|
-
/* @__PURE__ */ (0,
|
|
5711
|
+
children: panel === "tracks" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
5712
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "pano-video-chrome-menu-list", children: [
|
|
5713
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5538
5714
|
ChromeMenuRadioItem,
|
|
5539
5715
|
{
|
|
5540
5716
|
active: snapshot.trackId === null,
|
|
@@ -5547,7 +5723,7 @@ function CaptionsMenu({
|
|
|
5547
5723
|
),
|
|
5548
5724
|
snapshot.tracks.map((track) => {
|
|
5549
5725
|
const trackItemId = panoVideoTrackId(track);
|
|
5550
|
-
return /* @__PURE__ */ (0,
|
|
5726
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5551
5727
|
ChromeMenuRadioItem,
|
|
5552
5728
|
{
|
|
5553
5729
|
active: snapshot.trackId === trackItemId,
|
|
@@ -5561,29 +5737,29 @@ function CaptionsMenu({
|
|
|
5561
5737
|
);
|
|
5562
5738
|
})
|
|
5563
5739
|
] }),
|
|
5564
|
-
/* @__PURE__ */ (0,
|
|
5565
|
-
/* @__PURE__ */ (0,
|
|
5740
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ChromeMenuDivider, {}),
|
|
5741
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5566
5742
|
ChromeMenuActionItem,
|
|
5567
5743
|
{
|
|
5568
5744
|
appearance,
|
|
5569
5745
|
label: "Settings",
|
|
5570
5746
|
onClick: onOpenSettings,
|
|
5571
|
-
secondary: /* @__PURE__ */ (0,
|
|
5747
|
+
secondary: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { "aria-hidden": true, children: "\u203A" })
|
|
5572
5748
|
}
|
|
5573
5749
|
)
|
|
5574
|
-
] }) : /* @__PURE__ */ (0,
|
|
5575
|
-
/* @__PURE__ */ (0,
|
|
5750
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
5751
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5576
5752
|
ChromeMenuActionItem,
|
|
5577
5753
|
{
|
|
5578
5754
|
appearance,
|
|
5579
5755
|
label: "Back",
|
|
5580
5756
|
onClick: onShowTracks,
|
|
5581
|
-
secondary: /* @__PURE__ */ (0,
|
|
5757
|
+
secondary: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { "aria-hidden": true, children: "\u2039" })
|
|
5582
5758
|
}
|
|
5583
5759
|
),
|
|
5584
|
-
/* @__PURE__ */ (0,
|
|
5585
|
-
/* @__PURE__ */ (0,
|
|
5586
|
-
CAPTION_SIZE_OPTIONS.map((option) => /* @__PURE__ */ (0,
|
|
5760
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ChromeMenuDivider, {}),
|
|
5761
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ChromeMenuSectionLabel, { children: "Font size" }),
|
|
5762
|
+
CAPTION_SIZE_OPTIONS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5587
5763
|
ChromeMenuRadioItem,
|
|
5588
5764
|
{
|
|
5589
5765
|
active: Number(snapshot.captionAppearance.fontSize) === option.value,
|
|
@@ -5595,9 +5771,9 @@ function CaptionsMenu({
|
|
|
5595
5771
|
},
|
|
5596
5772
|
option.id
|
|
5597
5773
|
)),
|
|
5598
|
-
/* @__PURE__ */ (0,
|
|
5599
|
-
/* @__PURE__ */ (0,
|
|
5600
|
-
CAPTION_BACKGROUND_OPTIONS.map((option) => /* @__PURE__ */ (0,
|
|
5774
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ChromeMenuDivider, {}),
|
|
5775
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ChromeMenuSectionLabel, { children: "Background" }),
|
|
5776
|
+
CAPTION_BACKGROUND_OPTIONS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5601
5777
|
ChromeMenuRadioItem,
|
|
5602
5778
|
{
|
|
5603
5779
|
active: snapshot.captionAppearance.background === option.value,
|
|
@@ -5618,7 +5794,7 @@ function VerticalVolumeSlider({
|
|
|
5618
5794
|
onVolume,
|
|
5619
5795
|
volume
|
|
5620
5796
|
}) {
|
|
5621
|
-
const trackRef = (0,
|
|
5797
|
+
const trackRef = (0, import_react20.useRef)(null);
|
|
5622
5798
|
const applyPointer = (event) => {
|
|
5623
5799
|
const track = trackRef.current;
|
|
5624
5800
|
if (!track) {
|
|
@@ -5638,7 +5814,7 @@ function VerticalVolumeSlider({
|
|
|
5638
5814
|
}
|
|
5639
5815
|
};
|
|
5640
5816
|
const percentLabel = formatVolumePercent(volume);
|
|
5641
|
-
return /* @__PURE__ */ (0,
|
|
5817
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
5642
5818
|
"div",
|
|
5643
5819
|
{
|
|
5644
5820
|
className: "pano-video-volume-popover",
|
|
@@ -5652,7 +5828,7 @@ function VerticalVolumeSlider({
|
|
|
5652
5828
|
pointerEvents: "auto"
|
|
5653
5829
|
},
|
|
5654
5830
|
children: [
|
|
5655
|
-
/* @__PURE__ */ (0,
|
|
5831
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5656
5832
|
"span",
|
|
5657
5833
|
{
|
|
5658
5834
|
"aria-hidden": true,
|
|
@@ -5664,14 +5840,14 @@ function VerticalVolumeSlider({
|
|
|
5664
5840
|
children: percentLabel
|
|
5665
5841
|
}
|
|
5666
5842
|
),
|
|
5667
|
-
/* @__PURE__ */ (0,
|
|
5843
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5668
5844
|
"div",
|
|
5669
5845
|
{
|
|
5670
5846
|
style: {
|
|
5671
5847
|
paddingBottom: VOLUME_THUMB_SIZE / 2,
|
|
5672
5848
|
paddingTop: VOLUME_THUMB_SIZE / 2
|
|
5673
5849
|
},
|
|
5674
|
-
children: /* @__PURE__ */ (0,
|
|
5850
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
5675
5851
|
"div",
|
|
5676
5852
|
{
|
|
5677
5853
|
"aria-label": "Volume",
|
|
@@ -5704,7 +5880,7 @@ function VerticalVolumeSlider({
|
|
|
5704
5880
|
},
|
|
5705
5881
|
tabIndex: 0,
|
|
5706
5882
|
children: [
|
|
5707
|
-
/* @__PURE__ */ (0,
|
|
5883
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5708
5884
|
"div",
|
|
5709
5885
|
{
|
|
5710
5886
|
style: {
|
|
@@ -5719,7 +5895,7 @@ function VerticalVolumeSlider({
|
|
|
5719
5895
|
}
|
|
5720
5896
|
}
|
|
5721
5897
|
),
|
|
5722
|
-
/* @__PURE__ */ (0,
|
|
5898
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5723
5899
|
"div",
|
|
5724
5900
|
{
|
|
5725
5901
|
style: {
|
|
@@ -5754,14 +5930,14 @@ function VolumeControl({
|
|
|
5754
5930
|
volume,
|
|
5755
5931
|
volumeAdjustable
|
|
5756
5932
|
}) {
|
|
5757
|
-
const rootRef = (0,
|
|
5758
|
-
const [open, setOpen] = (0,
|
|
5933
|
+
const rootRef = (0, import_react20.useRef)(null);
|
|
5934
|
+
const [open, setOpen] = (0, import_react20.useState)(false);
|
|
5759
5935
|
const displayVolume = muted ? 0 : volume;
|
|
5760
5936
|
const mutedOrSilent = muted || volume === 0;
|
|
5761
|
-
(0,
|
|
5937
|
+
(0, import_react20.useEffect)(() => {
|
|
5762
5938
|
onOpenChange(open);
|
|
5763
5939
|
}, [onOpenChange, open]);
|
|
5764
|
-
(0,
|
|
5940
|
+
(0, import_react20.useEffect)(() => {
|
|
5765
5941
|
if (!open || !volumeAdjustable || hasFinePointerHover()) {
|
|
5766
5942
|
return;
|
|
5767
5943
|
}
|
|
@@ -5778,17 +5954,17 @@ function VolumeControl({
|
|
|
5778
5954
|
};
|
|
5779
5955
|
}, [open, volumeAdjustable]);
|
|
5780
5956
|
if (!volumeAdjustable) {
|
|
5781
|
-
return /* @__PURE__ */ (0,
|
|
5957
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5782
5958
|
ChromeButton,
|
|
5783
5959
|
{
|
|
5784
5960
|
appearance,
|
|
5785
5961
|
label: mutedOrSilent ? "Unmute" : "Mute",
|
|
5786
5962
|
onClick: onToggleMuted,
|
|
5787
|
-
children: mutedOrSilent ? /* @__PURE__ */ (0,
|
|
5963
|
+
children: mutedOrSilent ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { path: "M3 6.5h2.2L8.5 4v8L5.2 9.5H3zM10.2 6.2l3.2 3.6M13.4 6.2l-3.2 3.6" }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { path: "M3 6.5h2.2L8.5 4v8L5.2 9.5H3zM10.5 5.5a3 3 0 0 1 0 5" })
|
|
5788
5964
|
}
|
|
5789
5965
|
);
|
|
5790
5966
|
}
|
|
5791
|
-
return /* @__PURE__ */ (0,
|
|
5967
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
5792
5968
|
"div",
|
|
5793
5969
|
{
|
|
5794
5970
|
"data-pano-video-volume": "",
|
|
@@ -5816,7 +5992,7 @@ function VolumeControl({
|
|
|
5816
5992
|
},
|
|
5817
5993
|
ref: rootRef,
|
|
5818
5994
|
children: [
|
|
5819
|
-
open ? /* @__PURE__ */ (0,
|
|
5995
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5820
5996
|
VerticalVolumeSlider,
|
|
5821
5997
|
{
|
|
5822
5998
|
appearance,
|
|
@@ -5824,7 +6000,7 @@ function VolumeControl({
|
|
|
5824
6000
|
volume: displayVolume
|
|
5825
6001
|
}
|
|
5826
6002
|
) : null,
|
|
5827
|
-
/* @__PURE__ */ (0,
|
|
6003
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5828
6004
|
ChromeButton,
|
|
5829
6005
|
{
|
|
5830
6006
|
appearance,
|
|
@@ -5835,7 +6011,7 @@ function VolumeControl({
|
|
|
5835
6011
|
}
|
|
5836
6012
|
onToggleMuted();
|
|
5837
6013
|
},
|
|
5838
|
-
children: mutedOrSilent ? /* @__PURE__ */ (0,
|
|
6014
|
+
children: mutedOrSilent ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { path: "M3 6.5h2.2L8.5 4v8L5.2 9.5H3zM10.2 6.2l3.2 3.6M13.4 6.2l-3.2 3.6" }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { path: "M3 6.5h2.2L8.5 4v8L5.2 9.5H3zM10.5 5.5a3 3 0 0 1 0 5" })
|
|
5839
6015
|
}
|
|
5840
6016
|
)
|
|
5841
6017
|
]
|
|
@@ -5848,24 +6024,24 @@ function PanoVideoControlsHud({
|
|
|
5848
6024
|
fullscreen,
|
|
5849
6025
|
overlayElement
|
|
5850
6026
|
}) {
|
|
5851
|
-
const resolved = (0,
|
|
6027
|
+
const resolved = (0, import_react20.useMemo)(
|
|
5852
6028
|
() => resolveControlsAppearance(appearance),
|
|
5853
6029
|
[appearance]
|
|
5854
6030
|
);
|
|
5855
|
-
const snapshot = (0,
|
|
6031
|
+
const snapshot = (0, import_react20.useSyncExternalStore)(
|
|
5856
6032
|
controller.subscribe,
|
|
5857
6033
|
controller.getSnapshot,
|
|
5858
6034
|
controller.getSnapshot
|
|
5859
6035
|
);
|
|
5860
|
-
const [menu, setMenu] = (0,
|
|
5861
|
-
const [captionsPanel, setCaptionsPanel] = (0,
|
|
5862
|
-
const [visible, setVisible] = (0,
|
|
5863
|
-
const [volumeOpen, setVolumeOpen] = (0,
|
|
5864
|
-
const [overlayWidth, setOverlayWidth] = (0,
|
|
6036
|
+
const [menu, setMenu] = (0, import_react20.useState)(null);
|
|
6037
|
+
const [captionsPanel, setCaptionsPanel] = (0, import_react20.useState)("tracks");
|
|
6038
|
+
const [visible, setVisible] = (0, import_react20.useState)(true);
|
|
6039
|
+
const [volumeOpen, setVolumeOpen] = (0, import_react20.useState)(false);
|
|
6040
|
+
const [overlayWidth, setOverlayWidth] = (0, import_react20.useState)(
|
|
5865
6041
|
() => overlayElement.clientWidth
|
|
5866
6042
|
);
|
|
5867
|
-
const idleTimerRef = (0,
|
|
5868
|
-
const barId = (0,
|
|
6043
|
+
const idleTimerRef = (0, import_react20.useRef)(0);
|
|
6044
|
+
const barId = (0, import_react20.useId)();
|
|
5869
6045
|
const rateMenuId = `${barId}-rate`;
|
|
5870
6046
|
const variantMenuId = `${barId}-variant`;
|
|
5871
6047
|
const captionsMenuId = `${barId}-captions`;
|
|
@@ -5873,7 +6049,7 @@ function PanoVideoControlsHud({
|
|
|
5873
6049
|
const compact = overlayWidth < COMPACT_CONTROLS_WIDTH;
|
|
5874
6050
|
const hideTime = overlayWidth < NARROW_CONTROLS_WIDTH;
|
|
5875
6051
|
const showFullscreen = isFullscreenEnabled();
|
|
5876
|
-
const bumpVisibility = (0,
|
|
6052
|
+
const bumpVisibility = (0, import_react20.useCallback)(
|
|
5877
6053
|
(playing) => {
|
|
5878
6054
|
setVisible(true);
|
|
5879
6055
|
window.clearTimeout(idleTimerRef.current);
|
|
@@ -5886,7 +6062,7 @@ function PanoVideoControlsHud({
|
|
|
5886
6062
|
},
|
|
5887
6063
|
[menu, volumeOpen]
|
|
5888
6064
|
);
|
|
5889
|
-
(0,
|
|
6065
|
+
(0, import_react20.useEffect)(() => {
|
|
5890
6066
|
if (typeof ResizeObserver === "undefined") {
|
|
5891
6067
|
return;
|
|
5892
6068
|
}
|
|
@@ -5901,15 +6077,15 @@ function PanoVideoControlsHud({
|
|
|
5901
6077
|
observer.disconnect();
|
|
5902
6078
|
};
|
|
5903
6079
|
}, [overlayElement]);
|
|
5904
|
-
(0,
|
|
6080
|
+
(0, import_react20.useEffect)(() => {
|
|
5905
6081
|
if (!compact && menu === "more") {
|
|
5906
6082
|
setMenu(null);
|
|
5907
6083
|
}
|
|
5908
6084
|
}, [compact, menu]);
|
|
5909
|
-
(0,
|
|
6085
|
+
(0, import_react20.useEffect)(() => {
|
|
5910
6086
|
bumpVisibility(snapshot.playing);
|
|
5911
6087
|
}, [bumpVisibility, snapshot.playing]);
|
|
5912
|
-
(0,
|
|
6088
|
+
(0, import_react20.useEffect)(() => {
|
|
5913
6089
|
const root = overlayElement.parentElement;
|
|
5914
6090
|
if (!root) {
|
|
5915
6091
|
return;
|
|
@@ -5968,7 +6144,7 @@ function PanoVideoControlsHud({
|
|
|
5968
6144
|
document.removeEventListener("pointerdown", handlePointerDown, true);
|
|
5969
6145
|
};
|
|
5970
6146
|
}, [bumpVisibility, controller, menu, overlayElement, snapshot.playing, volumeOpen]);
|
|
5971
|
-
(0,
|
|
6147
|
+
(0, import_react20.useEffect)(
|
|
5972
6148
|
() => () => {
|
|
5973
6149
|
window.clearTimeout(idleTimerRef.current);
|
|
5974
6150
|
},
|
|
@@ -5995,7 +6171,7 @@ function PanoVideoControlsHud({
|
|
|
5995
6171
|
let menuNode = null;
|
|
5996
6172
|
switch (menu) {
|
|
5997
6173
|
case "rate":
|
|
5998
|
-
menuNode = /* @__PURE__ */ (0,
|
|
6174
|
+
menuNode = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5999
6175
|
ChromeMenu,
|
|
6000
6176
|
{
|
|
6001
6177
|
appearance: resolved,
|
|
@@ -6014,7 +6190,7 @@ function PanoVideoControlsHud({
|
|
|
6014
6190
|
);
|
|
6015
6191
|
break;
|
|
6016
6192
|
case "variant":
|
|
6017
|
-
menuNode = /* @__PURE__ */ (0,
|
|
6193
|
+
menuNode = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
6018
6194
|
ChromeMenu,
|
|
6019
6195
|
{
|
|
6020
6196
|
appearance: resolved,
|
|
@@ -6033,7 +6209,7 @@ function PanoVideoControlsHud({
|
|
|
6033
6209
|
);
|
|
6034
6210
|
break;
|
|
6035
6211
|
case "captions":
|
|
6036
|
-
menuNode = /* @__PURE__ */ (0,
|
|
6212
|
+
menuNode = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
6037
6213
|
CaptionsMenu,
|
|
6038
6214
|
{
|
|
6039
6215
|
appearance: resolved,
|
|
@@ -6057,7 +6233,7 @@ function PanoVideoControlsHud({
|
|
|
6057
6233
|
);
|
|
6058
6234
|
break;
|
|
6059
6235
|
case "more":
|
|
6060
|
-
menuNode = /* @__PURE__ */ (0,
|
|
6236
|
+
menuNode = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
6061
6237
|
ChromeMenu,
|
|
6062
6238
|
{
|
|
6063
6239
|
appearance: resolved,
|
|
@@ -6123,9 +6299,9 @@ function PanoVideoControlsHud({
|
|
|
6123
6299
|
transition: "opacity 160ms ease",
|
|
6124
6300
|
zIndex: 2
|
|
6125
6301
|
};
|
|
6126
|
-
const rateButton = /* @__PURE__ */ (0,
|
|
6302
|
+
const rateButton = /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "pano-video-menu", "data-pano-video-menu": "rate", children: [
|
|
6127
6303
|
!compact && menu === "rate" ? menuNode : null,
|
|
6128
|
-
/* @__PURE__ */ (0,
|
|
6304
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
6129
6305
|
ChromeButton,
|
|
6130
6306
|
{
|
|
6131
6307
|
appearance: resolved,
|
|
@@ -6133,13 +6309,13 @@ function PanoVideoControlsHud({
|
|
|
6133
6309
|
onClick: () => {
|
|
6134
6310
|
toggleMenu("rate");
|
|
6135
6311
|
},
|
|
6136
|
-
children: /* @__PURE__ */ (0,
|
|
6312
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "pano-video-chrome-label", id: `${barId}-rate-btn`, children: snapshot.playbackRate === 1 ? "1x" : `${snapshot.playbackRate}x` })
|
|
6137
6313
|
}
|
|
6138
6314
|
)
|
|
6139
6315
|
] });
|
|
6140
|
-
const variantButton = canSwitchVariant ? /* @__PURE__ */ (0,
|
|
6316
|
+
const variantButton = canSwitchVariant ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "pano-video-menu", "data-pano-video-menu": "variant", children: [
|
|
6141
6317
|
!compact && menu === "variant" ? menuNode : null,
|
|
6142
|
-
/* @__PURE__ */ (0,
|
|
6318
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
6143
6319
|
ChromeButton,
|
|
6144
6320
|
{
|
|
6145
6321
|
appearance: resolved,
|
|
@@ -6147,13 +6323,13 @@ function PanoVideoControlsHud({
|
|
|
6147
6323
|
onClick: () => {
|
|
6148
6324
|
toggleMenu("variant");
|
|
6149
6325
|
},
|
|
6150
|
-
children: /* @__PURE__ */ (0,
|
|
6326
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "pano-video-chrome-label", id: `${barId}-variant-btn`, children: snapshot.variants.find((variant) => variant.id === snapshot.variantId)?.label ?? "Quality" })
|
|
6151
6327
|
}
|
|
6152
6328
|
)
|
|
6153
6329
|
] }) : null;
|
|
6154
|
-
const captionsButton = showCaptionsMenu ? /* @__PURE__ */ (0,
|
|
6330
|
+
const captionsButton = showCaptionsMenu ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "pano-video-menu", "data-pano-video-menu": "captions", children: [
|
|
6155
6331
|
!compact && menu === "captions" ? menuNode : null,
|
|
6156
|
-
/* @__PURE__ */ (0,
|
|
6332
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
6157
6333
|
ChromeButton,
|
|
6158
6334
|
{
|
|
6159
6335
|
appearance: resolved,
|
|
@@ -6161,18 +6337,18 @@ function PanoVideoControlsHud({
|
|
|
6161
6337
|
onClick: () => {
|
|
6162
6338
|
toggleMenu("captions");
|
|
6163
6339
|
},
|
|
6164
|
-
children: /* @__PURE__ */ (0,
|
|
6340
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { id: `${barId}-captions-btn`, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { path: "M2.5 4.5h11v7h-11zM5 7.2h2.4M5 9.2h5.5" }) })
|
|
6165
6341
|
}
|
|
6166
6342
|
)
|
|
6167
6343
|
] }) : null;
|
|
6168
|
-
return /* @__PURE__ */ (0,
|
|
6344
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
6169
6345
|
"div",
|
|
6170
6346
|
{
|
|
6171
6347
|
className: "pano-video-controls",
|
|
6172
6348
|
"data-pano-video-controls": "",
|
|
6173
6349
|
style: barStyle,
|
|
6174
6350
|
children: [
|
|
6175
|
-
/* @__PURE__ */ (0,
|
|
6351
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
6176
6352
|
ChromeButton,
|
|
6177
6353
|
{
|
|
6178
6354
|
appearance: resolved,
|
|
@@ -6180,11 +6356,11 @@ function PanoVideoControlsHud({
|
|
|
6180
6356
|
onClick: () => {
|
|
6181
6357
|
controller.togglePlay();
|
|
6182
6358
|
},
|
|
6183
|
-
children: snapshot.playing ? /* @__PURE__ */ (0,
|
|
6359
|
+
children: snapshot.playing ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { path: "M5 3.5h2.2v9H5zM8.8 3.5H11v9H8.8z" }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { path: "M5 3.2v9.6L13 8z" })
|
|
6184
6360
|
}
|
|
6185
6361
|
),
|
|
6186
|
-
hideTime ? null : /* @__PURE__ */ (0,
|
|
6187
|
-
/* @__PURE__ */ (0,
|
|
6362
|
+
hideTime ? null : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "pano-video-time", children: formatMediaTime(snapshot.currentTime) }),
|
|
6363
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
6188
6364
|
"input",
|
|
6189
6365
|
{
|
|
6190
6366
|
"aria-label": "Seek",
|
|
@@ -6206,8 +6382,8 @@ function PanoVideoControlsHud({
|
|
|
6206
6382
|
value: duration > 0 ? snapshot.currentTime : 0
|
|
6207
6383
|
}
|
|
6208
6384
|
),
|
|
6209
|
-
hideTime ? null : /* @__PURE__ */ (0,
|
|
6210
|
-
/* @__PURE__ */ (0,
|
|
6385
|
+
hideTime ? null : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "pano-video-time", children: formatMediaTime(duration) }),
|
|
6386
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
6211
6387
|
VolumeControl,
|
|
6212
6388
|
{
|
|
6213
6389
|
appearance: resolved,
|
|
@@ -6223,9 +6399,9 @@ function PanoVideoControlsHud({
|
|
|
6223
6399
|
volumeAdjustable: snapshot.volumeAdjustable
|
|
6224
6400
|
}
|
|
6225
6401
|
),
|
|
6226
|
-
compact ? /* @__PURE__ */ (0,
|
|
6402
|
+
compact ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "pano-video-menu", "data-pano-video-menu": "more", children: [
|
|
6227
6403
|
menu !== null ? menuNode : null,
|
|
6228
|
-
/* @__PURE__ */ (0,
|
|
6404
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
6229
6405
|
ChromeButton,
|
|
6230
6406
|
{
|
|
6231
6407
|
appearance: resolved,
|
|
@@ -6234,15 +6410,15 @@ function PanoVideoControlsHud({
|
|
|
6234
6410
|
onClick: () => {
|
|
6235
6411
|
toggleMenu("more");
|
|
6236
6412
|
},
|
|
6237
|
-
children: /* @__PURE__ */ (0,
|
|
6413
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { path: "M3 8a1 1 0 1 0 2 0 1 1 0 1 0-2 0M7 8a1 1 0 1 0 2 0 1 1 0 1 0-2 0M11 8a1 1 0 1 0 2 0 1 1 0 1 0-2 0" })
|
|
6238
6414
|
}
|
|
6239
6415
|
)
|
|
6240
|
-
] }) : /* @__PURE__ */ (0,
|
|
6416
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
6241
6417
|
rateButton,
|
|
6242
6418
|
variantButton,
|
|
6243
6419
|
captionsButton
|
|
6244
6420
|
] }),
|
|
6245
|
-
showFullscreen ? /* @__PURE__ */ (0,
|
|
6421
|
+
showFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
6246
6422
|
ChromeButton,
|
|
6247
6423
|
{
|
|
6248
6424
|
appearance: resolved,
|
|
@@ -6250,7 +6426,7 @@ function PanoVideoControlsHud({
|
|
|
6250
6426
|
onClick: () => {
|
|
6251
6427
|
fullscreen?.toggleFullscreen();
|
|
6252
6428
|
},
|
|
6253
|
-
children: fullscreen?.isFullscreen ? /* @__PURE__ */ (0,
|
|
6429
|
+
children: fullscreen?.isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { path: "M6 3.5H3.5V6M10 3.5h2.5V6M6 12.5H3.5V10M10 12.5h2.5V10" }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { path: "M3.5 6V3.5H6M10 3.5h2.5V6M3.5 10v2.5H6M10 12.5h2.5V10" })
|
|
6254
6430
|
}
|
|
6255
6431
|
) : null
|
|
6256
6432
|
]
|
|
@@ -6259,7 +6435,7 @@ function PanoVideoControlsHud({
|
|
|
6259
6435
|
}
|
|
6260
6436
|
function PanoVideoControls({ appearance }) {
|
|
6261
6437
|
useClaimPanoVideoControls();
|
|
6262
|
-
const host = (0,
|
|
6438
|
+
const host = (0, import_react20.useContext)(PanoVideoHostContext);
|
|
6263
6439
|
if (host && appearance) {
|
|
6264
6440
|
host.controls = appearance;
|
|
6265
6441
|
}
|
|
@@ -6267,13 +6443,13 @@ function PanoVideoControls({ appearance }) {
|
|
|
6267
6443
|
}
|
|
6268
6444
|
|
|
6269
6445
|
// src/video/pano-video-chrome-bridge.tsx
|
|
6270
|
-
var
|
|
6446
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
6271
6447
|
function PanoVideoChromeBridge({
|
|
6272
6448
|
fullscreen,
|
|
6273
6449
|
host,
|
|
6274
6450
|
overlayElement
|
|
6275
6451
|
}) {
|
|
6276
|
-
(0,
|
|
6452
|
+
(0, import_react21.useSyncExternalStore)(
|
|
6277
6453
|
(onStoreChange) => subscribePanoVideoHost(host, onStoreChange),
|
|
6278
6454
|
() => getPanoVideoHostRevision(host),
|
|
6279
6455
|
() => getPanoVideoHostRevision(host)
|
|
@@ -6282,8 +6458,8 @@ function PanoVideoChromeBridge({
|
|
|
6282
6458
|
return null;
|
|
6283
6459
|
}
|
|
6284
6460
|
const showDefaultControls = host.controller !== null && host.controls !== false && host.controlClaims === 0;
|
|
6285
|
-
return /* @__PURE__ */ (0,
|
|
6286
|
-
showDefaultControls ? /* @__PURE__ */ (0,
|
|
6461
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
6462
|
+
showDefaultControls ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
6287
6463
|
PanoVideoControlsHud,
|
|
6288
6464
|
{
|
|
6289
6465
|
appearance: typeof host.controls === "object" ? host.controls : void 0,
|
|
@@ -6292,16 +6468,16 @@ function PanoVideoChromeBridge({
|
|
|
6292
6468
|
overlayElement
|
|
6293
6469
|
}
|
|
6294
6470
|
) : null,
|
|
6295
|
-
host.captions !== false && host.controller ? /* @__PURE__ */ (0,
|
|
6471
|
+
host.captions !== false && host.controller ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PanoVideoCaptionsOverlay, { controller: host.controller }) : null
|
|
6296
6472
|
] });
|
|
6297
6473
|
}
|
|
6298
6474
|
|
|
6299
6475
|
// src/webvr/chrome.tsx
|
|
6300
|
-
var
|
|
6476
|
+
var import_react23 = require("react");
|
|
6301
6477
|
|
|
6302
6478
|
// src/webvr/host.ts
|
|
6303
|
-
var
|
|
6304
|
-
var WebVRRuntimeContext = (0,
|
|
6479
|
+
var import_react22 = require("react");
|
|
6480
|
+
var WebVRRuntimeContext = (0, import_react22.createContext)(null);
|
|
6305
6481
|
function createWebVRHost() {
|
|
6306
6482
|
return {
|
|
6307
6483
|
controller: null,
|
|
@@ -6445,7 +6621,7 @@ function clamp2(value, min, max) {
|
|
|
6445
6621
|
}
|
|
6446
6622
|
|
|
6447
6623
|
// src/webvr/chrome.tsx
|
|
6448
|
-
var
|
|
6624
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
6449
6625
|
function resolveAppearance(value) {
|
|
6450
6626
|
return {
|
|
6451
6627
|
...DEFAULT_WEBVR_CHROME_APPEARANCE,
|
|
@@ -6457,7 +6633,7 @@ function ChromeButton2({
|
|
|
6457
6633
|
children,
|
|
6458
6634
|
onClick
|
|
6459
6635
|
}) {
|
|
6460
|
-
return /* @__PURE__ */ (0,
|
|
6636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
6461
6637
|
"button",
|
|
6462
6638
|
{
|
|
6463
6639
|
className: "pano-webvr-button",
|
|
@@ -6494,7 +6670,7 @@ function SetupPanel({
|
|
|
6494
6670
|
color: appearance.color,
|
|
6495
6671
|
fontSize: appearance.fontSize
|
|
6496
6672
|
};
|
|
6497
|
-
return /* @__PURE__ */ (0,
|
|
6673
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
6498
6674
|
"div",
|
|
6499
6675
|
{
|
|
6500
6676
|
"aria-label": "Mobile VR setup",
|
|
@@ -6502,11 +6678,11 @@ function SetupPanel({
|
|
|
6502
6678
|
role: "dialog",
|
|
6503
6679
|
style: panelStyle,
|
|
6504
6680
|
children: [
|
|
6505
|
-
/* @__PURE__ */ (0,
|
|
6506
|
-
/* @__PURE__ */ (0,
|
|
6681
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h2", { className: "pano-webvr-setup-title", children: appearance.setupTitle ?? "MobileVR Setup" }),
|
|
6682
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "pano-webvr-setup-field", children: [
|
|
6507
6683
|
"Screen size (inch)",
|
|
6508
|
-
/* @__PURE__ */ (0,
|
|
6509
|
-
/* @__PURE__ */ (0,
|
|
6684
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "pano-webvr-setup-row", children: [
|
|
6685
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
6510
6686
|
"button",
|
|
6511
6687
|
{
|
|
6512
6688
|
"aria-label": "Decrease screen size",
|
|
@@ -6518,8 +6694,8 @@ function SetupPanel({
|
|
|
6518
6694
|
children: "\u2039"
|
|
6519
6695
|
}
|
|
6520
6696
|
),
|
|
6521
|
-
/* @__PURE__ */ (0,
|
|
6522
|
-
/* @__PURE__ */ (0,
|
|
6697
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { className: "pano-webvr-setup-value", children: settings.screensize === "auto" ? "Auto" : settings.screensize.toFixed(1) }),
|
|
6698
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
6523
6699
|
"button",
|
|
6524
6700
|
{
|
|
6525
6701
|
"aria-label": "Increase screen size",
|
|
@@ -6533,10 +6709,10 @@ function SetupPanel({
|
|
|
6533
6709
|
)
|
|
6534
6710
|
] })
|
|
6535
6711
|
] }),
|
|
6536
|
-
/* @__PURE__ */ (0,
|
|
6537
|
-
/* @__PURE__ */ (0,
|
|
6538
|
-
/* @__PURE__ */ (0,
|
|
6539
|
-
/* @__PURE__ */ (0,
|
|
6712
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("fieldset", { className: "pano-webvr-setup-fieldset", children: [
|
|
6713
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("legend", { className: "pano-webvr-setup-legend", children: "VR headset preset" }),
|
|
6714
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "pano-webvr-setup-row", children: [
|
|
6715
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
6540
6716
|
"button",
|
|
6541
6717
|
{
|
|
6542
6718
|
"aria-label": "Previous headset preset",
|
|
@@ -6546,8 +6722,8 @@ function SetupPanel({
|
|
|
6546
6722
|
children: "\u2039"
|
|
6547
6723
|
}
|
|
6548
6724
|
),
|
|
6549
|
-
/* @__PURE__ */ (0,
|
|
6550
|
-
/* @__PURE__ */ (0,
|
|
6725
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { className: "pano-webvr-setup-value-wide", children: WEBVR_PROFILES[settings.profileId].label }),
|
|
6726
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
6551
6727
|
"button",
|
|
6552
6728
|
{
|
|
6553
6729
|
"aria-label": "Next headset preset",
|
|
@@ -6559,7 +6735,7 @@ function SetupPanel({
|
|
|
6559
6735
|
)
|
|
6560
6736
|
] })
|
|
6561
6737
|
] }),
|
|
6562
|
-
/* @__PURE__ */ (0,
|
|
6738
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
6563
6739
|
ChromeButton2,
|
|
6564
6740
|
{
|
|
6565
6741
|
appearance,
|
|
@@ -6572,7 +6748,7 @@ function SetupPanel({
|
|
|
6572
6748
|
);
|
|
6573
6749
|
}
|
|
6574
6750
|
function WebVRChromeBridge({ host }) {
|
|
6575
|
-
(0,
|
|
6751
|
+
(0, import_react23.useSyncExternalStore)(
|
|
6576
6752
|
(listener) => subscribeWebVRHost(host, listener),
|
|
6577
6753
|
() => host.revision,
|
|
6578
6754
|
() => host.revision
|
|
@@ -6582,9 +6758,9 @@ function WebVRChromeBridge({ host }) {
|
|
|
6582
6758
|
return null;
|
|
6583
6759
|
}
|
|
6584
6760
|
const appearance = resolveAppearance(chrome);
|
|
6585
|
-
return /* @__PURE__ */ (0,
|
|
6586
|
-
/* @__PURE__ */ (0,
|
|
6587
|
-
mode !== "webxr" ? /* @__PURE__ */ (0,
|
|
6761
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
6762
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "pano-webvr-toolbar", children: mode ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "pano-webvr-toolbar-actions", children: [
|
|
6763
|
+
mode !== "webxr" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
6588
6764
|
ChromeButton2,
|
|
6589
6765
|
{
|
|
6590
6766
|
appearance,
|
|
@@ -6592,7 +6768,7 @@ function WebVRChromeBridge({ host }) {
|
|
|
6592
6768
|
children: "VR Setup"
|
|
6593
6769
|
}
|
|
6594
6770
|
) : null,
|
|
6595
|
-
/* @__PURE__ */ (0,
|
|
6771
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
6596
6772
|
ChromeButton2,
|
|
6597
6773
|
{
|
|
6598
6774
|
appearance,
|
|
@@ -6600,7 +6776,7 @@ function WebVRChromeBridge({ host }) {
|
|
|
6600
6776
|
children: "Exit VR"
|
|
6601
6777
|
}
|
|
6602
6778
|
)
|
|
6603
|
-
] }) : /* @__PURE__ */ (0,
|
|
6779
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
6604
6780
|
ChromeButton2,
|
|
6605
6781
|
{
|
|
6606
6782
|
appearance,
|
|
@@ -6608,7 +6784,7 @@ function WebVRChromeBridge({ host }) {
|
|
|
6608
6784
|
children: available ? "Enter VR" : "VR unavailable"
|
|
6609
6785
|
}
|
|
6610
6786
|
) }),
|
|
6611
|
-
mode === "fake" ? /* @__PURE__ */ (0,
|
|
6787
|
+
mode === "fake" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
6612
6788
|
"p",
|
|
6613
6789
|
{
|
|
6614
6790
|
className: "pano-webvr-hint",
|
|
@@ -6616,7 +6792,7 @@ function WebVRChromeBridge({ host }) {
|
|
|
6616
6792
|
children: "Simulated VR Mode \xB7 Click the view to lock the mouse, then move to look around. Use a headset or phone for real VR."
|
|
6617
6793
|
}
|
|
6618
6794
|
) : null,
|
|
6619
|
-
setupOpen ? /* @__PURE__ */ (0,
|
|
6795
|
+
setupOpen ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
6620
6796
|
SetupPanel,
|
|
6621
6797
|
{
|
|
6622
6798
|
appearance,
|
|
@@ -6656,12 +6832,12 @@ function projectStereoHtmlPosition(el, camera, size, eye) {
|
|
|
6656
6832
|
// src/webvr/xr-origin.tsx
|
|
6657
6833
|
var import_fiber9 = require("@react-three/fiber");
|
|
6658
6834
|
var import_xr2 = require("@react-three/xr");
|
|
6659
|
-
var
|
|
6835
|
+
var import_react24 = require("react");
|
|
6660
6836
|
var import_three5 = require("three");
|
|
6661
|
-
var
|
|
6837
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
6662
6838
|
function PanoramaXROrigin() {
|
|
6663
|
-
const originRef = (0,
|
|
6664
|
-
const localHeadPositionRef = (0,
|
|
6839
|
+
const originRef = (0, import_react24.useRef)(null);
|
|
6840
|
+
const localHeadPositionRef = (0, import_react24.useRef)(new import_three5.Vector3());
|
|
6665
6841
|
const session2 = (0, import_xr2.useXR)((state) => state.session);
|
|
6666
6842
|
const gl = (0, import_fiber9.useThree)((state) => state.gl);
|
|
6667
6843
|
(0, import_fiber9.useFrame)(() => {
|
|
@@ -6674,11 +6850,11 @@ function PanoramaXROrigin() {
|
|
|
6674
6850
|
origin.position.copy(localHeadPositionRef.current).multiplyScalar(-1);
|
|
6675
6851
|
origin.updateMatrixWorld();
|
|
6676
6852
|
}, -100);
|
|
6677
|
-
return /* @__PURE__ */ (0,
|
|
6853
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_xr2.XROrigin, { ref: originRef });
|
|
6678
6854
|
}
|
|
6679
6855
|
|
|
6680
6856
|
// src/pano-viewer.tsx
|
|
6681
|
-
var
|
|
6857
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
6682
6858
|
var DEFAULT_VIEW = {
|
|
6683
6859
|
yaw: 0,
|
|
6684
6860
|
pitch: 0,
|
|
@@ -6723,10 +6899,10 @@ function PanoCursorTree({
|
|
|
6723
6899
|
if (!cursors) {
|
|
6724
6900
|
return children;
|
|
6725
6901
|
}
|
|
6726
|
-
return /* @__PURE__ */ (0,
|
|
6902
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PanoCursorController, { cursors, children });
|
|
6727
6903
|
}
|
|
6728
6904
|
function PanoVideoHostReset() {
|
|
6729
|
-
const host = (0,
|
|
6905
|
+
const host = (0, import_react25.useContext)(PanoVideoHostContext);
|
|
6730
6906
|
if (host) {
|
|
6731
6907
|
host.controlClaims = 0;
|
|
6732
6908
|
}
|
|
@@ -6739,14 +6915,14 @@ function DefaultControlChannels({
|
|
|
6739
6915
|
keyboardChannel,
|
|
6740
6916
|
fovSpeed
|
|
6741
6917
|
}) {
|
|
6742
|
-
const claims = (0,
|
|
6918
|
+
const claims = (0, import_react25.useContext)(ControlClaimsContext);
|
|
6743
6919
|
if (!claims) {
|
|
6744
6920
|
return null;
|
|
6745
6921
|
}
|
|
6746
|
-
return /* @__PURE__ */ (0,
|
|
6747
|
-
userControlsEnabled && mouseChannel.mount && claims.mouse === 0 ? /* @__PURE__ */ (0,
|
|
6748
|
-
userControlsEnabled && touchChannel.mount && claims.touch === 0 ? /* @__PURE__ */ (0,
|
|
6749
|
-
userControlsEnabled && keyboardChannel.mount && claims.keyboard === 0 ? /* @__PURE__ */ (0,
|
|
6922
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(DefaultControlChannelContext.Provider, { value: true, children: [
|
|
6923
|
+
userControlsEnabled && mouseChannel.mount && claims.mouse === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MouseControls, { ...mouseChannel.props, fovSpeed }) : null,
|
|
6924
|
+
userControlsEnabled && touchChannel.mount && claims.touch === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TouchControls, { ...touchChannel.props }) : null,
|
|
6925
|
+
userControlsEnabled && keyboardChannel.mount && claims.keyboard === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
6750
6926
|
KeyboardControls,
|
|
6751
6927
|
{
|
|
6752
6928
|
...keyboardChannel.props,
|
|
@@ -6755,7 +6931,7 @@ function DefaultControlChannels({
|
|
|
6755
6931
|
) : null
|
|
6756
6932
|
] });
|
|
6757
6933
|
}
|
|
6758
|
-
var PanoViewer = (0,
|
|
6934
|
+
var PanoViewer = (0, import_react25.forwardRef)(
|
|
6759
6935
|
function PanoViewer2({
|
|
6760
6936
|
children,
|
|
6761
6937
|
initialView,
|
|
@@ -6764,6 +6940,7 @@ var PanoViewer = (0, import_react24.forwardRef)(
|
|
|
6764
6940
|
controls = true,
|
|
6765
6941
|
cursors,
|
|
6766
6942
|
contextMenu = true,
|
|
6943
|
+
mediaActivation,
|
|
6767
6944
|
onViewChange,
|
|
6768
6945
|
onPanoramaClick,
|
|
6769
6946
|
onPanoramaDoubleClick,
|
|
@@ -6773,19 +6950,30 @@ var PanoViewer = (0, import_react24.forwardRef)(
|
|
|
6773
6950
|
"aria-label": ariaLabel = "Panorama viewer",
|
|
6774
6951
|
...divProps
|
|
6775
6952
|
}, ref) {
|
|
6776
|
-
const rootRef = (0,
|
|
6777
|
-
const controlsRef = (0,
|
|
6778
|
-
const eventBus = (0,
|
|
6953
|
+
const rootRef = (0, import_react25.useRef)(null);
|
|
6954
|
+
const controlsRef = (0, import_react25.useRef)(null);
|
|
6955
|
+
const eventBus = (0, import_react25.useMemo)(() => createPanoEventBus(), []);
|
|
6779
6956
|
const { controls: hotspotAccessibilityControls, registry } = useHotspotAccessibilityLayer();
|
|
6780
6957
|
const { api: contextMenuOverlayApi, overlay: contextMenuOverlay } = usePanoContextMenuOverlay();
|
|
6781
6958
|
const { api: chromeOverlayApi, setOverlayNode, overlayElement } = usePanoChromeOverlay();
|
|
6782
|
-
const videoHost = (0,
|
|
6783
|
-
const filterHost = (0,
|
|
6784
|
-
const webVRHost = (0,
|
|
6785
|
-
const scenesHost = (0,
|
|
6786
|
-
const bgmHost = (0,
|
|
6787
|
-
const
|
|
6788
|
-
const
|
|
6959
|
+
const videoHost = (0, import_react25.useMemo)(() => createPanoVideoHost(), []);
|
|
6960
|
+
const filterHost = (0, import_react25.useMemo)(() => createPanoFilterHost(), []);
|
|
6961
|
+
const webVRHost = (0, import_react25.useMemo)(() => createWebVRHost(), []);
|
|
6962
|
+
const scenesHost = (0, import_react25.useMemo)(() => createScenesHost(), []);
|
|
6963
|
+
const bgmHost = (0, import_react25.useMemo)(() => createBackgroundAudioHost(), []);
|
|
6964
|
+
const mediaActivationHost = (0, import_react25.useMemo)(() => createPanoMediaActivationHost(), []);
|
|
6965
|
+
const mediaActivationOptions = (0, import_react25.useMemo)(
|
|
6966
|
+
() => mediaActivation === false ? null : mediaActivation ?? {},
|
|
6967
|
+
[mediaActivation]
|
|
6968
|
+
);
|
|
6969
|
+
const mediaActivationRevision = (0, import_react25.useSyncExternalStore)(
|
|
6970
|
+
(onStoreChange) => subscribePanoMediaActivation(mediaActivationHost, onStoreChange),
|
|
6971
|
+
() => getPanoMediaActivationRevision(mediaActivationHost),
|
|
6972
|
+
() => getPanoMediaActivationRevision(mediaActivationHost)
|
|
6973
|
+
);
|
|
6974
|
+
const [mediaActivated, setMediaActivated] = (0, import_react25.useState)(false);
|
|
6975
|
+
const stereoView = (0, import_react25.useMemo)(() => createWebVRStereoView(), []);
|
|
6976
|
+
const xrStore = (0, import_react25.useMemo)(
|
|
6789
6977
|
() => (0, import_xr3.createXRStore)({
|
|
6790
6978
|
anchors: false,
|
|
6791
6979
|
bodyTracking: false,
|
|
@@ -6801,13 +6989,39 @@ var PanoViewer = (0, import_react24.forwardRef)(
|
|
|
6801
6989
|
}),
|
|
6802
6990
|
[]
|
|
6803
6991
|
);
|
|
6804
|
-
const
|
|
6992
|
+
const mediaActivationControls = (0, import_react25.useMemo)(
|
|
6993
|
+
() => ({
|
|
6994
|
+
resumeAudio: () => resumePanoAudio(),
|
|
6995
|
+
playVideo: async ({ unmute = false } = {}) => {
|
|
6996
|
+
const controller = videoHost.controller;
|
|
6997
|
+
if (!controller) {
|
|
6998
|
+
return false;
|
|
6999
|
+
}
|
|
7000
|
+
if (unmute) {
|
|
7001
|
+
controller.setMuted(false);
|
|
7002
|
+
}
|
|
7003
|
+
await controller.play();
|
|
7004
|
+
return !controller.getSnapshot().blocked;
|
|
7005
|
+
},
|
|
7006
|
+
playBackgroundAudio: () => bgmHost.controller?.play() ?? false
|
|
7007
|
+
}),
|
|
7008
|
+
[bgmHost, videoHost]
|
|
7009
|
+
);
|
|
7010
|
+
const activateMedia = (0, import_react25.useCallback)(() => {
|
|
7011
|
+
setMediaActivated(true);
|
|
7012
|
+
const resume = mediaActivationControls.resumeAudio();
|
|
7013
|
+
mediaActivationOptions?.onActivate?.(mediaActivationControls);
|
|
7014
|
+
return resume;
|
|
7015
|
+
}, [mediaActivationControls, mediaActivationOptions]);
|
|
7016
|
+
const hasMediaActivationIntent = mediaActivationRevision >= 0 && hasPanoMediaActivationIntent(mediaActivationHost);
|
|
7017
|
+
const shouldShowMediaActivation = mediaActivationOptions !== null && hasMediaActivationIntent && !mediaActivated;
|
|
7018
|
+
const fallbackViewRef = (0, import_react25.useRef)(DEFAULT_VIEW);
|
|
6805
7019
|
const normalizedMinFov = Math.max(1, Math.min(minFov, maxFov - 1));
|
|
6806
7020
|
const normalizedMaxFov = Math.min(
|
|
6807
7021
|
179,
|
|
6808
7022
|
Math.max(maxFov, normalizedMinFov + 1)
|
|
6809
7023
|
);
|
|
6810
|
-
const normalizedInitialView = (0,
|
|
7024
|
+
const normalizedInitialView = (0, import_react25.useMemo)(
|
|
6811
7025
|
() => ({
|
|
6812
7026
|
yaw: initialView?.yaw ?? DEFAULT_VIEW.yaw,
|
|
6813
7027
|
pitch: clampPanoPitch(initialView?.pitch ?? DEFAULT_VIEW.pitch),
|
|
@@ -6825,10 +7039,10 @@ var PanoViewer = (0, import_react24.forwardRef)(
|
|
|
6825
7039
|
]
|
|
6826
7040
|
);
|
|
6827
7041
|
fallbackViewRef.current = normalizedInitialView;
|
|
6828
|
-
const controlClaims = (0,
|
|
7042
|
+
const controlClaims = (0, import_react25.useMemo)(() => createControlClaims(), []);
|
|
6829
7043
|
resetControlClaims(controlClaims);
|
|
6830
7044
|
const controlsEnabled = controls !== false;
|
|
6831
|
-
const controlOptions = (0,
|
|
7045
|
+
const controlOptions = (0, import_react25.useMemo)(
|
|
6832
7046
|
() => typeof controls === "object" ? controls : {},
|
|
6833
7047
|
[controls]
|
|
6834
7048
|
);
|
|
@@ -6836,7 +7050,7 @@ var PanoViewer = (0, import_react24.forwardRef)(
|
|
|
6836
7050
|
const allModeInvert = controlOptions.invert === true;
|
|
6837
7051
|
const topRotateSpeed = controlOptions.rotateSpeed ?? DEFAULT_POINTER_ROTATE_SPEED;
|
|
6838
7052
|
const topZoomSpeed = controlOptions.zoomSpeed ?? DEFAULT_MOUSE_ZOOM_SPEED;
|
|
6839
|
-
const mouseChannel = (0,
|
|
7053
|
+
const mouseChannel = (0, import_react25.useMemo)(
|
|
6840
7054
|
() => resolveChannel(controlOptions.mouse, {
|
|
6841
7055
|
enabled: true,
|
|
6842
7056
|
rotateSpeed: topRotateSpeed,
|
|
@@ -6852,7 +7066,7 @@ var PanoViewer = (0, import_react24.forwardRef)(
|
|
|
6852
7066
|
topZoomSpeed
|
|
6853
7067
|
]
|
|
6854
7068
|
);
|
|
6855
|
-
const touchChannel = (0,
|
|
7069
|
+
const touchChannel = (0, import_react25.useMemo)(
|
|
6856
7070
|
() => resolveChannel(controlOptions.touch, {
|
|
6857
7071
|
enabled: true,
|
|
6858
7072
|
rotateSpeed: topRotateSpeed,
|
|
@@ -6861,13 +7075,13 @@ var PanoViewer = (0, import_react24.forwardRef)(
|
|
|
6861
7075
|
}),
|
|
6862
7076
|
[allModeInvert, controlOptions.touch, topRotateSpeed]
|
|
6863
7077
|
);
|
|
6864
|
-
const keyboardChannel = (0,
|
|
7078
|
+
const keyboardChannel = (0, import_react25.useMemo)(
|
|
6865
7079
|
() => resolveChannel(controlOptions.keyboard, {
|
|
6866
7080
|
enabled: true
|
|
6867
7081
|
}),
|
|
6868
7082
|
[controlOptions.keyboard]
|
|
6869
7083
|
);
|
|
6870
|
-
const enterFullscreen = (0,
|
|
7084
|
+
const enterFullscreen = (0, import_react25.useCallback)(async () => {
|
|
6871
7085
|
if (typeof document === "undefined") {
|
|
6872
7086
|
return;
|
|
6873
7087
|
}
|
|
@@ -6880,7 +7094,7 @@ var PanoViewer = (0, import_react24.forwardRef)(
|
|
|
6880
7094
|
}
|
|
6881
7095
|
await requestElementFullscreen(root);
|
|
6882
7096
|
}, []);
|
|
6883
|
-
const exitFullscreen = (0,
|
|
7097
|
+
const exitFullscreen = (0, import_react25.useCallback)(async () => {
|
|
6884
7098
|
if (typeof document === "undefined") {
|
|
6885
7099
|
return;
|
|
6886
7100
|
}
|
|
@@ -6889,7 +7103,7 @@ var PanoViewer = (0, import_react24.forwardRef)(
|
|
|
6889
7103
|
}
|
|
6890
7104
|
await exitElementFullscreen();
|
|
6891
7105
|
}, []);
|
|
6892
|
-
const toggleFullscreen = (0,
|
|
7106
|
+
const toggleFullscreen = (0, import_react25.useCallback)(async () => {
|
|
6893
7107
|
if (typeof document === "undefined") {
|
|
6894
7108
|
return;
|
|
6895
7109
|
}
|
|
@@ -6903,8 +7117,8 @@ var PanoViewer = (0, import_react24.forwardRef)(
|
|
|
6903
7117
|
}
|
|
6904
7118
|
await requestElementFullscreen(root);
|
|
6905
7119
|
}, []);
|
|
6906
|
-
const [isViewerFullscreen, setIsViewerFullscreen] = (0,
|
|
6907
|
-
(0,
|
|
7120
|
+
const [isViewerFullscreen, setIsViewerFullscreen] = (0, import_react25.useState)(false);
|
|
7121
|
+
(0, import_react25.useEffect)(() => {
|
|
6908
7122
|
if (typeof document === "undefined") {
|
|
6909
7123
|
return;
|
|
6910
7124
|
}
|
|
@@ -6922,7 +7136,7 @@ var PanoViewer = (0, import_react24.forwardRef)(
|
|
|
6922
7136
|
syncFullscreen();
|
|
6923
7137
|
return subscribeFullscreenChange(syncFullscreen);
|
|
6924
7138
|
}, []);
|
|
6925
|
-
(0,
|
|
7139
|
+
(0, import_react25.useEffect)(() => {
|
|
6926
7140
|
const root = rootRef.current;
|
|
6927
7141
|
if (!root) {
|
|
6928
7142
|
return;
|
|
@@ -6935,7 +7149,7 @@ var PanoViewer = (0, import_react24.forwardRef)(
|
|
|
6935
7149
|
root.removeEventListener("contextmenu", suppressNativeContextMenu, true);
|
|
6936
7150
|
};
|
|
6937
7151
|
}, []);
|
|
6938
|
-
const contextMenuActions = (0,
|
|
7152
|
+
const contextMenuActions = (0, import_react25.useMemo)(
|
|
6939
7153
|
() => ({
|
|
6940
7154
|
reset: () => {
|
|
6941
7155
|
controlsRef.current?.reset();
|
|
@@ -6947,24 +7161,24 @@ var PanoViewer = (0, import_react24.forwardRef)(
|
|
|
6947
7161
|
}),
|
|
6948
7162
|
[isViewerFullscreen, toggleFullscreen]
|
|
6949
7163
|
);
|
|
6950
|
-
const contextMenuChannel = (0,
|
|
7164
|
+
const contextMenuChannel = (0, import_react25.useMemo)(
|
|
6951
7165
|
() => resolveContextMenuChannel(contextMenu),
|
|
6952
7166
|
[contextMenu]
|
|
6953
7167
|
);
|
|
6954
|
-
const resolvedCursors = (0,
|
|
7168
|
+
const resolvedCursors = (0, import_react25.useMemo)(
|
|
6955
7169
|
() => resolvePanoCursors(cursors),
|
|
6956
7170
|
[cursors]
|
|
6957
7171
|
);
|
|
6958
7172
|
const legacyAutoRotateOptions = controlOptions;
|
|
6959
|
-
const [legacyAutoRotate, setLegacyAutoRotate] = (0,
|
|
7173
|
+
const [legacyAutoRotate, setLegacyAutoRotate] = (0, import_react25.useState)(
|
|
6960
7174
|
legacyAutoRotateOptions.autoRotate ?? false
|
|
6961
7175
|
);
|
|
6962
|
-
(0,
|
|
7176
|
+
(0, import_react25.useEffect)(() => {
|
|
6963
7177
|
setLegacyAutoRotate(legacyAutoRotateOptions.autoRotate ?? false);
|
|
6964
7178
|
}, [legacyAutoRotateOptions.autoRotate]);
|
|
6965
|
-
const isFullscreenRef = (0,
|
|
7179
|
+
const isFullscreenRef = (0, import_react25.useRef)(false);
|
|
6966
7180
|
isFullscreenRef.current = isViewerFullscreen;
|
|
6967
|
-
(0,
|
|
7181
|
+
(0, import_react25.useImperativeHandle)(
|
|
6968
7182
|
ref,
|
|
6969
7183
|
() => ({
|
|
6970
7184
|
// -- View --
|
|
@@ -6975,6 +7189,7 @@ var PanoViewer = (0, import_react24.forwardRef)(
|
|
|
6975
7189
|
reset: () => {
|
|
6976
7190
|
controlsRef.current?.reset();
|
|
6977
7191
|
},
|
|
7192
|
+
activateMedia,
|
|
6978
7193
|
// -- Fullscreen --
|
|
6979
7194
|
enterFullscreen,
|
|
6980
7195
|
exitFullscreen,
|
|
@@ -7027,6 +7242,7 @@ var PanoViewer = (0, import_react24.forwardRef)(
|
|
|
7027
7242
|
}),
|
|
7028
7243
|
[
|
|
7029
7244
|
bgmHost,
|
|
7245
|
+
activateMedia,
|
|
7030
7246
|
enterFullscreen,
|
|
7031
7247
|
exitFullscreen,
|
|
7032
7248
|
scenesHost,
|
|
@@ -7035,7 +7251,7 @@ var PanoViewer = (0, import_react24.forwardRef)(
|
|
|
7035
7251
|
webVRHost
|
|
7036
7252
|
]
|
|
7037
7253
|
);
|
|
7038
|
-
const rootStyle = (0,
|
|
7254
|
+
const rootStyle = (0, import_react25.useMemo)(
|
|
7039
7255
|
() => ({
|
|
7040
7256
|
overflow: "hidden",
|
|
7041
7257
|
position: "relative",
|
|
@@ -7043,7 +7259,7 @@ var PanoViewer = (0, import_react24.forwardRef)(
|
|
|
7043
7259
|
}),
|
|
7044
7260
|
[style]
|
|
7045
7261
|
);
|
|
7046
|
-
return /* @__PURE__ */ (0,
|
|
7262
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
7047
7263
|
"div",
|
|
7048
7264
|
{
|
|
7049
7265
|
...divProps,
|
|
@@ -7053,7 +7269,7 @@ var PanoViewer = (0, import_react24.forwardRef)(
|
|
|
7053
7269
|
"aria-label": ariaLabel,
|
|
7054
7270
|
style: rootStyle,
|
|
7055
7271
|
children: [
|
|
7056
|
-
/* @__PURE__ */ (0,
|
|
7272
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
7057
7273
|
import_fiber10.Canvas,
|
|
7058
7274
|
{
|
|
7059
7275
|
"aria-label": `${ariaLabel} canvas`,
|
|
@@ -7075,23 +7291,23 @@ var PanoViewer = (0, import_react24.forwardRef)(
|
|
|
7075
7291
|
...DEFAULT_CANVAS_STYLE,
|
|
7076
7292
|
touchAction: userControlsEnabled ? "none" : "auto"
|
|
7077
7293
|
},
|
|
7078
|
-
children: /* @__PURE__ */ (0,
|
|
7294
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_xr3.XR, { store: xrStore, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
7079
7295
|
WebVRRuntimeContext.Provider,
|
|
7080
7296
|
{
|
|
7081
7297
|
value: { host: webVRHost, xrStore, stereoView },
|
|
7082
7298
|
children: [
|
|
7083
|
-
/* @__PURE__ */ (0,
|
|
7084
|
-
/* @__PURE__ */ (0,
|
|
7299
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PanoramaXROrigin, {}),
|
|
7300
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(HotspotAccessibilityContext.Provider, { value: registry, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PanoEventBusContext.Provider, { value: eventBus, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PanoCursorTree, { cursors: resolvedCursors, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PanoramaViewContext.Provider, { value: controlsRef, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
7085
7301
|
PanoContextMenuOverlayContext.Provider,
|
|
7086
7302
|
{
|
|
7087
7303
|
value: contextMenuOverlayApi,
|
|
7088
|
-
children: /* @__PURE__ */ (0,
|
|
7304
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PanoChromeOverlayContext.Provider, { value: chromeOverlayApi, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PanoVideoHostContext.Provider, { value: videoHost, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PanoFilterHostContext.Provider, { value: filterHost, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
7089
7305
|
PanoContextMenuActionsContext.Provider,
|
|
7090
7306
|
{
|
|
7091
7307
|
value: contextMenuActions,
|
|
7092
|
-
children: /* @__PURE__ */ (0,
|
|
7093
|
-
/* @__PURE__ */ (0,
|
|
7094
|
-
/* @__PURE__ */ (0,
|
|
7308
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ScenesHostContext.Provider, { value: scenesHost, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BackgroundAudioHostContext.Provider, { value: bgmHost, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(PanoMediaActivationHostContext.Provider, { value: mediaActivationHost, children: [
|
|
7309
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PanoVideoHostReset, {}),
|
|
7310
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
7095
7311
|
PanoramaViewRuntime,
|
|
7096
7312
|
{
|
|
7097
7313
|
ref: controlsRef,
|
|
@@ -7102,7 +7318,7 @@ var PanoViewer = (0, import_react24.forwardRef)(
|
|
|
7102
7318
|
options: controlOptions
|
|
7103
7319
|
}
|
|
7104
7320
|
),
|
|
7105
|
-
(onViewChange || onPanoramaClick || onPanoramaDoubleClick || onPanoramaPointerMove) && /* @__PURE__ */ (0,
|
|
7321
|
+
(onViewChange || onPanoramaClick || onPanoramaDoubleClick || onPanoramaPointerMove) && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
7106
7322
|
PanoEvents,
|
|
7107
7323
|
{
|
|
7108
7324
|
onViewChange,
|
|
@@ -7111,18 +7327,18 @@ var PanoViewer = (0, import_react24.forwardRef)(
|
|
|
7111
7327
|
onPointerMove: onPanoramaPointerMove
|
|
7112
7328
|
}
|
|
7113
7329
|
),
|
|
7114
|
-
/* @__PURE__ */ (0,
|
|
7330
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
7115
7331
|
AutoRotate,
|
|
7116
7332
|
{
|
|
7117
7333
|
enabled: legacyAutoRotate,
|
|
7118
7334
|
speed: legacyAutoRotateOptions.autoRotateSpeed
|
|
7119
7335
|
}
|
|
7120
7336
|
),
|
|
7121
|
-
/* @__PURE__ */ (0,
|
|
7122
|
-
contextMenuChannel.mount ? /* @__PURE__ */ (0,
|
|
7123
|
-
/* @__PURE__ */ (0,
|
|
7337
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PanoramaEventSurface, {}),
|
|
7338
|
+
contextMenuChannel.mount ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PanoContextMenu, { ...contextMenuChannel.props }) : null,
|
|
7339
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(ControlClaimsContext.Provider, { value: controlClaims, children: [
|
|
7124
7340
|
children,
|
|
7125
|
-
/* @__PURE__ */ (0,
|
|
7341
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
7126
7342
|
DefaultControlChannels,
|
|
7127
7343
|
{
|
|
7128
7344
|
fovSpeed: controlOptions.fovSpeed,
|
|
@@ -7133,7 +7349,7 @@ var PanoViewer = (0, import_react24.forwardRef)(
|
|
|
7133
7349
|
}
|
|
7134
7350
|
)
|
|
7135
7351
|
] })
|
|
7136
|
-
] }) })
|
|
7352
|
+
] }) }) })
|
|
7137
7353
|
}
|
|
7138
7354
|
) }) }) })
|
|
7139
7355
|
}
|
|
@@ -7143,14 +7359,14 @@ var PanoViewer = (0, import_react24.forwardRef)(
|
|
|
7143
7359
|
) })
|
|
7144
7360
|
}
|
|
7145
7361
|
),
|
|
7146
|
-
/* @__PURE__ */ (0,
|
|
7362
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
7147
7363
|
"div",
|
|
7148
7364
|
{
|
|
7149
7365
|
className: "pano-chrome-overlay",
|
|
7150
7366
|
"data-pano-chrome-overlay": "",
|
|
7151
7367
|
ref: setOverlayNode,
|
|
7152
7368
|
children: [
|
|
7153
|
-
/* @__PURE__ */ (0,
|
|
7369
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
7154
7370
|
PanoVideoChromeBridge,
|
|
7155
7371
|
{
|
|
7156
7372
|
fullscreen: contextMenuActions,
|
|
@@ -7158,12 +7374,21 @@ var PanoViewer = (0, import_react24.forwardRef)(
|
|
|
7158
7374
|
overlayElement
|
|
7159
7375
|
}
|
|
7160
7376
|
),
|
|
7161
|
-
/* @__PURE__ */ (0,
|
|
7377
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(WebVRChromeBridge, { host: webVRHost })
|
|
7162
7378
|
]
|
|
7163
7379
|
}
|
|
7164
7380
|
),
|
|
7165
7381
|
contextMenuOverlay,
|
|
7166
|
-
hotspotAccessibilityControls
|
|
7382
|
+
hotspotAccessibilityControls,
|
|
7383
|
+
shouldShowMediaActivation ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
7384
|
+
PanoMediaActivationOverlay,
|
|
7385
|
+
{
|
|
7386
|
+
...mediaActivationOptions,
|
|
7387
|
+
onActivate: () => {
|
|
7388
|
+
void activateMedia();
|
|
7389
|
+
}
|
|
7390
|
+
}
|
|
7391
|
+
) : null
|
|
7167
7392
|
]
|
|
7168
7393
|
}
|
|
7169
7394
|
);
|
|
@@ -7171,102 +7396,7 @@ var PanoViewer = (0, import_react24.forwardRef)(
|
|
|
7171
7396
|
);
|
|
7172
7397
|
|
|
7173
7398
|
// src/background-audio.tsx
|
|
7174
|
-
var
|
|
7175
|
-
|
|
7176
|
-
// src/audio/howl.ts
|
|
7177
|
-
var import_howler = __toESM(require_howler());
|
|
7178
|
-
import_howler.Howler.autoUnlock = true;
|
|
7179
|
-
function sourceList(src) {
|
|
7180
|
-
if (src == null) {
|
|
7181
|
-
return [];
|
|
7182
|
-
}
|
|
7183
|
-
if (typeof src === "string") {
|
|
7184
|
-
return src ? [src] : [];
|
|
7185
|
-
}
|
|
7186
|
-
return src.filter((item) => Boolean(item));
|
|
7187
|
-
}
|
|
7188
|
-
function createUnlockingHowl({
|
|
7189
|
-
src,
|
|
7190
|
-
loop,
|
|
7191
|
-
crossOrigin,
|
|
7192
|
-
isActive,
|
|
7193
|
-
shouldRetryPlay,
|
|
7194
|
-
onEnded,
|
|
7195
|
-
onPlay,
|
|
7196
|
-
onPause,
|
|
7197
|
-
onLoadError,
|
|
7198
|
-
onPlayError
|
|
7199
|
-
}) {
|
|
7200
|
-
let disposed = false;
|
|
7201
|
-
let blockedNotified = false;
|
|
7202
|
-
const unlockListeners = [];
|
|
7203
|
-
const removeUnlockListeners = () => {
|
|
7204
|
-
for (const { type, listener } of unlockListeners) {
|
|
7205
|
-
window.removeEventListener(type, listener, true);
|
|
7206
|
-
}
|
|
7207
|
-
unlockListeners.length = 0;
|
|
7208
|
-
};
|
|
7209
|
-
const instance = new import_howler.Howl({
|
|
7210
|
-
src: [...src],
|
|
7211
|
-
html5: false,
|
|
7212
|
-
preload: true,
|
|
7213
|
-
loop,
|
|
7214
|
-
xhr: crossOrigin === "use-credentials" ? { withCredentials: true } : void 0,
|
|
7215
|
-
onend: () => {
|
|
7216
|
-
if (disposed || !isActive() || instance.loop()) {
|
|
7217
|
-
return;
|
|
7218
|
-
}
|
|
7219
|
-
onEnded?.();
|
|
7220
|
-
},
|
|
7221
|
-
onplay: () => {
|
|
7222
|
-
if (!disposed && isActive()) {
|
|
7223
|
-
onPlay?.();
|
|
7224
|
-
}
|
|
7225
|
-
},
|
|
7226
|
-
onpause: () => {
|
|
7227
|
-
if (!disposed && isActive()) {
|
|
7228
|
-
onPause?.();
|
|
7229
|
-
}
|
|
7230
|
-
},
|
|
7231
|
-
onloaderror: (_soundId, error) => {
|
|
7232
|
-
if (!disposed && isActive()) {
|
|
7233
|
-
onLoadError?.(error);
|
|
7234
|
-
}
|
|
7235
|
-
},
|
|
7236
|
-
onplayerror: (_soundId, error) => {
|
|
7237
|
-
if (disposed || !isActive()) {
|
|
7238
|
-
return;
|
|
7239
|
-
}
|
|
7240
|
-
if (!blockedNotified) {
|
|
7241
|
-
blockedNotified = true;
|
|
7242
|
-
onPlayError?.(error);
|
|
7243
|
-
}
|
|
7244
|
-
const retry = () => {
|
|
7245
|
-
removeUnlockListeners();
|
|
7246
|
-
if (!disposed && isActive() && shouldRetryPlay()) {
|
|
7247
|
-
void import_howler.Howler.ctx?.resume();
|
|
7248
|
-
instance.play();
|
|
7249
|
-
}
|
|
7250
|
-
};
|
|
7251
|
-
removeUnlockListeners();
|
|
7252
|
-
unlockListeners.push({ type: "pointerdown", listener: retry });
|
|
7253
|
-
unlockListeners.push({ type: "keydown", listener: retry });
|
|
7254
|
-
window.addEventListener("pointerdown", retry, { capture: true });
|
|
7255
|
-
window.addEventListener("keydown", retry, { capture: true });
|
|
7256
|
-
}
|
|
7257
|
-
});
|
|
7258
|
-
return {
|
|
7259
|
-
howl: instance,
|
|
7260
|
-
dispose: () => {
|
|
7261
|
-
if (disposed) {
|
|
7262
|
-
return;
|
|
7263
|
-
}
|
|
7264
|
-
disposed = true;
|
|
7265
|
-
removeUnlockListeners();
|
|
7266
|
-
instance.unload();
|
|
7267
|
-
}
|
|
7268
|
-
};
|
|
7269
|
-
}
|
|
7399
|
+
var import_react26 = require("react");
|
|
7270
7400
|
|
|
7271
7401
|
// src/hotspot/audio-spatial.ts
|
|
7272
7402
|
var import_three6 = require("three");
|
|
@@ -7354,30 +7484,31 @@ function BackgroundAudio({
|
|
|
7354
7484
|
onEnded,
|
|
7355
7485
|
onError
|
|
7356
7486
|
}) {
|
|
7357
|
-
const controlsRef = (0,
|
|
7487
|
+
const controlsRef = (0, import_react26.useContext)(PanoramaViewContext);
|
|
7358
7488
|
if (!controlsRef) {
|
|
7359
7489
|
throw new Error("<BackgroundAudio> must be rendered inside <PanoViewer>.");
|
|
7360
7490
|
}
|
|
7361
7491
|
const isControlled = controlledPlaying !== void 0;
|
|
7362
|
-
const [internalPlaying, setInternalPlaying] = (0,
|
|
7492
|
+
const [internalPlaying, setInternalPlaying] = (0, import_react26.useState)(defaultPlaying);
|
|
7363
7493
|
const playing = isControlled ? controlledPlaying : internalPlaying;
|
|
7364
7494
|
const urls = resolveBackgroundAudioUrls(src, sources, sceneId);
|
|
7495
|
+
usePanoMediaActivationIntent(playing && urls.length > 0);
|
|
7365
7496
|
const trackKey = urls.join("\0");
|
|
7366
|
-
const currentRef = (0,
|
|
7367
|
-
const outgoingRef = (0,
|
|
7368
|
-
const fadingInRef = (0,
|
|
7369
|
-
const isFirstTrackRef = (0,
|
|
7370
|
-
const playingRef = (0,
|
|
7371
|
-
const loopRef = (0,
|
|
7372
|
-
const mutedRef = (0,
|
|
7373
|
-
const volumeRef = (0,
|
|
7374
|
-
const mutedPropRef = (0,
|
|
7375
|
-
const volumePropRef = (0,
|
|
7376
|
-
const fadeMsRef = (0,
|
|
7377
|
-
const onPlaybackStateChangeRef = (0,
|
|
7378
|
-
const onPlaybackErrorRef = (0,
|
|
7379
|
-
const onEndedRef = (0,
|
|
7380
|
-
const onErrorRef = (0,
|
|
7497
|
+
const currentRef = (0, import_react26.useRef)(null);
|
|
7498
|
+
const outgoingRef = (0, import_react26.useRef)([]);
|
|
7499
|
+
const fadingInRef = (0, import_react26.useRef)(false);
|
|
7500
|
+
const isFirstTrackRef = (0, import_react26.useRef)(true);
|
|
7501
|
+
const playingRef = (0, import_react26.useRef)(playing);
|
|
7502
|
+
const loopRef = (0, import_react26.useRef)(loop);
|
|
7503
|
+
const mutedRef = (0, import_react26.useRef)(muted);
|
|
7504
|
+
const volumeRef = (0, import_react26.useRef)(volume);
|
|
7505
|
+
const mutedPropRef = (0, import_react26.useRef)(muted);
|
|
7506
|
+
const volumePropRef = (0, import_react26.useRef)(volume);
|
|
7507
|
+
const fadeMsRef = (0, import_react26.useRef)(resolveFadeMs(fadeMs));
|
|
7508
|
+
const onPlaybackStateChangeRef = (0, import_react26.useRef)(onPlaybackStateChange);
|
|
7509
|
+
const onPlaybackErrorRef = (0, import_react26.useRef)(onPlaybackError);
|
|
7510
|
+
const onEndedRef = (0, import_react26.useRef)(onEnded);
|
|
7511
|
+
const onErrorRef = (0, import_react26.useRef)(onError);
|
|
7381
7512
|
playingRef.current = playing;
|
|
7382
7513
|
loopRef.current = loop;
|
|
7383
7514
|
fadeMsRef.current = resolveFadeMs(fadeMs);
|
|
@@ -7393,7 +7524,7 @@ function BackgroundAudio({
|
|
|
7393
7524
|
onPlaybackErrorRef.current = onPlaybackError;
|
|
7394
7525
|
onEndedRef.current = onEnded;
|
|
7395
7526
|
onErrorRef.current = onError;
|
|
7396
|
-
const snapshotRef = (0,
|
|
7527
|
+
const snapshotRef = (0, import_react26.useRef)({
|
|
7397
7528
|
ready: false,
|
|
7398
7529
|
playing: false,
|
|
7399
7530
|
blocked: false,
|
|
@@ -7401,7 +7532,7 @@ function BackgroundAudio({
|
|
|
7401
7532
|
muted,
|
|
7402
7533
|
volume
|
|
7403
7534
|
});
|
|
7404
|
-
const snapshotListenersRef = (0,
|
|
7535
|
+
const snapshotListenersRef = (0, import_react26.useRef)(/* @__PURE__ */ new Set());
|
|
7405
7536
|
const notifySnapshot = (patch) => {
|
|
7406
7537
|
const prev = snapshotRef.current;
|
|
7407
7538
|
snapshotRef.current = { ...prev, ...patch };
|
|
@@ -7409,9 +7540,9 @@ function BackgroundAudio({
|
|
|
7409
7540
|
listener();
|
|
7410
7541
|
}
|
|
7411
7542
|
};
|
|
7412
|
-
const isControlledRef = (0,
|
|
7543
|
+
const isControlledRef = (0, import_react26.useRef)(isControlled);
|
|
7413
7544
|
isControlledRef.current = isControlled;
|
|
7414
|
-
const controller = (0,
|
|
7545
|
+
const controller = (0, import_react26.useMemo)(
|
|
7415
7546
|
() => ({
|
|
7416
7547
|
subscribe: (onStoreChange) => {
|
|
7417
7548
|
snapshotListenersRef.current.add(onStoreChange);
|
|
@@ -7422,9 +7553,11 @@ function BackgroundAudio({
|
|
|
7422
7553
|
getSnapshot: () => snapshotRef.current,
|
|
7423
7554
|
play: () => {
|
|
7424
7555
|
if (isControlledRef.current) {
|
|
7425
|
-
return;
|
|
7556
|
+
return false;
|
|
7426
7557
|
}
|
|
7558
|
+
currentRef.current?.handle.howl.play();
|
|
7427
7559
|
setInternalPlaying(true);
|
|
7560
|
+
return true;
|
|
7428
7561
|
},
|
|
7429
7562
|
pause: () => {
|
|
7430
7563
|
if (isControlledRef.current) {
|
|
@@ -7467,8 +7600,8 @@ function BackgroundAudio({
|
|
|
7467
7600
|
}),
|
|
7468
7601
|
[]
|
|
7469
7602
|
);
|
|
7470
|
-
const bgmHost = (0,
|
|
7471
|
-
(0,
|
|
7603
|
+
const bgmHost = (0, import_react26.useContext)(BackgroundAudioHostContext);
|
|
7604
|
+
(0, import_react26.useEffect)(() => {
|
|
7472
7605
|
if (!bgmHost) {
|
|
7473
7606
|
return;
|
|
7474
7607
|
}
|
|
@@ -7481,7 +7614,7 @@ function BackgroundAudio({
|
|
|
7481
7614
|
}
|
|
7482
7615
|
};
|
|
7483
7616
|
}, [bgmHost, controller]);
|
|
7484
|
-
(0,
|
|
7617
|
+
(0, import_react26.useEffect)(() => {
|
|
7485
7618
|
return () => {
|
|
7486
7619
|
fadingInRef.current = false;
|
|
7487
7620
|
isFirstTrackRef.current = true;
|
|
@@ -7493,7 +7626,7 @@ function BackgroundAudio({
|
|
|
7493
7626
|
outgoingRef.current = [];
|
|
7494
7627
|
};
|
|
7495
7628
|
}, []);
|
|
7496
|
-
(0,
|
|
7629
|
+
(0, import_react26.useEffect)(() => {
|
|
7497
7630
|
const previous = currentRef.current;
|
|
7498
7631
|
if (previous?.key === trackKey && previous.crossOrigin === crossOrigin) {
|
|
7499
7632
|
return;
|
|
@@ -7596,7 +7729,7 @@ function BackgroundAudio({
|
|
|
7596
7729
|
retire(previous);
|
|
7597
7730
|
}
|
|
7598
7731
|
}, [crossOrigin, trackKey]);
|
|
7599
|
-
(0,
|
|
7732
|
+
(0, import_react26.useEffect)(() => {
|
|
7600
7733
|
const howl = currentRef.current?.handle.howl;
|
|
7601
7734
|
if (!howl) {
|
|
7602
7735
|
return;
|
|
@@ -7612,9 +7745,11 @@ function BackgroundAudio({
|
|
|
7612
7745
|
outgoingRef.current = [];
|
|
7613
7746
|
return;
|
|
7614
7747
|
}
|
|
7615
|
-
howl.
|
|
7748
|
+
if (!howl.playing()) {
|
|
7749
|
+
howl.play();
|
|
7750
|
+
}
|
|
7616
7751
|
}, [playing, trackKey]);
|
|
7617
|
-
(0,
|
|
7752
|
+
(0, import_react26.useEffect)(() => {
|
|
7618
7753
|
const slot = currentRef.current;
|
|
7619
7754
|
if (!slot) {
|
|
7620
7755
|
return;
|
|
@@ -7629,7 +7764,7 @@ function BackgroundAudio({
|
|
|
7629
7764
|
volume: clampAudioVolume(volumeRef.current)
|
|
7630
7765
|
});
|
|
7631
7766
|
}, [loop, muted, trackKey, volume]);
|
|
7632
|
-
(0,
|
|
7767
|
+
(0, import_react26.useEffect)(() => {
|
|
7633
7768
|
if (!pauseWhenHidden) {
|
|
7634
7769
|
return;
|
|
7635
7770
|
}
|
|
@@ -7655,27 +7790,27 @@ function BackgroundAudio({
|
|
|
7655
7790
|
}
|
|
7656
7791
|
|
|
7657
7792
|
// src/pano-filter/pano-filter.tsx
|
|
7658
|
-
var
|
|
7793
|
+
var import_react27 = require("react");
|
|
7659
7794
|
function PanoFilter({
|
|
7660
7795
|
preset = "none",
|
|
7661
7796
|
intensity,
|
|
7662
7797
|
enabled = true
|
|
7663
7798
|
}) {
|
|
7664
|
-
const host = (0,
|
|
7799
|
+
const host = (0, import_react27.useContext)(PanoFilterHostContext);
|
|
7665
7800
|
if (!host) {
|
|
7666
7801
|
throw new Error("<PanoFilter> must be rendered inside <PanoViewer>.");
|
|
7667
7802
|
}
|
|
7668
|
-
const snapshot = (0,
|
|
7803
|
+
const snapshot = (0, import_react27.useMemo)(
|
|
7669
7804
|
() => resolvePanoFilterSnapshot({ preset, intensity, enabled }),
|
|
7670
7805
|
[enabled, intensity, preset]
|
|
7671
7806
|
);
|
|
7672
|
-
(0,
|
|
7807
|
+
(0, import_react27.useEffect)(() => {
|
|
7673
7808
|
claimPanoFilter(host);
|
|
7674
7809
|
return () => {
|
|
7675
7810
|
releasePanoFilter(host);
|
|
7676
7811
|
};
|
|
7677
7812
|
}, [host]);
|
|
7678
|
-
(0,
|
|
7813
|
+
(0, import_react27.useEffect)(() => {
|
|
7679
7814
|
setPanoFilterSnapshot(host, snapshot);
|
|
7680
7815
|
}, [host, snapshot]);
|
|
7681
7816
|
return null;
|
|
@@ -7683,7 +7818,7 @@ function PanoFilter({
|
|
|
7683
7818
|
|
|
7684
7819
|
// src/gyro.tsx
|
|
7685
7820
|
var import_fiber11 = require("@react-three/fiber");
|
|
7686
|
-
var
|
|
7821
|
+
var import_react28 = require("react");
|
|
7687
7822
|
|
|
7688
7823
|
// src/gyro-orientation.ts
|
|
7689
7824
|
var import_three7 = require("three");
|
|
@@ -7768,7 +7903,7 @@ function resolveSoftstart(value) {
|
|
|
7768
7903
|
function posesNearlyEqual(a, b) {
|
|
7769
7904
|
return Math.abs(shortestYawDelta2(a.yaw, b.yaw)) < 1e-4 && Math.abs(a.pitch - b.pitch) < 1e-4 && Math.abs(a.roll - b.roll) < 1e-4;
|
|
7770
7905
|
}
|
|
7771
|
-
var Gyro = (0,
|
|
7906
|
+
var Gyro = (0, import_react28.forwardRef)(function Gyro2({
|
|
7772
7907
|
enabled = false,
|
|
7773
7908
|
camroll = true,
|
|
7774
7909
|
absolute = false,
|
|
@@ -7783,24 +7918,24 @@ var Gyro = (0, import_react27.forwardRef)(function Gyro2({
|
|
|
7783
7918
|
onDisable,
|
|
7784
7919
|
onDenied
|
|
7785
7920
|
}, ref) {
|
|
7786
|
-
const controlsRef = (0,
|
|
7787
|
-
const eventBus = (0,
|
|
7921
|
+
const controlsRef = (0, import_react28.useContext)(PanoramaViewContext);
|
|
7922
|
+
const eventBus = (0, import_react28.useContext)(PanoEventBusContext);
|
|
7788
7923
|
const { gl } = (0, import_fiber11.useThree)();
|
|
7789
|
-
const [internallyDisabled, setInternallyDisabled] = (0,
|
|
7790
|
-
const availableRef = (0,
|
|
7791
|
-
const availabilityReportedRef = (0,
|
|
7792
|
-
const activeRef = (0,
|
|
7793
|
-
const permissionRef = (0,
|
|
7794
|
-
const absoluteEventSourceRef = (0,
|
|
7795
|
-
const rawQuaternionRef = (0,
|
|
7796
|
-
const calibrationRef = (0,
|
|
7797
|
-
const absoluteOffsetRef = (0,
|
|
7798
|
-
const screenAngleRef = (0,
|
|
7799
|
-
const startPoseRef = (0,
|
|
7800
|
-
const enabledAtRef = (0,
|
|
7801
|
-
const filteredPoseRef = (0,
|
|
7802
|
-
const lastAppliedPoseRef = (0,
|
|
7803
|
-
const callbacksRef = (0,
|
|
7924
|
+
const [internallyDisabled, setInternallyDisabled] = (0, import_react28.useState)(false);
|
|
7925
|
+
const availableRef = (0, import_react28.useRef)(false);
|
|
7926
|
+
const availabilityReportedRef = (0, import_react28.useRef)(null);
|
|
7927
|
+
const activeRef = (0, import_react28.useRef)(false);
|
|
7928
|
+
const permissionRef = (0, import_react28.useRef)(deviceOrientationPermissionState);
|
|
7929
|
+
const absoluteEventSourceRef = (0, import_react28.useRef)(null);
|
|
7930
|
+
const rawQuaternionRef = (0, import_react28.useRef)(null);
|
|
7931
|
+
const calibrationRef = (0, import_react28.useRef)(null);
|
|
7932
|
+
const absoluteOffsetRef = (0, import_react28.useRef)({ yaw: 0, pitch: 0 });
|
|
7933
|
+
const screenAngleRef = (0, import_react28.useRef)(getScreenOrientationAngle());
|
|
7934
|
+
const startPoseRef = (0, import_react28.useRef)(null);
|
|
7935
|
+
const enabledAtRef = (0, import_react28.useRef)(0);
|
|
7936
|
+
const filteredPoseRef = (0, import_react28.useRef)(null);
|
|
7937
|
+
const lastAppliedPoseRef = (0, import_react28.useRef)(null);
|
|
7938
|
+
const callbacksRef = (0, import_react28.useRef)({
|
|
7804
7939
|
onAvailable,
|
|
7805
7940
|
onUnavailable,
|
|
7806
7941
|
onEnable,
|
|
@@ -7817,7 +7952,7 @@ var Gyro = (0, import_react27.forwardRef)(function Gyro2({
|
|
|
7817
7952
|
if (!controlsRef) {
|
|
7818
7953
|
throw new Error("<Gyro> must be rendered inside <PanoViewer>.");
|
|
7819
7954
|
}
|
|
7820
|
-
const emit = (0,
|
|
7955
|
+
const emit = (0, import_react28.useCallback)(
|
|
7821
7956
|
(type) => {
|
|
7822
7957
|
eventBus?.emit(type, void 0);
|
|
7823
7958
|
switch (type) {
|
|
@@ -7844,7 +7979,7 @@ var Gyro = (0, import_react27.forwardRef)(function Gyro2({
|
|
|
7844
7979
|
},
|
|
7845
7980
|
[eventBus]
|
|
7846
7981
|
);
|
|
7847
|
-
const setAvailable = (0,
|
|
7982
|
+
const setAvailable = (0, import_react28.useCallback)(
|
|
7848
7983
|
(available) => {
|
|
7849
7984
|
availableRef.current = available;
|
|
7850
7985
|
if (availabilityReportedRef.current === available) {
|
|
@@ -7855,7 +7990,7 @@ var Gyro = (0, import_react27.forwardRef)(function Gyro2({
|
|
|
7855
7990
|
},
|
|
7856
7991
|
[emit]
|
|
7857
7992
|
);
|
|
7858
|
-
const requestPermission = (0,
|
|
7993
|
+
const requestPermission = (0, import_react28.useCallback)(async () => {
|
|
7859
7994
|
if (!availableRef.current) {
|
|
7860
7995
|
return false;
|
|
7861
7996
|
}
|
|
@@ -7888,7 +8023,7 @@ var Gyro = (0, import_react27.forwardRef)(function Gyro2({
|
|
|
7888
8023
|
emit("gyrodenied");
|
|
7889
8024
|
return false;
|
|
7890
8025
|
}, [emit, setAvailable]);
|
|
7891
|
-
const deactivate = (0,
|
|
8026
|
+
const deactivate = (0, import_react28.useCallback)(() => {
|
|
7892
8027
|
if (activeRef.current) {
|
|
7893
8028
|
activeRef.current = false;
|
|
7894
8029
|
controlsRef.current?.setGyroActive(false);
|
|
@@ -7900,7 +8035,7 @@ var Gyro = (0, import_react27.forwardRef)(function Gyro2({
|
|
|
7900
8035
|
filteredPoseRef.current = null;
|
|
7901
8036
|
lastAppliedPoseRef.current = null;
|
|
7902
8037
|
}, [controlsRef, emit]);
|
|
7903
|
-
const resetSensor = (0,
|
|
8038
|
+
const resetSensor = (0, import_react28.useCallback)(
|
|
7904
8039
|
(yaw, pitch) => {
|
|
7905
8040
|
const rawQuaternion = rawQuaternionRef.current;
|
|
7906
8041
|
if (!rawQuaternion) {
|
|
@@ -7935,7 +8070,7 @@ var Gyro = (0, import_react27.forwardRef)(function Gyro2({
|
|
|
7935
8070
|
},
|
|
7936
8071
|
[absolute, controlsRef, north]
|
|
7937
8072
|
);
|
|
7938
|
-
(0,
|
|
8073
|
+
(0, import_react28.useImperativeHandle)(
|
|
7939
8074
|
ref,
|
|
7940
8075
|
() => ({
|
|
7941
8076
|
resetSensor,
|
|
@@ -7945,22 +8080,22 @@ var Gyro = (0, import_react27.forwardRef)(function Gyro2({
|
|
|
7945
8080
|
}),
|
|
7946
8081
|
[requestPermission, resetSensor]
|
|
7947
8082
|
);
|
|
7948
|
-
(0,
|
|
8083
|
+
(0, import_react28.useEffect)(() => {
|
|
7949
8084
|
if (!enabled) {
|
|
7950
8085
|
setInternallyDisabled(false);
|
|
7951
8086
|
}
|
|
7952
8087
|
}, [enabled]);
|
|
7953
|
-
(0,
|
|
8088
|
+
(0, import_react28.useEffect)(() => {
|
|
7954
8089
|
const supported = typeof window !== "undefined" && window.isSecureContext && typeof DeviceOrientationEvent !== "undefined" && (desktopSupport || isMobileDevice());
|
|
7955
8090
|
setAvailable(supported);
|
|
7956
8091
|
return () => {
|
|
7957
8092
|
availableRef.current = false;
|
|
7958
8093
|
};
|
|
7959
8094
|
}, [desktopSupport, setAvailable]);
|
|
7960
|
-
(0,
|
|
8095
|
+
(0, import_react28.useEffect)(() => {
|
|
7961
8096
|
controlsRef.current?.setGyroTouchMode(touchMode);
|
|
7962
8097
|
}, [controlsRef, touchMode]);
|
|
7963
|
-
(0,
|
|
8098
|
+
(0, import_react28.useEffect)(() => {
|
|
7964
8099
|
if (!enabled || internallyDisabled || touchMode !== "disablegyro") {
|
|
7965
8100
|
return;
|
|
7966
8101
|
}
|
|
@@ -7974,7 +8109,7 @@ var Gyro = (0, import_react27.forwardRef)(function Gyro2({
|
|
|
7974
8109
|
gl.domElement.removeEventListener("pointerdown", onPointerDown);
|
|
7975
8110
|
};
|
|
7976
8111
|
}, [enabled, gl, internallyDisabled, touchMode]);
|
|
7977
|
-
(0,
|
|
8112
|
+
(0, import_react28.useEffect)(() => {
|
|
7978
8113
|
if (!enabled || internallyDisabled || !availableRef.current) {
|
|
7979
8114
|
deactivate();
|
|
7980
8115
|
return;
|
|
@@ -8136,7 +8271,7 @@ var Gyro = (0, import_react27.forwardRef)(function Gyro2({
|
|
|
8136
8271
|
|
|
8137
8272
|
// src/webvr/webvr.tsx
|
|
8138
8273
|
var import_fiber14 = require("@react-three/fiber");
|
|
8139
|
-
var
|
|
8274
|
+
var import_react33 = require("react");
|
|
8140
8275
|
|
|
8141
8276
|
// src/webvr/detect.ts
|
|
8142
8277
|
function isMobileVRDevice() {
|
|
@@ -8159,9 +8294,9 @@ async function detectWebVRCapabilities() {
|
|
|
8159
8294
|
|
|
8160
8295
|
// src/webvr/reticle.tsx
|
|
8161
8296
|
var import_fiber12 = require("@react-three/fiber");
|
|
8162
|
-
var
|
|
8297
|
+
var import_react29 = require("react");
|
|
8163
8298
|
var import_three8 = require("three");
|
|
8164
|
-
var
|
|
8299
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
8165
8300
|
var CENTER_NDC = new import_three8.Vector2(0, 0);
|
|
8166
8301
|
var HUD_DISTANCE = 2;
|
|
8167
8302
|
var RETICLE_SCALE = 1;
|
|
@@ -8245,13 +8380,13 @@ function WebVRReticle({
|
|
|
8245
8380
|
dwellMs,
|
|
8246
8381
|
visible
|
|
8247
8382
|
}) {
|
|
8248
|
-
const groupRef = (0,
|
|
8249
|
-
const ringMeshRef = (0,
|
|
8250
|
-
const directionRef = (0,
|
|
8251
|
-
const raycasterRef = (0,
|
|
8252
|
-
const hoveredRef = (0,
|
|
8253
|
-
const dwellRef = (0,
|
|
8254
|
-
const clickedRef = (0,
|
|
8383
|
+
const groupRef = (0, import_react29.useRef)(null);
|
|
8384
|
+
const ringMeshRef = (0, import_react29.useRef)(null);
|
|
8385
|
+
const directionRef = (0, import_react29.useRef)(new import_three8.Vector3());
|
|
8386
|
+
const raycasterRef = (0, import_react29.useRef)(new import_three8.Raycaster());
|
|
8387
|
+
const hoveredRef = (0, import_react29.useRef)(null);
|
|
8388
|
+
const dwellRef = (0, import_react29.useRef)(0);
|
|
8389
|
+
const clickedRef = (0, import_react29.useRef)(false);
|
|
8255
8390
|
const { camera, gl, scene } = (0, import_fiber12.useThree)();
|
|
8256
8391
|
(0, import_fiber12.useFrame)((_, deltaSeconds) => {
|
|
8257
8392
|
const group = groupRef.current;
|
|
@@ -8321,7 +8456,7 @@ function WebVRReticle({
|
|
|
8321
8456
|
group.quaternion.copy(activeCamera.quaternion);
|
|
8322
8457
|
group.scale.setScalar(RETICLE_SCALE);
|
|
8323
8458
|
});
|
|
8324
|
-
return /* @__PURE__ */ (0,
|
|
8459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
8325
8460
|
"group",
|
|
8326
8461
|
{
|
|
8327
8462
|
frustumCulled: false,
|
|
@@ -8329,15 +8464,15 @@ function WebVRReticle({
|
|
|
8329
8464
|
renderOrder: RETICLE_RENDER_ORDER,
|
|
8330
8465
|
visible,
|
|
8331
8466
|
children: [
|
|
8332
|
-
/* @__PURE__ */ (0,
|
|
8467
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
8333
8468
|
"mesh",
|
|
8334
8469
|
{
|
|
8335
8470
|
frustumCulled: false,
|
|
8336
8471
|
raycast: noopRaycast,
|
|
8337
8472
|
renderOrder: RETICLE_RENDER_ORDER + 1,
|
|
8338
8473
|
children: [
|
|
8339
|
-
/* @__PURE__ */ (0,
|
|
8340
|
-
/* @__PURE__ */ (0,
|
|
8474
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("boxGeometry", { args: [CROSSHAIR_LENGTH, CROSSHAIR_THICKNESS, 1e-3] }),
|
|
8475
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
8341
8476
|
"meshBasicMaterial",
|
|
8342
8477
|
{
|
|
8343
8478
|
color: "#ffffff",
|
|
@@ -8350,15 +8485,15 @@ function WebVRReticle({
|
|
|
8350
8485
|
]
|
|
8351
8486
|
}
|
|
8352
8487
|
),
|
|
8353
|
-
/* @__PURE__ */ (0,
|
|
8488
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
8354
8489
|
"mesh",
|
|
8355
8490
|
{
|
|
8356
8491
|
frustumCulled: false,
|
|
8357
8492
|
raycast: noopRaycast,
|
|
8358
8493
|
renderOrder: RETICLE_RENDER_ORDER + 1,
|
|
8359
8494
|
children: [
|
|
8360
|
-
/* @__PURE__ */ (0,
|
|
8361
|
-
/* @__PURE__ */ (0,
|
|
8495
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("boxGeometry", { args: [CROSSHAIR_THICKNESS, CROSSHAIR_LENGTH, 1e-3] }),
|
|
8496
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
8362
8497
|
"meshBasicMaterial",
|
|
8363
8498
|
{
|
|
8364
8499
|
color: "#ffffff",
|
|
@@ -8371,7 +8506,7 @@ function WebVRReticle({
|
|
|
8371
8506
|
]
|
|
8372
8507
|
}
|
|
8373
8508
|
),
|
|
8374
|
-
/* @__PURE__ */ (0,
|
|
8509
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
8375
8510
|
"mesh",
|
|
8376
8511
|
{
|
|
8377
8512
|
frustumCulled: false,
|
|
@@ -8380,7 +8515,7 @@ function WebVRReticle({
|
|
|
8380
8515
|
renderOrder: RETICLE_RENDER_ORDER + 2,
|
|
8381
8516
|
visible: false,
|
|
8382
8517
|
children: [
|
|
8383
|
-
/* @__PURE__ */ (0,
|
|
8518
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
8384
8519
|
"ringGeometry",
|
|
8385
8520
|
{
|
|
8386
8521
|
args: [
|
|
@@ -8393,7 +8528,7 @@ function WebVRReticle({
|
|
|
8393
8528
|
]
|
|
8394
8529
|
}
|
|
8395
8530
|
),
|
|
8396
|
-
/* @__PURE__ */ (0,
|
|
8531
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
8397
8532
|
"meshBasicMaterial",
|
|
8398
8533
|
{
|
|
8399
8534
|
color: "#ffffff",
|
|
@@ -8414,7 +8549,7 @@ function WebVRReticle({
|
|
|
8414
8549
|
|
|
8415
8550
|
// src/webvr/stereo.tsx
|
|
8416
8551
|
var import_fiber13 = require("@react-three/fiber");
|
|
8417
|
-
var
|
|
8552
|
+
var import_react30 = require("react");
|
|
8418
8553
|
var import_three9 = require("three");
|
|
8419
8554
|
var vertexShader = `
|
|
8420
8555
|
varying vec2 vUv;
|
|
@@ -8489,25 +8624,25 @@ function WebVRStereoRenderer({
|
|
|
8489
8624
|
screensize
|
|
8490
8625
|
}) {
|
|
8491
8626
|
const { camera, gl } = (0, import_fiber13.useThree)();
|
|
8492
|
-
const runtime = (0,
|
|
8493
|
-
const fallbackStereoRef = (0,
|
|
8627
|
+
const runtime = (0, import_react30.useContext)(WebVRRuntimeContext);
|
|
8628
|
+
const fallbackStereoRef = (0, import_react30.useRef)(null);
|
|
8494
8629
|
if (!fallbackStereoRef.current) {
|
|
8495
8630
|
fallbackStereoRef.current = new import_three9.StereoCamera();
|
|
8496
8631
|
}
|
|
8497
8632
|
const stereo = runtime?.stereoView.stereo ?? fallbackStereoRef.current;
|
|
8498
|
-
const stereoRef = (0,
|
|
8633
|
+
const stereoRef = (0, import_react30.useRef)(stereo);
|
|
8499
8634
|
stereoRef.current = stereo;
|
|
8500
|
-
const resources = (0,
|
|
8501
|
-
const drawingSizeRef = (0,
|
|
8502
|
-
const viewportRef = (0,
|
|
8503
|
-
const scissorRef = (0,
|
|
8504
|
-
const originalFovRef = (0,
|
|
8505
|
-
const stereoActiveRef = (0,
|
|
8506
|
-
const profileRef = (0,
|
|
8507
|
-
const screensizeRef = (0,
|
|
8635
|
+
const resources = (0, import_react30.useMemo)(createDistortionResources, []);
|
|
8636
|
+
const drawingSizeRef = (0, import_react30.useRef)(new import_three9.Vector2());
|
|
8637
|
+
const viewportRef = (0, import_react30.useRef)(new import_three9.Vector4());
|
|
8638
|
+
const scissorRef = (0, import_react30.useRef)(new import_three9.Vector4());
|
|
8639
|
+
const originalFovRef = (0, import_react30.useRef)(null);
|
|
8640
|
+
const stereoActiveRef = (0, import_react30.useRef)(false);
|
|
8641
|
+
const profileRef = (0, import_react30.useRef)(profile);
|
|
8642
|
+
const screensizeRef = (0, import_react30.useRef)(screensize);
|
|
8508
8643
|
profileRef.current = profile;
|
|
8509
8644
|
screensizeRef.current = screensize;
|
|
8510
|
-
(0,
|
|
8645
|
+
(0, import_react30.useEffect)(
|
|
8511
8646
|
() => () => {
|
|
8512
8647
|
resources.geometry.dispose();
|
|
8513
8648
|
resources.material.dispose();
|
|
@@ -8515,7 +8650,7 @@ function WebVRStereoRenderer({
|
|
|
8515
8650
|
},
|
|
8516
8651
|
[resources]
|
|
8517
8652
|
);
|
|
8518
|
-
(0,
|
|
8653
|
+
(0, import_react30.useEffect)(() => {
|
|
8519
8654
|
const originalRender = gl.render.bind(gl);
|
|
8520
8655
|
gl.render = (sceneToRender, cameraToRender) => {
|
|
8521
8656
|
if (!stereoActiveRef.current || !(cameraToRender instanceof import_three9.PerspectiveCamera)) {
|
|
@@ -8579,7 +8714,7 @@ function WebVRStereoRenderer({
|
|
|
8579
8714
|
gl.render = originalRender;
|
|
8580
8715
|
};
|
|
8581
8716
|
}, [gl, resources]);
|
|
8582
|
-
(0,
|
|
8717
|
+
(0, import_react30.useEffect)(
|
|
8583
8718
|
() => () => {
|
|
8584
8719
|
if (runtime) {
|
|
8585
8720
|
runtime.stereoView.active = false;
|
|
@@ -8614,7 +8749,7 @@ function WebVRStereoRenderer({
|
|
|
8614
8749
|
}
|
|
8615
8750
|
|
|
8616
8751
|
// src/webvr/pointerlock.ts
|
|
8617
|
-
var
|
|
8752
|
+
var import_react31 = require("react");
|
|
8618
8753
|
var POINTER_LOCK_CURSOR_ID = "webvr:pointerlock";
|
|
8619
8754
|
async function requestWebVRPointerLock(element) {
|
|
8620
8755
|
if (typeof document === "undefined") {
|
|
@@ -8647,11 +8782,11 @@ function exitWebVRPointerLock(element) {
|
|
|
8647
8782
|
}
|
|
8648
8783
|
function useWebVRPointerLock(enabled, element) {
|
|
8649
8784
|
const cursor = usePanoCursor();
|
|
8650
|
-
const cursorRef = (0,
|
|
8651
|
-
const enabledRef = (0,
|
|
8785
|
+
const cursorRef = (0, import_react31.useRef)(cursor);
|
|
8786
|
+
const enabledRef = (0, import_react31.useRef)(enabled);
|
|
8652
8787
|
cursorRef.current = cursor;
|
|
8653
8788
|
enabledRef.current = enabled;
|
|
8654
|
-
(0,
|
|
8789
|
+
(0, import_react31.useEffect)(() => {
|
|
8655
8790
|
if (!enabled || !element) {
|
|
8656
8791
|
return;
|
|
8657
8792
|
}
|
|
@@ -8681,7 +8816,7 @@ function useWebVRPointerLock(enabled, element) {
|
|
|
8681
8816
|
}
|
|
8682
8817
|
|
|
8683
8818
|
// src/webvr/wakelock.ts
|
|
8684
|
-
var
|
|
8819
|
+
var import_react32 = require("react");
|
|
8685
8820
|
|
|
8686
8821
|
// src/webvr/wakelock-fallback.ts
|
|
8687
8822
|
var WEBVR_WAKELOCK_FALLBACK_VIDEO_BASE64 = "AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAbBbW9vdgAAAGxtdmhkAAAAAAAAAAAAAAAAAAAD6AAAD4AAAQAAAQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAxt0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAABAAAAAAAAAggAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAABAAAAAQAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAIIAAAEAAABAAAAAAKTbWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAAyAAAAGgBVxAAAAAAALWhkbHIAAAAAAAAAAHZpZGUAAAAAAAAAAAAAAABWaWRlb0hhbmRsZXIAAAACPm1pbmYAAAAUdm1oZAAAAAEAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAf5zdGJsAAAAvnN0c2QAAAAAAAAAAQAAAK5hdmMxAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAABAAEABIAAAASAAAAAAAAAABFUxhdmM2Mi4xMS4xMDAgbGlieDI2NAAAAAAAAAAAAAAAGP//AAAANGF2Y0MBZAAK/+EAF2dkAAqs2V7ARAAAAwAEAAADAMg8SJZYAQAGaOvjyyLA/fj4AAAAABBwYXNwAAAAAQAAAAEAAAAUYnRydAAAAAAAADQ5AAAAAAAAABhzdHRzAAAAAAAAAAEAAAANAAACAAAAABRzdHNzAAAAAAAAAAEAAAABAAAAeGN0dHMAAAAAAAAADQAAAAEAAAQAAAAAAQAACgAAAAABAAAEAAAAAAEAAAAAAAAAAQAAAgAAAAABAAAKAAAAAAEAAAQAAAAAAQAAAAAAAAABAAACAAAAAAEAAAoAAAAAAQAABAAAAAABAAAAAAAAAAEAAAIAAAAAKHN0c2MAAAAAAAAAAgAAAAEAAAADAAAAAQAAAAUAAAABAAAAAQAAAEhzdHN6AAAAAAAAAAAAAAANAAACxQAAAAwAAAAMAAAADAAAAAwAAAASAAAADgAAAAwAAAAMAAAAEgAAAA4AAAAMAAAADAAAACRzdGNvAAAAAAAAAAUAAAcGAAAJ5wAAChUAAAo/AAAKbwAAAtF0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAACAAAAAAAAD4AAAAAAAAAAAAAAAAEBAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAA+AAAAEAAABAAAAAAJJbWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAAfQAAAgABVxAAAAAAALWhkbHIAAAAAAAAAAHNvdW4AAAAAAAAAAAAAAABTb3VuZEhhbmRsZXIAAAAB9G1pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAABuHN0YmwAAAB+c3RzZAAAAAAAAAABAAAAbm1wNGEAAAAAAAAAAQAAAAAAAAAAAAEAEAAAAAAfQAAAAAAANmVzZHMAAAAAA4CAgCUAAgAEgICAF0AVAAAAAAAfQAAAARsFgICABRWIVuUABoCAgAECAAAAFGJ0cnQAAAAAAAAfQAAAARsAAAAYc3R0cwAAAAAAAAABAAAAIAAABAAAAAAoc3RzYwAAAAAAAAACAAAAAQAAAAEAAAABAAAABgAAABsAAAABAAAAlHN0c3oAAAAAAAAAAAAAACAAAAAVAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAChzdGNvAAAAAAAAAAYAAAbxAAAJ4wAAChEAAAo7AAAKawAACnsAAAAac2dwZAEAAAByb2xsAAAAAgAAAAH//wAAABxzYmdwAAAAAHJvbGwAAAABAAAAIAAAAAEAAABhdWR0YQAAAFltZXRhAAAAAAAAACFoZGxyAAAAAAAAAABtZGlyYXBwbAAAAAAAAAAAAAAAACxpbHN0AAAAJKl0b28AAAAcZGF0YQAAAAEAAAAATGF2ZjYyLjMuMTAwAAAACGZyZWUAAAP+bWRhdN4CAExhdmM2Mi4xMS4xMDAAAjBADgAAAq4GBf//qtxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNjUgcjMyMjIgYjM1NjA1YSAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTIwMjUgLSBodHRwOi8vd3d3LnZpZGVvbGFuLm9yZy94MjY0Lmh0bWwgLSBvcHRpb25zOiBjYWJhYz0xIHJlZj0zIGRlYmxvY2s9MTowOjAgYW5hbHlzZT0weDM6MHgxMTMgbWU9aGV4IHN1Ym1lPTcgcHN5PTEgcHN5X3JkPTEuMDA6MC4wMCBtaXhlZF9yZWY9MSBtZV9yYW5nZT0xNiBjaHJvbWFfbWU9MSB0cmVsbGlzPTEgOHg4ZGN0PTEgY3FtPTAgZGVhZHpvbmU9MjEsMTEgZmFzdF9wc2tpcD0xIGNocm9tYV9xcF9vZmZzZXQ9LTIgdGhyZWFkcz0xIGxvb2thaGVhZF90aHJlYWRzPTEgc2xpY2VkX3RocmVhZHM9MCBucj0wIGRlY2ltYXRlPTEgaW50ZXJsYWNlZD0wIGJsdXJheV9jb21wYXQ9MCBjb25zdHJhaW5lZF9pbnRyYT0wIGJmcmFtZXM9MyBiX3B5cmFtaWQ9MiBiX2FkYXB0PTEgYl9iaWFzPTAgZGlyZWN0PTEgd2VpZ2h0Yj0xIG9wZW5fZ29wPTAgd2VpZ2h0cD0yIGtleWludD0yNTAga2V5aW50X21pbj0yNSBzY2VuZWN1dD00MCBpbnRyYV9yZWZyZXNoPTAgcmNfbG9va2FoZWFkPTQwIHJjPWNyZiBtYnRyZWU9MSBjcmY9MjMuMCBxY29tcD0wLjYwIHFwbWluPTAgcXBtYXg9NjkgcXBzdGVwPTQgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAAA9liIQAO//+906/AptUwmEAAAAIQZokbEN//uAAAAAIQZ5CeIX/wYEBGCAHAAAACAGeYXRCv8SAAAAACAGeY2pCv8SBAAAADkGaaEmoQWiZTAhn//7hARggBwAAAApBnoZFESwv/8GBAAAACAGepXRCv8SBAAAACAGep2pCv8SAARggBwAAAA5BmqxJqEFsmUwIV//+wAAAAApBnspFFSwv/8GBAAAACAGe6XRCv8SAARggBwAAAAgBnutqQr/EgAEYIAcBGCAHARggBwEYIAcBGCAHARggBwEYIAcBGCAHARggBwEYIAcBGCAHARggBwEYIAcBGCAHARggBwEYIAcBGCAHARggBwEYIAcBGCAHARggBwEYIAcBGCAHARggBwEYIAcBGCAHARggBw==";
|
|
@@ -8815,7 +8950,7 @@ function releaseWebVRWakeLock() {
|
|
|
8815
8950
|
stopFallbackVideo();
|
|
8816
8951
|
}
|
|
8817
8952
|
function useWebVRWakeLock(enabled) {
|
|
8818
|
-
(0,
|
|
8953
|
+
(0, import_react32.useEffect)(() => {
|
|
8819
8954
|
if (!enabled) {
|
|
8820
8955
|
return;
|
|
8821
8956
|
}
|
|
@@ -8834,7 +8969,7 @@ function useWebVRWakeLock(enabled) {
|
|
|
8834
8969
|
}
|
|
8835
8970
|
|
|
8836
8971
|
// src/webvr/webvr.tsx
|
|
8837
|
-
var
|
|
8972
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
8838
8973
|
function initializeSettings(screensize, profile) {
|
|
8839
8974
|
const stored = loadWebVRSettings();
|
|
8840
8975
|
return {
|
|
@@ -8845,7 +8980,7 @@ function initializeSettings(screensize, profile) {
|
|
|
8845
8980
|
function getViewerElement(canvas) {
|
|
8846
8981
|
return canvas.closest("[data-pano-viewer]") ?? canvas.parentElement ?? canvas;
|
|
8847
8982
|
}
|
|
8848
|
-
var WebVR = (0,
|
|
8983
|
+
var WebVR = (0, import_react33.forwardRef)(function WebVR2({
|
|
8849
8984
|
chrome = true,
|
|
8850
8985
|
mobileVr = true,
|
|
8851
8986
|
desktopSupport = false,
|
|
@@ -8863,24 +8998,24 @@ var WebVR = (0, import_react32.forwardRef)(function WebVR2({
|
|
|
8863
8998
|
onDenied,
|
|
8864
8999
|
onUnknownDevice
|
|
8865
9000
|
}, ref) {
|
|
8866
|
-
const runtime = (0,
|
|
8867
|
-
const controlsRef = (0,
|
|
8868
|
-
const eventBus = (0,
|
|
9001
|
+
const runtime = (0, import_react33.useContext)(WebVRRuntimeContext);
|
|
9002
|
+
const controlsRef = (0, import_react33.useContext)(PanoramaViewContext);
|
|
9003
|
+
const eventBus = (0, import_react33.useContext)(PanoEventBusContext);
|
|
8869
9004
|
const gl = (0, import_fiber14.useThree)((state) => state.gl);
|
|
8870
|
-
const gyroRef = (0,
|
|
8871
|
-
const capabilitiesRef = (0,
|
|
9005
|
+
const gyroRef = (0, import_react33.useRef)(null);
|
|
9006
|
+
const capabilitiesRef = (0, import_react33.useRef)({
|
|
8872
9007
|
mobile: false,
|
|
8873
9008
|
sensor: false,
|
|
8874
9009
|
webxr: false
|
|
8875
9010
|
});
|
|
8876
|
-
const availableRef = (0,
|
|
8877
|
-
const modeRef = (0,
|
|
8878
|
-
const webXRSessionRef = (0,
|
|
8879
|
-
const [mode, setMode] = (0,
|
|
8880
|
-
const [settings, setSettings] = (0,
|
|
9011
|
+
const availableRef = (0, import_react33.useRef)(false);
|
|
9012
|
+
const modeRef = (0, import_react33.useRef)(null);
|
|
9013
|
+
const webXRSessionRef = (0, import_react33.useRef)(null);
|
|
9014
|
+
const [mode, setMode] = (0, import_react33.useState)(null);
|
|
9015
|
+
const [settings, setSettings] = (0, import_react33.useState)(
|
|
8881
9016
|
() => initializeSettings(screensize, profile)
|
|
8882
9017
|
);
|
|
8883
|
-
const callbacksRef = (0,
|
|
9018
|
+
const callbacksRef = (0, import_react33.useRef)({
|
|
8884
9019
|
onAvailable,
|
|
8885
9020
|
onDenied,
|
|
8886
9021
|
onEnterVR,
|
|
@@ -8900,22 +9035,22 @@ var WebVR = (0, import_react32.forwardRef)(function WebVR2({
|
|
|
8900
9035
|
throw new Error("<WebVR> must be rendered inside <PanoViewer>.");
|
|
8901
9036
|
}
|
|
8902
9037
|
const { host, xrStore } = runtime;
|
|
8903
|
-
const resolvedProfile = (0,
|
|
9038
|
+
const resolvedProfile = (0, import_react33.useMemo)(
|
|
8904
9039
|
() => resolveWebVRProfile(profile, settings.profileId),
|
|
8905
9040
|
[profile, settings.profileId]
|
|
8906
9041
|
);
|
|
8907
|
-
const reportDenied = (0,
|
|
9042
|
+
const reportDenied = (0, import_react33.useCallback)(
|
|
8908
9043
|
(error) => {
|
|
8909
9044
|
eventBus.emit("vrdenied", { error });
|
|
8910
9045
|
callbacksRef.current.onDenied?.(error);
|
|
8911
9046
|
},
|
|
8912
9047
|
[eventBus]
|
|
8913
9048
|
);
|
|
8914
|
-
const reportUnknownDevice = (0,
|
|
9049
|
+
const reportUnknownDevice = (0, import_react33.useCallback)(() => {
|
|
8915
9050
|
eventBus.emit("vrunknowndevice", void 0);
|
|
8916
9051
|
callbacksRef.current.onUnknownDevice?.();
|
|
8917
9052
|
}, [eventBus]);
|
|
8918
|
-
const activate = (0,
|
|
9053
|
+
const activate = (0, import_react33.useCallback)(
|
|
8919
9054
|
(nextMode) => {
|
|
8920
9055
|
if (modeRef.current === nextMode) {
|
|
8921
9056
|
return;
|
|
@@ -8930,7 +9065,7 @@ var WebVR = (0, import_react32.forwardRef)(function WebVR2({
|
|
|
8930
9065
|
},
|
|
8931
9066
|
[controlsRef, eventBus]
|
|
8932
9067
|
);
|
|
8933
|
-
const deactivate = (0,
|
|
9068
|
+
const deactivate = (0, import_react33.useCallback)(
|
|
8934
9069
|
(expectedMode) => {
|
|
8935
9070
|
const previousMode = modeRef.current;
|
|
8936
9071
|
if (!previousMode || expectedMode && previousMode !== expectedMode) {
|
|
@@ -8947,10 +9082,10 @@ var WebVR = (0, import_react32.forwardRef)(function WebVR2({
|
|
|
8947
9082
|
},
|
|
8948
9083
|
[controlsRef, eventBus, gl.domElement]
|
|
8949
9084
|
);
|
|
8950
|
-
const requestPermission = (0,
|
|
9085
|
+
const requestPermission = (0, import_react33.useCallback)(async () => {
|
|
8951
9086
|
return await gyroRef.current?.requestPermission() ?? false;
|
|
8952
9087
|
}, []);
|
|
8953
|
-
const enterVR = (0,
|
|
9088
|
+
const enterVR = (0, import_react33.useCallback)(async () => {
|
|
8954
9089
|
if (modeRef.current) {
|
|
8955
9090
|
return true;
|
|
8956
9091
|
}
|
|
@@ -9035,7 +9170,7 @@ var WebVR = (0, import_react32.forwardRef)(function WebVR2({
|
|
|
9035
9170
|
wakelock,
|
|
9036
9171
|
xrStore
|
|
9037
9172
|
]);
|
|
9038
|
-
const exitVR = (0,
|
|
9173
|
+
const exitVR = (0, import_react33.useCallback)(async () => {
|
|
9039
9174
|
if (modeRef.current === "webxr") {
|
|
9040
9175
|
const session2 = webXRSessionRef.current ?? xrStore.getState().session ?? null;
|
|
9041
9176
|
if (session2) {
|
|
@@ -9050,14 +9185,14 @@ var WebVR = (0, import_react32.forwardRef)(function WebVR2({
|
|
|
9050
9185
|
await exitElementFullscreen();
|
|
9051
9186
|
}
|
|
9052
9187
|
}, [deactivate, xrStore]);
|
|
9053
|
-
const toggleVR = (0,
|
|
9188
|
+
const toggleVR = (0, import_react33.useCallback)(async () => {
|
|
9054
9189
|
if (modeRef.current) {
|
|
9055
9190
|
await exitVR();
|
|
9056
9191
|
return false;
|
|
9057
9192
|
}
|
|
9058
9193
|
return enterVR();
|
|
9059
9194
|
}, [enterVR, exitVR]);
|
|
9060
|
-
const updateSettings = (0,
|
|
9195
|
+
const updateSettings = (0, import_react33.useCallback)((next) => {
|
|
9061
9196
|
const normalized = {
|
|
9062
9197
|
profileId: next.profileId,
|
|
9063
9198
|
screensize: next.screensize === "auto" ? "auto" : Math.round(Math.max(3, Math.min(20, next.screensize)) * 10) / 10
|
|
@@ -9065,7 +9200,7 @@ var WebVR = (0, import_react32.forwardRef)(function WebVR2({
|
|
|
9065
9200
|
setSettings(normalized);
|
|
9066
9201
|
saveWebVRSettings(normalized);
|
|
9067
9202
|
}, []);
|
|
9068
|
-
const controller = (0,
|
|
9203
|
+
const controller = (0, import_react33.useMemo)(
|
|
9069
9204
|
() => ({
|
|
9070
9205
|
closeSetup: () => updateWebVRHost(host, { setupOpen: false }),
|
|
9071
9206
|
enterVR,
|
|
@@ -9077,7 +9212,7 @@ var WebVR = (0, import_react32.forwardRef)(function WebVR2({
|
|
|
9077
9212
|
}),
|
|
9078
9213
|
[enterVR, exitVR, host, requestPermission, toggleVR, updateSettings]
|
|
9079
9214
|
);
|
|
9080
|
-
(0,
|
|
9215
|
+
(0, import_react33.useImperativeHandle)(
|
|
9081
9216
|
ref,
|
|
9082
9217
|
() => ({
|
|
9083
9218
|
enterVR,
|
|
@@ -9090,7 +9225,7 @@ var WebVR = (0, import_react32.forwardRef)(function WebVR2({
|
|
|
9090
9225
|
}),
|
|
9091
9226
|
[enterVR, exitVR, requestPermission, toggleVR]
|
|
9092
9227
|
);
|
|
9093
|
-
(0,
|
|
9228
|
+
(0, import_react33.useEffect)(() => {
|
|
9094
9229
|
let active = true;
|
|
9095
9230
|
void detectWebVRCapabilities().then((capabilities) => {
|
|
9096
9231
|
if (!active) {
|
|
@@ -9112,7 +9247,7 @@ var WebVR = (0, import_react32.forwardRef)(function WebVR2({
|
|
|
9112
9247
|
active = false;
|
|
9113
9248
|
};
|
|
9114
9249
|
}, [desktopSupport, eventBus, fakeSupport, host, mobileVr]);
|
|
9115
|
-
(0,
|
|
9250
|
+
(0, import_react33.useEffect)(() => {
|
|
9116
9251
|
host.controller = controller;
|
|
9117
9252
|
return () => {
|
|
9118
9253
|
if (host.controller === controller) {
|
|
@@ -9121,10 +9256,10 @@ var WebVR = (0, import_react32.forwardRef)(function WebVR2({
|
|
|
9121
9256
|
}
|
|
9122
9257
|
};
|
|
9123
9258
|
}, [controller, host]);
|
|
9124
|
-
(0,
|
|
9259
|
+
(0, import_react33.useEffect)(() => {
|
|
9125
9260
|
updateWebVRHost(host, { chrome, mode, settings });
|
|
9126
9261
|
}, [chrome, host, mode, settings]);
|
|
9127
|
-
(0,
|
|
9262
|
+
(0, import_react33.useEffect)(() => {
|
|
9128
9263
|
if (mode !== "fake") {
|
|
9129
9264
|
return;
|
|
9130
9265
|
}
|
|
@@ -9148,7 +9283,7 @@ var WebVR = (0, import_react32.forwardRef)(function WebVR2({
|
|
|
9148
9283
|
document.removeEventListener("mousemove", onMouseMove);
|
|
9149
9284
|
};
|
|
9150
9285
|
}, [controlsRef, gl.domElement, mode, mousePointerLock]);
|
|
9151
|
-
(0,
|
|
9286
|
+
(0, import_react33.useEffect)(
|
|
9152
9287
|
() => () => {
|
|
9153
9288
|
const session2 = webXRSessionRef.current;
|
|
9154
9289
|
if (session2) {
|
|
@@ -9167,8 +9302,8 @@ var WebVR = (0, import_react32.forwardRef)(function WebVR2({
|
|
|
9167
9302
|
useWebVRWakeLock(
|
|
9168
9303
|
wakelock && (mode === "mobilevr" || mode === "fake")
|
|
9169
9304
|
);
|
|
9170
|
-
return /* @__PURE__ */ (0,
|
|
9171
|
-
/* @__PURE__ */ (0,
|
|
9305
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
9306
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
9172
9307
|
Gyro,
|
|
9173
9308
|
{
|
|
9174
9309
|
ref: gyroRef,
|
|
@@ -9182,7 +9317,7 @@ var WebVR = (0, import_react32.forwardRef)(function WebVR2({
|
|
|
9182
9317
|
touchMode: "off"
|
|
9183
9318
|
}
|
|
9184
9319
|
),
|
|
9185
|
-
/* @__PURE__ */ (0,
|
|
9320
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
9186
9321
|
WebVRStereoRenderer,
|
|
9187
9322
|
{
|
|
9188
9323
|
mode,
|
|
@@ -9190,7 +9325,7 @@ var WebVR = (0, import_react32.forwardRef)(function WebVR2({
|
|
|
9190
9325
|
screensize: settings.screensize
|
|
9191
9326
|
}
|
|
9192
9327
|
),
|
|
9193
|
-
/* @__PURE__ */ (0,
|
|
9328
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
9194
9329
|
WebVRReticle,
|
|
9195
9330
|
{
|
|
9196
9331
|
dwellMs: cursorDwellMs,
|
|
@@ -9201,7 +9336,7 @@ var WebVR = (0, import_react32.forwardRef)(function WebVR2({
|
|
|
9201
9336
|
});
|
|
9202
9337
|
|
|
9203
9338
|
// src/use-pano-viewer.ts
|
|
9204
|
-
var
|
|
9339
|
+
var import_react34 = require("react");
|
|
9205
9340
|
function createPanoViewerHandle(ref) {
|
|
9206
9341
|
return {
|
|
9207
9342
|
getView: () => ref.current?.getView() ?? { yaw: 0, pitch: 0, fov: 75 },
|
|
@@ -9211,6 +9346,7 @@ function createPanoViewerHandle(ref) {
|
|
|
9211
9346
|
reset: () => {
|
|
9212
9347
|
ref.current?.reset();
|
|
9213
9348
|
},
|
|
9349
|
+
activateMedia: () => ref.current?.activateMedia() ?? Promise.resolve(),
|
|
9214
9350
|
enterFullscreen: () => ref.current?.enterFullscreen() ?? Promise.resolve(),
|
|
9215
9351
|
exitFullscreen: () => ref.current?.exitFullscreen() ?? Promise.resolve(),
|
|
9216
9352
|
toggleFullscreen: () => ref.current?.toggleFullscreen() ?? Promise.resolve(),
|
|
@@ -9278,14 +9414,14 @@ function createPanoViewerHandle(ref) {
|
|
|
9278
9414
|
};
|
|
9279
9415
|
}
|
|
9280
9416
|
function usePanoViewer() {
|
|
9281
|
-
const ref = (0,
|
|
9282
|
-
const handle = (0,
|
|
9283
|
-
return (0,
|
|
9417
|
+
const ref = (0, import_react34.useRef)(null);
|
|
9418
|
+
const handle = (0, import_react34.useMemo)(() => createPanoViewerHandle(ref), []);
|
|
9419
|
+
return (0, import_react34.useMemo)(() => ({ ref, ...handle }), [handle]);
|
|
9284
9420
|
}
|
|
9285
9421
|
|
|
9286
9422
|
// src/sphere.tsx
|
|
9287
9423
|
var import_fiber15 = require("@react-three/fiber");
|
|
9288
|
-
var
|
|
9424
|
+
var import_react36 = require("react");
|
|
9289
9425
|
var import_three10 = require("three");
|
|
9290
9426
|
|
|
9291
9427
|
// src/asset-url.ts
|
|
@@ -9310,7 +9446,7 @@ function resolveUrlAgainstFile(fileUrl, path) {
|
|
|
9310
9446
|
}
|
|
9311
9447
|
|
|
9312
9448
|
// src/pano-filter/pano-basic-material.tsx
|
|
9313
|
-
var
|
|
9449
|
+
var import_react35 = require("react");
|
|
9314
9450
|
|
|
9315
9451
|
// src/pano-filter/shaders.ts
|
|
9316
9452
|
var GLSL_FILTER_COMMON = `
|
|
@@ -9461,7 +9597,7 @@ diffuseColor.rgb = mix(diffuseColor.rgb, applyPanoFilter(diffuseColor.rgb), clam
|
|
|
9461
9597
|
}
|
|
9462
9598
|
|
|
9463
9599
|
// src/pano-filter/pano-basic-material.tsx
|
|
9464
|
-
var
|
|
9600
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
9465
9601
|
function PanoBasicMaterial({
|
|
9466
9602
|
map,
|
|
9467
9603
|
side,
|
|
@@ -9470,13 +9606,13 @@ function PanoBasicMaterial({
|
|
|
9470
9606
|
toneMapped = false
|
|
9471
9607
|
}) {
|
|
9472
9608
|
const snapshot = usePanoFilterSnapshot();
|
|
9473
|
-
const materialRef = (0,
|
|
9474
|
-
const intensityRef = (0,
|
|
9475
|
-
const intensityUniformRef = (0,
|
|
9609
|
+
const materialRef = (0, import_react35.useRef)(null);
|
|
9610
|
+
const intensityRef = (0, import_react35.useRef)(snapshot.intensity);
|
|
9611
|
+
const intensityUniformRef = (0, import_react35.useRef)(null);
|
|
9476
9612
|
intensityRef.current = snapshot.intensity;
|
|
9477
9613
|
const active = isPanoFilterActive(snapshot);
|
|
9478
9614
|
const preset = snapshot.preset;
|
|
9479
|
-
const onBeforeCompile = (0,
|
|
9615
|
+
const onBeforeCompile = (0, import_react35.useMemo)(() => {
|
|
9480
9616
|
if (!active || preset === "none") {
|
|
9481
9617
|
return void 0;
|
|
9482
9618
|
}
|
|
@@ -9493,7 +9629,7 @@ function PanoBasicMaterial({
|
|
|
9493
9629
|
compile.toString = () => `pano-filter:${preset}`;
|
|
9494
9630
|
return compile;
|
|
9495
9631
|
}, [active, preset]);
|
|
9496
|
-
(0,
|
|
9632
|
+
(0, import_react35.useLayoutEffect)(() => {
|
|
9497
9633
|
if (!active) {
|
|
9498
9634
|
intensityUniformRef.current = null;
|
|
9499
9635
|
}
|
|
@@ -9503,12 +9639,12 @@ function PanoBasicMaterial({
|
|
|
9503
9639
|
}
|
|
9504
9640
|
material.needsUpdate = true;
|
|
9505
9641
|
}, [active, preset]);
|
|
9506
|
-
(0,
|
|
9642
|
+
(0, import_react35.useLayoutEffect)(() => {
|
|
9507
9643
|
if (intensityUniformRef.current) {
|
|
9508
9644
|
intensityUniformRef.current.value = snapshot.intensity;
|
|
9509
9645
|
}
|
|
9510
9646
|
}, [snapshot.intensity]);
|
|
9511
|
-
return /* @__PURE__ */ (0,
|
|
9647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
9512
9648
|
"meshBasicMaterial",
|
|
9513
9649
|
{
|
|
9514
9650
|
ref: materialRef,
|
|
@@ -9524,14 +9660,14 @@ function PanoBasicMaterial({
|
|
|
9524
9660
|
}
|
|
9525
9661
|
|
|
9526
9662
|
// src/sphere.tsx
|
|
9527
|
-
var
|
|
9663
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
9528
9664
|
function useEquirectTexture(url, anisotropy, generateMipmaps, onLoad, onError) {
|
|
9529
|
-
const [texture, setTexture] = (0,
|
|
9530
|
-
const onLoadRef = (0,
|
|
9531
|
-
const onErrorRef = (0,
|
|
9665
|
+
const [texture, setTexture] = (0, import_react36.useState)(null);
|
|
9666
|
+
const onLoadRef = (0, import_react36.useRef)(onLoad);
|
|
9667
|
+
const onErrorRef = (0, import_react36.useRef)(onError);
|
|
9532
9668
|
onLoadRef.current = onLoad;
|
|
9533
9669
|
onErrorRef.current = onError;
|
|
9534
|
-
(0,
|
|
9670
|
+
(0, import_react36.useEffect)(() => {
|
|
9535
9671
|
if (!url) {
|
|
9536
9672
|
setTexture(null);
|
|
9537
9673
|
return;
|
|
@@ -9570,7 +9706,7 @@ function useEquirectTexture(url, anisotropy, generateMipmaps, onLoad, onError) {
|
|
|
9570
9706
|
active = false;
|
|
9571
9707
|
};
|
|
9572
9708
|
}, [anisotropy, generateMipmaps, url]);
|
|
9573
|
-
(0,
|
|
9709
|
+
(0, import_react36.useEffect)(
|
|
9574
9710
|
() => () => {
|
|
9575
9711
|
texture?.dispose();
|
|
9576
9712
|
},
|
|
@@ -9590,7 +9726,7 @@ function Sphere({
|
|
|
9590
9726
|
}) {
|
|
9591
9727
|
const gl = (0, import_fiber15.useThree)((state) => state.gl);
|
|
9592
9728
|
const anisotropy = gl.capabilities.getMaxAnisotropy();
|
|
9593
|
-
const resolvedPreviewUrl = (0,
|
|
9729
|
+
const resolvedPreviewUrl = (0, import_react36.useMemo)(
|
|
9594
9730
|
() => resolveUrlAgainstFile(src, previewUrl),
|
|
9595
9731
|
[previewUrl, src]
|
|
9596
9732
|
);
|
|
@@ -9609,11 +9745,11 @@ function Sphere({
|
|
|
9609
9745
|
onPreviewError
|
|
9610
9746
|
);
|
|
9611
9747
|
const displayTexture = texture ?? previewTexture;
|
|
9612
|
-
const readyRef = (0,
|
|
9613
|
-
(0,
|
|
9748
|
+
const readyRef = (0, import_react36.useRef)(false);
|
|
9749
|
+
(0, import_react36.useEffect)(() => {
|
|
9614
9750
|
readyRef.current = false;
|
|
9615
9751
|
}, [resolvedPreviewUrl, src]);
|
|
9616
|
-
(0,
|
|
9752
|
+
(0, import_react36.useEffect)(() => {
|
|
9617
9753
|
if (!displayTexture || readyRef.current) {
|
|
9618
9754
|
return;
|
|
9619
9755
|
}
|
|
@@ -9623,14 +9759,14 @@ function Sphere({
|
|
|
9623
9759
|
if (!displayTexture) {
|
|
9624
9760
|
return null;
|
|
9625
9761
|
}
|
|
9626
|
-
return /* @__PURE__ */ (0,
|
|
9762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
9627
9763
|
"mesh",
|
|
9628
9764
|
{
|
|
9629
9765
|
rotation: [0, import_three10.MathUtils.degToRad(90 + yawOffset), 0],
|
|
9630
9766
|
visible,
|
|
9631
9767
|
children: [
|
|
9632
|
-
/* @__PURE__ */ (0,
|
|
9633
|
-
/* @__PURE__ */ (0,
|
|
9768
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("sphereGeometry", { args: [DEFAULT_PANORAMA_RADIUS, 128, 64] }),
|
|
9769
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
9634
9770
|
PanoBasicMaterial,
|
|
9635
9771
|
{
|
|
9636
9772
|
map: displayTexture,
|
|
@@ -9645,9 +9781,9 @@ function Sphere({
|
|
|
9645
9781
|
|
|
9646
9782
|
// src/video/pano-video.tsx
|
|
9647
9783
|
var import_fiber16 = require("@react-three/fiber");
|
|
9648
|
-
var
|
|
9784
|
+
var import_react37 = require("react");
|
|
9649
9785
|
var import_three11 = require("three");
|
|
9650
|
-
var
|
|
9786
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
9651
9787
|
var EMPTY_TRACKS = [];
|
|
9652
9788
|
var EMPTY_RATES = DEFAULT_PANO_VIDEO_PLAYBACK_RATES;
|
|
9653
9789
|
function createEmptySnapshot() {
|
|
@@ -9732,10 +9868,10 @@ function applyEquirectangularLayout(texture, anisotropy) {
|
|
|
9732
9868
|
}
|
|
9733
9869
|
function usePosterTexture(poster, onError) {
|
|
9734
9870
|
const gl = (0, import_fiber16.useThree)((state) => state.gl);
|
|
9735
|
-
const [texture, setTexture] = (0,
|
|
9736
|
-
const onErrorRef = (0,
|
|
9871
|
+
const [texture, setTexture] = (0, import_react37.useState)(null);
|
|
9872
|
+
const onErrorRef = (0, import_react37.useRef)(onError);
|
|
9737
9873
|
onErrorRef.current = onError;
|
|
9738
|
-
(0,
|
|
9874
|
+
(0, import_react37.useEffect)(() => {
|
|
9739
9875
|
let active = true;
|
|
9740
9876
|
setTexture(null);
|
|
9741
9877
|
if (!poster) {
|
|
@@ -9772,7 +9908,7 @@ function usePosterTexture(poster, onError) {
|
|
|
9772
9908
|
active = false;
|
|
9773
9909
|
};
|
|
9774
9910
|
}, [gl, poster]);
|
|
9775
|
-
(0,
|
|
9911
|
+
(0, import_react37.useEffect)(
|
|
9776
9912
|
() => () => {
|
|
9777
9913
|
texture?.dispose();
|
|
9778
9914
|
},
|
|
@@ -9829,39 +9965,40 @@ function PanoVideo({
|
|
|
9829
9965
|
onVariantChange,
|
|
9830
9966
|
onTrackChange
|
|
9831
9967
|
}) {
|
|
9968
|
+
usePanoMediaActivationIntent(autoPlay);
|
|
9832
9969
|
const gl = (0, import_fiber16.useThree)((state) => state.gl);
|
|
9833
|
-
const host = (0,
|
|
9834
|
-
const overlay = (0,
|
|
9835
|
-
const variants = (0,
|
|
9970
|
+
const host = (0, import_react37.useContext)(PanoVideoHostContext);
|
|
9971
|
+
const overlay = (0, import_react37.useContext)(PanoChromeOverlayContext);
|
|
9972
|
+
const variants = (0, import_react37.useMemo)(
|
|
9836
9973
|
() => resolvePanoVideoVariants({ poster, src, variants: variantsProp }),
|
|
9837
9974
|
[poster, src, variantsProp]
|
|
9838
9975
|
);
|
|
9839
9976
|
const tracks = tracksProp ?? EMPTY_TRACKS;
|
|
9840
9977
|
const captionsEnabled = captions !== false;
|
|
9841
|
-
const captionAppearance = (0,
|
|
9978
|
+
const captionAppearance = (0, import_react37.useMemo)(
|
|
9842
9979
|
() => resolvePanoVideoCaptionAppearance(
|
|
9843
9980
|
typeof captions === "object" ? captions : void 0
|
|
9844
9981
|
),
|
|
9845
9982
|
[captions]
|
|
9846
9983
|
);
|
|
9847
|
-
const [variantId, setVariantId] = (0,
|
|
9984
|
+
const [variantId, setVariantId] = (0, import_react37.useState)(
|
|
9848
9985
|
() => resolvePanoVideoVariantId(variants, defaultVariantId)
|
|
9849
9986
|
);
|
|
9850
|
-
const [trackId, setTrackId] = (0,
|
|
9987
|
+
const [trackId, setTrackId] = (0, import_react37.useState)(
|
|
9851
9988
|
() => captionsEnabled ? defaultPanoVideoTrackId(tracks) : null
|
|
9852
9989
|
);
|
|
9853
|
-
const [ready, setReady] = (0,
|
|
9854
|
-
const autoPlayRef = (0,
|
|
9990
|
+
const [ready, setReady] = (0, import_react37.useState)(false);
|
|
9991
|
+
const autoPlayRef = (0, import_react37.useRef)(autoPlay);
|
|
9855
9992
|
autoPlayRef.current = autoPlay;
|
|
9856
|
-
const blockedRef = (0,
|
|
9857
|
-
const captionAppearanceOverrideRef = (0,
|
|
9993
|
+
const blockedRef = (0, import_react37.useRef)(false);
|
|
9994
|
+
const captionAppearanceOverrideRef = (0, import_react37.useRef)(
|
|
9858
9995
|
{}
|
|
9859
9996
|
);
|
|
9860
|
-
const mediaCapabilitiesRef = (0,
|
|
9997
|
+
const mediaCapabilitiesRef = (0, import_react37.useRef)({
|
|
9861
9998
|
volumeAdjustable: true,
|
|
9862
9999
|
playbackRates: [...DEFAULT_PANO_VIDEO_PLAYBACK_RATES]
|
|
9863
10000
|
});
|
|
9864
|
-
const storeRef = (0,
|
|
10001
|
+
const storeRef = (0, import_react37.useRef)(null);
|
|
9865
10002
|
if (!storeRef.current) {
|
|
9866
10003
|
storeRef.current = {
|
|
9867
10004
|
snapshot: {
|
|
@@ -9871,7 +10008,7 @@ function PanoVideo({
|
|
|
9871
10008
|
listeners: /* @__PURE__ */ new Set()
|
|
9872
10009
|
};
|
|
9873
10010
|
}
|
|
9874
|
-
const actionsRef = (0,
|
|
10011
|
+
const actionsRef = (0, import_react37.useRef)({
|
|
9875
10012
|
play: async () => {
|
|
9876
10013
|
},
|
|
9877
10014
|
pause: () => {
|
|
@@ -9891,19 +10028,19 @@ function PanoVideo({
|
|
|
9891
10028
|
setCaptionAppearance: (_appearance) => {
|
|
9892
10029
|
}
|
|
9893
10030
|
});
|
|
9894
|
-
const onLoadRef = (0,
|
|
9895
|
-
const onErrorRef = (0,
|
|
9896
|
-
const onPlaybackStateChangeRef = (0,
|
|
9897
|
-
const onEndedRef = (0,
|
|
9898
|
-
const onVariantChangeRef = (0,
|
|
9899
|
-
const onTrackChangeRef = (0,
|
|
10031
|
+
const onLoadRef = (0, import_react37.useRef)(onLoad);
|
|
10032
|
+
const onErrorRef = (0, import_react37.useRef)(onError);
|
|
10033
|
+
const onPlaybackStateChangeRef = (0, import_react37.useRef)(onPlaybackStateChange);
|
|
10034
|
+
const onEndedRef = (0, import_react37.useRef)(onEnded);
|
|
10035
|
+
const onVariantChangeRef = (0, import_react37.useRef)(onVariantChange);
|
|
10036
|
+
const onTrackChangeRef = (0, import_react37.useRef)(onTrackChange);
|
|
9900
10037
|
onLoadRef.current = onLoad;
|
|
9901
10038
|
onErrorRef.current = onError;
|
|
9902
10039
|
onPlaybackStateChangeRef.current = onPlaybackStateChange;
|
|
9903
10040
|
onEndedRef.current = onEnded;
|
|
9904
10041
|
onVariantChangeRef.current = onVariantChange;
|
|
9905
10042
|
onTrackChangeRef.current = onTrackChange;
|
|
9906
|
-
const resource = (0,
|
|
10043
|
+
const resource = (0, import_react37.useMemo)(() => {
|
|
9907
10044
|
if (typeof document === "undefined") {
|
|
9908
10045
|
return null;
|
|
9909
10046
|
}
|
|
@@ -9920,7 +10057,7 @@ function PanoVideo({
|
|
|
9920
10057
|
texture.generateMipmaps = false;
|
|
9921
10058
|
return { video, texture };
|
|
9922
10059
|
}, []);
|
|
9923
|
-
(0,
|
|
10060
|
+
(0, import_react37.useEffect)(
|
|
9924
10061
|
() => () => {
|
|
9925
10062
|
if (!resource) {
|
|
9926
10063
|
return;
|
|
@@ -9935,13 +10072,13 @@ function PanoVideo({
|
|
|
9935
10072
|
},
|
|
9936
10073
|
[resource]
|
|
9937
10074
|
);
|
|
9938
|
-
(0,
|
|
10075
|
+
(0, import_react37.useEffect)(() => {
|
|
9939
10076
|
if (!resource) {
|
|
9940
10077
|
return;
|
|
9941
10078
|
}
|
|
9942
10079
|
resource.texture.anisotropy = gl.capabilities.getMaxAnisotropy();
|
|
9943
10080
|
}, [gl, resource]);
|
|
9944
|
-
(0,
|
|
10081
|
+
(0, import_react37.useEffect)(() => {
|
|
9945
10082
|
if (!resource || !overlay?.overlayElement) {
|
|
9946
10083
|
return;
|
|
9947
10084
|
}
|
|
@@ -9964,7 +10101,7 @@ function PanoVideo({
|
|
|
9964
10101
|
activeVariant?.poster ?? poster,
|
|
9965
10102
|
onError
|
|
9966
10103
|
);
|
|
9967
|
-
const emitSnapshot = (0,
|
|
10104
|
+
const emitSnapshot = (0, import_react37.useCallback)(
|
|
9968
10105
|
(patch) => {
|
|
9969
10106
|
const store = storeRef.current;
|
|
9970
10107
|
const video = resource?.video;
|
|
@@ -10016,7 +10153,7 @@ function PanoVideo({
|
|
|
10016
10153
|
captionAppearance
|
|
10017
10154
|
]
|
|
10018
10155
|
);
|
|
10019
|
-
const controller = (0,
|
|
10156
|
+
const controller = (0, import_react37.useMemo)(
|
|
10020
10157
|
() => ({
|
|
10021
10158
|
subscribe: (onStoreChange) => {
|
|
10022
10159
|
const store = storeRef.current;
|
|
@@ -10068,7 +10205,7 @@ function PanoVideo({
|
|
|
10068
10205
|
}),
|
|
10069
10206
|
[]
|
|
10070
10207
|
);
|
|
10071
|
-
(0,
|
|
10208
|
+
(0, import_react37.useLayoutEffect)(() => {
|
|
10072
10209
|
if (!host || variants.length === 0) {
|
|
10073
10210
|
return;
|
|
10074
10211
|
}
|
|
@@ -10081,7 +10218,7 @@ function PanoVideo({
|
|
|
10081
10218
|
notifyPanoVideoHost(host);
|
|
10082
10219
|
};
|
|
10083
10220
|
}, [captionsEnabled, controller, controls, host, variants.length]);
|
|
10084
|
-
(0,
|
|
10221
|
+
(0, import_react37.useLayoutEffect)(() => {
|
|
10085
10222
|
if (!resource) {
|
|
10086
10223
|
return;
|
|
10087
10224
|
}
|
|
@@ -10094,10 +10231,10 @@ function PanoVideo({
|
|
|
10094
10231
|
};
|
|
10095
10232
|
emitSnapshot();
|
|
10096
10233
|
}, [emitSnapshot, playbackRates, resource]);
|
|
10097
|
-
(0,
|
|
10234
|
+
(0, import_react37.useEffect)(() => {
|
|
10098
10235
|
emitSnapshot();
|
|
10099
10236
|
}, [emitSnapshot]);
|
|
10100
|
-
(0,
|
|
10237
|
+
(0, import_react37.useEffect)(() => {
|
|
10101
10238
|
if (!resource || !activeVariant || !mediaKey) {
|
|
10102
10239
|
return;
|
|
10103
10240
|
}
|
|
@@ -10154,7 +10291,7 @@ function PanoVideo({
|
|
|
10154
10291
|
video.removeEventListener("error", handleError);
|
|
10155
10292
|
};
|
|
10156
10293
|
}, [mediaKey, resource]);
|
|
10157
|
-
(0,
|
|
10294
|
+
(0, import_react37.useEffect)(() => {
|
|
10158
10295
|
if (!resource) {
|
|
10159
10296
|
return;
|
|
10160
10297
|
}
|
|
@@ -10244,7 +10381,7 @@ function PanoVideo({
|
|
|
10244
10381
|
}
|
|
10245
10382
|
};
|
|
10246
10383
|
}, [emitSnapshot, resource]);
|
|
10247
|
-
(0,
|
|
10384
|
+
(0, import_react37.useEffect)(() => {
|
|
10248
10385
|
if (!resource) {
|
|
10249
10386
|
return;
|
|
10250
10387
|
}
|
|
@@ -10255,9 +10392,16 @@ function PanoVideo({
|
|
|
10255
10392
|
video.volume = clampVolume(volume);
|
|
10256
10393
|
}
|
|
10257
10394
|
video.playsInline = playsInline;
|
|
10395
|
+
if (playsInline) {
|
|
10396
|
+
video.setAttribute("playsinline", "true");
|
|
10397
|
+
video.setAttribute("webkit-playsinline", "true");
|
|
10398
|
+
} else {
|
|
10399
|
+
video.removeAttribute("playsinline");
|
|
10400
|
+
video.removeAttribute("webkit-playsinline");
|
|
10401
|
+
}
|
|
10258
10402
|
video.preload = preload;
|
|
10259
10403
|
}, [loop, muted, playsInline, preload, resource, volume]);
|
|
10260
|
-
(0,
|
|
10404
|
+
(0, import_react37.useEffect)(() => {
|
|
10261
10405
|
if (!resource) {
|
|
10262
10406
|
return;
|
|
10263
10407
|
}
|
|
@@ -10307,7 +10451,7 @@ function PanoVideo({
|
|
|
10307
10451
|
video.removeEventListener("ratechange", handleVolume);
|
|
10308
10452
|
};
|
|
10309
10453
|
}, [emitSnapshot, resource]);
|
|
10310
|
-
(0,
|
|
10454
|
+
(0, import_react37.useEffect)(() => {
|
|
10311
10455
|
if (!resource) {
|
|
10312
10456
|
return;
|
|
10313
10457
|
}
|
|
@@ -10342,7 +10486,7 @@ function PanoVideo({
|
|
|
10342
10486
|
video.textTracks.removeEventListener("change", applyModes);
|
|
10343
10487
|
};
|
|
10344
10488
|
}, [emitSnapshot, resource, trackId, tracks]);
|
|
10345
|
-
(0,
|
|
10489
|
+
(0, import_react37.useEffect)(() => {
|
|
10346
10490
|
if (!captionsEnabled) {
|
|
10347
10491
|
setTrackId(null);
|
|
10348
10492
|
return;
|
|
@@ -10353,15 +10497,15 @@ function PanoVideo({
|
|
|
10353
10497
|
if (variants.length === 0) {
|
|
10354
10498
|
return null;
|
|
10355
10499
|
}
|
|
10356
|
-
return /* @__PURE__ */ (0,
|
|
10357
|
-
activeTexture ? /* @__PURE__ */ (0,
|
|
10500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
10501
|
+
activeTexture ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
10358
10502
|
"mesh",
|
|
10359
10503
|
{
|
|
10360
10504
|
rotation: [0, import_three11.MathUtils.degToRad(90 + yawOffset), 0],
|
|
10361
10505
|
visible,
|
|
10362
10506
|
children: [
|
|
10363
|
-
/* @__PURE__ */ (0,
|
|
10364
|
-
/* @__PURE__ */ (0,
|
|
10507
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("sphereGeometry", { args: [DEFAULT_PANORAMA_RADIUS, 128, 64] }),
|
|
10508
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
10365
10509
|
PanoBasicMaterial,
|
|
10366
10510
|
{
|
|
10367
10511
|
map: activeTexture,
|
|
@@ -10372,13 +10516,13 @@ function PanoVideo({
|
|
|
10372
10516
|
]
|
|
10373
10517
|
}
|
|
10374
10518
|
) : null,
|
|
10375
|
-
captionsEnabled ? /* @__PURE__ */ (0,
|
|
10519
|
+
captionsEnabled ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PanoVideoCaptions, { appearance: typeof captions === "object" ? captions : void 0 }) : null
|
|
10376
10520
|
] });
|
|
10377
10521
|
}
|
|
10378
10522
|
|
|
10379
10523
|
// src/scenes.tsx
|
|
10380
10524
|
var import_fiber21 = require("@react-three/fiber");
|
|
10381
|
-
var
|
|
10525
|
+
var import_react42 = require("react");
|
|
10382
10526
|
var import_three19 = require("three");
|
|
10383
10527
|
|
|
10384
10528
|
// src/scene-transitions/presets.ts
|
|
@@ -10429,7 +10573,7 @@ function isSnapshotTransition(preset) {
|
|
|
10429
10573
|
|
|
10430
10574
|
// src/scene-transitions/particle-overlay.tsx
|
|
10431
10575
|
var import_fiber17 = require("@react-three/fiber");
|
|
10432
|
-
var
|
|
10576
|
+
var import_react38 = require("react");
|
|
10433
10577
|
var import_three13 = require("three");
|
|
10434
10578
|
|
|
10435
10579
|
// src/scene-transitions/glsl.ts
|
|
@@ -10484,7 +10628,7 @@ function overlayProgress(elapsedTime, duration, startTime) {
|
|
|
10484
10628
|
}
|
|
10485
10629
|
|
|
10486
10630
|
// src/scene-transitions/particle-overlay.tsx
|
|
10487
|
-
var
|
|
10631
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
10488
10632
|
var PARTICLE_GRID = 48;
|
|
10489
10633
|
var PARTICLE_COUNT = PARTICLE_GRID * PARTICLE_GRID;
|
|
10490
10634
|
var PARTICLE_VERTEX_SHADER = `
|
|
@@ -10561,12 +10705,12 @@ function ParticleOverlay({
|
|
|
10561
10705
|
onFinish
|
|
10562
10706
|
}) {
|
|
10563
10707
|
const { camera } = (0, import_fiber17.useThree)();
|
|
10564
|
-
const meshRef = (0,
|
|
10565
|
-
const startRef = (0,
|
|
10566
|
-
const finishedRef = (0,
|
|
10567
|
-
const directionRef = (0,
|
|
10568
|
-
const geometry = (0,
|
|
10569
|
-
const material = (0,
|
|
10708
|
+
const meshRef = (0, import_react38.useRef)(null);
|
|
10709
|
+
const startRef = (0, import_react38.useRef)(null);
|
|
10710
|
+
const finishedRef = (0, import_react38.useRef)(false);
|
|
10711
|
+
const directionRef = (0, import_react38.useRef)(new import_three13.Vector3());
|
|
10712
|
+
const geometry = (0, import_react38.useMemo)(() => createParticleGeometry(), []);
|
|
10713
|
+
const material = (0, import_react38.useMemo)(
|
|
10570
10714
|
() => new import_three13.ShaderMaterial({
|
|
10571
10715
|
transparent: true,
|
|
10572
10716
|
depthTest: false,
|
|
@@ -10582,9 +10726,9 @@ function ParticleOverlay({
|
|
|
10582
10726
|
}),
|
|
10583
10727
|
[snapshot.texture]
|
|
10584
10728
|
);
|
|
10585
|
-
(0,
|
|
10586
|
-
(0,
|
|
10587
|
-
(0,
|
|
10729
|
+
(0, import_react38.useEffect)(() => () => geometry.dispose(), [geometry]);
|
|
10730
|
+
(0, import_react38.useEffect)(() => () => material.dispose(), [material]);
|
|
10731
|
+
(0, import_react38.useEffect)(() => {
|
|
10588
10732
|
startRef.current = null;
|
|
10589
10733
|
finishedRef.current = false;
|
|
10590
10734
|
material.uniforms.progress.value = 0;
|
|
@@ -10606,7 +10750,7 @@ function ParticleOverlay({
|
|
|
10606
10750
|
onFinish();
|
|
10607
10751
|
}
|
|
10608
10752
|
});
|
|
10609
|
-
return /* @__PURE__ */ (0,
|
|
10753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
10610
10754
|
"mesh",
|
|
10611
10755
|
{
|
|
10612
10756
|
ref: meshRef,
|
|
@@ -10620,7 +10764,7 @@ function ParticleOverlay({
|
|
|
10620
10764
|
|
|
10621
10765
|
// src/scene-transitions/snapshot-overlay.tsx
|
|
10622
10766
|
var import_fiber18 = require("@react-three/fiber");
|
|
10623
|
-
var
|
|
10767
|
+
var import_react39 = require("react");
|
|
10624
10768
|
var import_three15 = require("three");
|
|
10625
10769
|
|
|
10626
10770
|
// src/scene-transitions/snapshot-shaders.ts
|
|
@@ -10900,7 +11044,7 @@ function createSnapshotMaterial(preset, texture) {
|
|
|
10900
11044
|
}
|
|
10901
11045
|
|
|
10902
11046
|
// src/scene-transitions/snapshot-overlay.tsx
|
|
10903
|
-
var
|
|
11047
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
10904
11048
|
function SnapshotOverlay({
|
|
10905
11049
|
snapshot,
|
|
10906
11050
|
transition,
|
|
@@ -10909,18 +11053,18 @@ function SnapshotOverlay({
|
|
|
10909
11053
|
onFinish
|
|
10910
11054
|
}) {
|
|
10911
11055
|
const { camera, gl } = (0, import_fiber18.useThree)();
|
|
10912
|
-
const meshRef = (0,
|
|
10913
|
-
const startRef = (0,
|
|
10914
|
-
const finishedRef = (0,
|
|
10915
|
-
const directionRef = (0,
|
|
10916
|
-
const material = (0,
|
|
11056
|
+
const meshRef = (0, import_react39.useRef)(null);
|
|
11057
|
+
const startRef = (0, import_react39.useRef)(null);
|
|
11058
|
+
const finishedRef = (0, import_react39.useRef)(false);
|
|
11059
|
+
const directionRef = (0, import_react39.useRef)(new import_three15.Vector3());
|
|
11060
|
+
const material = (0, import_react39.useMemo)(() => {
|
|
10917
11061
|
if (!isSnapshotTransition(transition.preset)) {
|
|
10918
11062
|
return null;
|
|
10919
11063
|
}
|
|
10920
11064
|
return createSnapshotMaterial(transition.preset, snapshot.texture);
|
|
10921
11065
|
}, [snapshot.texture, transition.preset]);
|
|
10922
|
-
(0,
|
|
10923
|
-
(0,
|
|
11066
|
+
(0, import_react39.useEffect)(() => () => material?.dispose(), [material]);
|
|
11067
|
+
(0, import_react39.useEffect)(() => {
|
|
10924
11068
|
startRef.current = null;
|
|
10925
11069
|
finishedRef.current = false;
|
|
10926
11070
|
if (material) {
|
|
@@ -10949,21 +11093,21 @@ function SnapshotOverlay({
|
|
|
10949
11093
|
if (!material) {
|
|
10950
11094
|
return null;
|
|
10951
11095
|
}
|
|
10952
|
-
return /* @__PURE__ */ (0,
|
|
10953
|
-
/* @__PURE__ */ (0,
|
|
10954
|
-
/* @__PURE__ */ (0,
|
|
11096
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("mesh", { ref: meshRef, renderOrder: OVERLAY_RENDER_ORDER, frustumCulled: false, children: [
|
|
11097
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("primitive", { attach: "geometry", object: FULLSCREEN_PLANE }),
|
|
11098
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("primitive", { attach: "material", object: material })
|
|
10955
11099
|
] });
|
|
10956
11100
|
}
|
|
10957
11101
|
|
|
10958
11102
|
// src/scene-transitions/transition-overlay.tsx
|
|
10959
|
-
var
|
|
11103
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
10960
11104
|
function TransitionOverlay(props) {
|
|
10961
11105
|
const { preset } = props.transition;
|
|
10962
11106
|
switch (preset) {
|
|
10963
11107
|
case "none":
|
|
10964
11108
|
return null;
|
|
10965
11109
|
case "particles":
|
|
10966
|
-
return /* @__PURE__ */ (0,
|
|
11110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ParticleOverlay, { ...props });
|
|
10967
11111
|
case "crossfade":
|
|
10968
11112
|
case "zoom":
|
|
10969
11113
|
case "blackout":
|
|
@@ -10991,7 +11135,7 @@ function TransitionOverlay(props) {
|
|
|
10991
11135
|
case "zoomBlur":
|
|
10992
11136
|
case "hexDissolve":
|
|
10993
11137
|
case "filmBurn":
|
|
10994
|
-
return /* @__PURE__ */ (0,
|
|
11138
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SnapshotOverlay, { ...props });
|
|
10995
11139
|
default: {
|
|
10996
11140
|
const exhaustive = preset;
|
|
10997
11141
|
void exhaustive;
|
|
@@ -11002,7 +11146,7 @@ function TransitionOverlay(props) {
|
|
|
11002
11146
|
|
|
11003
11147
|
// src/tile/texture-manager-context.tsx
|
|
11004
11148
|
var import_fiber19 = require("@react-three/fiber");
|
|
11005
|
-
var
|
|
11149
|
+
var import_react40 = require("react");
|
|
11006
11150
|
|
|
11007
11151
|
// src/tile/texture-manager.ts
|
|
11008
11152
|
var import_three16 = require("three");
|
|
@@ -11226,8 +11370,8 @@ var TileTextureManager = class {
|
|
|
11226
11370
|
};
|
|
11227
11371
|
|
|
11228
11372
|
// src/tile/texture-manager-context.tsx
|
|
11229
|
-
var
|
|
11230
|
-
var TileTextureManagerContext = (0,
|
|
11373
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
11374
|
+
var TileTextureManagerContext = (0, import_react40.createContext)(
|
|
11231
11375
|
null
|
|
11232
11376
|
);
|
|
11233
11377
|
function TileTextureManagerProvider({
|
|
@@ -11237,7 +11381,7 @@ function TileTextureManagerProvider({
|
|
|
11237
11381
|
}) {
|
|
11238
11382
|
const gl = (0, import_fiber19.useThree)((state) => state.gl);
|
|
11239
11383
|
const anisotropy = gl.capabilities.getMaxAnisotropy();
|
|
11240
|
-
const manager = (0,
|
|
11384
|
+
const manager = (0, import_react40.useMemo)(
|
|
11241
11385
|
() => new TileTextureManager({
|
|
11242
11386
|
anisotropy,
|
|
11243
11387
|
maxBytes: Math.max(1, maxTextureMemoryMb) * 1024 * 1024,
|
|
@@ -11246,19 +11390,19 @@ function TileTextureManagerProvider({
|
|
|
11246
11390
|
}),
|
|
11247
11391
|
[anisotropy, maxConcurrentLoads, maxTextureMemoryMb]
|
|
11248
11392
|
);
|
|
11249
|
-
(0,
|
|
11393
|
+
(0, import_react40.useEffect)(() => {
|
|
11250
11394
|
manager.resume();
|
|
11251
11395
|
return () => manager.dispose();
|
|
11252
11396
|
}, [manager]);
|
|
11253
|
-
return /* @__PURE__ */ (0,
|
|
11397
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TileTextureManagerContext.Provider, { value: manager, children });
|
|
11254
11398
|
}
|
|
11255
11399
|
function useSharedTileTextureManager() {
|
|
11256
|
-
return (0,
|
|
11400
|
+
return (0, import_react40.useContext)(TileTextureManagerContext);
|
|
11257
11401
|
}
|
|
11258
11402
|
|
|
11259
11403
|
// src/tile/tile.tsx
|
|
11260
11404
|
var import_fiber20 = require("@react-three/fiber");
|
|
11261
|
-
var
|
|
11405
|
+
var import_react41 = require("react");
|
|
11262
11406
|
var import_three18 = require("three");
|
|
11263
11407
|
|
|
11264
11408
|
// src/tile/face-layout.ts
|
|
@@ -11438,7 +11582,7 @@ function resolveTemplateUrl(template, address) {
|
|
|
11438
11582
|
}
|
|
11439
11583
|
|
|
11440
11584
|
// src/tile/tile.tsx
|
|
11441
|
-
var
|
|
11585
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
11442
11586
|
var MAX_LOD_UPDATE_INTERVAL_MS = 100;
|
|
11443
11587
|
var FAST_ROTATION_THRESHOLD_RADIANS = Math.PI / 180;
|
|
11444
11588
|
var FAST_FOV_THRESHOLD_DEGREES = 0.5;
|
|
@@ -11447,10 +11591,10 @@ var VISIBILITY_FOV_PADDING_DEGREES = 8;
|
|
|
11447
11591
|
var PREVIEW_RADIUS = CUBE_RADIUS + 0.05;
|
|
11448
11592
|
var SHARED_TILE_GEOMETRY = new import_three18.PlaneGeometry(1, 1);
|
|
11449
11593
|
function usePreviewTexture(url, anisotropy, onError) {
|
|
11450
|
-
const [texture, setTexture] = (0,
|
|
11451
|
-
const onErrorRef = (0,
|
|
11594
|
+
const [texture, setTexture] = (0, import_react41.useState)(null);
|
|
11595
|
+
const onErrorRef = (0, import_react41.useRef)(onError);
|
|
11452
11596
|
onErrorRef.current = onError;
|
|
11453
|
-
(0,
|
|
11597
|
+
(0, import_react41.useEffect)(() => {
|
|
11454
11598
|
if (!url) {
|
|
11455
11599
|
setTexture(null);
|
|
11456
11600
|
return;
|
|
@@ -11487,7 +11631,7 @@ function usePreviewTexture(url, anisotropy, onError) {
|
|
|
11487
11631
|
active = false;
|
|
11488
11632
|
};
|
|
11489
11633
|
}, [anisotropy, url]);
|
|
11490
|
-
(0,
|
|
11634
|
+
(0, import_react41.useEffect)(
|
|
11491
11635
|
() => () => {
|
|
11492
11636
|
texture?.dispose();
|
|
11493
11637
|
},
|
|
@@ -11500,7 +11644,7 @@ function PreviewFace({
|
|
|
11500
11644
|
texture,
|
|
11501
11645
|
faceOrder
|
|
11502
11646
|
}) {
|
|
11503
|
-
const geometry = (0,
|
|
11647
|
+
const geometry = (0, import_react41.useMemo)(() => {
|
|
11504
11648
|
const nextGeometry = new import_three18.PlaneGeometry(
|
|
11505
11649
|
PREVIEW_RADIUS * 2,
|
|
11506
11650
|
PREVIEW_RADIUS * 2
|
|
@@ -11518,21 +11662,21 @@ function PreviewFace({
|
|
|
11518
11662
|
uv.needsUpdate = true;
|
|
11519
11663
|
return nextGeometry;
|
|
11520
11664
|
}, [face, faceOrder]);
|
|
11521
|
-
(0,
|
|
11665
|
+
(0, import_react41.useEffect)(
|
|
11522
11666
|
() => () => {
|
|
11523
11667
|
geometry.dispose();
|
|
11524
11668
|
},
|
|
11525
11669
|
[geometry]
|
|
11526
11670
|
);
|
|
11527
11671
|
const transform = getFaceTransform(face, PREVIEW_RADIUS);
|
|
11528
|
-
return /* @__PURE__ */ (0,
|
|
11672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
11529
11673
|
"mesh",
|
|
11530
11674
|
{
|
|
11531
11675
|
geometry,
|
|
11532
11676
|
position: transform.position,
|
|
11533
11677
|
renderOrder: -100,
|
|
11534
11678
|
rotation: transform.rotation,
|
|
11535
|
-
children: /* @__PURE__ */ (0,
|
|
11679
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
11536
11680
|
PanoBasicMaterial,
|
|
11537
11681
|
{
|
|
11538
11682
|
depthTest: false,
|
|
@@ -11548,7 +11692,7 @@ function PreviewCube({
|
|
|
11548
11692
|
texture,
|
|
11549
11693
|
faceOrder
|
|
11550
11694
|
}) {
|
|
11551
|
-
return CUBE_FACES.map((face) => /* @__PURE__ */ (0,
|
|
11695
|
+
return CUBE_FACES.map((face) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
11552
11696
|
PreviewFace,
|
|
11553
11697
|
{
|
|
11554
11698
|
face,
|
|
@@ -11559,14 +11703,14 @@ function PreviewCube({
|
|
|
11559
11703
|
));
|
|
11560
11704
|
}
|
|
11561
11705
|
function useManagedTexture(manager, key, url, address) {
|
|
11562
|
-
const [managedState, setManagedState] = (0,
|
|
11706
|
+
const [managedState, setManagedState] = (0, import_react41.useState)(() => ({
|
|
11563
11707
|
manager,
|
|
11564
11708
|
key,
|
|
11565
11709
|
url,
|
|
11566
11710
|
snapshot: manager.getSnapshot(key)
|
|
11567
11711
|
}));
|
|
11568
11712
|
const snapshot = managedState.manager === manager && managedState.key === key && managedState.url === url ? managedState.snapshot : manager.getSnapshot(key);
|
|
11569
|
-
(0,
|
|
11713
|
+
(0, import_react41.useEffect)(
|
|
11570
11714
|
() => manager.acquire(key, url, address, (nextSnapshot) => {
|
|
11571
11715
|
setManagedState({
|
|
11572
11716
|
manager,
|
|
@@ -11579,7 +11723,7 @@ function useManagedTexture(manager, key, url, address) {
|
|
|
11579
11723
|
);
|
|
11580
11724
|
return snapshot;
|
|
11581
11725
|
}
|
|
11582
|
-
var TileMesh = (0,
|
|
11726
|
+
var TileMesh = (0, import_react41.memo)(function TileMesh2({
|
|
11583
11727
|
address,
|
|
11584
11728
|
manager,
|
|
11585
11729
|
renderOrder,
|
|
@@ -11593,14 +11737,14 @@ var TileMesh = (0, import_react40.memo)(function TileMesh2({
|
|
|
11593
11737
|
if (!snapshot.texture) {
|
|
11594
11738
|
return null;
|
|
11595
11739
|
}
|
|
11596
|
-
return /* @__PURE__ */ (0,
|
|
11740
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("group", { position: transform.position, rotation: transform.rotation, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
11597
11741
|
"mesh",
|
|
11598
11742
|
{
|
|
11599
11743
|
geometry: SHARED_TILE_GEOMETRY,
|
|
11600
11744
|
position: [layout.x, layout.y, 0],
|
|
11601
11745
|
renderOrder,
|
|
11602
11746
|
scale: [layout.width, layout.height, 1],
|
|
11603
|
-
children: /* @__PURE__ */ (0,
|
|
11747
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
11604
11748
|
PanoBasicMaterial,
|
|
11605
11749
|
{
|
|
11606
11750
|
depthTest: false,
|
|
@@ -11612,12 +11756,12 @@ var TileMesh = (0, import_react40.memo)(function TileMesh2({
|
|
|
11612
11756
|
}
|
|
11613
11757
|
) });
|
|
11614
11758
|
});
|
|
11615
|
-
var TileLayerMeshes = (0,
|
|
11759
|
+
var TileLayerMeshes = (0, import_react41.memo)(function TileLayerMeshes2({
|
|
11616
11760
|
layer,
|
|
11617
11761
|
manager,
|
|
11618
11762
|
resolveUrl
|
|
11619
11763
|
}) {
|
|
11620
|
-
return layer.addresses.map((address) => /* @__PURE__ */ (0,
|
|
11764
|
+
return layer.addresses.map((address) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
11621
11765
|
TileMesh,
|
|
11622
11766
|
{
|
|
11623
11767
|
address,
|
|
@@ -11786,10 +11930,10 @@ function Tile({
|
|
|
11786
11930
|
onLevelChange
|
|
11787
11931
|
}) {
|
|
11788
11932
|
const { camera, gl, size } = (0, import_fiber20.useThree)();
|
|
11789
|
-
const multiresConfig = (0,
|
|
11933
|
+
const multiresConfig = (0, import_react41.useMemo)(() => parseMultires(multires), [multires]);
|
|
11790
11934
|
const { levels, tileSize } = multiresConfig;
|
|
11791
11935
|
const multiresToken = `${tileSize}:${levels.join(",")}`;
|
|
11792
|
-
const candidatesByLevel = (0,
|
|
11936
|
+
const candidatesByLevel = (0, import_react41.useMemo)(
|
|
11793
11937
|
() => buildTileCandidates(levels, tileSize),
|
|
11794
11938
|
[levels, tileSize]
|
|
11795
11939
|
);
|
|
@@ -11801,13 +11945,13 @@ function Tile({
|
|
|
11801
11945
|
onPreviewError
|
|
11802
11946
|
);
|
|
11803
11947
|
const sharedManager = useSharedTileTextureManager();
|
|
11804
|
-
const progressRef = (0,
|
|
11805
|
-
const errorRef = (0,
|
|
11806
|
-
const levelChangeRef = (0,
|
|
11948
|
+
const progressRef = (0, import_react41.useRef)(onLoadProgress);
|
|
11949
|
+
const errorRef = (0, import_react41.useRef)(onTileError);
|
|
11950
|
+
const levelChangeRef = (0, import_react41.useRef)(onLevelChange);
|
|
11807
11951
|
progressRef.current = onLoadProgress;
|
|
11808
11952
|
errorRef.current = onTileError;
|
|
11809
11953
|
levelChangeRef.current = onLevelChange;
|
|
11810
|
-
const ownedManager = (0,
|
|
11954
|
+
const ownedManager = (0, import_react41.useMemo)(
|
|
11811
11955
|
() => new TileTextureManager({
|
|
11812
11956
|
anisotropy,
|
|
11813
11957
|
maxBytes: Math.max(1, maxTextureMemoryMb) * 1024 * 1024,
|
|
@@ -11828,7 +11972,7 @@ function Tile({
|
|
|
11828
11972
|
]
|
|
11829
11973
|
);
|
|
11830
11974
|
const manager = sharedManager ?? ownedManager;
|
|
11831
|
-
(0,
|
|
11975
|
+
(0, import_react41.useEffect)(() => {
|
|
11832
11976
|
manager.resume();
|
|
11833
11977
|
return () => {
|
|
11834
11978
|
if (manager === ownedManager) {
|
|
@@ -11838,11 +11982,11 @@ function Tile({
|
|
|
11838
11982
|
queueMicrotask(() => manager.releaseUnused());
|
|
11839
11983
|
};
|
|
11840
11984
|
}, [manager, ownedManager]);
|
|
11841
|
-
const readyRef = (0,
|
|
11842
|
-
(0,
|
|
11985
|
+
const readyRef = (0, import_react41.useRef)(false);
|
|
11986
|
+
(0, import_react41.useEffect)(() => {
|
|
11843
11987
|
readyRef.current = false;
|
|
11844
11988
|
}, [effectivePreviewUrl]);
|
|
11845
|
-
(0,
|
|
11989
|
+
(0, import_react41.useEffect)(() => {
|
|
11846
11990
|
if (!previewTexture || readyRef.current) {
|
|
11847
11991
|
return;
|
|
11848
11992
|
}
|
|
@@ -11850,31 +11994,31 @@ function Tile({
|
|
|
11850
11994
|
onReady?.();
|
|
11851
11995
|
}, [onReady, previewTexture]);
|
|
11852
11996
|
const template = urlTemplate ?? buildDefaultTileUrlTemplate();
|
|
11853
|
-
const resolveUrl = (0,
|
|
11997
|
+
const resolveUrl = (0, import_react41.useMemo)(
|
|
11854
11998
|
() => (address) => {
|
|
11855
11999
|
const relativePath = resolveTileUrl ? resolveTileUrl(address) : resolveTemplateUrl(template, address);
|
|
11856
12000
|
return resolveRelativeTileUrl(baseUrl, relativePath);
|
|
11857
12001
|
},
|
|
11858
12002
|
[baseUrl, resolveTileUrl, template]
|
|
11859
12003
|
);
|
|
11860
|
-
const [layers, setLayers] = (0,
|
|
11861
|
-
const layerTokenRef = (0,
|
|
11862
|
-
const currentLevelRef = (0,
|
|
11863
|
-
const lastUpdateAtRef = (0,
|
|
11864
|
-
const visibilityDirtyRef = (0,
|
|
11865
|
-
const lastVisibilityQuaternionRef = (0,
|
|
11866
|
-
const lastVisibilityFovRef = (0,
|
|
11867
|
-
const lastViewportRef = (0,
|
|
11868
|
-
const frustumRef = (0,
|
|
11869
|
-
const projectionMatrixRef = (0,
|
|
11870
|
-
const visibilityCameraRef = (0,
|
|
11871
|
-
(0,
|
|
12004
|
+
const [layers, setLayers] = (0, import_react41.useState)([]);
|
|
12005
|
+
const layerTokenRef = (0, import_react41.useRef)("");
|
|
12006
|
+
const currentLevelRef = (0, import_react41.useRef)(1);
|
|
12007
|
+
const lastUpdateAtRef = (0, import_react41.useRef)(-Infinity);
|
|
12008
|
+
const visibilityDirtyRef = (0, import_react41.useRef)(true);
|
|
12009
|
+
const lastVisibilityQuaternionRef = (0, import_react41.useRef)(camera.quaternion.clone());
|
|
12010
|
+
const lastVisibilityFovRef = (0, import_react41.useRef)(Number.NaN);
|
|
12011
|
+
const lastViewportRef = (0, import_react41.useRef)({ width: 0, height: 0, dpr: 0 });
|
|
12012
|
+
const frustumRef = (0, import_react41.useRef)(new import_three18.Frustum());
|
|
12013
|
+
const projectionMatrixRef = (0, import_react41.useRef)(new import_three18.Matrix4());
|
|
12014
|
+
const visibilityCameraRef = (0, import_react41.useRef)(new import_three18.PerspectiveCamera());
|
|
12015
|
+
(0, import_react41.useEffect)(() => {
|
|
11872
12016
|
currentLevelRef.current = 1;
|
|
11873
12017
|
layerTokenRef.current = "";
|
|
11874
12018
|
visibilityDirtyRef.current = true;
|
|
11875
12019
|
setLayers([]);
|
|
11876
12020
|
}, [manager, multiresToken]);
|
|
11877
|
-
(0,
|
|
12021
|
+
(0, import_react41.useEffect)(() => {
|
|
11878
12022
|
if (loadMode !== "preview") {
|
|
11879
12023
|
return;
|
|
11880
12024
|
}
|
|
@@ -11954,15 +12098,15 @@ function Tile({
|
|
|
11954
12098
|
};
|
|
11955
12099
|
commitLayers(nextLayers);
|
|
11956
12100
|
});
|
|
11957
|
-
return /* @__PURE__ */ (0,
|
|
11958
|
-
previewTexture ? /* @__PURE__ */ (0,
|
|
12101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("group", { visible, children: [
|
|
12102
|
+
previewTexture ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
11959
12103
|
PreviewCube,
|
|
11960
12104
|
{
|
|
11961
12105
|
texture: previewTexture,
|
|
11962
12106
|
faceOrder: previewFaceOrder
|
|
11963
12107
|
}
|
|
11964
12108
|
) : null,
|
|
11965
|
-
layers.map((layer) => /* @__PURE__ */ (0,
|
|
12109
|
+
layers.map((layer) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
11966
12110
|
TileLayerMeshes,
|
|
11967
12111
|
{
|
|
11968
12112
|
layer,
|
|
@@ -11975,7 +12119,7 @@ function Tile({
|
|
|
11975
12119
|
}
|
|
11976
12120
|
|
|
11977
12121
|
// src/scenes.tsx
|
|
11978
|
-
var
|
|
12122
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
11979
12123
|
function SceneSource({
|
|
11980
12124
|
scene,
|
|
11981
12125
|
visible,
|
|
@@ -11988,7 +12132,7 @@ function SceneSource({
|
|
|
11988
12132
|
}
|
|
11989
12133
|
switch (scene.type) {
|
|
11990
12134
|
case "sphere":
|
|
11991
|
-
return /* @__PURE__ */ (0,
|
|
12135
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
11992
12136
|
Sphere,
|
|
11993
12137
|
{
|
|
11994
12138
|
src: scene.src,
|
|
@@ -12001,7 +12145,7 @@ function SceneSource({
|
|
|
12001
12145
|
);
|
|
12002
12146
|
case "tile": {
|
|
12003
12147
|
const { id: _id, type: _type, ...tileProps } = scene;
|
|
12004
|
-
return /* @__PURE__ */ (0,
|
|
12148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
12005
12149
|
Tile,
|
|
12006
12150
|
{
|
|
12007
12151
|
...tileProps,
|
|
@@ -12025,9 +12169,9 @@ function SnapshotCapture({
|
|
|
12025
12169
|
onCaptured
|
|
12026
12170
|
}) {
|
|
12027
12171
|
const { camera, gl, scene, size } = (0, import_fiber21.useThree)();
|
|
12028
|
-
const capturedRequestRef = (0,
|
|
12029
|
-
const renderTargetRef = (0,
|
|
12030
|
-
(0,
|
|
12172
|
+
const capturedRequestRef = (0, import_react42.useRef)(0);
|
|
12173
|
+
const renderTargetRef = (0, import_react42.useRef)(null);
|
|
12174
|
+
(0, import_react42.useEffect)(
|
|
12031
12175
|
() => () => {
|
|
12032
12176
|
renderTargetRef.current?.dispose();
|
|
12033
12177
|
renderTargetRef.current = null;
|
|
@@ -12083,50 +12227,50 @@ function ScenesController({
|
|
|
12083
12227
|
snapshotMaxPixels = 3686400,
|
|
12084
12228
|
phaseRef: externalPhaseRef
|
|
12085
12229
|
}) {
|
|
12086
|
-
const controlsRef = (0,
|
|
12230
|
+
const controlsRef = (0, import_react42.useContext)(PanoramaViewContext);
|
|
12087
12231
|
const manager = useSharedTileTextureManager();
|
|
12088
|
-
const transition = (0,
|
|
12232
|
+
const transition = (0, import_react42.useMemo)(
|
|
12089
12233
|
() => resolveTransition(transitionInput),
|
|
12090
12234
|
[transitionInput]
|
|
12091
12235
|
);
|
|
12092
|
-
const sceneMap = (0,
|
|
12236
|
+
const sceneMap = (0, import_react42.useMemo)(
|
|
12093
12237
|
() => new Map(scenes.map((scene) => [scene.id, scene])),
|
|
12094
12238
|
[scenes]
|
|
12095
12239
|
);
|
|
12096
12240
|
const initialScene = sceneMap.get(activeSceneId) ?? null;
|
|
12097
|
-
const [slots, setSlots] = (0,
|
|
12241
|
+
const [slots, setSlots] = (0, import_react42.useState)([
|
|
12098
12242
|
initialScene,
|
|
12099
12243
|
null
|
|
12100
12244
|
]);
|
|
12101
|
-
const [activeSlot, setActiveSlot] = (0,
|
|
12102
|
-
const [liveSlot, setLiveSlot] = (0,
|
|
12103
|
-
const [pendingSlot, setPendingSlot] = (0,
|
|
12104
|
-
const [phase, setPhase] = (0,
|
|
12105
|
-
const [captureRequestId, setCaptureRequestId] = (0,
|
|
12106
|
-
const [transitionRunId, setTransitionRunId] = (0,
|
|
12107
|
-
const [snapshot, setSnapshot] = (0,
|
|
12108
|
-
const [recoveryKey, setRecoveryKey] = (0,
|
|
12109
|
-
const requestedSceneIdRef = (0,
|
|
12110
|
-
const captureReasonRef = (0,
|
|
12111
|
-
const interactionReleaseRef = (0,
|
|
12112
|
-
const slotsRef = (0,
|
|
12113
|
-
const phaseRef = (0,
|
|
12114
|
-
const liveSlotRef = (0,
|
|
12115
|
-
const transitionFromRef = (0,
|
|
12245
|
+
const [activeSlot, setActiveSlot] = (0, import_react42.useState)(0);
|
|
12246
|
+
const [liveSlot, setLiveSlot] = (0, import_react42.useState)(0);
|
|
12247
|
+
const [pendingSlot, setPendingSlot] = (0, import_react42.useState)(null);
|
|
12248
|
+
const [phase, setPhase] = (0, import_react42.useState)(initialScene ? "idle" : "preloading");
|
|
12249
|
+
const [captureRequestId, setCaptureRequestId] = (0, import_react42.useState)(0);
|
|
12250
|
+
const [transitionRunId, setTransitionRunId] = (0, import_react42.useState)(0);
|
|
12251
|
+
const [snapshot, setSnapshot] = (0, import_react42.useState)(null);
|
|
12252
|
+
const [recoveryKey, setRecoveryKey] = (0, import_react42.useState)(0);
|
|
12253
|
+
const requestedSceneIdRef = (0, import_react42.useRef)(activeSceneId);
|
|
12254
|
+
const captureReasonRef = (0, import_react42.useRef)("start");
|
|
12255
|
+
const interactionReleaseRef = (0, import_react42.useRef)(null);
|
|
12256
|
+
const slotsRef = (0, import_react42.useRef)(slots);
|
|
12257
|
+
const phaseRef = (0, import_react42.useRef)(phase);
|
|
12258
|
+
const liveSlotRef = (0, import_react42.useRef)(liveSlot);
|
|
12259
|
+
const transitionFromRef = (0, import_react42.useRef)(initialScene);
|
|
12116
12260
|
slotsRef.current = slots;
|
|
12117
12261
|
phaseRef.current = phase;
|
|
12118
12262
|
if (externalPhaseRef) {
|
|
12119
12263
|
externalPhaseRef.current = phase;
|
|
12120
12264
|
}
|
|
12121
12265
|
liveSlotRef.current = liveSlot;
|
|
12122
|
-
const releaseInteraction = (0,
|
|
12266
|
+
const releaseInteraction = (0, import_react42.useCallback)(() => {
|
|
12123
12267
|
interactionReleaseRef.current?.();
|
|
12124
12268
|
interactionReleaseRef.current = null;
|
|
12125
12269
|
}, []);
|
|
12126
|
-
const reportError = (0,
|
|
12270
|
+
const reportError = (0, import_react42.useCallback)((sceneId, error) => {
|
|
12127
12271
|
onTransitionError?.({ sceneId, error });
|
|
12128
12272
|
}, [onTransitionError]);
|
|
12129
|
-
const startPreload = (0,
|
|
12273
|
+
const startPreload = (0, import_react42.useCallback)((scene) => {
|
|
12130
12274
|
const nextSlot = 1 - liveSlotRef.current;
|
|
12131
12275
|
requestedSceneIdRef.current = scene.id;
|
|
12132
12276
|
setSlots((current) => {
|
|
@@ -12137,7 +12281,7 @@ function ScenesController({
|
|
|
12137
12281
|
setPendingSlot(nextSlot);
|
|
12138
12282
|
setPhase("preloading");
|
|
12139
12283
|
}, []);
|
|
12140
|
-
(0,
|
|
12284
|
+
(0, import_react42.useEffect)(() => {
|
|
12141
12285
|
const requested = sceneMap.get(activeSceneId);
|
|
12142
12286
|
if (!requested) {
|
|
12143
12287
|
reportError(activeSceneId, new Error(`Unknown panorama scene: ${activeSceneId}`));
|
|
@@ -12161,7 +12305,7 @@ function ScenesController({
|
|
|
12161
12305
|
}
|
|
12162
12306
|
startPreload(requested);
|
|
12163
12307
|
}, [activeSceneId, pendingSlot, reportError, sceneMap, startPreload]);
|
|
12164
|
-
const handleReady = (0,
|
|
12308
|
+
const handleReady = (0, import_react42.useCallback)((slot) => {
|
|
12165
12309
|
if (slot !== pendingSlot || phaseRef.current !== "preloading") {
|
|
12166
12310
|
return;
|
|
12167
12311
|
}
|
|
@@ -12192,7 +12336,7 @@ function ScenesController({
|
|
|
12192
12336
|
setPhase("capturing");
|
|
12193
12337
|
setCaptureRequestId((current) => current + 1);
|
|
12194
12338
|
}, [controlsRef, onTransitionEnd, pendingSlot, transition.preset]);
|
|
12195
|
-
const handleCaptured = (0,
|
|
12339
|
+
const handleCaptured = (0, import_react42.useCallback)((nextSnapshot) => {
|
|
12196
12340
|
setSnapshot((current) => {
|
|
12197
12341
|
current?.dispose();
|
|
12198
12342
|
return nextSnapshot;
|
|
@@ -12214,7 +12358,7 @@ function ScenesController({
|
|
|
12214
12358
|
setPhase("transitioning");
|
|
12215
12359
|
setTransitionRunId((current) => current + 1);
|
|
12216
12360
|
}, [manager, pendingSlot, sceneMap, startPreload]);
|
|
12217
|
-
const finishTransition = (0,
|
|
12361
|
+
const finishTransition = (0, import_react42.useCallback)(() => {
|
|
12218
12362
|
const nextSlot = pendingSlot;
|
|
12219
12363
|
const previousScene = transitionFromRef.current;
|
|
12220
12364
|
const nextScene = nextSlot === null ? null : slotsRef.current[nextSlot];
|
|
@@ -12239,12 +12383,12 @@ function ScenesController({
|
|
|
12239
12383
|
});
|
|
12240
12384
|
}
|
|
12241
12385
|
}, [onTransitionEnd, pendingSlot, releaseInteraction, snapshot, transition.preset]);
|
|
12242
|
-
(0,
|
|
12386
|
+
(0, import_react42.useEffect)(() => () => {
|
|
12243
12387
|
releaseInteraction();
|
|
12244
12388
|
snapshot?.dispose();
|
|
12245
12389
|
}, [releaseInteraction, snapshot]);
|
|
12246
12390
|
const { gl } = (0, import_fiber21.useThree)();
|
|
12247
|
-
(0,
|
|
12391
|
+
(0, import_react42.useEffect)(() => {
|
|
12248
12392
|
const canvas = gl.domElement;
|
|
12249
12393
|
const onContextLost = (event) => {
|
|
12250
12394
|
event.preventDefault();
|
|
@@ -12268,8 +12412,8 @@ function ScenesController({
|
|
|
12268
12412
|
}, [gl, manager, releaseInteraction, snapshot]);
|
|
12269
12413
|
const renderedScene = slots[liveSlot];
|
|
12270
12414
|
const snapshotVisible = snapshot !== null && (phase === "transitioning" || phase === "recapturing" || phase === "preloading");
|
|
12271
|
-
return /* @__PURE__ */ (0,
|
|
12272
|
-
/* @__PURE__ */ (0,
|
|
12415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react42.Fragment, { children: [
|
|
12416
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
12273
12417
|
SnapshotCapture,
|
|
12274
12418
|
{
|
|
12275
12419
|
requestId: captureRequestId,
|
|
@@ -12281,7 +12425,7 @@ function ScenesController({
|
|
|
12281
12425
|
const source = slots[slot];
|
|
12282
12426
|
const isLive = slot === liveSlot;
|
|
12283
12427
|
const isPending = slot === pendingSlot;
|
|
12284
|
-
return /* @__PURE__ */ (0,
|
|
12428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
12285
12429
|
SceneSource,
|
|
12286
12430
|
{
|
|
12287
12431
|
scene: source,
|
|
@@ -12297,7 +12441,7 @@ function ScenesController({
|
|
|
12297
12441
|
`${slot}:${source?.id ?? "empty"}:${recoveryKey}`
|
|
12298
12442
|
);
|
|
12299
12443
|
}),
|
|
12300
|
-
snapshotVisible ? /* @__PURE__ */ (0,
|
|
12444
|
+
snapshotVisible ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
12301
12445
|
TransitionOverlay,
|
|
12302
12446
|
{
|
|
12303
12447
|
snapshot,
|
|
@@ -12320,11 +12464,11 @@ function Scenes({
|
|
|
12320
12464
|
...rest
|
|
12321
12465
|
}) {
|
|
12322
12466
|
const isControlled = controlledId !== void 0;
|
|
12323
|
-
const [internalId, setInternalId] = (0,
|
|
12467
|
+
const [internalId, setInternalId] = (0, import_react42.useState)(
|
|
12324
12468
|
() => controlledId ?? defaultActiveSceneId ?? scenes[0]?.id ?? ""
|
|
12325
12469
|
);
|
|
12326
12470
|
const resolvedId = isControlled ? controlledId : internalId;
|
|
12327
|
-
const requestSceneChange = (0,
|
|
12471
|
+
const requestSceneChange = (0, import_react42.useCallback)(
|
|
12328
12472
|
(id) => {
|
|
12329
12473
|
if (isControlled) {
|
|
12330
12474
|
onActiveSceneIdChange?.(id);
|
|
@@ -12334,13 +12478,13 @@ function Scenes({
|
|
|
12334
12478
|
},
|
|
12335
12479
|
[isControlled, onActiveSceneIdChange]
|
|
12336
12480
|
);
|
|
12337
|
-
const scenesRef = (0,
|
|
12481
|
+
const scenesRef = (0, import_react42.useRef)(scenes);
|
|
12338
12482
|
scenesRef.current = scenes;
|
|
12339
|
-
const resolvedIdRef = (0,
|
|
12483
|
+
const resolvedIdRef = (0, import_react42.useRef)(resolvedId);
|
|
12340
12484
|
resolvedIdRef.current = resolvedId;
|
|
12341
|
-
const host = (0,
|
|
12342
|
-
const phaseRef = (0,
|
|
12343
|
-
(0,
|
|
12485
|
+
const host = (0, import_react42.useContext)(ScenesHostContext);
|
|
12486
|
+
const phaseRef = (0, import_react42.useRef)("idle");
|
|
12487
|
+
(0, import_react42.useEffect)(() => {
|
|
12344
12488
|
if (!host) {
|
|
12345
12489
|
return;
|
|
12346
12490
|
}
|
|
@@ -12390,12 +12534,12 @@ function Scenes({
|
|
|
12390
12534
|
}
|
|
12391
12535
|
};
|
|
12392
12536
|
}, [host, requestSceneChange]);
|
|
12393
|
-
return /* @__PURE__ */ (0,
|
|
12537
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
12394
12538
|
TileTextureManagerProvider,
|
|
12395
12539
|
{
|
|
12396
12540
|
maxTextureMemoryMb,
|
|
12397
12541
|
maxConcurrentLoads: maxConcurrentTileLoads,
|
|
12398
|
-
children: /* @__PURE__ */ (0,
|
|
12542
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
12399
12543
|
ScenesController,
|
|
12400
12544
|
{
|
|
12401
12545
|
...rest,
|
|
@@ -12410,25 +12554,25 @@ function Scenes({
|
|
|
12410
12554
|
|
|
12411
12555
|
// src/hotspot/image-hotspot.tsx
|
|
12412
12556
|
var import_fiber23 = require("@react-three/fiber");
|
|
12413
|
-
var
|
|
12557
|
+
var import_react46 = require("react");
|
|
12414
12558
|
var import_three22 = require("three");
|
|
12415
12559
|
|
|
12416
12560
|
// src/hotspot/hotspot-anchor.tsx
|
|
12417
12561
|
var import_fiber22 = require("@react-three/fiber");
|
|
12418
|
-
var
|
|
12562
|
+
var import_react45 = require("react");
|
|
12419
12563
|
var import_three20 = require("three");
|
|
12420
12564
|
|
|
12421
12565
|
// src/hotspot/hotspot-tooltip.tsx
|
|
12422
|
-
var
|
|
12566
|
+
var import_react44 = require("react");
|
|
12423
12567
|
|
|
12424
12568
|
// src/webvr/stereo-html.tsx
|
|
12425
12569
|
var import_drei = require("@react-three/drei");
|
|
12426
|
-
var
|
|
12427
|
-
var
|
|
12570
|
+
var import_react43 = require("react");
|
|
12571
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
12428
12572
|
function useFallbackStereoView() {
|
|
12429
|
-
const runtime = (0,
|
|
12573
|
+
const runtime = (0, import_react43.useContext)(WebVRRuntimeContext);
|
|
12430
12574
|
const host = runtime?.host ?? null;
|
|
12431
|
-
const fallback = (0,
|
|
12575
|
+
const fallback = (0, import_react43.useSyncExternalStore)(
|
|
12432
12576
|
(onStoreChange) => host ? subscribeWebVRHost(host, onStoreChange) : () => void 0,
|
|
12433
12577
|
() => isFallbackStereoMode(host?.snapshot.mode ?? null),
|
|
12434
12578
|
() => false
|
|
@@ -12449,10 +12593,10 @@ function stereoCalculatePosition(eye, stereoView) {
|
|
|
12449
12593
|
function PanoHtml({ children, ...htmlProps }) {
|
|
12450
12594
|
const stereoView = useFallbackStereoView();
|
|
12451
12595
|
if (!stereoView) {
|
|
12452
|
-
return /* @__PURE__ */ (0,
|
|
12596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_drei.Html, { ...htmlProps, children });
|
|
12453
12597
|
}
|
|
12454
|
-
return /* @__PURE__ */ (0,
|
|
12455
|
-
/* @__PURE__ */ (0,
|
|
12598
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
12599
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12456
12600
|
import_drei.Html,
|
|
12457
12601
|
{
|
|
12458
12602
|
...htmlProps,
|
|
@@ -12460,7 +12604,7 @@ function PanoHtml({ children, ...htmlProps }) {
|
|
|
12460
12604
|
children
|
|
12461
12605
|
}
|
|
12462
12606
|
),
|
|
12463
|
-
/* @__PURE__ */ (0,
|
|
12607
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12464
12608
|
import_drei.Html,
|
|
12465
12609
|
{
|
|
12466
12610
|
...htmlProps,
|
|
@@ -12473,7 +12617,7 @@ function PanoHtml({ children, ...htmlProps }) {
|
|
|
12473
12617
|
}
|
|
12474
12618
|
|
|
12475
12619
|
// src/hotspot/hotspot-tooltip.tsx
|
|
12476
|
-
var
|
|
12620
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
12477
12621
|
var DEFAULT_HOTSPOT_TOOLTIP_OFFSET = 12;
|
|
12478
12622
|
var DEFAULT_HOTSPOT_TOOLTIP_APPEARANCE = {
|
|
12479
12623
|
background: "rgba(22, 22, 22, 0.72)",
|
|
@@ -12542,16 +12686,16 @@ function HotspotTooltip({
|
|
|
12542
12686
|
offset = DEFAULT_HOTSPOT_TOOLTIP_OFFSET,
|
|
12543
12687
|
appearance
|
|
12544
12688
|
}) {
|
|
12545
|
-
const [imageFailed, setImageFailed] = (0,
|
|
12546
|
-
(0,
|
|
12689
|
+
const [imageFailed, setImageFailed] = (0, import_react44.useState)(false);
|
|
12690
|
+
(0, import_react44.useEffect)(() => {
|
|
12547
12691
|
setImageFailed(false);
|
|
12548
12692
|
}, [content.image]);
|
|
12549
12693
|
const showImage = Boolean(content.image) && !imageFailed;
|
|
12550
|
-
const resolvedAppearance = (0,
|
|
12694
|
+
const resolvedAppearance = (0, import_react44.useMemo)(
|
|
12551
12695
|
() => resolveHotspotTooltipAppearance(appearance),
|
|
12552
12696
|
[appearance]
|
|
12553
12697
|
);
|
|
12554
|
-
const bubbleStyle = (0,
|
|
12698
|
+
const bubbleStyle = (0, import_react44.useMemo)(
|
|
12555
12699
|
() => ({
|
|
12556
12700
|
background: resolvedAppearance.background,
|
|
12557
12701
|
border: resolvedAppearance.border,
|
|
@@ -12570,14 +12714,14 @@ function HotspotTooltip({
|
|
|
12570
12714
|
if (!showImage && !content.text) {
|
|
12571
12715
|
return null;
|
|
12572
12716
|
}
|
|
12573
|
-
return /* @__PURE__ */ (0,
|
|
12717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(PanoHtml, { pointerEvents: "none", style: WRAPPER_STYLE, zIndexRange: [20, 10], children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
12574
12718
|
"div",
|
|
12575
12719
|
{
|
|
12576
12720
|
className: "pano-hotspot-tooltip",
|
|
12577
12721
|
role: "tooltip",
|
|
12578
12722
|
style: bubbleStyle,
|
|
12579
12723
|
children: [
|
|
12580
|
-
showImage ? /* @__PURE__ */ (0,
|
|
12724
|
+
showImage ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
12581
12725
|
"img",
|
|
12582
12726
|
{
|
|
12583
12727
|
alt: content.imageAlt ?? content.text ?? "",
|
|
@@ -12586,14 +12730,14 @@ function HotspotTooltip({
|
|
|
12586
12730
|
src: content.image
|
|
12587
12731
|
}
|
|
12588
12732
|
) : null,
|
|
12589
|
-
content.text ? /* @__PURE__ */ (0,
|
|
12733
|
+
content.text ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "pano-hotspot-tooltip-text", children: content.text }) : null
|
|
12590
12734
|
]
|
|
12591
12735
|
}
|
|
12592
12736
|
) });
|
|
12593
12737
|
}
|
|
12594
12738
|
|
|
12595
12739
|
// src/hotspot/hotspot-anchor.tsx
|
|
12596
|
-
var
|
|
12740
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
12597
12741
|
var DEFAULT_FLOATING_DISTANCE = 10;
|
|
12598
12742
|
var PANORAMA_RADIUS = DEFAULT_PANORAMA_RADIUS;
|
|
12599
12743
|
var PANORAMA_SURFACE_INSET = 4;
|
|
@@ -12930,18 +13074,18 @@ function HotspotAnchor({
|
|
|
12930
13074
|
onPositionChange,
|
|
12931
13075
|
onDragEnd
|
|
12932
13076
|
}) {
|
|
12933
|
-
const controlsRef = (0,
|
|
12934
|
-
const eventBus = (0,
|
|
13077
|
+
const controlsRef = (0, import_react45.useContext)(PanoramaViewContext);
|
|
13078
|
+
const eventBus = (0, import_react45.useContext)(PanoEventBusContext);
|
|
12935
13079
|
const cursorApi = usePanoCursor();
|
|
12936
13080
|
const { camera, size } = (0, import_fiber22.useThree)();
|
|
12937
|
-
const groupRef = (0,
|
|
12938
|
-
const tooltipAnchorRef = (0,
|
|
12939
|
-
const dragStateRef = (0,
|
|
12940
|
-
const suppressNextClickRef = (0,
|
|
12941
|
-
const [hovered, setHovered] = (0,
|
|
12942
|
-
const [dragging, setDragging] = (0,
|
|
12943
|
-
const [pinned, setPinned] = (0,
|
|
12944
|
-
const tooltipContent = (0,
|
|
13081
|
+
const groupRef = (0, import_react45.useRef)(null);
|
|
13082
|
+
const tooltipAnchorRef = (0, import_react45.useRef)(null);
|
|
13083
|
+
const dragStateRef = (0, import_react45.useRef)(null);
|
|
13084
|
+
const suppressNextClickRef = (0, import_react45.useRef)(false);
|
|
13085
|
+
const [hovered, setHovered] = (0, import_react45.useState)(false);
|
|
13086
|
+
const [dragging, setDragging] = (0, import_react45.useState)(false);
|
|
13087
|
+
const [pinned, setPinned] = (0, import_react45.useState)(false);
|
|
13088
|
+
const tooltipContent = (0, import_react45.useMemo)(
|
|
12945
13089
|
() => resolveHotspotTooltipContent(tooltip),
|
|
12946
13090
|
[tooltip]
|
|
12947
13091
|
);
|
|
@@ -12957,17 +13101,17 @@ function HotspotAnchor({
|
|
|
12957
13101
|
scaledWidth,
|
|
12958
13102
|
scaledHeight
|
|
12959
13103
|
);
|
|
12960
|
-
const worldPosition = (0,
|
|
13104
|
+
const worldPosition = (0, import_react45.useMemo)(
|
|
12961
13105
|
() => panoPositionToVector3(normalizedPosition, resolvedDistance),
|
|
12962
13106
|
[normalizedPosition.pitch, normalizedPosition.yaw, resolvedDistance]
|
|
12963
13107
|
);
|
|
12964
|
-
const surfaceQuaternion3 = (0,
|
|
13108
|
+
const surfaceQuaternion3 = (0, import_react45.useMemo)(
|
|
12965
13109
|
() => createSurfaceQuaternion(normalizedPosition),
|
|
12966
13110
|
[normalizedPosition.pitch, normalizedPosition.yaw]
|
|
12967
13111
|
);
|
|
12968
13112
|
const worldWidth = angularSizeToWorldSize(scaledWidth, resolvedDistance);
|
|
12969
13113
|
const worldHeight = angularSizeToWorldSize(scaledHeight, resolvedDistance);
|
|
12970
|
-
const focusGeometry = (0,
|
|
13114
|
+
const focusGeometry = (0, import_react45.useMemo)(() => {
|
|
12971
13115
|
const planeGeometry = new import_three20.PlaneGeometry(1, 1);
|
|
12972
13116
|
const geometry = new import_three20.EdgesGeometry(planeGeometry);
|
|
12973
13117
|
planeGeometry.dispose();
|
|
@@ -12994,14 +13138,14 @@ function HotspotAnchor({
|
|
|
12994
13138
|
});
|
|
12995
13139
|
const tooltipOpen = visible && tooltipContent !== null && isTooltipOpen(tooltipTrigger, hovered, focused, pinned);
|
|
12996
13140
|
const cursorClaimId = hotspotCursorClaimId(id);
|
|
12997
|
-
(0,
|
|
13141
|
+
(0, import_react45.useEffect)(
|
|
12998
13142
|
() => () => {
|
|
12999
13143
|
dragStateRef.current?.releaseInteractionLock();
|
|
13000
13144
|
dragStateRef.current = null;
|
|
13001
13145
|
},
|
|
13002
13146
|
[]
|
|
13003
13147
|
);
|
|
13004
|
-
(0,
|
|
13148
|
+
(0, import_react45.useEffect)(() => {
|
|
13005
13149
|
if (!cursorApi) {
|
|
13006
13150
|
return;
|
|
13007
13151
|
}
|
|
@@ -13023,14 +13167,14 @@ function HotspotAnchor({
|
|
|
13023
13167
|
hovered,
|
|
13024
13168
|
visible
|
|
13025
13169
|
]);
|
|
13026
|
-
(0,
|
|
13170
|
+
(0, import_react45.useEffect)(
|
|
13027
13171
|
() => () => {
|
|
13028
13172
|
cursorApi?.release(cursorClaimId);
|
|
13029
13173
|
},
|
|
13030
13174
|
[cursorApi, cursorClaimId]
|
|
13031
13175
|
);
|
|
13032
|
-
(0,
|
|
13033
|
-
(0,
|
|
13176
|
+
(0, import_react45.useEffect)(() => () => focusGeometry.dispose(), [focusGeometry]);
|
|
13177
|
+
(0, import_react45.useEffect)(() => {
|
|
13034
13178
|
if (tooltipTrigger !== "click") {
|
|
13035
13179
|
setPinned(false);
|
|
13036
13180
|
return;
|
|
@@ -13039,12 +13183,12 @@ function HotspotAnchor({
|
|
|
13039
13183
|
setPinned(false);
|
|
13040
13184
|
});
|
|
13041
13185
|
}, [eventBus, tooltipTrigger]);
|
|
13042
|
-
(0,
|
|
13186
|
+
(0, import_react45.useEffect)(() => {
|
|
13043
13187
|
if (tooltipTrigger !== "hover") {
|
|
13044
13188
|
setHovered(false);
|
|
13045
13189
|
}
|
|
13046
13190
|
}, [tooltipTrigger]);
|
|
13047
|
-
(0,
|
|
13191
|
+
(0, import_react45.useEffect)(() => {
|
|
13048
13192
|
if (acceptsPointer) {
|
|
13049
13193
|
return;
|
|
13050
13194
|
}
|
|
@@ -13057,7 +13201,7 @@ function HotspotAnchor({
|
|
|
13057
13201
|
dragStateRef.current = null;
|
|
13058
13202
|
setDragging(false);
|
|
13059
13203
|
}, [acceptsPointer]);
|
|
13060
|
-
(0,
|
|
13204
|
+
(0, import_react45.useLayoutEffect)(() => {
|
|
13061
13205
|
const group = groupRef.current;
|
|
13062
13206
|
if (!group) {
|
|
13063
13207
|
return;
|
|
@@ -13156,7 +13300,7 @@ function HotspotAnchor({
|
|
|
13156
13300
|
setHovered(true);
|
|
13157
13301
|
}
|
|
13158
13302
|
};
|
|
13159
|
-
return /* @__PURE__ */ (0,
|
|
13303
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
13160
13304
|
"group",
|
|
13161
13305
|
{
|
|
13162
13306
|
ref: groupRef,
|
|
@@ -13233,18 +13377,18 @@ function HotspotAnchor({
|
|
|
13233
13377
|
} : void 0,
|
|
13234
13378
|
onPointerUp: acceptsPointer ? (event) => releasePointer(event, true) : void 0,
|
|
13235
13379
|
children: [
|
|
13236
|
-
focused ? focusContent ?? /* @__PURE__ */ (0,
|
|
13380
|
+
focused ? focusContent ?? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
13237
13381
|
"lineSegments",
|
|
13238
13382
|
{
|
|
13239
13383
|
geometry: focusGeometry,
|
|
13240
13384
|
position: [0, 0, 0.01],
|
|
13241
13385
|
renderOrder: renderOrder + 1,
|
|
13242
13386
|
scale: [1.12, 1.12, 1],
|
|
13243
|
-
children: /* @__PURE__ */ (0,
|
|
13387
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("lineBasicMaterial", { color: "#f5fbfc", depthTest: false })
|
|
13244
13388
|
}
|
|
13245
13389
|
) : null,
|
|
13246
13390
|
children,
|
|
13247
|
-
tooltipOpen && tooltipContent ? /* @__PURE__ */ (0,
|
|
13391
|
+
tooltipOpen && tooltipContent ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("group", { ref: tooltipAnchorRef, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
13248
13392
|
HotspotTooltip,
|
|
13249
13393
|
{
|
|
13250
13394
|
appearance: tooltipAppearance,
|
|
@@ -13260,7 +13404,7 @@ function HotspotAnchor({
|
|
|
13260
13404
|
|
|
13261
13405
|
// src/hotspot/hotspot-plane.tsx
|
|
13262
13406
|
var import_three21 = require("three");
|
|
13263
|
-
var
|
|
13407
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
13264
13408
|
var HOTSPOT_ALPHA_CUTOFF = 0.05;
|
|
13265
13409
|
var SAMPLE_UV = new import_three21.Vector2();
|
|
13266
13410
|
var RAYCAST_HITS = [];
|
|
@@ -13362,9 +13506,9 @@ function HotspotPlane({
|
|
|
13362
13506
|
map,
|
|
13363
13507
|
opacity
|
|
13364
13508
|
}) {
|
|
13365
|
-
return /* @__PURE__ */ (0,
|
|
13366
|
-
/* @__PURE__ */ (0,
|
|
13367
|
-
/* @__PURE__ */ (0,
|
|
13509
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("mesh", { raycast: hotspotPlaneRaycast, children: [
|
|
13510
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("planeGeometry", { args: [1, 1] }),
|
|
13511
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
13368
13512
|
"meshBasicMaterial",
|
|
13369
13513
|
{
|
|
13370
13514
|
alphaTest: HOTSPOT_ALPHA_CUTOFF,
|
|
@@ -13380,15 +13524,15 @@ function HotspotPlane({
|
|
|
13380
13524
|
}
|
|
13381
13525
|
|
|
13382
13526
|
// src/hotspot/image-hotspot.tsx
|
|
13383
|
-
var
|
|
13527
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
13384
13528
|
function useHotspotImageTexture(src, onLoad, onError) {
|
|
13385
13529
|
const gl = (0, import_fiber23.useThree)((state) => state.gl);
|
|
13386
|
-
const [texture, setTexture] = (0,
|
|
13387
|
-
const onLoadRef = (0,
|
|
13388
|
-
const onErrorRef = (0,
|
|
13530
|
+
const [texture, setTexture] = (0, import_react46.useState)(null);
|
|
13531
|
+
const onLoadRef = (0, import_react46.useRef)(onLoad);
|
|
13532
|
+
const onErrorRef = (0, import_react46.useRef)(onError);
|
|
13389
13533
|
onLoadRef.current = onLoad;
|
|
13390
13534
|
onErrorRef.current = onError;
|
|
13391
|
-
(0,
|
|
13535
|
+
(0, import_react46.useEffect)(() => {
|
|
13392
13536
|
let active = true;
|
|
13393
13537
|
setTexture(null);
|
|
13394
13538
|
if (!src) {
|
|
@@ -13426,7 +13570,7 @@ function useHotspotImageTexture(src, onLoad, onError) {
|
|
|
13426
13570
|
active = false;
|
|
13427
13571
|
};
|
|
13428
13572
|
}, [gl, src]);
|
|
13429
|
-
(0,
|
|
13573
|
+
(0, import_react46.useEffect)(
|
|
13430
13574
|
() => () => {
|
|
13431
13575
|
texture?.dispose();
|
|
13432
13576
|
},
|
|
@@ -13444,19 +13588,19 @@ function ImageHotspot({
|
|
|
13444
13588
|
...anchorProps
|
|
13445
13589
|
}) {
|
|
13446
13590
|
const texture = useHotspotImageTexture(src, onLoad, onError);
|
|
13447
|
-
return /* @__PURE__ */ (0,
|
|
13591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(HotspotAnchor, { ...anchorProps, height, width, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(HotspotPlane, { map: texture, opacity }) });
|
|
13448
13592
|
}
|
|
13449
13593
|
|
|
13450
13594
|
// src/hotspot/polygon-hotspot.tsx
|
|
13451
|
-
var
|
|
13595
|
+
var import_react48 = require("react");
|
|
13452
13596
|
var import_three24 = require("three");
|
|
13453
13597
|
|
|
13454
13598
|
// src/hotspot/hotspot-stroke-line.tsx
|
|
13455
13599
|
var import_drei2 = require("@react-three/drei");
|
|
13456
13600
|
var import_fiber24 = require("@react-three/fiber");
|
|
13457
|
-
var
|
|
13601
|
+
var import_react47 = require("react");
|
|
13458
13602
|
var import_three23 = require("three");
|
|
13459
|
-
var
|
|
13603
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
13460
13604
|
var LINE_WORLD_POSITION = new import_three23.Vector3();
|
|
13461
13605
|
function applyScreenSpaceDashScale(object, camera, viewportHeight) {
|
|
13462
13606
|
const material = object?.material;
|
|
@@ -13487,10 +13631,10 @@ function HotspotStrokeLine({
|
|
|
13487
13631
|
dashSize,
|
|
13488
13632
|
gapSize
|
|
13489
13633
|
}) {
|
|
13490
|
-
const lineRef = (0,
|
|
13634
|
+
const lineRef = (0, import_react47.useRef)(null);
|
|
13491
13635
|
const { camera, size } = (0, import_fiber24.useThree)();
|
|
13492
13636
|
const dash = resolveDash(dashSize, gapSize);
|
|
13493
|
-
(0,
|
|
13637
|
+
(0, import_react47.useLayoutEffect)(() => {
|
|
13494
13638
|
if (!dash.dashed) {
|
|
13495
13639
|
return;
|
|
13496
13640
|
}
|
|
@@ -13502,7 +13646,7 @@ function HotspotStrokeLine({
|
|
|
13502
13646
|
}
|
|
13503
13647
|
applyScreenSpaceDashScale(lineRef.current, state.camera, state.size.height);
|
|
13504
13648
|
});
|
|
13505
|
-
return /* @__PURE__ */ (0,
|
|
13649
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
13506
13650
|
import_drei2.Line,
|
|
13507
13651
|
{
|
|
13508
13652
|
ref: lineRef,
|
|
@@ -13524,7 +13668,7 @@ function HotspotStrokeLine({
|
|
|
13524
13668
|
}
|
|
13525
13669
|
|
|
13526
13670
|
// src/hotspot/polygon-hotspot.tsx
|
|
13527
|
-
var
|
|
13671
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
13528
13672
|
var POLYGON_RADIUS = 990;
|
|
13529
13673
|
var MAX_FILL_SEGMENT_DEGREES = 7;
|
|
13530
13674
|
function cloneVertices(vertices) {
|
|
@@ -13780,24 +13924,24 @@ function PolygonHotspot({
|
|
|
13780
13924
|
onInvalid,
|
|
13781
13925
|
...anchorProps
|
|
13782
13926
|
}) {
|
|
13783
|
-
const issues = (0,
|
|
13927
|
+
const issues = (0, import_react48.useMemo)(() => validatePolygonVertices(vertices), [vertices]);
|
|
13784
13928
|
const valid = issues.length === 0;
|
|
13785
|
-
const center = (0,
|
|
13786
|
-
const fillGeometry = (0,
|
|
13929
|
+
const center = (0, import_react48.useMemo)(() => valid ? polygonCenter(vertices) : null, [valid, vertices]);
|
|
13930
|
+
const fillGeometry = (0, import_react48.useMemo)(
|
|
13787
13931
|
() => valid && center ? makeFillGeometry(vertices, center) : null,
|
|
13788
13932
|
[center, valid, vertices]
|
|
13789
13933
|
);
|
|
13790
|
-
const strokePoints = (0,
|
|
13934
|
+
const strokePoints = (0, import_react48.useMemo)(
|
|
13791
13935
|
() => valid && center ? makeStrokePositions(vertices, center) : null,
|
|
13792
13936
|
[center, valid, vertices]
|
|
13793
13937
|
);
|
|
13794
13938
|
const resolvedStrokeOpacity = Math.max(0, Math.min(strokeOpacity, 1));
|
|
13795
|
-
const startVerticesRef = (0,
|
|
13939
|
+
const startVerticesRef = (0, import_react48.useRef)(null);
|
|
13796
13940
|
const issuesKey = issues.map((issue) => issue.code).join(",");
|
|
13797
|
-
(0,
|
|
13941
|
+
(0, import_react48.useEffect)(() => {
|
|
13798
13942
|
if (!valid) onInvalid?.(issues);
|
|
13799
13943
|
}, [issues, issuesKey, onInvalid, valid]);
|
|
13800
|
-
(0,
|
|
13944
|
+
(0, import_react48.useEffect)(() => () => fillGeometry?.dispose(), [fillGeometry]);
|
|
13801
13945
|
if (!valid || !center || !fillGeometry || !strokePoints || strokePoints.length < 2) {
|
|
13802
13946
|
return null;
|
|
13803
13947
|
}
|
|
@@ -13812,7 +13956,7 @@ function PolygonHotspot({
|
|
|
13812
13956
|
startPosition: event.startPosition
|
|
13813
13957
|
});
|
|
13814
13958
|
};
|
|
13815
|
-
return /* @__PURE__ */ (0,
|
|
13959
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
13816
13960
|
HotspotAnchor,
|
|
13817
13961
|
{
|
|
13818
13962
|
...anchorProps,
|
|
@@ -13827,7 +13971,7 @@ function PolygonHotspot({
|
|
|
13827
13971
|
draggable,
|
|
13828
13972
|
interactive,
|
|
13829
13973
|
useAngularScale: false,
|
|
13830
|
-
focusContent: /* @__PURE__ */ (0,
|
|
13974
|
+
focusContent: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
13831
13975
|
HotspotStrokeLine,
|
|
13832
13976
|
{
|
|
13833
13977
|
color: "#75cbd3",
|
|
@@ -13849,7 +13993,7 @@ function PolygonHotspot({
|
|
|
13849
13993
|
startVerticesRef.current = null;
|
|
13850
13994
|
},
|
|
13851
13995
|
children: [
|
|
13852
|
-
/* @__PURE__ */ (0,
|
|
13996
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("mesh", { geometry: fillGeometry, renderOrder, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
13853
13997
|
"meshBasicMaterial",
|
|
13854
13998
|
{
|
|
13855
13999
|
color: fill,
|
|
@@ -13859,7 +14003,7 @@ function PolygonHotspot({
|
|
|
13859
14003
|
transparent: true
|
|
13860
14004
|
}
|
|
13861
14005
|
) }),
|
|
13862
|
-
/* @__PURE__ */ (0,
|
|
14006
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
13863
14007
|
HotspotStrokeLine,
|
|
13864
14008
|
{
|
|
13865
14009
|
color: stroke,
|
|
@@ -13877,9 +14021,9 @@ function PolygonHotspot({
|
|
|
13877
14021
|
}
|
|
13878
14022
|
|
|
13879
14023
|
// src/hotspot/polyline-hotspot.tsx
|
|
13880
|
-
var
|
|
14024
|
+
var import_react49 = require("react");
|
|
13881
14025
|
var import_three25 = require("three");
|
|
13882
|
-
var
|
|
14026
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
13883
14027
|
var POLYLINE_RADIUS = 990;
|
|
13884
14028
|
var MAX_SEGMENT_DEGREES = 7;
|
|
13885
14029
|
function cloneVertices2(vertices) {
|
|
@@ -13996,16 +14140,16 @@ function PolylineHotspot({
|
|
|
13996
14140
|
onInvalid,
|
|
13997
14141
|
...anchorProps
|
|
13998
14142
|
}) {
|
|
13999
|
-
const issues = (0,
|
|
14143
|
+
const issues = (0, import_react49.useMemo)(() => validatePolylineVertices(vertices), [vertices]);
|
|
14000
14144
|
const valid = issues.length === 0;
|
|
14001
|
-
const center = (0,
|
|
14002
|
-
const linePoints = (0,
|
|
14145
|
+
const center = (0, import_react49.useMemo)(() => valid ? polylineCenter(vertices) : null, [valid, vertices]);
|
|
14146
|
+
const linePoints = (0, import_react49.useMemo)(
|
|
14003
14147
|
() => valid && center ? makeLinePositions(vertices, center) : null,
|
|
14004
14148
|
[center, valid, vertices]
|
|
14005
14149
|
);
|
|
14006
14150
|
const opacity = Math.max(0, Math.min(strokeOpacity, 1));
|
|
14007
|
-
const startVerticesRef = (0,
|
|
14008
|
-
(0,
|
|
14151
|
+
const startVerticesRef = (0, import_react49.useRef)(null);
|
|
14152
|
+
(0, import_react49.useEffect)(() => {
|
|
14009
14153
|
if (!valid) onInvalid?.(issues);
|
|
14010
14154
|
}, [issues, onInvalid, valid]);
|
|
14011
14155
|
if (!valid || !center || !linePoints || linePoints.length < 2) return null;
|
|
@@ -14019,7 +14163,7 @@ function PolylineHotspot({
|
|
|
14019
14163
|
startPosition: event.startPosition
|
|
14020
14164
|
});
|
|
14021
14165
|
};
|
|
14022
|
-
return /* @__PURE__ */ (0,
|
|
14166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
14023
14167
|
HotspotAnchor,
|
|
14024
14168
|
{
|
|
14025
14169
|
...anchorProps,
|
|
@@ -14033,7 +14177,7 @@ function PolylineHotspot({
|
|
|
14033
14177
|
renderOrder,
|
|
14034
14178
|
draggable,
|
|
14035
14179
|
useAngularScale: false,
|
|
14036
|
-
focusContent: /* @__PURE__ */ (0,
|
|
14180
|
+
focusContent: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
14037
14181
|
HotspotStrokeLine,
|
|
14038
14182
|
{
|
|
14039
14183
|
color: "#75cbd3",
|
|
@@ -14054,7 +14198,7 @@ function PolylineHotspot({
|
|
|
14054
14198
|
emitVerticesChange(event, onDragEnd);
|
|
14055
14199
|
startVerticesRef.current = null;
|
|
14056
14200
|
},
|
|
14057
|
-
children: /* @__PURE__ */ (0,
|
|
14201
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
14058
14202
|
HotspotStrokeLine,
|
|
14059
14203
|
{
|
|
14060
14204
|
color: stroke,
|
|
@@ -14071,9 +14215,9 @@ function PolylineHotspot({
|
|
|
14071
14215
|
}
|
|
14072
14216
|
|
|
14073
14217
|
// src/hotspot/graphic-hotspot.tsx
|
|
14074
|
-
var
|
|
14218
|
+
var import_react50 = require("react");
|
|
14075
14219
|
var import_three26 = require("three");
|
|
14076
|
-
var
|
|
14220
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
14077
14221
|
var GRAPHIC_TEXTURE_SIZE = 512;
|
|
14078
14222
|
function resolveStrokeWidth(value) {
|
|
14079
14223
|
return Number.isFinite(value) ? Math.max(value, 0) : 8;
|
|
@@ -14262,12 +14406,12 @@ function createGraphicTexture(graphic, aspectWidth, aspectHeight) {
|
|
|
14262
14406
|
return texture;
|
|
14263
14407
|
}
|
|
14264
14408
|
function useGraphicTexture(graphic, aspectWidth, aspectHeight, onLoad, onError) {
|
|
14265
|
-
const [texture, setTexture] = (0,
|
|
14266
|
-
const onLoadRef = (0,
|
|
14267
|
-
const onErrorRef = (0,
|
|
14409
|
+
const [texture, setTexture] = (0, import_react50.useState)(null);
|
|
14410
|
+
const onLoadRef = (0, import_react50.useRef)(onLoad);
|
|
14411
|
+
const onErrorRef = (0, import_react50.useRef)(onError);
|
|
14268
14412
|
onLoadRef.current = onLoad;
|
|
14269
14413
|
onErrorRef.current = onError;
|
|
14270
|
-
(0,
|
|
14414
|
+
(0, import_react50.useEffect)(() => {
|
|
14271
14415
|
let nextTexture = null;
|
|
14272
14416
|
try {
|
|
14273
14417
|
nextTexture = createGraphicTexture(graphic, aspectWidth, aspectHeight);
|
|
@@ -14293,22 +14437,22 @@ function CanvasGraphicHotspot({
|
|
|
14293
14437
|
...anchorProps
|
|
14294
14438
|
}) {
|
|
14295
14439
|
const texture = useGraphicTexture(graphic, width, height, onLoad, onError);
|
|
14296
|
-
return /* @__PURE__ */ (0,
|
|
14440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(HotspotAnchor, { ...anchorProps, height, width, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(HotspotPlane, { map: texture, opacity }) });
|
|
14297
14441
|
}
|
|
14298
14442
|
function GraphicHotspot(props) {
|
|
14299
14443
|
const { graphic, ...restProps } = props;
|
|
14300
14444
|
if (graphic.kind === "svg") {
|
|
14301
14445
|
const imageProps = restProps;
|
|
14302
|
-
return /* @__PURE__ */ (0,
|
|
14446
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ImageHotspot, { ...imageProps, src: graphic.src });
|
|
14303
14447
|
}
|
|
14304
|
-
return /* @__PURE__ */ (0,
|
|
14448
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CanvasGraphicHotspot, { ...restProps, graphic });
|
|
14305
14449
|
}
|
|
14306
14450
|
|
|
14307
14451
|
// src/hotspot/sequence-hotspot.tsx
|
|
14308
14452
|
var import_fiber25 = require("@react-three/fiber");
|
|
14309
|
-
var
|
|
14453
|
+
var import_react51 = require("react");
|
|
14310
14454
|
var import_three27 = require("three");
|
|
14311
|
-
var
|
|
14455
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
14312
14456
|
var DEFAULT_SEQUENCE_FPS = 12;
|
|
14313
14457
|
function resolveFps(value) {
|
|
14314
14458
|
return Number.isFinite(value) && value > 0 ? value : DEFAULT_SEQUENCE_FPS;
|
|
@@ -14323,12 +14467,12 @@ function useSpriteTexture({
|
|
|
14323
14467
|
onLoadProgress
|
|
14324
14468
|
}) {
|
|
14325
14469
|
const gl = (0, import_fiber25.useThree)((state) => state.gl);
|
|
14326
|
-
const [texture, setTexture] = (0,
|
|
14327
|
-
const onErrorRef = (0,
|
|
14328
|
-
const onLoadProgressRef = (0,
|
|
14470
|
+
const [texture, setTexture] = (0, import_react51.useState)(null);
|
|
14471
|
+
const onErrorRef = (0, import_react51.useRef)(onError);
|
|
14472
|
+
const onLoadProgressRef = (0, import_react51.useRef)(onLoadProgress);
|
|
14329
14473
|
onErrorRef.current = onError;
|
|
14330
14474
|
onLoadProgressRef.current = onLoadProgress;
|
|
14331
|
-
(0,
|
|
14475
|
+
(0, import_react51.useEffect)(() => {
|
|
14332
14476
|
let active = true;
|
|
14333
14477
|
setTexture(null);
|
|
14334
14478
|
if (!src) {
|
|
@@ -14369,7 +14513,7 @@ function useSpriteTexture({
|
|
|
14369
14513
|
active = false;
|
|
14370
14514
|
};
|
|
14371
14515
|
}, [gl, id, src]);
|
|
14372
|
-
(0,
|
|
14516
|
+
(0, import_react51.useEffect)(
|
|
14373
14517
|
() => () => {
|
|
14374
14518
|
texture?.dispose();
|
|
14375
14519
|
},
|
|
@@ -14398,24 +14542,24 @@ function SequenceHotspot({
|
|
|
14398
14542
|
const texture = useSpriteTexture({ id, src, onError, onLoadProgress });
|
|
14399
14543
|
const frameCount = resolveFrameCount(requestedFrameCount);
|
|
14400
14544
|
const safeFps = resolveFps(fps);
|
|
14401
|
-
const [frameIndex, setFrameIndex] = (0,
|
|
14402
|
-
const elapsedRef = (0,
|
|
14403
|
-
const frameIndexRef = (0,
|
|
14404
|
-
const endedRef = (0,
|
|
14405
|
-
const lastPlaybackStateRef = (0,
|
|
14406
|
-
const onFrameChangeRef = (0,
|
|
14407
|
-
const onPlaybackStateChangeRef = (0,
|
|
14408
|
-
const onEndedRef = (0,
|
|
14545
|
+
const [frameIndex, setFrameIndex] = (0, import_react51.useState)(0);
|
|
14546
|
+
const elapsedRef = (0, import_react51.useRef)(0);
|
|
14547
|
+
const frameIndexRef = (0, import_react51.useRef)(0);
|
|
14548
|
+
const endedRef = (0, import_react51.useRef)(false);
|
|
14549
|
+
const lastPlaybackStateRef = (0, import_react51.useRef)(null);
|
|
14550
|
+
const onFrameChangeRef = (0, import_react51.useRef)(onFrameChange);
|
|
14551
|
+
const onPlaybackStateChangeRef = (0, import_react51.useRef)(onPlaybackStateChange);
|
|
14552
|
+
const onEndedRef = (0, import_react51.useRef)(onEnded);
|
|
14409
14553
|
onFrameChangeRef.current = onFrameChange;
|
|
14410
14554
|
onPlaybackStateChangeRef.current = onPlaybackStateChange;
|
|
14411
14555
|
onEndedRef.current = onEnded;
|
|
14412
|
-
(0,
|
|
14556
|
+
(0, import_react51.useEffect)(() => {
|
|
14413
14557
|
elapsedRef.current = 0;
|
|
14414
14558
|
frameIndexRef.current = 0;
|
|
14415
14559
|
endedRef.current = false;
|
|
14416
14560
|
setFrameIndex(0);
|
|
14417
14561
|
}, [frameCount, frameDirection, src]);
|
|
14418
|
-
(0,
|
|
14562
|
+
(0, import_react51.useEffect)(() => {
|
|
14419
14563
|
if (!texture) {
|
|
14420
14564
|
return;
|
|
14421
14565
|
}
|
|
@@ -14429,13 +14573,13 @@ function SequenceHotspot({
|
|
|
14429
14573
|
);
|
|
14430
14574
|
texture.needsUpdate = true;
|
|
14431
14575
|
}, [frameCount, frameDirection, frameIndex, texture]);
|
|
14432
|
-
(0,
|
|
14576
|
+
(0, import_react51.useEffect)(() => {
|
|
14433
14577
|
if (!texture) {
|
|
14434
14578
|
return;
|
|
14435
14579
|
}
|
|
14436
14580
|
onFrameChangeRef.current?.({ id, index: 0, src });
|
|
14437
14581
|
}, [id, src, texture]);
|
|
14438
|
-
(0,
|
|
14582
|
+
(0, import_react51.useEffect)(() => {
|
|
14439
14583
|
if (!texture) {
|
|
14440
14584
|
return;
|
|
14441
14585
|
}
|
|
@@ -14484,14 +14628,14 @@ function SequenceHotspot({
|
|
|
14484
14628
|
onFrameChangeRef.current?.({ id, index: nextIndex, src });
|
|
14485
14629
|
}
|
|
14486
14630
|
});
|
|
14487
|
-
return /* @__PURE__ */ (0,
|
|
14631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(HotspotAnchor, { ...anchorProps, id, height, width, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(HotspotPlane, { map: texture, opacity }) });
|
|
14488
14632
|
}
|
|
14489
14633
|
|
|
14490
14634
|
// src/hotspot/video-hotspot.tsx
|
|
14491
14635
|
var import_fiber26 = require("@react-three/fiber");
|
|
14492
|
-
var
|
|
14636
|
+
var import_react52 = require("react");
|
|
14493
14637
|
var import_three28 = require("three");
|
|
14494
|
-
var
|
|
14638
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
14495
14639
|
function clampVolume2(volume) {
|
|
14496
14640
|
if (!Number.isFinite(volume)) {
|
|
14497
14641
|
return 1;
|
|
@@ -14500,10 +14644,10 @@ function clampVolume2(volume) {
|
|
|
14500
14644
|
}
|
|
14501
14645
|
function usePosterTexture2(id, poster, onError) {
|
|
14502
14646
|
const gl = (0, import_fiber26.useThree)((state) => state.gl);
|
|
14503
|
-
const [texture, setTexture] = (0,
|
|
14504
|
-
const onErrorRef = (0,
|
|
14647
|
+
const [texture, setTexture] = (0, import_react52.useState)(null);
|
|
14648
|
+
const onErrorRef = (0, import_react52.useRef)(onError);
|
|
14505
14649
|
onErrorRef.current = onError;
|
|
14506
|
-
(0,
|
|
14650
|
+
(0, import_react52.useEffect)(() => {
|
|
14507
14651
|
let active = true;
|
|
14508
14652
|
setTexture(null);
|
|
14509
14653
|
if (!poster) {
|
|
@@ -14540,7 +14684,7 @@ function usePosterTexture2(id, poster, onError) {
|
|
|
14540
14684
|
active = false;
|
|
14541
14685
|
};
|
|
14542
14686
|
}, [gl, id, poster]);
|
|
14543
|
-
(0,
|
|
14687
|
+
(0, import_react52.useEffect)(
|
|
14544
14688
|
() => () => {
|
|
14545
14689
|
texture?.dispose();
|
|
14546
14690
|
},
|
|
@@ -14558,14 +14702,14 @@ function useVideoResource({
|
|
|
14558
14702
|
poster,
|
|
14559
14703
|
src
|
|
14560
14704
|
}) {
|
|
14561
|
-
const [resource, setResource] = (0,
|
|
14562
|
-
const onEndedRef = (0,
|
|
14563
|
-
const onErrorRef = (0,
|
|
14564
|
-
const onPlaybackStateChangeRef = (0,
|
|
14705
|
+
const [resource, setResource] = (0, import_react52.useState)(null);
|
|
14706
|
+
const onEndedRef = (0, import_react52.useRef)(onEnded);
|
|
14707
|
+
const onErrorRef = (0, import_react52.useRef)(onError);
|
|
14708
|
+
const onPlaybackStateChangeRef = (0, import_react52.useRef)(onPlaybackStateChange);
|
|
14565
14709
|
onEndedRef.current = onEnded;
|
|
14566
14710
|
onErrorRef.current = onError;
|
|
14567
14711
|
onPlaybackStateChangeRef.current = onPlaybackStateChange;
|
|
14568
|
-
(0,
|
|
14712
|
+
(0, import_react52.useEffect)(() => {
|
|
14569
14713
|
if (!src) {
|
|
14570
14714
|
setResource(null);
|
|
14571
14715
|
return;
|
|
@@ -14575,7 +14719,12 @@ function useVideoResource({
|
|
|
14575
14719
|
if (crossOrigin !== void 0) {
|
|
14576
14720
|
video.crossOrigin = crossOrigin;
|
|
14577
14721
|
}
|
|
14578
|
-
|
|
14722
|
+
const inline = playsInline ?? true;
|
|
14723
|
+
video.playsInline = inline;
|
|
14724
|
+
if (inline) {
|
|
14725
|
+
video.setAttribute("playsinline", "true");
|
|
14726
|
+
video.setAttribute("webkit-playsinline", "true");
|
|
14727
|
+
}
|
|
14579
14728
|
video.poster = poster ?? "";
|
|
14580
14729
|
const texture = new import_three28.VideoTexture(video);
|
|
14581
14730
|
texture.colorSpace = import_three28.SRGBColorSpace;
|
|
@@ -14655,6 +14804,7 @@ function VideoHotspot({
|
|
|
14655
14804
|
onError,
|
|
14656
14805
|
...anchorProps
|
|
14657
14806
|
}) {
|
|
14807
|
+
usePanoMediaActivationIntent(playing);
|
|
14658
14808
|
const resource = useVideoResource({
|
|
14659
14809
|
crossOrigin,
|
|
14660
14810
|
id,
|
|
@@ -14666,11 +14816,11 @@ function VideoHotspot({
|
|
|
14666
14816
|
src
|
|
14667
14817
|
});
|
|
14668
14818
|
const posterTexture = usePosterTexture2(id, poster, onError);
|
|
14669
|
-
const onPlaybackErrorRef = (0,
|
|
14670
|
-
const onPlaybackStateChangeRef = (0,
|
|
14819
|
+
const onPlaybackErrorRef = (0, import_react52.useRef)(onPlaybackError);
|
|
14820
|
+
const onPlaybackStateChangeRef = (0, import_react52.useRef)(onPlaybackStateChange);
|
|
14671
14821
|
onPlaybackErrorRef.current = onPlaybackError;
|
|
14672
14822
|
onPlaybackStateChangeRef.current = onPlaybackStateChange;
|
|
14673
|
-
(0,
|
|
14823
|
+
(0, import_react52.useEffect)(() => {
|
|
14674
14824
|
if (!resource) {
|
|
14675
14825
|
return;
|
|
14676
14826
|
}
|
|
@@ -14678,9 +14828,16 @@ function VideoHotspot({
|
|
|
14678
14828
|
resource.video.muted = muted;
|
|
14679
14829
|
resource.video.volume = clampVolume2(volume);
|
|
14680
14830
|
resource.video.playsInline = playsInline;
|
|
14831
|
+
if (playsInline) {
|
|
14832
|
+
resource.video.setAttribute("playsinline", "true");
|
|
14833
|
+
resource.video.setAttribute("webkit-playsinline", "true");
|
|
14834
|
+
} else {
|
|
14835
|
+
resource.video.removeAttribute("playsinline");
|
|
14836
|
+
resource.video.removeAttribute("webkit-playsinline");
|
|
14837
|
+
}
|
|
14681
14838
|
resource.video.preload = preload;
|
|
14682
14839
|
}, [loop, muted, playsInline, preload, resource, volume]);
|
|
14683
|
-
(0,
|
|
14840
|
+
(0, import_react52.useEffect)(() => {
|
|
14684
14841
|
if (!resource) {
|
|
14685
14842
|
return;
|
|
14686
14843
|
}
|
|
@@ -14703,14 +14860,14 @@ function VideoHotspot({
|
|
|
14703
14860
|
};
|
|
14704
14861
|
}, [playing, resource]);
|
|
14705
14862
|
const activeTexture = resource?.ready ? resource.texture : posterTexture;
|
|
14706
|
-
return /* @__PURE__ */ (0,
|
|
14863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(HotspotAnchor, { ...anchorProps, id, height, width, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(HotspotPlane, { map: activeTexture, opacity }) });
|
|
14707
14864
|
}
|
|
14708
14865
|
|
|
14709
14866
|
// src/hotspot/audio-hotspot.tsx
|
|
14710
14867
|
var import_fiber27 = require("@react-three/fiber");
|
|
14711
|
-
var
|
|
14868
|
+
var import_react53 = require("react");
|
|
14712
14869
|
var import_three29 = require("three");
|
|
14713
|
-
var
|
|
14870
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
14714
14871
|
var SPEAKER_TEXTURE_SIZE = 512;
|
|
14715
14872
|
function paintSpeakerBody(context, center) {
|
|
14716
14873
|
context.fillStyle = "#f5fbfc";
|
|
@@ -14774,8 +14931,8 @@ function createSpeakerTexture(state) {
|
|
|
14774
14931
|
return texture;
|
|
14775
14932
|
}
|
|
14776
14933
|
function useSpeakerTextures(enabled) {
|
|
14777
|
-
const [textures, setTextures] = (0,
|
|
14778
|
-
(0,
|
|
14934
|
+
const [textures, setTextures] = (0, import_react53.useState)({ playing: null, stopped: null });
|
|
14935
|
+
(0, import_react53.useEffect)(() => {
|
|
14779
14936
|
if (!enabled) {
|
|
14780
14937
|
setTextures({ playing: null, stopped: null });
|
|
14781
14938
|
return;
|
|
@@ -14792,10 +14949,10 @@ function useSpeakerTextures(enabled) {
|
|
|
14792
14949
|
}
|
|
14793
14950
|
function useIconTexture(icon, enabled, onError, id) {
|
|
14794
14951
|
const gl = (0, import_fiber27.useThree)((state) => state.gl);
|
|
14795
|
-
const [texture, setTexture] = (0,
|
|
14796
|
-
const onErrorRef = (0,
|
|
14952
|
+
const [texture, setTexture] = (0, import_react53.useState)(null);
|
|
14953
|
+
const onErrorRef = (0, import_react53.useRef)(onError);
|
|
14797
14954
|
onErrorRef.current = onError;
|
|
14798
|
-
(0,
|
|
14955
|
+
(0, import_react53.useEffect)(() => {
|
|
14799
14956
|
let active = true;
|
|
14800
14957
|
setTexture(null);
|
|
14801
14958
|
if (!enabled || !icon) {
|
|
@@ -14832,7 +14989,7 @@ function useIconTexture(icon, enabled, onError, id) {
|
|
|
14832
14989
|
active = false;
|
|
14833
14990
|
};
|
|
14834
14991
|
}, [enabled, gl, icon, id]);
|
|
14835
|
-
(0,
|
|
14992
|
+
(0, import_react53.useEffect)(
|
|
14836
14993
|
() => () => {
|
|
14837
14994
|
texture?.dispose();
|
|
14838
14995
|
},
|
|
@@ -14851,13 +15008,13 @@ function useAudioHowl({
|
|
|
14851
15008
|
playing,
|
|
14852
15009
|
src
|
|
14853
15010
|
}) {
|
|
14854
|
-
const [howl, setHowl] = (0,
|
|
14855
|
-
const playingRef = (0,
|
|
14856
|
-
const loopRef = (0,
|
|
14857
|
-
const onEndedRef = (0,
|
|
14858
|
-
const onErrorRef = (0,
|
|
14859
|
-
const onPlaybackErrorRef = (0,
|
|
14860
|
-
const onPlaybackStateChangeRef = (0,
|
|
15011
|
+
const [howl, setHowl] = (0, import_react53.useState)(null);
|
|
15012
|
+
const playingRef = (0, import_react53.useRef)(playing);
|
|
15013
|
+
const loopRef = (0, import_react53.useRef)(loop ?? false);
|
|
15014
|
+
const onEndedRef = (0, import_react53.useRef)(onEnded);
|
|
15015
|
+
const onErrorRef = (0, import_react53.useRef)(onError);
|
|
15016
|
+
const onPlaybackErrorRef = (0, import_react53.useRef)(onPlaybackError);
|
|
15017
|
+
const onPlaybackStateChangeRef = (0, import_react53.useRef)(onPlaybackStateChange);
|
|
14861
15018
|
playingRef.current = playing;
|
|
14862
15019
|
loopRef.current = loop ?? false;
|
|
14863
15020
|
onEndedRef.current = onEnded;
|
|
@@ -14865,7 +15022,7 @@ function useAudioHowl({
|
|
|
14865
15022
|
onPlaybackErrorRef.current = onPlaybackError;
|
|
14866
15023
|
onPlaybackStateChangeRef.current = onPlaybackStateChange;
|
|
14867
15024
|
const sourcesKey = sourceList(src).join("\0");
|
|
14868
|
-
(0,
|
|
15025
|
+
(0, import_react53.useEffect)(() => {
|
|
14869
15026
|
const sources = sourcesKey.length > 0 ? sourcesKey.split("\0") : [];
|
|
14870
15027
|
if (sources.length === 0) {
|
|
14871
15028
|
setHowl(null);
|
|
@@ -14902,7 +15059,7 @@ function useAudioHowl({
|
|
|
14902
15059
|
handle.dispose();
|
|
14903
15060
|
};
|
|
14904
15061
|
}, [crossOrigin, id, sourcesKey]);
|
|
14905
|
-
(0,
|
|
15062
|
+
(0, import_react53.useEffect)(() => {
|
|
14906
15063
|
howl?.loop(loop ?? false);
|
|
14907
15064
|
}, [howl, loop]);
|
|
14908
15065
|
return howl;
|
|
@@ -14929,6 +15086,7 @@ function AudioHotspot({
|
|
|
14929
15086
|
onError,
|
|
14930
15087
|
...anchorProps
|
|
14931
15088
|
}) {
|
|
15089
|
+
usePanoMediaActivationIntent(playing);
|
|
14932
15090
|
const camera = (0, import_fiber27.useThree)((state) => state.camera);
|
|
14933
15091
|
const howl = useAudioHowl({
|
|
14934
15092
|
crossOrigin,
|
|
@@ -14945,15 +15103,15 @@ function AudioHotspot({
|
|
|
14945
15103
|
const stoppedIconTexture = useIconTexture(icon, marker, onError, id);
|
|
14946
15104
|
const playingIconTexture = useIconTexture(playingIcon, marker, onError, id);
|
|
14947
15105
|
const markerTexture = playing ? playingIconTexture ?? stoppedIconTexture ?? speakerTextures.playing : stoppedIconTexture ?? speakerTextures.stopped;
|
|
14948
|
-
const playingRef = (0,
|
|
15106
|
+
const playingRef = (0, import_react53.useRef)(playing);
|
|
14949
15107
|
playingRef.current = playing;
|
|
14950
|
-
const mutedRef = (0,
|
|
14951
|
-
const volumeRef = (0,
|
|
14952
|
-
const rangeRef = (0,
|
|
15108
|
+
const mutedRef = (0, import_react53.useRef)(muted);
|
|
15109
|
+
const volumeRef = (0, import_react53.useRef)(volume);
|
|
15110
|
+
const rangeRef = (0, import_react53.useRef)(range);
|
|
14953
15111
|
mutedRef.current = muted;
|
|
14954
15112
|
volumeRef.current = volume;
|
|
14955
15113
|
rangeRef.current = range;
|
|
14956
|
-
(0,
|
|
15114
|
+
(0, import_react53.useEffect)(() => {
|
|
14957
15115
|
if (!howl) {
|
|
14958
15116
|
return;
|
|
14959
15117
|
}
|
|
@@ -14963,7 +15121,7 @@ function AudioHotspot({
|
|
|
14963
15121
|
}
|
|
14964
15122
|
howl.play();
|
|
14965
15123
|
}, [howl, playing]);
|
|
14966
|
-
(0,
|
|
15124
|
+
(0, import_react53.useEffect)(() => {
|
|
14967
15125
|
if (!howl || !pauseWhenHidden) {
|
|
14968
15126
|
return;
|
|
14969
15127
|
}
|
|
@@ -14994,13 +15152,13 @@ function AudioHotspot({
|
|
|
14994
15152
|
howl.mute(mutedRef.current);
|
|
14995
15153
|
howl.volume(clampAudioVolume(volumeRef.current) * spatial.gain);
|
|
14996
15154
|
});
|
|
14997
|
-
return /* @__PURE__ */ (0,
|
|
15155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(HotspotAnchor, { ...anchorProps, id, height, width, children: marker ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(HotspotPlane, { map: markerTexture, opacity }) : null });
|
|
14998
15156
|
}
|
|
14999
15157
|
|
|
15000
15158
|
// src/hotspot/text-hotspot.tsx
|
|
15001
|
-
var
|
|
15159
|
+
var import_react54 = require("react");
|
|
15002
15160
|
var import_three30 = require("three");
|
|
15003
|
-
var
|
|
15161
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
15004
15162
|
var TEXT_TEXTURE_LONG_SIDE = 1024;
|
|
15005
15163
|
var DEFAULT_FONT_FAMILY = "system-ui, sans-serif";
|
|
15006
15164
|
var DEFAULT_FONT_SIZE = 96;
|
|
@@ -15220,12 +15378,12 @@ function createTextTexture(text, width, height, style) {
|
|
|
15220
15378
|
return texture;
|
|
15221
15379
|
}
|
|
15222
15380
|
function useTextTexture(text, width, height, style, onLoad, onError) {
|
|
15223
|
-
const [texture, setTexture] = (0,
|
|
15224
|
-
const onLoadRef = (0,
|
|
15225
|
-
const onErrorRef = (0,
|
|
15381
|
+
const [texture, setTexture] = (0, import_react54.useState)(null);
|
|
15382
|
+
const onLoadRef = (0, import_react54.useRef)(onLoad);
|
|
15383
|
+
const onErrorRef = (0, import_react54.useRef)(onError);
|
|
15226
15384
|
onLoadRef.current = onLoad;
|
|
15227
15385
|
onErrorRef.current = onError;
|
|
15228
|
-
(0,
|
|
15386
|
+
(0, import_react54.useEffect)(() => {
|
|
15229
15387
|
let cancelled = false;
|
|
15230
15388
|
let nextTexture = null;
|
|
15231
15389
|
const run = async () => {
|
|
@@ -15318,13 +15476,13 @@ function TextHotspot({
|
|
|
15318
15476
|
whiteSpace
|
|
15319
15477
|
};
|
|
15320
15478
|
const texture = useTextTexture(text, width, height, style, onLoad, onError);
|
|
15321
|
-
return /* @__PURE__ */ (0,
|
|
15479
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(HotspotAnchor, { ...anchorProps, height, width, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(HotspotPlane, { map: texture, opacity }) });
|
|
15322
15480
|
}
|
|
15323
15481
|
|
|
15324
15482
|
// src/hotspot/iframe-hotspot.tsx
|
|
15325
15483
|
var import_drei3 = require("@react-three/drei");
|
|
15326
15484
|
var import_three31 = require("three");
|
|
15327
|
-
var
|
|
15485
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
15328
15486
|
var IFRAME_LONG_SIDE = 800;
|
|
15329
15487
|
var CSS3D_DISTANCE_FACTOR = 400;
|
|
15330
15488
|
var DEFAULT_SANDBOX = "allow-scripts allow-popups allow-forms";
|
|
@@ -15381,7 +15539,7 @@ function IframeHotspot({
|
|
|
15381
15539
|
interactive,
|
|
15382
15540
|
pointerEvents
|
|
15383
15541
|
);
|
|
15384
|
-
return /* @__PURE__ */ (0,
|
|
15542
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
15385
15543
|
HotspotAnchor,
|
|
15386
15544
|
{
|
|
15387
15545
|
...anchorProps,
|
|
@@ -15390,9 +15548,9 @@ function IframeHotspot({
|
|
|
15390
15548
|
pointerEvents,
|
|
15391
15549
|
width,
|
|
15392
15550
|
children: [
|
|
15393
|
-
/* @__PURE__ */ (0,
|
|
15394
|
-
/* @__PURE__ */ (0,
|
|
15395
|
-
/* @__PURE__ */ (0,
|
|
15551
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("mesh", { children: [
|
|
15552
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("planeGeometry", { args: [1, 1] }),
|
|
15553
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
15396
15554
|
"meshBasicMaterial",
|
|
15397
15555
|
{
|
|
15398
15556
|
depthWrite: false,
|
|
@@ -15403,7 +15561,7 @@ function IframeHotspot({
|
|
|
15403
15561
|
}
|
|
15404
15562
|
)
|
|
15405
15563
|
] }),
|
|
15406
|
-
/* @__PURE__ */ (0,
|
|
15564
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
15407
15565
|
import_drei3.Html,
|
|
15408
15566
|
{
|
|
15409
15567
|
distanceFactor: CSS3D_DISTANCE_FACTOR,
|
|
@@ -15418,7 +15576,7 @@ function IframeHotspot({
|
|
|
15418
15576
|
},
|
|
15419
15577
|
transform: true,
|
|
15420
15578
|
zIndexRange: [10, 0],
|
|
15421
|
-
children: /* @__PURE__ */ (0,
|
|
15579
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
15422
15580
|
"iframe",
|
|
15423
15581
|
{
|
|
15424
15582
|
allow,
|