@ericchen1990/pano-view 3.2.1 → 3.2.3

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