@ericchen1990/pano-view 3.2.1 → 3.2.2
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/dist/index.cjs +258 -199
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +244 -177
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -13335,8 +13335,8 @@ function Scenes({
|
|
|
13335
13335
|
}
|
|
13336
13336
|
|
|
13337
13337
|
// src/hotspot/image-hotspot.tsx
|
|
13338
|
-
import { useThree as
|
|
13339
|
-
import { useEffect as useEffect32, useRef as
|
|
13338
|
+
import { useThree as useThree23 } from "@react-three/fiber";
|
|
13339
|
+
import { useEffect as useEffect32, useRef as useRef32, useState as useState17 } from "react";
|
|
13340
13340
|
import {
|
|
13341
13341
|
ClampToEdgeWrapping as ClampToEdgeWrapping3,
|
|
13342
13342
|
LinearFilter as LinearFilter6,
|
|
@@ -13346,34 +13346,40 @@ import {
|
|
|
13346
13346
|
} from "three";
|
|
13347
13347
|
|
|
13348
13348
|
// src/hotspot/hotspot-anchor.tsx
|
|
13349
|
-
import { useFrame as
|
|
13349
|
+
import { useFrame as useFrame15, useThree as useThree22 } from "@react-three/fiber";
|
|
13350
13350
|
import {
|
|
13351
13351
|
useContext as useContext25,
|
|
13352
13352
|
useEffect as useEffect31,
|
|
13353
|
-
useLayoutEffect as
|
|
13353
|
+
useLayoutEffect as useLayoutEffect5,
|
|
13354
13354
|
useMemo as useMemo23,
|
|
13355
|
-
useRef as
|
|
13355
|
+
useRef as useRef31,
|
|
13356
13356
|
useState as useState16
|
|
13357
13357
|
} from "react";
|
|
13358
13358
|
import {
|
|
13359
13359
|
Box3 as Box34,
|
|
13360
13360
|
EdgesGeometry,
|
|
13361
|
-
MathUtils as
|
|
13361
|
+
MathUtils as MathUtils9,
|
|
13362
13362
|
Matrix4 as Matrix44,
|
|
13363
13363
|
Plane,
|
|
13364
13364
|
PlaneGeometry as PlaneGeometry5,
|
|
13365
|
-
|
|
13366
|
-
Quaternion as Quaternion3,
|
|
13365
|
+
Quaternion as Quaternion4,
|
|
13367
13366
|
Ray,
|
|
13368
|
-
Vector3 as
|
|
13367
|
+
Vector3 as Vector316
|
|
13369
13368
|
} from "three";
|
|
13370
13369
|
|
|
13371
13370
|
// src/hotspot/hotspot-tooltip.tsx
|
|
13372
13371
|
import { useEffect as useEffect30, useMemo as useMemo22, useState as useState15 } from "react";
|
|
13373
13372
|
|
|
13374
13373
|
// src/webvr/stereo-html.tsx
|
|
13375
|
-
import {
|
|
13376
|
-
import {
|
|
13374
|
+
import { useFrame as useFrame14, useThree as useThree21 } from "@react-three/fiber";
|
|
13375
|
+
import {
|
|
13376
|
+
useContext as useContext24,
|
|
13377
|
+
useLayoutEffect as useLayoutEffect4,
|
|
13378
|
+
useRef as useRef30,
|
|
13379
|
+
useSyncExternalStore as useSyncExternalStore7
|
|
13380
|
+
} from "react";
|
|
13381
|
+
import { createRoot } from "react-dom/client";
|
|
13382
|
+
import { Vector3 as Vector314 } from "three";
|
|
13377
13383
|
import { Fragment as Fragment7, jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
13378
13384
|
function useFallbackStereoView() {
|
|
13379
13385
|
const runtime = useContext24(WebVRRuntimeContext);
|
|
@@ -13383,43 +13389,87 @@ function useFallbackStereoView() {
|
|
|
13383
13389
|
() => isFallbackStereoMode(host?.snapshot.mode ?? null),
|
|
13384
13390
|
() => false
|
|
13385
13391
|
);
|
|
13386
|
-
|
|
13387
|
-
return null;
|
|
13388
|
-
}
|
|
13389
|
-
return runtime.stereoView;
|
|
13392
|
+
return fallback && runtime ? runtime.stereoView : null;
|
|
13390
13393
|
}
|
|
13391
|
-
function
|
|
13392
|
-
|
|
13393
|
-
|
|
13394
|
-
|
|
13395
|
-
|
|
13396
|
-
|
|
13397
|
-
|
|
13394
|
+
function ProjectedHtml({
|
|
13395
|
+
children,
|
|
13396
|
+
pointerEvents = "auto",
|
|
13397
|
+
style,
|
|
13398
|
+
zIndexRange = [16777271, 0],
|
|
13399
|
+
stereoView,
|
|
13400
|
+
eye
|
|
13401
|
+
}) {
|
|
13402
|
+
const { camera, gl, events, size } = useThree21();
|
|
13403
|
+
const group = useRef30(null);
|
|
13404
|
+
const overlay = useRef30(null);
|
|
13405
|
+
const scratch = useRef30(new Vector314());
|
|
13406
|
+
const target = events.connected || gl.domElement.parentElement;
|
|
13407
|
+
const updatePosition = () => {
|
|
13408
|
+
const anchor = group.current;
|
|
13409
|
+
const element = overlay.current?.element;
|
|
13410
|
+
if (!anchor || !element) return;
|
|
13411
|
+
const viewCamera = stereoView && eye ? eye === "left" ? stereoView.stereo.cameraL : stereoView.stereo.cameraR : camera;
|
|
13412
|
+
anchor.updateWorldMatrix(true, false);
|
|
13413
|
+
const position = scratch.current.setFromMatrixPosition(anchor.matrixWorld);
|
|
13414
|
+
const distance = position.distanceTo(viewCamera.position);
|
|
13415
|
+
position.applyMatrix4(viewCamera.matrixWorldInverse);
|
|
13416
|
+
element.style.display = position.z < 0 ? "block" : "none";
|
|
13417
|
+
let x;
|
|
13418
|
+
let y;
|
|
13419
|
+
if (stereoView && eye) {
|
|
13420
|
+
[x, y] = projectStereoHtmlPosition(anchor, viewCamera, size, eye);
|
|
13421
|
+
} else {
|
|
13422
|
+
position.setFromMatrixPosition(anchor.matrixWorld).project(viewCamera);
|
|
13423
|
+
x = (position.x + 1) * size.width / 2;
|
|
13424
|
+
y = (1 - position.y) * size.height / 2;
|
|
13425
|
+
}
|
|
13426
|
+
element.style.transform = `translate3d(${x}px,${y}px,0)`;
|
|
13427
|
+
element.style.zIndex = String(
|
|
13428
|
+
Math.round(
|
|
13429
|
+
zIndexRange[0] + (zIndexRange[1] - zIndexRange[0]) * (distance - viewCamera.near) / (viewCamera.far - viewCamera.near)
|
|
13430
|
+
)
|
|
13431
|
+
);
|
|
13432
|
+
};
|
|
13433
|
+
useLayoutEffect4(() => {
|
|
13434
|
+
if (!target) return;
|
|
13435
|
+
const element = document.createElement("div");
|
|
13436
|
+
Object.assign(element.style, {
|
|
13437
|
+
position: "absolute",
|
|
13438
|
+
top: "0",
|
|
13439
|
+
left: "0",
|
|
13440
|
+
transformOrigin: "0 0"
|
|
13441
|
+
});
|
|
13442
|
+
const root = createRoot(element);
|
|
13443
|
+
overlay.current = { element, root };
|
|
13444
|
+
target.appendChild(element);
|
|
13445
|
+
return () => {
|
|
13446
|
+
overlay.current = null;
|
|
13447
|
+
element.remove();
|
|
13448
|
+
queueMicrotask(() => root.unmount());
|
|
13449
|
+
};
|
|
13450
|
+
}, [target]);
|
|
13451
|
+
useLayoutEffect4(() => {
|
|
13452
|
+
overlay.current?.root.render(
|
|
13453
|
+
/* @__PURE__ */ jsx24(
|
|
13454
|
+
"div",
|
|
13455
|
+
{
|
|
13456
|
+
"aria-hidden": eye === "right" || void 0,
|
|
13457
|
+
style: { position: "absolute", pointerEvents, ...style },
|
|
13458
|
+
children
|
|
13459
|
+
}
|
|
13460
|
+
)
|
|
13461
|
+
);
|
|
13462
|
+
updatePosition();
|
|
13463
|
+
});
|
|
13464
|
+
useFrame14(updatePosition);
|
|
13465
|
+
return /* @__PURE__ */ jsx24("group", { ref: group });
|
|
13398
13466
|
}
|
|
13399
|
-
function PanoHtml(
|
|
13467
|
+
function PanoHtml(props) {
|
|
13400
13468
|
const stereoView = useFallbackStereoView();
|
|
13401
|
-
|
|
13402
|
-
|
|
13403
|
-
|
|
13404
|
-
|
|
13405
|
-
/* @__PURE__ */ jsx24(
|
|
13406
|
-
Html,
|
|
13407
|
-
{
|
|
13408
|
-
...htmlProps,
|
|
13409
|
-
calculatePosition: stereoCalculatePosition("left", stereoView),
|
|
13410
|
-
children
|
|
13411
|
-
}
|
|
13412
|
-
),
|
|
13413
|
-
/* @__PURE__ */ jsx24(
|
|
13414
|
-
Html,
|
|
13415
|
-
{
|
|
13416
|
-
...htmlProps,
|
|
13417
|
-
"aria-hidden": true,
|
|
13418
|
-
calculatePosition: stereoCalculatePosition("right", stereoView),
|
|
13419
|
-
children
|
|
13420
|
-
}
|
|
13421
|
-
)
|
|
13422
|
-
] });
|
|
13469
|
+
return stereoView ? /* @__PURE__ */ jsxs15(Fragment7, { children: [
|
|
13470
|
+
/* @__PURE__ */ jsx24(ProjectedHtml, { ...props, stereoView, eye: "left" }),
|
|
13471
|
+
/* @__PURE__ */ jsx24(ProjectedHtml, { ...props, stereoView, eye: "right" })
|
|
13472
|
+
] }) : /* @__PURE__ */ jsx24(ProjectedHtml, { ...props });
|
|
13423
13473
|
}
|
|
13424
13474
|
|
|
13425
13475
|
// src/hotspot/hotspot-tooltip.tsx
|
|
@@ -13551,6 +13601,41 @@ function HotspotTooltip({
|
|
|
13551
13601
|
] }) });
|
|
13552
13602
|
}
|
|
13553
13603
|
|
|
13604
|
+
// src/hotspot/transform.ts
|
|
13605
|
+
import {
|
|
13606
|
+
MathUtils as MathUtils8,
|
|
13607
|
+
PerspectiveCamera as PerspectiveCamera6,
|
|
13608
|
+
Vector3 as Vector315
|
|
13609
|
+
} from "three";
|
|
13610
|
+
var LOCAL_FORWARD = new Vector315(0, 0, 1);
|
|
13611
|
+
var CAMERA_POSITION = new Vector315();
|
|
13612
|
+
function applyHotspotTransform(group, camera, orientation2, surfaceQuaternion3, rotation, scaleMode, referenceFov, useAngularScale, worldWidth, worldHeight, distance) {
|
|
13613
|
+
if (orientation2 === "billboard") {
|
|
13614
|
+
group.quaternion.copy(camera.quaternion);
|
|
13615
|
+
} else {
|
|
13616
|
+
group.quaternion.copy(surfaceQuaternion3);
|
|
13617
|
+
}
|
|
13618
|
+
group.rotateOnAxis(LOCAL_FORWARD, MathUtils8.degToRad(-rotation));
|
|
13619
|
+
let scaleFactor = scaleMode === "fixed" && camera instanceof PerspectiveCamera6 ? fixedScaleFactor(camera.fov, referenceFov) : 1;
|
|
13620
|
+
if (scaleMode === "fixed" && orientation2 === "billboard" && useAngularScale && camera instanceof PerspectiveCamera6) {
|
|
13621
|
+
group.updateWorldMatrix(true, false);
|
|
13622
|
+
CAMERA_POSITION.setFromMatrixPosition(group.matrixWorld).applyMatrix4(
|
|
13623
|
+
camera.matrixWorldInverse
|
|
13624
|
+
);
|
|
13625
|
+
scaleFactor *= Math.max(0, -CAMERA_POSITION.z) / distance;
|
|
13626
|
+
}
|
|
13627
|
+
group.scale.set(
|
|
13628
|
+
(useAngularScale ? worldWidth : 1) * scaleFactor,
|
|
13629
|
+
(useAngularScale ? worldHeight : 1) * scaleFactor,
|
|
13630
|
+
1
|
|
13631
|
+
);
|
|
13632
|
+
group.updateMatrixWorld();
|
|
13633
|
+
}
|
|
13634
|
+
function fixedScaleFactor(cameraFov, referenceFov) {
|
|
13635
|
+
const safeReferenceFov = MathUtils8.clamp(referenceFov, 1, 179);
|
|
13636
|
+
return Math.tan(MathUtils8.degToRad(cameraFov) / 2) / Math.tan(MathUtils8.degToRad(safeReferenceFov) / 2);
|
|
13637
|
+
}
|
|
13638
|
+
|
|
13554
13639
|
// src/hotspot/hotspot-anchor.tsx
|
|
13555
13640
|
import { jsx as jsx26, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
13556
13641
|
var DEFAULT_FLOATING_DISTANCE = 10;
|
|
@@ -13560,28 +13645,27 @@ var DEFAULT_REFERENCE_FOV = 75;
|
|
|
13560
13645
|
var MIN_ANGULAR_SIZE = 0.01;
|
|
13561
13646
|
var MAX_ANGULAR_SIZE = 179;
|
|
13562
13647
|
var DRAG_EPSILON_DEGREES = 1e-3;
|
|
13563
|
-
var LOCAL_FORWARD = new Vector314(0, 0, 1);
|
|
13564
13648
|
var TOOLTIP_WORLD_BOX = new Box34();
|
|
13565
13649
|
var TOOLTIP_LOCAL_BOX = new Box34();
|
|
13566
|
-
var TOOLTIP_CORNER = new
|
|
13650
|
+
var TOOLTIP_CORNER = new Vector316();
|
|
13567
13651
|
var TOOLTIP_INVERSE = new Matrix44();
|
|
13568
|
-
var TOOLTIP_WORLD_CORNER = new
|
|
13569
|
-
var TOOLTIP_PROJECTED = new
|
|
13570
|
-
var TOOLTIP_RAY_ORIGIN = new
|
|
13571
|
-
var TOOLTIP_RAY_FAR = new
|
|
13572
|
-
var TOOLTIP_RAY_DIRECTION = new
|
|
13652
|
+
var TOOLTIP_WORLD_CORNER = new Vector316();
|
|
13653
|
+
var TOOLTIP_PROJECTED = new Vector316();
|
|
13654
|
+
var TOOLTIP_RAY_ORIGIN = new Vector316();
|
|
13655
|
+
var TOOLTIP_RAY_FAR = new Vector316();
|
|
13656
|
+
var TOOLTIP_RAY_DIRECTION = new Vector316();
|
|
13573
13657
|
var TOOLTIP_RAY = new Ray();
|
|
13574
13658
|
var TOOLTIP_PLANE = new Plane();
|
|
13575
|
-
var TOOLTIP_INTERSECTION = new
|
|
13576
|
-
var TOOLTIP_PLANE_NORMAL = new
|
|
13577
|
-
var TOOLTIP_PLANE_POINT = new
|
|
13659
|
+
var TOOLTIP_INTERSECTION = new Vector316();
|
|
13660
|
+
var TOOLTIP_PLANE_NORMAL = new Vector316();
|
|
13661
|
+
var TOOLTIP_PLANE_POINT = new Vector316();
|
|
13578
13662
|
var HOTSPOT_MODE_RENDERING = {
|
|
13579
13663
|
surface: { orientation: "surface", placement: "surface" },
|
|
13580
13664
|
billboard: { orientation: "billboard", placement: "floating" }
|
|
13581
13665
|
};
|
|
13582
13666
|
function angularSizeToWorldSize(size, radius) {
|
|
13583
|
-
const safeSize = Number.isFinite(size) ?
|
|
13584
|
-
return 2 * radius * Math.tan(
|
|
13667
|
+
const safeSize = Number.isFinite(size) ? MathUtils9.clamp(Math.abs(size), MIN_ANGULAR_SIZE, MAX_ANGULAR_SIZE) : MIN_ANGULAR_SIZE;
|
|
13668
|
+
return 2 * radius * Math.tan(MathUtils9.degToRad(safeSize) / 2);
|
|
13585
13669
|
}
|
|
13586
13670
|
function resolveScale(scale) {
|
|
13587
13671
|
return Number.isFinite(scale) && scale > 0 ? scale : 1;
|
|
@@ -13594,58 +13678,39 @@ function resolveDistance(placement, distance, width, height) {
|
|
|
13594
13678
|
if (!Number.isFinite(distance)) {
|
|
13595
13679
|
return DEFAULT_FLOATING_DISTANCE;
|
|
13596
13680
|
}
|
|
13597
|
-
return
|
|
13598
|
-
}
|
|
13599
|
-
function applyHotspotTransform(group, camera, orientation2, surfaceQuaternion3, rotation, scaleMode, referenceFov, useAngularScale, worldWidth, worldHeight) {
|
|
13600
|
-
if (orientation2 === "billboard") {
|
|
13601
|
-
group.quaternion.copy(camera.quaternion);
|
|
13602
|
-
} else {
|
|
13603
|
-
group.quaternion.copy(surfaceQuaternion3);
|
|
13604
|
-
}
|
|
13605
|
-
group.rotateOnAxis(LOCAL_FORWARD, MathUtils8.degToRad(-rotation));
|
|
13606
|
-
const scaleFactor = scaleMode === "fixed" && camera instanceof PerspectiveCamera6 ? fixedScaleFactor(camera.fov, referenceFov) : 1;
|
|
13607
|
-
group.scale.set(
|
|
13608
|
-
(useAngularScale ? worldWidth : 1) * scaleFactor,
|
|
13609
|
-
(useAngularScale ? worldHeight : 1) * scaleFactor,
|
|
13610
|
-
1
|
|
13611
|
-
);
|
|
13612
|
-
group.updateMatrixWorld();
|
|
13681
|
+
return MathUtils9.clamp(Math.abs(distance), 0.1, maximumDistance);
|
|
13613
13682
|
}
|
|
13614
13683
|
function maximumHotspotDistance(width, height) {
|
|
13615
|
-
const safeWidth =
|
|
13684
|
+
const safeWidth = MathUtils9.clamp(
|
|
13616
13685
|
Math.abs(Number.isFinite(width) ? width : MIN_ANGULAR_SIZE),
|
|
13617
13686
|
MIN_ANGULAR_SIZE,
|
|
13618
13687
|
MAX_ANGULAR_SIZE
|
|
13619
13688
|
);
|
|
13620
|
-
const safeHeight =
|
|
13689
|
+
const safeHeight = MathUtils9.clamp(
|
|
13621
13690
|
Math.abs(Number.isFinite(height) ? height : MIN_ANGULAR_SIZE),
|
|
13622
13691
|
MIN_ANGULAR_SIZE,
|
|
13623
13692
|
MAX_ANGULAR_SIZE
|
|
13624
13693
|
);
|
|
13625
13694
|
const cornerFactor = Math.hypot(
|
|
13626
13695
|
1,
|
|
13627
|
-
Math.tan(
|
|
13628
|
-
Math.tan(
|
|
13696
|
+
Math.tan(MathUtils9.degToRad(safeWidth) / 2),
|
|
13697
|
+
Math.tan(MathUtils9.degToRad(safeHeight) / 2)
|
|
13629
13698
|
);
|
|
13630
13699
|
return (PANORAMA_RADIUS - PANORAMA_SURFACE_INSET) / cornerFactor;
|
|
13631
13700
|
}
|
|
13632
|
-
function fixedScaleFactor(cameraFov, referenceFov) {
|
|
13633
|
-
const safeReferenceFov = MathUtils8.clamp(referenceFov, 1, 179);
|
|
13634
|
-
return Math.tan(MathUtils8.degToRad(cameraFov) / 2) / Math.tan(MathUtils8.degToRad(safeReferenceFov) / 2);
|
|
13635
|
-
}
|
|
13636
13701
|
function createSurfaceQuaternion(position) {
|
|
13637
13702
|
const outward = panoPositionToVector3(position).normalize();
|
|
13638
13703
|
const inward = outward.clone().negate();
|
|
13639
|
-
const pitch =
|
|
13640
|
-
const yaw =
|
|
13641
|
-
const localUp = new
|
|
13704
|
+
const pitch = MathUtils9.degToRad(position.pitch);
|
|
13705
|
+
const yaw = MathUtils9.degToRad(position.yaw);
|
|
13706
|
+
const localUp = new Vector316(
|
|
13642
13707
|
-Math.sin(pitch) * Math.sin(yaw),
|
|
13643
13708
|
Math.cos(pitch),
|
|
13644
13709
|
Math.sin(pitch) * Math.cos(yaw)
|
|
13645
13710
|
).normalize();
|
|
13646
13711
|
const localRight = localUp.clone().cross(inward).normalize();
|
|
13647
13712
|
const basis = new Matrix44().makeBasis(localRight, localUp, inward);
|
|
13648
|
-
return new
|
|
13713
|
+
return new Quaternion4().setFromRotationMatrix(basis);
|
|
13649
13714
|
}
|
|
13650
13715
|
function makeInteractionEvent(id, position, event) {
|
|
13651
13716
|
return {
|
|
@@ -13658,7 +13723,7 @@ function makeInteractionEvent(id, position, event) {
|
|
|
13658
13723
|
function angularDistance(a, b) {
|
|
13659
13724
|
const aVector = panoPositionToVector3(a);
|
|
13660
13725
|
const bVector = panoPositionToVector3(b);
|
|
13661
|
-
return
|
|
13726
|
+
return MathUtils9.radToDeg(aVector.angleTo(bVector));
|
|
13662
13727
|
}
|
|
13663
13728
|
function isTooltipOpen(trigger, hovered, focused, pinned) {
|
|
13664
13729
|
switch (trigger) {
|
|
@@ -13893,11 +13958,11 @@ function HotspotAnchor({
|
|
|
13893
13958
|
const hotspotTargetRegistry = useContext25(HotspotTargetRegistryContext);
|
|
13894
13959
|
const eventBus = useContext25(PanoEventBusContext);
|
|
13895
13960
|
const cursorApi = usePanoCursor();
|
|
13896
|
-
const { camera, size } =
|
|
13897
|
-
const groupRef =
|
|
13898
|
-
const tooltipAnchorRef =
|
|
13899
|
-
const dragStateRef =
|
|
13900
|
-
const suppressNextClickRef =
|
|
13961
|
+
const { camera, size } = useThree22();
|
|
13962
|
+
const groupRef = useRef31(null);
|
|
13963
|
+
const tooltipAnchorRef = useRef31(null);
|
|
13964
|
+
const dragStateRef = useRef31(null);
|
|
13965
|
+
const suppressNextClickRef = useRef31(false);
|
|
13901
13966
|
const [hovered, setHovered] = useState16(false);
|
|
13902
13967
|
const [dragging, setDragging] = useState16(false);
|
|
13903
13968
|
const [pinned, setPinned] = useState16(false);
|
|
@@ -14023,7 +14088,7 @@ function HotspotAnchor({
|
|
|
14023
14088
|
dragStateRef.current = null;
|
|
14024
14089
|
setDragging(false);
|
|
14025
14090
|
}, [acceptsPointer]);
|
|
14026
|
-
|
|
14091
|
+
useLayoutEffect5(() => {
|
|
14027
14092
|
const group = groupRef.current;
|
|
14028
14093
|
if (!group) {
|
|
14029
14094
|
return;
|
|
@@ -14038,7 +14103,8 @@ function HotspotAnchor({
|
|
|
14038
14103
|
referenceFov,
|
|
14039
14104
|
useAngularScale,
|
|
14040
14105
|
worldWidth,
|
|
14041
|
-
worldHeight
|
|
14106
|
+
worldHeight,
|
|
14107
|
+
resolvedDistance
|
|
14042
14108
|
);
|
|
14043
14109
|
if (tooltipOpen && tooltipAnchorRef.current) {
|
|
14044
14110
|
updateTooltipAnchor(
|
|
@@ -14054,6 +14120,7 @@ function HotspotAnchor({
|
|
|
14054
14120
|
camera,
|
|
14055
14121
|
orientation2,
|
|
14056
14122
|
referenceFov,
|
|
14123
|
+
resolvedDistance,
|
|
14057
14124
|
rotation,
|
|
14058
14125
|
scaleMode,
|
|
14059
14126
|
size,
|
|
@@ -14064,7 +14131,7 @@ function HotspotAnchor({
|
|
|
14064
14131
|
worldHeight,
|
|
14065
14132
|
worldWidth
|
|
14066
14133
|
]);
|
|
14067
|
-
|
|
14134
|
+
useFrame15((state) => {
|
|
14068
14135
|
const group = groupRef.current;
|
|
14069
14136
|
if (!group) {
|
|
14070
14137
|
return;
|
|
@@ -14079,7 +14146,8 @@ function HotspotAnchor({
|
|
|
14079
14146
|
referenceFov,
|
|
14080
14147
|
useAngularScale,
|
|
14081
14148
|
worldWidth,
|
|
14082
|
-
worldHeight
|
|
14149
|
+
worldHeight,
|
|
14150
|
+
resolvedDistance
|
|
14083
14151
|
);
|
|
14084
14152
|
if (tooltipOpen && tooltipAnchorRef.current) {
|
|
14085
14153
|
updateTooltipAnchor(
|
|
@@ -14340,7 +14408,6 @@ function HotspotPlane({
|
|
|
14340
14408
|
{
|
|
14341
14409
|
target: "hotspot",
|
|
14342
14410
|
alphaTest: HOTSPOT_ALPHA_CUTOFF,
|
|
14343
|
-
alphaToCoverage: true,
|
|
14344
14411
|
map,
|
|
14345
14412
|
opacity: map ? clampOpacity(opacity) : 0,
|
|
14346
14413
|
side: DoubleSide4,
|
|
@@ -14354,10 +14421,10 @@ function HotspotPlane({
|
|
|
14354
14421
|
// src/hotspot/image-hotspot.tsx
|
|
14355
14422
|
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
14356
14423
|
function useHotspotImageTexture(src, onLoad, onError) {
|
|
14357
|
-
const gl =
|
|
14424
|
+
const gl = useThree23((state) => state.gl);
|
|
14358
14425
|
const [texture, setTexture] = useState17(null);
|
|
14359
|
-
const onLoadRef =
|
|
14360
|
-
const onErrorRef =
|
|
14426
|
+
const onLoadRef = useRef32(onLoad);
|
|
14427
|
+
const onErrorRef = useRef32(onError);
|
|
14361
14428
|
onLoadRef.current = onLoad;
|
|
14362
14429
|
onErrorRef.current = onError;
|
|
14363
14430
|
useEffect32(() => {
|
|
@@ -14420,29 +14487,29 @@ function ImageHotspot({
|
|
|
14420
14487
|
}
|
|
14421
14488
|
|
|
14422
14489
|
// src/hotspot/polygon-hotspot.tsx
|
|
14423
|
-
import { useEffect as useEffect33, useMemo as useMemo24, useRef as
|
|
14490
|
+
import { useEffect as useEffect33, useMemo as useMemo24, useRef as useRef34 } from "react";
|
|
14424
14491
|
import {
|
|
14425
14492
|
BufferGeometry as BufferGeometry2,
|
|
14426
14493
|
DoubleSide as DoubleSide5,
|
|
14427
14494
|
Float32BufferAttribute as Float32BufferAttribute2,
|
|
14428
14495
|
Matrix4 as Matrix45,
|
|
14429
|
-
Quaternion as
|
|
14496
|
+
Quaternion as Quaternion5,
|
|
14430
14497
|
ShapeUtils,
|
|
14431
14498
|
Vector2 as Vector27,
|
|
14432
|
-
Vector3 as
|
|
14499
|
+
Vector3 as Vector318
|
|
14433
14500
|
} from "three";
|
|
14434
14501
|
|
|
14435
14502
|
// src/hotspot/hotspot-stroke-line.tsx
|
|
14436
14503
|
import { Line } from "@react-three/drei";
|
|
14437
|
-
import { useFrame as
|
|
14438
|
-
import { useLayoutEffect as
|
|
14504
|
+
import { useFrame as useFrame16, useThree as useThree24 } from "@react-three/fiber";
|
|
14505
|
+
import { useLayoutEffect as useLayoutEffect6, useRef as useRef33 } from "react";
|
|
14439
14506
|
import {
|
|
14440
|
-
MathUtils as
|
|
14507
|
+
MathUtils as MathUtils10,
|
|
14441
14508
|
PerspectiveCamera as PerspectiveCamera7,
|
|
14442
|
-
Vector3 as
|
|
14509
|
+
Vector3 as Vector317
|
|
14443
14510
|
} from "three";
|
|
14444
14511
|
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
14445
|
-
var LINE_WORLD_POSITION = new
|
|
14512
|
+
var LINE_WORLD_POSITION = new Vector317();
|
|
14446
14513
|
function applyScreenSpaceDashScale(object, camera, viewportHeight) {
|
|
14447
14514
|
const material = object?.material;
|
|
14448
14515
|
if (!object || typeof material?.dashScale !== "number") {
|
|
@@ -14451,7 +14518,7 @@ function applyScreenSpaceDashScale(object, camera, viewportHeight) {
|
|
|
14451
14518
|
object.getWorldPosition(LINE_WORLD_POSITION);
|
|
14452
14519
|
const depth = Math.max(camera.position.distanceTo(LINE_WORLD_POSITION), 1);
|
|
14453
14520
|
const fov = camera instanceof PerspectiveCamera7 ? camera.fov : 75;
|
|
14454
|
-
material.dashScale = viewportHeight / (2 * Math.tan(
|
|
14521
|
+
material.dashScale = viewportHeight / (2 * Math.tan(MathUtils10.degToRad(fov) * 0.5) * depth);
|
|
14455
14522
|
}
|
|
14456
14523
|
function resolveDash(dashSize, gapSize) {
|
|
14457
14524
|
if (dashSize === void 0 || !Number.isFinite(dashSize) || dashSize <= 0) {
|
|
@@ -14472,16 +14539,16 @@ function HotspotStrokeLine({
|
|
|
14472
14539
|
dashSize,
|
|
14473
14540
|
gapSize
|
|
14474
14541
|
}) {
|
|
14475
|
-
const lineRef =
|
|
14476
|
-
const { camera, size } =
|
|
14542
|
+
const lineRef = useRef33(null);
|
|
14543
|
+
const { camera, size } = useThree24();
|
|
14477
14544
|
const dash = resolveDash(dashSize, gapSize);
|
|
14478
|
-
|
|
14545
|
+
useLayoutEffect6(() => {
|
|
14479
14546
|
if (!dash.dashed) {
|
|
14480
14547
|
return;
|
|
14481
14548
|
}
|
|
14482
14549
|
applyScreenSpaceDashScale(lineRef.current, camera, size.height);
|
|
14483
14550
|
}, [camera, dash.dashed, dash.dashSize, dash.gapSize, size.height]);
|
|
14484
|
-
|
|
14551
|
+
useFrame16((state) => {
|
|
14485
14552
|
if (!dash.dashed) {
|
|
14486
14553
|
return;
|
|
14487
14554
|
}
|
|
@@ -14581,7 +14648,7 @@ function polygonContainsDirection(vertices, direction) {
|
|
|
14581
14648
|
}
|
|
14582
14649
|
function fitsHemisphere(vertices) {
|
|
14583
14650
|
const directions = vertices.map((vertex) => panoPositionToVector3(vertex).normalize());
|
|
14584
|
-
const candidates = [new
|
|
14651
|
+
const candidates = [new Vector318()];
|
|
14585
14652
|
for (const direction of directions) {
|
|
14586
14653
|
candidates[0].add(direction);
|
|
14587
14654
|
candidates.push(direction.clone());
|
|
@@ -14605,7 +14672,7 @@ function validatePolygonVertices(vertices) {
|
|
|
14605
14672
|
if (hasSelfIntersection(unwrapped)) {
|
|
14606
14673
|
issues.push({ code: "self_intersection", message: "Polygon edges cannot cross." });
|
|
14607
14674
|
}
|
|
14608
|
-
if (polygonContainsDirection(normalized, new
|
|
14675
|
+
if (polygonContainsDirection(normalized, new Vector318(0, 1, 0)) || polygonContainsDirection(normalized, new Vector318(0, -1, 0))) {
|
|
14609
14676
|
issues.push({ code: "contains_pole", message: "Polygons cannot contain a panorama pole." });
|
|
14610
14677
|
}
|
|
14611
14678
|
if (!fitsHemisphere(normalized)) {
|
|
@@ -14616,7 +14683,7 @@ function validatePolygonVertices(vertices) {
|
|
|
14616
14683
|
function polygonCenter(vertices) {
|
|
14617
14684
|
const sum = vertices.reduce(
|
|
14618
14685
|
(total, vertex) => total.add(panoPositionToVector3(vertex).normalize()),
|
|
14619
|
-
new
|
|
14686
|
+
new Vector318()
|
|
14620
14687
|
);
|
|
14621
14688
|
return sum.lengthSq() > 1e-8 ? vector3ToPanoPosition(sum) : normalizePanoPosition(vertices[0]);
|
|
14622
14689
|
}
|
|
@@ -14625,12 +14692,12 @@ function surfaceQuaternion(position) {
|
|
|
14625
14692
|
const inward = outward.clone().negate();
|
|
14626
14693
|
const pitch = position.pitch * Math.PI / 180;
|
|
14627
14694
|
const yaw = position.yaw * Math.PI / 180;
|
|
14628
|
-
const localUp = new
|
|
14695
|
+
const localUp = new Vector318(
|
|
14629
14696
|
-Math.sin(pitch) * Math.sin(yaw),
|
|
14630
14697
|
Math.cos(pitch),
|
|
14631
14698
|
Math.sin(pitch) * Math.cos(yaw)
|
|
14632
14699
|
).normalize();
|
|
14633
|
-
return new
|
|
14700
|
+
return new Quaternion5().setFromRotationMatrix(
|
|
14634
14701
|
new Matrix45().makeBasis(localUp.clone().cross(inward).normalize(), localUp, inward)
|
|
14635
14702
|
);
|
|
14636
14703
|
}
|
|
@@ -14638,7 +14705,7 @@ function makeWorldToLocal(center) {
|
|
|
14638
14705
|
return new Matrix45().compose(
|
|
14639
14706
|
panoPositionToVector3(center, POLYGON_RADIUS),
|
|
14640
14707
|
surfaceQuaternion(center),
|
|
14641
|
-
new
|
|
14708
|
+
new Vector318(1, 1, 1)
|
|
14642
14709
|
).invert();
|
|
14643
14710
|
}
|
|
14644
14711
|
function projectedPoint(a, b, c, weightB, weightC, radius, worldToLocal) {
|
|
@@ -14777,7 +14844,7 @@ function PolygonHotspot({
|
|
|
14777
14844
|
[center, valid, vertices]
|
|
14778
14845
|
);
|
|
14779
14846
|
const resolvedStrokeOpacity = Math.max(0, Math.min(strokeOpacity, 1));
|
|
14780
|
-
const startVerticesRef =
|
|
14847
|
+
const startVerticesRef = useRef34(null);
|
|
14781
14848
|
const issuesKey = issues.map((issue) => issue.code).join(",");
|
|
14782
14849
|
useEffect33(() => {
|
|
14783
14850
|
if (!valid) onInvalid?.(issues);
|
|
@@ -14862,12 +14929,12 @@ function PolygonHotspot({
|
|
|
14862
14929
|
}
|
|
14863
14930
|
|
|
14864
14931
|
// src/hotspot/polyline-hotspot.tsx
|
|
14865
|
-
import { useEffect as useEffect34, useMemo as useMemo25, useRef as
|
|
14932
|
+
import { useEffect as useEffect34, useMemo as useMemo25, useRef as useRef35 } from "react";
|
|
14866
14933
|
import {
|
|
14867
|
-
MathUtils as
|
|
14934
|
+
MathUtils as MathUtils11,
|
|
14868
14935
|
Matrix4 as Matrix46,
|
|
14869
|
-
Quaternion as
|
|
14870
|
-
Vector3 as
|
|
14936
|
+
Quaternion as Quaternion6,
|
|
14937
|
+
Vector3 as Vector319
|
|
14871
14938
|
} from "three";
|
|
14872
14939
|
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
14873
14940
|
var POLYLINE_RADIUS = 990;
|
|
@@ -14894,21 +14961,21 @@ function unwrapVertices(vertices) {
|
|
|
14894
14961
|
function polylineCenter(vertices) {
|
|
14895
14962
|
const sum = vertices.reduce(
|
|
14896
14963
|
(total, vertex) => total.add(panoPositionToVector3(vertex).normalize()),
|
|
14897
|
-
new
|
|
14964
|
+
new Vector319()
|
|
14898
14965
|
);
|
|
14899
14966
|
return sum.lengthSq() > 1e-8 ? vector3ToPanoPosition(sum) : normalizePanoPosition(vertices[0]);
|
|
14900
14967
|
}
|
|
14901
14968
|
function surfaceQuaternion2(position) {
|
|
14902
14969
|
const outward = panoPositionToVector3(position).normalize();
|
|
14903
14970
|
const inward = outward.clone().negate();
|
|
14904
|
-
const pitch =
|
|
14905
|
-
const yaw =
|
|
14906
|
-
const localUp = new
|
|
14971
|
+
const pitch = MathUtils11.degToRad(position.pitch);
|
|
14972
|
+
const yaw = MathUtils11.degToRad(position.yaw);
|
|
14973
|
+
const localUp = new Vector319(
|
|
14907
14974
|
-Math.sin(pitch) * Math.sin(yaw),
|
|
14908
14975
|
Math.cos(pitch),
|
|
14909
14976
|
Math.sin(pitch) * Math.cos(yaw)
|
|
14910
14977
|
).normalize();
|
|
14911
|
-
return new
|
|
14978
|
+
return new Quaternion6().setFromRotationMatrix(
|
|
14912
14979
|
new Matrix46().makeBasis(localUp.clone().cross(inward).normalize(), localUp, inward)
|
|
14913
14980
|
);
|
|
14914
14981
|
}
|
|
@@ -14916,7 +14983,7 @@ function makeWorldToLocal2(center) {
|
|
|
14916
14983
|
return new Matrix46().compose(
|
|
14917
14984
|
panoPositionToVector3(center, POLYLINE_RADIUS),
|
|
14918
14985
|
surfaceQuaternion2(center),
|
|
14919
|
-
new
|
|
14986
|
+
new Vector319(1, 1, 1)
|
|
14920
14987
|
).invert();
|
|
14921
14988
|
}
|
|
14922
14989
|
function subdivisionSteps(vertices) {
|
|
@@ -14931,7 +14998,7 @@ function subdivisionSteps(vertices) {
|
|
|
14931
14998
|
}
|
|
14932
14999
|
return Math.min(
|
|
14933
15000
|
8,
|
|
14934
|
-
Math.max(1, Math.ceil(
|
|
15001
|
+
Math.max(1, Math.ceil(MathUtils11.radToDeg(maxAngle) / MAX_SEGMENT_DEGREES))
|
|
14935
15002
|
);
|
|
14936
15003
|
}
|
|
14937
15004
|
function makeLinePositions(vertices, center) {
|
|
@@ -14994,7 +15061,7 @@ function PolylineHotspot({
|
|
|
14994
15061
|
[center, valid, vertices]
|
|
14995
15062
|
);
|
|
14996
15063
|
const opacity = Math.max(0, Math.min(strokeOpacity, 1));
|
|
14997
|
-
const startVerticesRef =
|
|
15064
|
+
const startVerticesRef = useRef35(null);
|
|
14998
15065
|
useEffect34(() => {
|
|
14999
15066
|
if (!valid) onInvalid?.(issues);
|
|
15000
15067
|
}, [issues, onInvalid, valid]);
|
|
@@ -15061,7 +15128,7 @@ function PolylineHotspot({
|
|
|
15061
15128
|
}
|
|
15062
15129
|
|
|
15063
15130
|
// src/hotspot/graphic-hotspot.tsx
|
|
15064
|
-
import { useEffect as useEffect35, useRef as
|
|
15131
|
+
import { useEffect as useEffect35, useRef as useRef36, useState as useState18 } from "react";
|
|
15065
15132
|
import {
|
|
15066
15133
|
CanvasTexture,
|
|
15067
15134
|
ClampToEdgeWrapping as ClampToEdgeWrapping4,
|
|
@@ -15259,8 +15326,8 @@ function createGraphicTexture(graphic, aspectWidth, aspectHeight) {
|
|
|
15259
15326
|
}
|
|
15260
15327
|
function useGraphicTexture(graphic, aspectWidth, aspectHeight, onLoad, onError) {
|
|
15261
15328
|
const [texture, setTexture] = useState18(null);
|
|
15262
|
-
const onLoadRef =
|
|
15263
|
-
const onErrorRef =
|
|
15329
|
+
const onLoadRef = useRef36(onLoad);
|
|
15330
|
+
const onErrorRef = useRef36(onError);
|
|
15264
15331
|
onLoadRef.current = onLoad;
|
|
15265
15332
|
onErrorRef.current = onError;
|
|
15266
15333
|
useEffect35(() => {
|
|
@@ -15301,8 +15368,8 @@ function GraphicHotspot(props) {
|
|
|
15301
15368
|
}
|
|
15302
15369
|
|
|
15303
15370
|
// src/hotspot/sequence-hotspot.tsx
|
|
15304
|
-
import { useFrame as
|
|
15305
|
-
import { useEffect as useEffect36, useRef as
|
|
15371
|
+
import { useFrame as useFrame17, useThree as useThree25 } from "@react-three/fiber";
|
|
15372
|
+
import { useEffect as useEffect36, useRef as useRef37, useState as useState19 } from "react";
|
|
15306
15373
|
import {
|
|
15307
15374
|
ClampToEdgeWrapping as ClampToEdgeWrapping5,
|
|
15308
15375
|
LinearFilter as LinearFilter8,
|
|
@@ -15324,10 +15391,10 @@ function useSpriteTexture({
|
|
|
15324
15391
|
onError,
|
|
15325
15392
|
onLoadProgress
|
|
15326
15393
|
}) {
|
|
15327
|
-
const gl =
|
|
15394
|
+
const gl = useThree25((state) => state.gl);
|
|
15328
15395
|
const [texture, setTexture] = useState19(null);
|
|
15329
|
-
const onErrorRef =
|
|
15330
|
-
const onLoadProgressRef =
|
|
15396
|
+
const onErrorRef = useRef37(onError);
|
|
15397
|
+
const onLoadProgressRef = useRef37(onLoadProgress);
|
|
15331
15398
|
onErrorRef.current = onError;
|
|
15332
15399
|
onLoadProgressRef.current = onLoadProgress;
|
|
15333
15400
|
useEffect36(() => {
|
|
@@ -15401,13 +15468,13 @@ function SequenceHotspot({
|
|
|
15401
15468
|
const frameCount = resolveFrameCount(requestedFrameCount);
|
|
15402
15469
|
const safeFps = resolveFps(fps);
|
|
15403
15470
|
const [frameIndex, setFrameIndex] = useState19(0);
|
|
15404
|
-
const elapsedRef =
|
|
15405
|
-
const frameIndexRef =
|
|
15406
|
-
const endedRef =
|
|
15407
|
-
const lastPlaybackStateRef =
|
|
15408
|
-
const onFrameChangeRef =
|
|
15409
|
-
const onPlaybackStateChangeRef =
|
|
15410
|
-
const onEndedRef =
|
|
15471
|
+
const elapsedRef = useRef37(0);
|
|
15472
|
+
const frameIndexRef = useRef37(0);
|
|
15473
|
+
const endedRef = useRef37(false);
|
|
15474
|
+
const lastPlaybackStateRef = useRef37(null);
|
|
15475
|
+
const onFrameChangeRef = useRef37(onFrameChange);
|
|
15476
|
+
const onPlaybackStateChangeRef = useRef37(onPlaybackStateChange);
|
|
15477
|
+
const onEndedRef = useRef37(onEnded);
|
|
15411
15478
|
onFrameChangeRef.current = onFrameChange;
|
|
15412
15479
|
onPlaybackStateChangeRef.current = onPlaybackStateChange;
|
|
15413
15480
|
onEndedRef.current = onEnded;
|
|
@@ -15456,7 +15523,7 @@ function SequenceHotspot({
|
|
|
15456
15523
|
onPlaybackStateChangeRef.current?.(nextState);
|
|
15457
15524
|
}
|
|
15458
15525
|
}, [playing, texture]);
|
|
15459
|
-
|
|
15526
|
+
useFrame17((_, deltaSeconds) => {
|
|
15460
15527
|
if (!texture || !playing || endedRef.current) {
|
|
15461
15528
|
return;
|
|
15462
15529
|
}
|
|
@@ -15490,8 +15557,8 @@ function SequenceHotspot({
|
|
|
15490
15557
|
}
|
|
15491
15558
|
|
|
15492
15559
|
// src/hotspot/video-hotspot.tsx
|
|
15493
|
-
import { useThree as
|
|
15494
|
-
import { useEffect as useEffect37, useRef as
|
|
15560
|
+
import { useThree as useThree26 } from "@react-three/fiber";
|
|
15561
|
+
import { useEffect as useEffect37, useRef as useRef38, useState as useState20 } from "react";
|
|
15495
15562
|
import {
|
|
15496
15563
|
ClampToEdgeWrapping as ClampToEdgeWrapping6,
|
|
15497
15564
|
LinearFilter as LinearFilter9,
|
|
@@ -15508,9 +15575,9 @@ function clampVolume2(volume) {
|
|
|
15508
15575
|
return Math.max(0, Math.min(volume, 1));
|
|
15509
15576
|
}
|
|
15510
15577
|
function usePosterTexture2(id, poster, onError) {
|
|
15511
|
-
const gl =
|
|
15578
|
+
const gl = useThree26((state) => state.gl);
|
|
15512
15579
|
const [texture, setTexture] = useState20(null);
|
|
15513
|
-
const onErrorRef =
|
|
15580
|
+
const onErrorRef = useRef38(onError);
|
|
15514
15581
|
onErrorRef.current = onError;
|
|
15515
15582
|
useEffect37(() => {
|
|
15516
15583
|
let active = true;
|
|
@@ -15568,9 +15635,9 @@ function useVideoResource({
|
|
|
15568
15635
|
src
|
|
15569
15636
|
}) {
|
|
15570
15637
|
const [resource, setResource] = useState20(null);
|
|
15571
|
-
const onEndedRef =
|
|
15572
|
-
const onErrorRef =
|
|
15573
|
-
const onPlaybackStateChangeRef =
|
|
15638
|
+
const onEndedRef = useRef38(onEnded);
|
|
15639
|
+
const onErrorRef = useRef38(onError);
|
|
15640
|
+
const onPlaybackStateChangeRef = useRef38(onPlaybackStateChange);
|
|
15574
15641
|
onEndedRef.current = onEnded;
|
|
15575
15642
|
onErrorRef.current = onError;
|
|
15576
15643
|
onPlaybackStateChangeRef.current = onPlaybackStateChange;
|
|
@@ -15681,8 +15748,8 @@ function VideoHotspot({
|
|
|
15681
15748
|
src
|
|
15682
15749
|
});
|
|
15683
15750
|
const posterTexture = usePosterTexture2(id, poster, onError);
|
|
15684
|
-
const onPlaybackErrorRef =
|
|
15685
|
-
const onPlaybackStateChangeRef =
|
|
15751
|
+
const onPlaybackErrorRef = useRef38(onPlaybackError);
|
|
15752
|
+
const onPlaybackStateChangeRef = useRef38(onPlaybackStateChange);
|
|
15686
15753
|
onPlaybackErrorRef.current = onPlaybackError;
|
|
15687
15754
|
onPlaybackStateChangeRef.current = onPlaybackStateChange;
|
|
15688
15755
|
useEffect37(() => {
|
|
@@ -15729,8 +15796,8 @@ function VideoHotspot({
|
|
|
15729
15796
|
}
|
|
15730
15797
|
|
|
15731
15798
|
// src/hotspot/audio-hotspot.tsx
|
|
15732
|
-
import { useFrame as
|
|
15733
|
-
import { useEffect as useEffect38, useRef as
|
|
15799
|
+
import { useFrame as useFrame18, useThree as useThree27 } from "@react-three/fiber";
|
|
15800
|
+
import { useEffect as useEffect38, useRef as useRef39, useState as useState21 } from "react";
|
|
15734
15801
|
import {
|
|
15735
15802
|
CanvasTexture as CanvasTexture2,
|
|
15736
15803
|
ClampToEdgeWrapping as ClampToEdgeWrapping7,
|
|
@@ -15820,9 +15887,9 @@ function useSpeakerTextures(enabled) {
|
|
|
15820
15887
|
return textures;
|
|
15821
15888
|
}
|
|
15822
15889
|
function useIconTexture(icon, enabled, onError, id) {
|
|
15823
|
-
const gl =
|
|
15890
|
+
const gl = useThree27((state) => state.gl);
|
|
15824
15891
|
const [texture, setTexture] = useState21(null);
|
|
15825
|
-
const onErrorRef =
|
|
15892
|
+
const onErrorRef = useRef39(onError);
|
|
15826
15893
|
onErrorRef.current = onError;
|
|
15827
15894
|
useEffect38(() => {
|
|
15828
15895
|
let active = true;
|
|
@@ -15881,12 +15948,12 @@ function useAudioHowl({
|
|
|
15881
15948
|
src
|
|
15882
15949
|
}) {
|
|
15883
15950
|
const [howl, setHowl] = useState21(null);
|
|
15884
|
-
const playingRef =
|
|
15885
|
-
const loopRef =
|
|
15886
|
-
const onEndedRef =
|
|
15887
|
-
const onErrorRef =
|
|
15888
|
-
const onPlaybackErrorRef =
|
|
15889
|
-
const onPlaybackStateChangeRef =
|
|
15951
|
+
const playingRef = useRef39(playing);
|
|
15952
|
+
const loopRef = useRef39(loop ?? false);
|
|
15953
|
+
const onEndedRef = useRef39(onEnded);
|
|
15954
|
+
const onErrorRef = useRef39(onError);
|
|
15955
|
+
const onPlaybackErrorRef = useRef39(onPlaybackError);
|
|
15956
|
+
const onPlaybackStateChangeRef = useRef39(onPlaybackStateChange);
|
|
15890
15957
|
playingRef.current = playing;
|
|
15891
15958
|
loopRef.current = loop ?? false;
|
|
15892
15959
|
onEndedRef.current = onEnded;
|
|
@@ -15959,7 +16026,7 @@ function AudioHotspot({
|
|
|
15959
16026
|
...anchorProps
|
|
15960
16027
|
}) {
|
|
15961
16028
|
usePanoMediaActivationIntent(playing);
|
|
15962
|
-
const camera =
|
|
16029
|
+
const camera = useThree27((state) => state.camera);
|
|
15963
16030
|
const howl = useAudioHowl({
|
|
15964
16031
|
crossOrigin,
|
|
15965
16032
|
id,
|
|
@@ -15975,11 +16042,11 @@ function AudioHotspot({
|
|
|
15975
16042
|
const stoppedIconTexture = useIconTexture(icon, marker, onError, id);
|
|
15976
16043
|
const playingIconTexture = useIconTexture(playingIcon, marker, onError, id);
|
|
15977
16044
|
const markerTexture = playing ? playingIconTexture ?? stoppedIconTexture ?? speakerTextures.playing : stoppedIconTexture ?? speakerTextures.stopped;
|
|
15978
|
-
const playingRef =
|
|
16045
|
+
const playingRef = useRef39(playing);
|
|
15979
16046
|
playingRef.current = playing;
|
|
15980
|
-
const mutedRef =
|
|
15981
|
-
const volumeRef =
|
|
15982
|
-
const rangeRef =
|
|
16047
|
+
const mutedRef = useRef39(muted);
|
|
16048
|
+
const volumeRef = useRef39(volume);
|
|
16049
|
+
const rangeRef = useRef39(range);
|
|
15983
16050
|
mutedRef.current = muted;
|
|
15984
16051
|
volumeRef.current = volume;
|
|
15985
16052
|
rangeRef.current = range;
|
|
@@ -16011,7 +16078,7 @@ function AudioHotspot({
|
|
|
16011
16078
|
document.removeEventListener("visibilitychange", handleVisibility);
|
|
16012
16079
|
};
|
|
16013
16080
|
}, [howl, pauseWhenHidden]);
|
|
16014
|
-
|
|
16081
|
+
useFrame18(() => {
|
|
16015
16082
|
if (!howl) {
|
|
16016
16083
|
return;
|
|
16017
16084
|
}
|
|
@@ -16028,7 +16095,7 @@ function AudioHotspot({
|
|
|
16028
16095
|
}
|
|
16029
16096
|
|
|
16030
16097
|
// src/hotspot/text-hotspot.tsx
|
|
16031
|
-
import { useEffect as useEffect39, useRef as
|
|
16098
|
+
import { useEffect as useEffect39, useRef as useRef40, useState as useState22 } from "react";
|
|
16032
16099
|
import {
|
|
16033
16100
|
CanvasTexture as CanvasTexture3,
|
|
16034
16101
|
ClampToEdgeWrapping as ClampToEdgeWrapping8,
|
|
@@ -16257,8 +16324,8 @@ function createTextTexture(text, width, height, style) {
|
|
|
16257
16324
|
}
|
|
16258
16325
|
function useTextTexture(text, width, height, style, onLoad, onError) {
|
|
16259
16326
|
const [texture, setTexture] = useState22(null);
|
|
16260
|
-
const onLoadRef =
|
|
16261
|
-
const onErrorRef =
|
|
16327
|
+
const onLoadRef = useRef40(onLoad);
|
|
16328
|
+
const onErrorRef = useRef40(onError);
|
|
16262
16329
|
onLoadRef.current = onLoad;
|
|
16263
16330
|
onErrorRef.current = onError;
|
|
16264
16331
|
useEffect39(() => {
|
|
@@ -16358,7 +16425,7 @@ function TextHotspot({
|
|
|
16358
16425
|
}
|
|
16359
16426
|
|
|
16360
16427
|
// src/hotspot/iframe-hotspot.tsx
|
|
16361
|
-
import { Html
|
|
16428
|
+
import { Html } from "@react-three/drei";
|
|
16362
16429
|
import { DoubleSide as DoubleSide6 } from "three";
|
|
16363
16430
|
import { jsx as jsx37, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
16364
16431
|
var IFRAME_LONG_SIDE = 800;
|
|
@@ -16440,7 +16507,7 @@ function IframeHotspot({
|
|
|
16440
16507
|
)
|
|
16441
16508
|
] }),
|
|
16442
16509
|
/* @__PURE__ */ jsx37(
|
|
16443
|
-
|
|
16510
|
+
Html,
|
|
16444
16511
|
{
|
|
16445
16512
|
distanceFactor: CSS3D_DISTANCE_FACTOR,
|
|
16446
16513
|
pointerEvents: acceptsPointer && pointerPolicy === "content" ? "auto" : "none",
|