@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.cjs +259 -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 +245 -177
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7548,6 +7548,7 @@ var PanoViewer = (0, import_react26.forwardRef)(
|
|
|
7548
7548
|
import_fiber10.Canvas,
|
|
7549
7549
|
{
|
|
7550
7550
|
"aria-label": `${ariaLabel} canvas`,
|
|
7551
|
+
resize: { debounce: 0 },
|
|
7551
7552
|
camera: {
|
|
7552
7553
|
far: DEFAULT_PANORAMA_CAMERA_FAR,
|
|
7553
7554
|
fov: normalizedInitialView.fov,
|
|
@@ -13238,21 +13239,23 @@ function Scenes({
|
|
|
13238
13239
|
}
|
|
13239
13240
|
|
|
13240
13241
|
// src/hotspot/image-hotspot.tsx
|
|
13241
|
-
var
|
|
13242
|
+
var import_fiber25 = require("@react-three/fiber");
|
|
13242
13243
|
var import_react49 = require("react");
|
|
13243
|
-
var
|
|
13244
|
+
var import_three28 = require("three");
|
|
13244
13245
|
|
|
13245
13246
|
// src/hotspot/hotspot-anchor.tsx
|
|
13246
|
-
var
|
|
13247
|
+
var import_fiber24 = require("@react-three/fiber");
|
|
13247
13248
|
var import_react48 = require("react");
|
|
13248
|
-
var
|
|
13249
|
+
var import_three26 = require("three");
|
|
13249
13250
|
|
|
13250
13251
|
// src/hotspot/hotspot-tooltip.tsx
|
|
13251
13252
|
var import_react47 = require("react");
|
|
13252
13253
|
|
|
13253
13254
|
// src/webvr/stereo-html.tsx
|
|
13254
|
-
var
|
|
13255
|
+
var import_fiber23 = require("@react-three/fiber");
|
|
13255
13256
|
var import_react46 = require("react");
|
|
13257
|
+
var import_client = require("react-dom/client");
|
|
13258
|
+
var import_three24 = require("three");
|
|
13256
13259
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
13257
13260
|
function useFallbackStereoView() {
|
|
13258
13261
|
const runtime = (0, import_react46.useContext)(WebVRRuntimeContext);
|
|
@@ -13262,43 +13265,87 @@ function useFallbackStereoView() {
|
|
|
13262
13265
|
() => isFallbackStereoMode(host?.snapshot.mode ?? null),
|
|
13263
13266
|
() => false
|
|
13264
13267
|
);
|
|
13265
|
-
|
|
13266
|
-
return null;
|
|
13267
|
-
}
|
|
13268
|
-
return runtime.stereoView;
|
|
13268
|
+
return fallback && runtime ? runtime.stereoView : null;
|
|
13269
13269
|
}
|
|
13270
|
-
function
|
|
13271
|
-
|
|
13272
|
-
|
|
13273
|
-
|
|
13274
|
-
|
|
13275
|
-
|
|
13276
|
-
|
|
13270
|
+
function ProjectedHtml({
|
|
13271
|
+
children,
|
|
13272
|
+
pointerEvents = "auto",
|
|
13273
|
+
style,
|
|
13274
|
+
zIndexRange = [16777271, 0],
|
|
13275
|
+
stereoView,
|
|
13276
|
+
eye
|
|
13277
|
+
}) {
|
|
13278
|
+
const { camera, gl, events, size } = (0, import_fiber23.useThree)();
|
|
13279
|
+
const group = (0, import_react46.useRef)(null);
|
|
13280
|
+
const overlay = (0, import_react46.useRef)(null);
|
|
13281
|
+
const scratch = (0, import_react46.useRef)(new import_three24.Vector3());
|
|
13282
|
+
const target = events.connected || gl.domElement.parentElement;
|
|
13283
|
+
const updatePosition = () => {
|
|
13284
|
+
const anchor = group.current;
|
|
13285
|
+
const element = overlay.current?.element;
|
|
13286
|
+
if (!anchor || !element) return;
|
|
13287
|
+
const viewCamera = stereoView && eye ? eye === "left" ? stereoView.stereo.cameraL : stereoView.stereo.cameraR : camera;
|
|
13288
|
+
anchor.updateWorldMatrix(true, false);
|
|
13289
|
+
const position = scratch.current.setFromMatrixPosition(anchor.matrixWorld);
|
|
13290
|
+
const distance = position.distanceTo(viewCamera.position);
|
|
13291
|
+
position.applyMatrix4(viewCamera.matrixWorldInverse);
|
|
13292
|
+
element.style.display = position.z < 0 ? "block" : "none";
|
|
13293
|
+
let x;
|
|
13294
|
+
let y;
|
|
13295
|
+
if (stereoView && eye) {
|
|
13296
|
+
[x, y] = projectStereoHtmlPosition(anchor, viewCamera, size, eye);
|
|
13297
|
+
} else {
|
|
13298
|
+
position.setFromMatrixPosition(anchor.matrixWorld).project(viewCamera);
|
|
13299
|
+
x = (position.x + 1) * size.width / 2;
|
|
13300
|
+
y = (1 - position.y) * size.height / 2;
|
|
13301
|
+
}
|
|
13302
|
+
element.style.transform = `translate3d(${x}px,${y}px,0)`;
|
|
13303
|
+
element.style.zIndex = String(
|
|
13304
|
+
Math.round(
|
|
13305
|
+
zIndexRange[0] + (zIndexRange[1] - zIndexRange[0]) * (distance - viewCamera.near) / (viewCamera.far - viewCamera.near)
|
|
13306
|
+
)
|
|
13307
|
+
);
|
|
13308
|
+
};
|
|
13309
|
+
(0, import_react46.useLayoutEffect)(() => {
|
|
13310
|
+
if (!target) return;
|
|
13311
|
+
const element = document.createElement("div");
|
|
13312
|
+
Object.assign(element.style, {
|
|
13313
|
+
position: "absolute",
|
|
13314
|
+
top: "0",
|
|
13315
|
+
left: "0",
|
|
13316
|
+
transformOrigin: "0 0"
|
|
13317
|
+
});
|
|
13318
|
+
const root = (0, import_client.createRoot)(element);
|
|
13319
|
+
overlay.current = { element, root };
|
|
13320
|
+
target.appendChild(element);
|
|
13321
|
+
return () => {
|
|
13322
|
+
overlay.current = null;
|
|
13323
|
+
element.remove();
|
|
13324
|
+
queueMicrotask(() => root.unmount());
|
|
13325
|
+
};
|
|
13326
|
+
}, [target]);
|
|
13327
|
+
(0, import_react46.useLayoutEffect)(() => {
|
|
13328
|
+
overlay.current?.root.render(
|
|
13329
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
13330
|
+
"div",
|
|
13331
|
+
{
|
|
13332
|
+
"aria-hidden": eye === "right" || void 0,
|
|
13333
|
+
style: { position: "absolute", pointerEvents, ...style },
|
|
13334
|
+
children
|
|
13335
|
+
}
|
|
13336
|
+
)
|
|
13337
|
+
);
|
|
13338
|
+
updatePosition();
|
|
13339
|
+
});
|
|
13340
|
+
(0, import_fiber23.useFrame)(updatePosition);
|
|
13341
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("group", { ref: group });
|
|
13277
13342
|
}
|
|
13278
|
-
function PanoHtml(
|
|
13343
|
+
function PanoHtml(props) {
|
|
13279
13344
|
const stereoView = useFallbackStereoView();
|
|
13280
|
-
|
|
13281
|
-
|
|
13282
|
-
|
|
13283
|
-
|
|
13284
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
13285
|
-
import_drei.Html,
|
|
13286
|
-
{
|
|
13287
|
-
...htmlProps,
|
|
13288
|
-
calculatePosition: stereoCalculatePosition("left", stereoView),
|
|
13289
|
-
children
|
|
13290
|
-
}
|
|
13291
|
-
),
|
|
13292
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
13293
|
-
import_drei.Html,
|
|
13294
|
-
{
|
|
13295
|
-
...htmlProps,
|
|
13296
|
-
"aria-hidden": true,
|
|
13297
|
-
calculatePosition: stereoCalculatePosition("right", stereoView),
|
|
13298
|
-
children
|
|
13299
|
-
}
|
|
13300
|
-
)
|
|
13301
|
-
] });
|
|
13345
|
+
return stereoView ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
13346
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ProjectedHtml, { ...props, stereoView, eye: "left" }),
|
|
13347
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ProjectedHtml, { ...props, stereoView, eye: "right" })
|
|
13348
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ProjectedHtml, { ...props });
|
|
13302
13349
|
}
|
|
13303
13350
|
|
|
13304
13351
|
// src/hotspot/hotspot-tooltip.tsx
|
|
@@ -13430,6 +13477,37 @@ function HotspotTooltip({
|
|
|
13430
13477
|
] }) });
|
|
13431
13478
|
}
|
|
13432
13479
|
|
|
13480
|
+
// src/hotspot/transform.ts
|
|
13481
|
+
var import_three25 = require("three");
|
|
13482
|
+
var LOCAL_FORWARD = new import_three25.Vector3(0, 0, 1);
|
|
13483
|
+
var CAMERA_POSITION = new import_three25.Vector3();
|
|
13484
|
+
function applyHotspotTransform(group, camera, orientation2, surfaceQuaternion3, rotation, scaleMode, referenceFov, useAngularScale, worldWidth, worldHeight, distance) {
|
|
13485
|
+
if (orientation2 === "billboard") {
|
|
13486
|
+
group.quaternion.copy(camera.quaternion);
|
|
13487
|
+
} else {
|
|
13488
|
+
group.quaternion.copy(surfaceQuaternion3);
|
|
13489
|
+
}
|
|
13490
|
+
group.rotateOnAxis(LOCAL_FORWARD, import_three25.MathUtils.degToRad(-rotation));
|
|
13491
|
+
let scaleFactor = scaleMode === "fixed" && camera instanceof import_three25.PerspectiveCamera ? fixedScaleFactor(camera.fov, referenceFov) : 1;
|
|
13492
|
+
if (scaleMode === "fixed" && orientation2 === "billboard" && useAngularScale && camera instanceof import_three25.PerspectiveCamera) {
|
|
13493
|
+
group.updateWorldMatrix(true, false);
|
|
13494
|
+
CAMERA_POSITION.setFromMatrixPosition(group.matrixWorld).applyMatrix4(
|
|
13495
|
+
camera.matrixWorldInverse
|
|
13496
|
+
);
|
|
13497
|
+
scaleFactor *= Math.max(0, -CAMERA_POSITION.z) / distance;
|
|
13498
|
+
}
|
|
13499
|
+
group.scale.set(
|
|
13500
|
+
(useAngularScale ? worldWidth : 1) * scaleFactor,
|
|
13501
|
+
(useAngularScale ? worldHeight : 1) * scaleFactor,
|
|
13502
|
+
1
|
|
13503
|
+
);
|
|
13504
|
+
group.updateMatrixWorld();
|
|
13505
|
+
}
|
|
13506
|
+
function fixedScaleFactor(cameraFov, referenceFov) {
|
|
13507
|
+
const safeReferenceFov = import_three25.MathUtils.clamp(referenceFov, 1, 179);
|
|
13508
|
+
return Math.tan(import_three25.MathUtils.degToRad(cameraFov) / 2) / Math.tan(import_three25.MathUtils.degToRad(safeReferenceFov) / 2);
|
|
13509
|
+
}
|
|
13510
|
+
|
|
13433
13511
|
// src/hotspot/hotspot-anchor.tsx
|
|
13434
13512
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
13435
13513
|
var DEFAULT_FLOATING_DISTANCE = 10;
|
|
@@ -13439,28 +13517,27 @@ var DEFAULT_REFERENCE_FOV = 75;
|
|
|
13439
13517
|
var MIN_ANGULAR_SIZE = 0.01;
|
|
13440
13518
|
var MAX_ANGULAR_SIZE = 179;
|
|
13441
13519
|
var DRAG_EPSILON_DEGREES = 1e-3;
|
|
13442
|
-
var
|
|
13443
|
-
var
|
|
13444
|
-
var
|
|
13445
|
-
var
|
|
13446
|
-
var
|
|
13447
|
-
var
|
|
13448
|
-
var
|
|
13449
|
-
var
|
|
13450
|
-
var
|
|
13451
|
-
var
|
|
13452
|
-
var
|
|
13453
|
-
var
|
|
13454
|
-
var
|
|
13455
|
-
var
|
|
13456
|
-
var TOOLTIP_PLANE_POINT = new import_three24.Vector3();
|
|
13520
|
+
var TOOLTIP_WORLD_BOX = new import_three26.Box3();
|
|
13521
|
+
var TOOLTIP_LOCAL_BOX = new import_three26.Box3();
|
|
13522
|
+
var TOOLTIP_CORNER = new import_three26.Vector3();
|
|
13523
|
+
var TOOLTIP_INVERSE = new import_three26.Matrix4();
|
|
13524
|
+
var TOOLTIP_WORLD_CORNER = new import_three26.Vector3();
|
|
13525
|
+
var TOOLTIP_PROJECTED = new import_three26.Vector3();
|
|
13526
|
+
var TOOLTIP_RAY_ORIGIN = new import_three26.Vector3();
|
|
13527
|
+
var TOOLTIP_RAY_FAR = new import_three26.Vector3();
|
|
13528
|
+
var TOOLTIP_RAY_DIRECTION = new import_three26.Vector3();
|
|
13529
|
+
var TOOLTIP_RAY = new import_three26.Ray();
|
|
13530
|
+
var TOOLTIP_PLANE = new import_three26.Plane();
|
|
13531
|
+
var TOOLTIP_INTERSECTION = new import_three26.Vector3();
|
|
13532
|
+
var TOOLTIP_PLANE_NORMAL = new import_three26.Vector3();
|
|
13533
|
+
var TOOLTIP_PLANE_POINT = new import_three26.Vector3();
|
|
13457
13534
|
var HOTSPOT_MODE_RENDERING = {
|
|
13458
13535
|
surface: { orientation: "surface", placement: "surface" },
|
|
13459
13536
|
billboard: { orientation: "billboard", placement: "floating" }
|
|
13460
13537
|
};
|
|
13461
13538
|
function angularSizeToWorldSize(size, radius) {
|
|
13462
|
-
const safeSize = Number.isFinite(size) ?
|
|
13463
|
-
return 2 * radius * Math.tan(
|
|
13539
|
+
const safeSize = Number.isFinite(size) ? import_three26.MathUtils.clamp(Math.abs(size), MIN_ANGULAR_SIZE, MAX_ANGULAR_SIZE) : MIN_ANGULAR_SIZE;
|
|
13540
|
+
return 2 * radius * Math.tan(import_three26.MathUtils.degToRad(safeSize) / 2);
|
|
13464
13541
|
}
|
|
13465
13542
|
function resolveScale(scale) {
|
|
13466
13543
|
return Number.isFinite(scale) && scale > 0 ? scale : 1;
|
|
@@ -13473,58 +13550,39 @@ function resolveDistance(placement, distance, width, height) {
|
|
|
13473
13550
|
if (!Number.isFinite(distance)) {
|
|
13474
13551
|
return DEFAULT_FLOATING_DISTANCE;
|
|
13475
13552
|
}
|
|
13476
|
-
return
|
|
13477
|
-
}
|
|
13478
|
-
function applyHotspotTransform(group, camera, orientation2, surfaceQuaternion3, rotation, scaleMode, referenceFov, useAngularScale, worldWidth, worldHeight) {
|
|
13479
|
-
if (orientation2 === "billboard") {
|
|
13480
|
-
group.quaternion.copy(camera.quaternion);
|
|
13481
|
-
} else {
|
|
13482
|
-
group.quaternion.copy(surfaceQuaternion3);
|
|
13483
|
-
}
|
|
13484
|
-
group.rotateOnAxis(LOCAL_FORWARD, import_three24.MathUtils.degToRad(-rotation));
|
|
13485
|
-
const scaleFactor = scaleMode === "fixed" && camera instanceof import_three24.PerspectiveCamera ? fixedScaleFactor(camera.fov, referenceFov) : 1;
|
|
13486
|
-
group.scale.set(
|
|
13487
|
-
(useAngularScale ? worldWidth : 1) * scaleFactor,
|
|
13488
|
-
(useAngularScale ? worldHeight : 1) * scaleFactor,
|
|
13489
|
-
1
|
|
13490
|
-
);
|
|
13491
|
-
group.updateMatrixWorld();
|
|
13553
|
+
return import_three26.MathUtils.clamp(Math.abs(distance), 0.1, maximumDistance);
|
|
13492
13554
|
}
|
|
13493
13555
|
function maximumHotspotDistance(width, height) {
|
|
13494
|
-
const safeWidth =
|
|
13556
|
+
const safeWidth = import_three26.MathUtils.clamp(
|
|
13495
13557
|
Math.abs(Number.isFinite(width) ? width : MIN_ANGULAR_SIZE),
|
|
13496
13558
|
MIN_ANGULAR_SIZE,
|
|
13497
13559
|
MAX_ANGULAR_SIZE
|
|
13498
13560
|
);
|
|
13499
|
-
const safeHeight =
|
|
13561
|
+
const safeHeight = import_three26.MathUtils.clamp(
|
|
13500
13562
|
Math.abs(Number.isFinite(height) ? height : MIN_ANGULAR_SIZE),
|
|
13501
13563
|
MIN_ANGULAR_SIZE,
|
|
13502
13564
|
MAX_ANGULAR_SIZE
|
|
13503
13565
|
);
|
|
13504
13566
|
const cornerFactor = Math.hypot(
|
|
13505
13567
|
1,
|
|
13506
|
-
Math.tan(
|
|
13507
|
-
Math.tan(
|
|
13568
|
+
Math.tan(import_three26.MathUtils.degToRad(safeWidth) / 2),
|
|
13569
|
+
Math.tan(import_three26.MathUtils.degToRad(safeHeight) / 2)
|
|
13508
13570
|
);
|
|
13509
13571
|
return (PANORAMA_RADIUS - PANORAMA_SURFACE_INSET) / cornerFactor;
|
|
13510
13572
|
}
|
|
13511
|
-
function fixedScaleFactor(cameraFov, referenceFov) {
|
|
13512
|
-
const safeReferenceFov = import_three24.MathUtils.clamp(referenceFov, 1, 179);
|
|
13513
|
-
return Math.tan(import_three24.MathUtils.degToRad(cameraFov) / 2) / Math.tan(import_three24.MathUtils.degToRad(safeReferenceFov) / 2);
|
|
13514
|
-
}
|
|
13515
13573
|
function createSurfaceQuaternion(position) {
|
|
13516
13574
|
const outward = panoPositionToVector3(position).normalize();
|
|
13517
13575
|
const inward = outward.clone().negate();
|
|
13518
|
-
const pitch =
|
|
13519
|
-
const yaw =
|
|
13520
|
-
const localUp = new
|
|
13576
|
+
const pitch = import_three26.MathUtils.degToRad(position.pitch);
|
|
13577
|
+
const yaw = import_three26.MathUtils.degToRad(position.yaw);
|
|
13578
|
+
const localUp = new import_three26.Vector3(
|
|
13521
13579
|
-Math.sin(pitch) * Math.sin(yaw),
|
|
13522
13580
|
Math.cos(pitch),
|
|
13523
13581
|
Math.sin(pitch) * Math.cos(yaw)
|
|
13524
13582
|
).normalize();
|
|
13525
13583
|
const localRight = localUp.clone().cross(inward).normalize();
|
|
13526
|
-
const basis = new
|
|
13527
|
-
return new
|
|
13584
|
+
const basis = new import_three26.Matrix4().makeBasis(localRight, localUp, inward);
|
|
13585
|
+
return new import_three26.Quaternion().setFromRotationMatrix(basis);
|
|
13528
13586
|
}
|
|
13529
13587
|
function makeInteractionEvent(id, position, event) {
|
|
13530
13588
|
return {
|
|
@@ -13537,7 +13595,7 @@ function makeInteractionEvent(id, position, event) {
|
|
|
13537
13595
|
function angularDistance(a, b) {
|
|
13538
13596
|
const aVector = panoPositionToVector3(a);
|
|
13539
13597
|
const bVector = panoPositionToVector3(b);
|
|
13540
|
-
return
|
|
13598
|
+
return import_three26.MathUtils.radToDeg(aVector.angleTo(bVector));
|
|
13541
13599
|
}
|
|
13542
13600
|
function isTooltipOpen(trigger, hovered, focused, pinned) {
|
|
13543
13601
|
switch (trigger) {
|
|
@@ -13772,7 +13830,7 @@ function HotspotAnchor({
|
|
|
13772
13830
|
const hotspotTargetRegistry = (0, import_react48.useContext)(HotspotTargetRegistryContext);
|
|
13773
13831
|
const eventBus = (0, import_react48.useContext)(PanoEventBusContext);
|
|
13774
13832
|
const cursorApi = usePanoCursor();
|
|
13775
|
-
const { camera, size } = (0,
|
|
13833
|
+
const { camera, size } = (0, import_fiber24.useThree)();
|
|
13776
13834
|
const groupRef = (0, import_react48.useRef)(null);
|
|
13777
13835
|
const tooltipAnchorRef = (0, import_react48.useRef)(null);
|
|
13778
13836
|
const dragStateRef = (0, import_react48.useRef)(null);
|
|
@@ -13813,8 +13871,8 @@ function HotspotAnchor({
|
|
|
13813
13871
|
const worldWidth = angularSizeToWorldSize(scaledWidth, resolvedDistance);
|
|
13814
13872
|
const worldHeight = angularSizeToWorldSize(scaledHeight, resolvedDistance);
|
|
13815
13873
|
const focusGeometry = (0, import_react48.useMemo)(() => {
|
|
13816
|
-
const planeGeometry = new
|
|
13817
|
-
const geometry = new
|
|
13874
|
+
const planeGeometry = new import_three26.PlaneGeometry(1, 1);
|
|
13875
|
+
const geometry = new import_three26.EdgesGeometry(planeGeometry);
|
|
13818
13876
|
planeGeometry.dispose();
|
|
13819
13877
|
return geometry;
|
|
13820
13878
|
}, []);
|
|
@@ -13917,7 +13975,8 @@ function HotspotAnchor({
|
|
|
13917
13975
|
referenceFov,
|
|
13918
13976
|
useAngularScale,
|
|
13919
13977
|
worldWidth,
|
|
13920
|
-
worldHeight
|
|
13978
|
+
worldHeight,
|
|
13979
|
+
resolvedDistance
|
|
13921
13980
|
);
|
|
13922
13981
|
if (tooltipOpen && tooltipAnchorRef.current) {
|
|
13923
13982
|
updateTooltipAnchor(
|
|
@@ -13933,6 +13992,7 @@ function HotspotAnchor({
|
|
|
13933
13992
|
camera,
|
|
13934
13993
|
orientation2,
|
|
13935
13994
|
referenceFov,
|
|
13995
|
+
resolvedDistance,
|
|
13936
13996
|
rotation,
|
|
13937
13997
|
scaleMode,
|
|
13938
13998
|
size,
|
|
@@ -13943,7 +14003,7 @@ function HotspotAnchor({
|
|
|
13943
14003
|
worldHeight,
|
|
13944
14004
|
worldWidth
|
|
13945
14005
|
]);
|
|
13946
|
-
(0,
|
|
14006
|
+
(0, import_fiber24.useFrame)((state) => {
|
|
13947
14007
|
const group = groupRef.current;
|
|
13948
14008
|
if (!group) {
|
|
13949
14009
|
return;
|
|
@@ -13958,7 +14018,8 @@ function HotspotAnchor({
|
|
|
13958
14018
|
referenceFov,
|
|
13959
14019
|
useAngularScale,
|
|
13960
14020
|
worldWidth,
|
|
13961
|
-
worldHeight
|
|
14021
|
+
worldHeight,
|
|
14022
|
+
resolvedDistance
|
|
13962
14023
|
);
|
|
13963
14024
|
if (tooltipOpen && tooltipAnchorRef.current) {
|
|
13964
14025
|
updateTooltipAnchor(
|
|
@@ -14104,10 +14165,10 @@ function HotspotAnchor({
|
|
|
14104
14165
|
}
|
|
14105
14166
|
|
|
14106
14167
|
// src/hotspot/hotspot-plane.tsx
|
|
14107
|
-
var
|
|
14168
|
+
var import_three27 = require("three");
|
|
14108
14169
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
14109
14170
|
var HOTSPOT_ALPHA_CUTOFF = 0.05;
|
|
14110
|
-
var SAMPLE_UV = new
|
|
14171
|
+
var SAMPLE_UV = new import_three27.Vector2();
|
|
14111
14172
|
var RAYCAST_HITS = [];
|
|
14112
14173
|
var IMAGE_DATA_CACHE = /* @__PURE__ */ new WeakMap();
|
|
14113
14174
|
function clampOpacity(opacity) {
|
|
@@ -14181,8 +14242,8 @@ function sampleTextureAlpha(texture, u, v) {
|
|
|
14181
14242
|
}
|
|
14182
14243
|
function hotspotPlaneRaycast(raycaster, intersects2) {
|
|
14183
14244
|
const material = Array.isArray(this.material) ? this.material[0] : this.material;
|
|
14184
|
-
if (!(material instanceof
|
|
14185
|
-
|
|
14245
|
+
if (!(material instanceof import_three27.MeshBasicMaterial)) {
|
|
14246
|
+
import_three27.Mesh.prototype.raycast.call(this, raycaster, intersects2);
|
|
14186
14247
|
return;
|
|
14187
14248
|
}
|
|
14188
14249
|
const cutoff = Math.max(material.alphaTest, HOTSPOT_ALPHA_CUTOFF);
|
|
@@ -14190,7 +14251,7 @@ function hotspotPlaneRaycast(raycaster, intersects2) {
|
|
|
14190
14251
|
return;
|
|
14191
14252
|
}
|
|
14192
14253
|
RAYCAST_HITS.length = 0;
|
|
14193
|
-
|
|
14254
|
+
import_three27.Mesh.prototype.raycast.call(this, raycaster, RAYCAST_HITS);
|
|
14194
14255
|
const map = material.map;
|
|
14195
14256
|
for (const hit of RAYCAST_HITS) {
|
|
14196
14257
|
if (!map || !hit.uv) {
|
|
@@ -14214,10 +14275,9 @@ function HotspotPlane({
|
|
|
14214
14275
|
{
|
|
14215
14276
|
target: "hotspot",
|
|
14216
14277
|
alphaTest: HOTSPOT_ALPHA_CUTOFF,
|
|
14217
|
-
alphaToCoverage: true,
|
|
14218
14278
|
map,
|
|
14219
14279
|
opacity: map ? clampOpacity(opacity) : 0,
|
|
14220
|
-
side:
|
|
14280
|
+
side: import_three27.DoubleSide,
|
|
14221
14281
|
toneMapped: false,
|
|
14222
14282
|
transparent: true
|
|
14223
14283
|
}
|
|
@@ -14228,7 +14288,7 @@ function HotspotPlane({
|
|
|
14228
14288
|
// src/hotspot/image-hotspot.tsx
|
|
14229
14289
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
14230
14290
|
function useHotspotImageTexture(src, onLoad, onError) {
|
|
14231
|
-
const gl = (0,
|
|
14291
|
+
const gl = (0, import_fiber25.useThree)((state) => state.gl);
|
|
14232
14292
|
const [texture, setTexture] = (0, import_react49.useState)(null);
|
|
14233
14293
|
const onLoadRef = (0, import_react49.useRef)(onLoad);
|
|
14234
14294
|
const onErrorRef = (0, import_react49.useRef)(onError);
|
|
@@ -14242,7 +14302,7 @@ function useHotspotImageTexture(src, onLoad, onError) {
|
|
|
14242
14302
|
active = false;
|
|
14243
14303
|
};
|
|
14244
14304
|
}
|
|
14245
|
-
const loader = new
|
|
14305
|
+
const loader = new import_three28.TextureLoader();
|
|
14246
14306
|
loader.load(
|
|
14247
14307
|
src,
|
|
14248
14308
|
(loadedTexture) => {
|
|
@@ -14250,11 +14310,11 @@ function useHotspotImageTexture(src, onLoad, onError) {
|
|
|
14250
14310
|
loadedTexture.dispose();
|
|
14251
14311
|
return;
|
|
14252
14312
|
}
|
|
14253
|
-
loadedTexture.colorSpace =
|
|
14254
|
-
loadedTexture.wrapS =
|
|
14255
|
-
loadedTexture.wrapT =
|
|
14256
|
-
loadedTexture.magFilter =
|
|
14257
|
-
loadedTexture.minFilter =
|
|
14313
|
+
loadedTexture.colorSpace = import_three28.SRGBColorSpace;
|
|
14314
|
+
loadedTexture.wrapS = import_three28.ClampToEdgeWrapping;
|
|
14315
|
+
loadedTexture.wrapT = import_three28.ClampToEdgeWrapping;
|
|
14316
|
+
loadedTexture.magFilter = import_three28.LinearFilter;
|
|
14317
|
+
loadedTexture.minFilter = import_three28.LinearMipmapLinearFilter;
|
|
14258
14318
|
loadedTexture.generateMipmaps = true;
|
|
14259
14319
|
loadedTexture.anisotropy = gl.capabilities.getMaxAnisotropy();
|
|
14260
14320
|
loadedTexture.needsUpdate = true;
|
|
@@ -14295,15 +14355,15 @@ function ImageHotspot({
|
|
|
14295
14355
|
|
|
14296
14356
|
// src/hotspot/polygon-hotspot.tsx
|
|
14297
14357
|
var import_react51 = require("react");
|
|
14298
|
-
var
|
|
14358
|
+
var import_three30 = require("three");
|
|
14299
14359
|
|
|
14300
14360
|
// src/hotspot/hotspot-stroke-line.tsx
|
|
14301
|
-
var
|
|
14302
|
-
var
|
|
14361
|
+
var import_drei = require("@react-three/drei");
|
|
14362
|
+
var import_fiber26 = require("@react-three/fiber");
|
|
14303
14363
|
var import_react50 = require("react");
|
|
14304
|
-
var
|
|
14364
|
+
var import_three29 = require("three");
|
|
14305
14365
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
14306
|
-
var LINE_WORLD_POSITION = new
|
|
14366
|
+
var LINE_WORLD_POSITION = new import_three29.Vector3();
|
|
14307
14367
|
function applyScreenSpaceDashScale(object, camera, viewportHeight) {
|
|
14308
14368
|
const material = object?.material;
|
|
14309
14369
|
if (!object || typeof material?.dashScale !== "number") {
|
|
@@ -14311,8 +14371,8 @@ function applyScreenSpaceDashScale(object, camera, viewportHeight) {
|
|
|
14311
14371
|
}
|
|
14312
14372
|
object.getWorldPosition(LINE_WORLD_POSITION);
|
|
14313
14373
|
const depth = Math.max(camera.position.distanceTo(LINE_WORLD_POSITION), 1);
|
|
14314
|
-
const fov = camera instanceof
|
|
14315
|
-
material.dashScale = viewportHeight / (2 * Math.tan(
|
|
14374
|
+
const fov = camera instanceof import_three29.PerspectiveCamera ? camera.fov : 75;
|
|
14375
|
+
material.dashScale = viewportHeight / (2 * Math.tan(import_three29.MathUtils.degToRad(fov) * 0.5) * depth);
|
|
14316
14376
|
}
|
|
14317
14377
|
function resolveDash(dashSize, gapSize) {
|
|
14318
14378
|
if (dashSize === void 0 || !Number.isFinite(dashSize) || dashSize <= 0) {
|
|
@@ -14334,7 +14394,7 @@ function HotspotStrokeLine({
|
|
|
14334
14394
|
gapSize
|
|
14335
14395
|
}) {
|
|
14336
14396
|
const lineRef = (0, import_react50.useRef)(null);
|
|
14337
|
-
const { camera, size } = (0,
|
|
14397
|
+
const { camera, size } = (0, import_fiber26.useThree)();
|
|
14338
14398
|
const dash = resolveDash(dashSize, gapSize);
|
|
14339
14399
|
(0, import_react50.useLayoutEffect)(() => {
|
|
14340
14400
|
if (!dash.dashed) {
|
|
@@ -14342,14 +14402,14 @@ function HotspotStrokeLine({
|
|
|
14342
14402
|
}
|
|
14343
14403
|
applyScreenSpaceDashScale(lineRef.current, camera, size.height);
|
|
14344
14404
|
}, [camera, dash.dashed, dash.dashSize, dash.gapSize, size.height]);
|
|
14345
|
-
(0,
|
|
14405
|
+
(0, import_fiber26.useFrame)((state) => {
|
|
14346
14406
|
if (!dash.dashed) {
|
|
14347
14407
|
return;
|
|
14348
14408
|
}
|
|
14349
14409
|
applyScreenSpaceDashScale(lineRef.current, state.camera, state.size.height);
|
|
14350
14410
|
});
|
|
14351
14411
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
14352
|
-
|
|
14412
|
+
import_drei.Line,
|
|
14353
14413
|
{
|
|
14354
14414
|
ref: lineRef,
|
|
14355
14415
|
alphaToCoverage: true,
|
|
@@ -14405,7 +14465,7 @@ function intersects(a, b, c, d) {
|
|
|
14405
14465
|
}
|
|
14406
14466
|
function hasSelfIntersection(vertices) {
|
|
14407
14467
|
const points = vertices.map(
|
|
14408
|
-
(vertex) => new
|
|
14468
|
+
(vertex) => new import_three30.Vector2(vertex.unwrappedYaw, vertex.pitch)
|
|
14409
14469
|
);
|
|
14410
14470
|
for (let index = 0; index < points.length; index += 1) {
|
|
14411
14471
|
const nextIndex = (index + 1) % points.length;
|
|
@@ -14442,7 +14502,7 @@ function polygonContainsDirection(vertices, direction) {
|
|
|
14442
14502
|
}
|
|
14443
14503
|
function fitsHemisphere(vertices) {
|
|
14444
14504
|
const directions = vertices.map((vertex) => panoPositionToVector3(vertex).normalize());
|
|
14445
|
-
const candidates = [new
|
|
14505
|
+
const candidates = [new import_three30.Vector3()];
|
|
14446
14506
|
for (const direction of directions) {
|
|
14447
14507
|
candidates[0].add(direction);
|
|
14448
14508
|
candidates.push(direction.clone());
|
|
@@ -14466,7 +14526,7 @@ function validatePolygonVertices(vertices) {
|
|
|
14466
14526
|
if (hasSelfIntersection(unwrapped)) {
|
|
14467
14527
|
issues.push({ code: "self_intersection", message: "Polygon edges cannot cross." });
|
|
14468
14528
|
}
|
|
14469
|
-
if (polygonContainsDirection(normalized, new
|
|
14529
|
+
if (polygonContainsDirection(normalized, new import_three30.Vector3(0, 1, 0)) || polygonContainsDirection(normalized, new import_three30.Vector3(0, -1, 0))) {
|
|
14470
14530
|
issues.push({ code: "contains_pole", message: "Polygons cannot contain a panorama pole." });
|
|
14471
14531
|
}
|
|
14472
14532
|
if (!fitsHemisphere(normalized)) {
|
|
@@ -14477,7 +14537,7 @@ function validatePolygonVertices(vertices) {
|
|
|
14477
14537
|
function polygonCenter(vertices) {
|
|
14478
14538
|
const sum = vertices.reduce(
|
|
14479
14539
|
(total, vertex) => total.add(panoPositionToVector3(vertex).normalize()),
|
|
14480
|
-
new
|
|
14540
|
+
new import_three30.Vector3()
|
|
14481
14541
|
);
|
|
14482
14542
|
return sum.lengthSq() > 1e-8 ? vector3ToPanoPosition(sum) : normalizePanoPosition(vertices[0]);
|
|
14483
14543
|
}
|
|
@@ -14486,20 +14546,20 @@ function surfaceQuaternion(position) {
|
|
|
14486
14546
|
const inward = outward.clone().negate();
|
|
14487
14547
|
const pitch = position.pitch * Math.PI / 180;
|
|
14488
14548
|
const yaw = position.yaw * Math.PI / 180;
|
|
14489
|
-
const localUp = new
|
|
14549
|
+
const localUp = new import_three30.Vector3(
|
|
14490
14550
|
-Math.sin(pitch) * Math.sin(yaw),
|
|
14491
14551
|
Math.cos(pitch),
|
|
14492
14552
|
Math.sin(pitch) * Math.cos(yaw)
|
|
14493
14553
|
).normalize();
|
|
14494
|
-
return new
|
|
14495
|
-
new
|
|
14554
|
+
return new import_three30.Quaternion().setFromRotationMatrix(
|
|
14555
|
+
new import_three30.Matrix4().makeBasis(localUp.clone().cross(inward).normalize(), localUp, inward)
|
|
14496
14556
|
);
|
|
14497
14557
|
}
|
|
14498
14558
|
function makeWorldToLocal(center) {
|
|
14499
|
-
return new
|
|
14559
|
+
return new import_three30.Matrix4().compose(
|
|
14500
14560
|
panoPositionToVector3(center, POLYGON_RADIUS),
|
|
14501
14561
|
surfaceQuaternion(center),
|
|
14502
|
-
new
|
|
14562
|
+
new import_three30.Vector3(1, 1, 1)
|
|
14503
14563
|
).invert();
|
|
14504
14564
|
}
|
|
14505
14565
|
function projectedPoint(a, b, c, weightB, weightC, radius, worldToLocal) {
|
|
@@ -14554,8 +14614,8 @@ function addSubdividedTriangle(positions, indices, a, b, c, worldToLocal, steps)
|
|
|
14554
14614
|
}
|
|
14555
14615
|
function makeFillGeometry(vertices, center) {
|
|
14556
14616
|
const unwrapped = unwrapPolygonVertices(vertices);
|
|
14557
|
-
const contour = unwrapped.map((vertex) => new
|
|
14558
|
-
const triangles =
|
|
14617
|
+
const contour = unwrapped.map((vertex) => new import_three30.Vector2(vertex.unwrappedYaw, vertex.pitch));
|
|
14618
|
+
const triangles = import_three30.ShapeUtils.triangulateShape(contour, []);
|
|
14559
14619
|
const positions = [];
|
|
14560
14620
|
const indices = [];
|
|
14561
14621
|
const worldToLocal = makeWorldToLocal(center);
|
|
@@ -14571,7 +14631,7 @@ function makeFillGeometry(vertices, center) {
|
|
|
14571
14631
|
steps
|
|
14572
14632
|
);
|
|
14573
14633
|
}
|
|
14574
|
-
return new
|
|
14634
|
+
return new import_three30.BufferGeometry().setAttribute("position", new import_three30.Float32BufferAttribute(positions, 3)).setIndex(indices);
|
|
14575
14635
|
}
|
|
14576
14636
|
function makeStrokePositions(vertices, center) {
|
|
14577
14637
|
const points = [];
|
|
@@ -14701,7 +14761,7 @@ function PolygonHotspot({
|
|
|
14701
14761
|
color: fill,
|
|
14702
14762
|
depthWrite: false,
|
|
14703
14763
|
opacity: Math.max(0, Math.min(fillOpacity, 1)),
|
|
14704
|
-
side:
|
|
14764
|
+
side: import_three30.DoubleSide,
|
|
14705
14765
|
transparent: true
|
|
14706
14766
|
}
|
|
14707
14767
|
) }),
|
|
@@ -14724,7 +14784,7 @@ function PolygonHotspot({
|
|
|
14724
14784
|
|
|
14725
14785
|
// src/hotspot/polyline-hotspot.tsx
|
|
14726
14786
|
var import_react52 = require("react");
|
|
14727
|
-
var
|
|
14787
|
+
var import_three31 = require("three");
|
|
14728
14788
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
14729
14789
|
var POLYLINE_RADIUS = 990;
|
|
14730
14790
|
var MAX_SEGMENT_DEGREES = 7;
|
|
@@ -14750,29 +14810,29 @@ function unwrapVertices(vertices) {
|
|
|
14750
14810
|
function polylineCenter(vertices) {
|
|
14751
14811
|
const sum = vertices.reduce(
|
|
14752
14812
|
(total, vertex) => total.add(panoPositionToVector3(vertex).normalize()),
|
|
14753
|
-
new
|
|
14813
|
+
new import_three31.Vector3()
|
|
14754
14814
|
);
|
|
14755
14815
|
return sum.lengthSq() > 1e-8 ? vector3ToPanoPosition(sum) : normalizePanoPosition(vertices[0]);
|
|
14756
14816
|
}
|
|
14757
14817
|
function surfaceQuaternion2(position) {
|
|
14758
14818
|
const outward = panoPositionToVector3(position).normalize();
|
|
14759
14819
|
const inward = outward.clone().negate();
|
|
14760
|
-
const pitch =
|
|
14761
|
-
const yaw =
|
|
14762
|
-
const localUp = new
|
|
14820
|
+
const pitch = import_three31.MathUtils.degToRad(position.pitch);
|
|
14821
|
+
const yaw = import_three31.MathUtils.degToRad(position.yaw);
|
|
14822
|
+
const localUp = new import_three31.Vector3(
|
|
14763
14823
|
-Math.sin(pitch) * Math.sin(yaw),
|
|
14764
14824
|
Math.cos(pitch),
|
|
14765
14825
|
Math.sin(pitch) * Math.cos(yaw)
|
|
14766
14826
|
).normalize();
|
|
14767
|
-
return new
|
|
14768
|
-
new
|
|
14827
|
+
return new import_three31.Quaternion().setFromRotationMatrix(
|
|
14828
|
+
new import_three31.Matrix4().makeBasis(localUp.clone().cross(inward).normalize(), localUp, inward)
|
|
14769
14829
|
);
|
|
14770
14830
|
}
|
|
14771
14831
|
function makeWorldToLocal2(center) {
|
|
14772
|
-
return new
|
|
14832
|
+
return new import_three31.Matrix4().compose(
|
|
14773
14833
|
panoPositionToVector3(center, POLYLINE_RADIUS),
|
|
14774
14834
|
surfaceQuaternion2(center),
|
|
14775
|
-
new
|
|
14835
|
+
new import_three31.Vector3(1, 1, 1)
|
|
14776
14836
|
).invert();
|
|
14777
14837
|
}
|
|
14778
14838
|
function subdivisionSteps(vertices) {
|
|
@@ -14787,7 +14847,7 @@ function subdivisionSteps(vertices) {
|
|
|
14787
14847
|
}
|
|
14788
14848
|
return Math.min(
|
|
14789
14849
|
8,
|
|
14790
|
-
Math.max(1, Math.ceil(
|
|
14850
|
+
Math.max(1, Math.ceil(import_three31.MathUtils.radToDeg(maxAngle) / MAX_SEGMENT_DEGREES))
|
|
14791
14851
|
);
|
|
14792
14852
|
}
|
|
14793
14853
|
function makeLinePositions(vertices, center) {
|
|
@@ -14918,7 +14978,7 @@ function PolylineHotspot({
|
|
|
14918
14978
|
|
|
14919
14979
|
// src/hotspot/graphic-hotspot.tsx
|
|
14920
14980
|
var import_react53 = require("react");
|
|
14921
|
-
var
|
|
14981
|
+
var import_three32 = require("three");
|
|
14922
14982
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
14923
14983
|
var GRAPHIC_TEXTURE_SIZE = 512;
|
|
14924
14984
|
function resolveStrokeWidth(value) {
|
|
@@ -15097,12 +15157,12 @@ function createGraphicTexture(graphic, aspectWidth, aspectHeight) {
|
|
|
15097
15157
|
throw new Error("Canvas 2D is unavailable for this graphic hotspot.");
|
|
15098
15158
|
}
|
|
15099
15159
|
drawGraphic(context, graphic, aspectWidth, aspectHeight);
|
|
15100
|
-
const texture = new
|
|
15101
|
-
texture.colorSpace =
|
|
15102
|
-
texture.wrapS =
|
|
15103
|
-
texture.wrapT =
|
|
15104
|
-
texture.magFilter =
|
|
15105
|
-
texture.minFilter =
|
|
15160
|
+
const texture = new import_three32.CanvasTexture(canvas);
|
|
15161
|
+
texture.colorSpace = import_three32.SRGBColorSpace;
|
|
15162
|
+
texture.wrapS = import_three32.ClampToEdgeWrapping;
|
|
15163
|
+
texture.wrapT = import_three32.ClampToEdgeWrapping;
|
|
15164
|
+
texture.magFilter = import_three32.LinearFilter;
|
|
15165
|
+
texture.minFilter = import_three32.LinearMipmapLinearFilter;
|
|
15106
15166
|
texture.generateMipmaps = true;
|
|
15107
15167
|
texture.needsUpdate = true;
|
|
15108
15168
|
return texture;
|
|
@@ -15151,9 +15211,9 @@ function GraphicHotspot(props) {
|
|
|
15151
15211
|
}
|
|
15152
15212
|
|
|
15153
15213
|
// src/hotspot/sequence-hotspot.tsx
|
|
15154
|
-
var
|
|
15214
|
+
var import_fiber27 = require("@react-three/fiber");
|
|
15155
15215
|
var import_react54 = require("react");
|
|
15156
|
-
var
|
|
15216
|
+
var import_three33 = require("three");
|
|
15157
15217
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
15158
15218
|
var DEFAULT_SEQUENCE_FPS = 12;
|
|
15159
15219
|
function resolveFps(value) {
|
|
@@ -15168,7 +15228,7 @@ function useSpriteTexture({
|
|
|
15168
15228
|
onError,
|
|
15169
15229
|
onLoadProgress
|
|
15170
15230
|
}) {
|
|
15171
|
-
const gl = (0,
|
|
15231
|
+
const gl = (0, import_fiber27.useThree)((state) => state.gl);
|
|
15172
15232
|
const [texture, setTexture] = (0, import_react54.useState)(null);
|
|
15173
15233
|
const onErrorRef = (0, import_react54.useRef)(onError);
|
|
15174
15234
|
const onLoadProgressRef = (0, import_react54.useRef)(onLoadProgress);
|
|
@@ -15183,7 +15243,7 @@ function useSpriteTexture({
|
|
|
15183
15243
|
active = false;
|
|
15184
15244
|
};
|
|
15185
15245
|
}
|
|
15186
|
-
const loader = new
|
|
15246
|
+
const loader = new import_three33.TextureLoader();
|
|
15187
15247
|
loader.load(
|
|
15188
15248
|
src,
|
|
15189
15249
|
(loadedTexture) => {
|
|
@@ -15191,11 +15251,11 @@ function useSpriteTexture({
|
|
|
15191
15251
|
loadedTexture.dispose();
|
|
15192
15252
|
return;
|
|
15193
15253
|
}
|
|
15194
|
-
loadedTexture.colorSpace =
|
|
15195
|
-
loadedTexture.wrapS =
|
|
15196
|
-
loadedTexture.wrapT =
|
|
15197
|
-
loadedTexture.magFilter =
|
|
15198
|
-
loadedTexture.minFilter =
|
|
15254
|
+
loadedTexture.colorSpace = import_three33.SRGBColorSpace;
|
|
15255
|
+
loadedTexture.wrapS = import_three33.ClampToEdgeWrapping;
|
|
15256
|
+
loadedTexture.wrapT = import_three33.ClampToEdgeWrapping;
|
|
15257
|
+
loadedTexture.magFilter = import_three33.LinearFilter;
|
|
15258
|
+
loadedTexture.minFilter = import_three33.LinearMipmapLinearFilter;
|
|
15199
15259
|
loadedTexture.generateMipmaps = true;
|
|
15200
15260
|
loadedTexture.anisotropy = gl.capabilities.getMaxAnisotropy();
|
|
15201
15261
|
loadedTexture.needsUpdate = true;
|
|
@@ -15300,7 +15360,7 @@ function SequenceHotspot({
|
|
|
15300
15360
|
onPlaybackStateChangeRef.current?.(nextState);
|
|
15301
15361
|
}
|
|
15302
15362
|
}, [playing, texture]);
|
|
15303
|
-
(0,
|
|
15363
|
+
(0, import_fiber27.useFrame)((_, deltaSeconds) => {
|
|
15304
15364
|
if (!texture || !playing || endedRef.current) {
|
|
15305
15365
|
return;
|
|
15306
15366
|
}
|
|
@@ -15334,9 +15394,9 @@ function SequenceHotspot({
|
|
|
15334
15394
|
}
|
|
15335
15395
|
|
|
15336
15396
|
// src/hotspot/video-hotspot.tsx
|
|
15337
|
-
var
|
|
15397
|
+
var import_fiber28 = require("@react-three/fiber");
|
|
15338
15398
|
var import_react55 = require("react");
|
|
15339
|
-
var
|
|
15399
|
+
var import_three34 = require("three");
|
|
15340
15400
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
15341
15401
|
function clampVolume2(volume) {
|
|
15342
15402
|
if (!Number.isFinite(volume)) {
|
|
@@ -15345,7 +15405,7 @@ function clampVolume2(volume) {
|
|
|
15345
15405
|
return Math.max(0, Math.min(volume, 1));
|
|
15346
15406
|
}
|
|
15347
15407
|
function usePosterTexture2(id, poster, onError) {
|
|
15348
|
-
const gl = (0,
|
|
15408
|
+
const gl = (0, import_fiber28.useThree)((state) => state.gl);
|
|
15349
15409
|
const [texture, setTexture] = (0, import_react55.useState)(null);
|
|
15350
15410
|
const onErrorRef = (0, import_react55.useRef)(onError);
|
|
15351
15411
|
onErrorRef.current = onError;
|
|
@@ -15357,7 +15417,7 @@ function usePosterTexture2(id, poster, onError) {
|
|
|
15357
15417
|
active = false;
|
|
15358
15418
|
};
|
|
15359
15419
|
}
|
|
15360
|
-
const loader = new
|
|
15420
|
+
const loader = new import_three34.TextureLoader();
|
|
15361
15421
|
loader.load(
|
|
15362
15422
|
poster,
|
|
15363
15423
|
(loadedTexture) => {
|
|
@@ -15365,11 +15425,11 @@ function usePosterTexture2(id, poster, onError) {
|
|
|
15365
15425
|
loadedTexture.dispose();
|
|
15366
15426
|
return;
|
|
15367
15427
|
}
|
|
15368
|
-
loadedTexture.colorSpace =
|
|
15369
|
-
loadedTexture.wrapS =
|
|
15370
|
-
loadedTexture.wrapT =
|
|
15371
|
-
loadedTexture.magFilter =
|
|
15372
|
-
loadedTexture.minFilter =
|
|
15428
|
+
loadedTexture.colorSpace = import_three34.SRGBColorSpace;
|
|
15429
|
+
loadedTexture.wrapS = import_three34.ClampToEdgeWrapping;
|
|
15430
|
+
loadedTexture.wrapT = import_three34.ClampToEdgeWrapping;
|
|
15431
|
+
loadedTexture.magFilter = import_three34.LinearFilter;
|
|
15432
|
+
loadedTexture.minFilter = import_three34.LinearMipmapLinearFilter;
|
|
15373
15433
|
loadedTexture.generateMipmaps = true;
|
|
15374
15434
|
loadedTexture.anisotropy = gl.capabilities.getMaxAnisotropy();
|
|
15375
15435
|
loadedTexture.needsUpdate = true;
|
|
@@ -15428,12 +15488,12 @@ function useVideoResource({
|
|
|
15428
15488
|
video.setAttribute("webkit-playsinline", "true");
|
|
15429
15489
|
}
|
|
15430
15490
|
video.poster = poster ?? "";
|
|
15431
|
-
const texture = new
|
|
15432
|
-
texture.colorSpace =
|
|
15433
|
-
texture.wrapS =
|
|
15434
|
-
texture.wrapT =
|
|
15435
|
-
texture.magFilter =
|
|
15436
|
-
texture.minFilter =
|
|
15491
|
+
const texture = new import_three34.VideoTexture(video);
|
|
15492
|
+
texture.colorSpace = import_three34.SRGBColorSpace;
|
|
15493
|
+
texture.wrapS = import_three34.ClampToEdgeWrapping;
|
|
15494
|
+
texture.wrapT = import_three34.ClampToEdgeWrapping;
|
|
15495
|
+
texture.magFilter = import_three34.LinearFilter;
|
|
15496
|
+
texture.minFilter = import_three34.LinearFilter;
|
|
15437
15497
|
texture.generateMipmaps = false;
|
|
15438
15498
|
const notifyState = (state) => {
|
|
15439
15499
|
if (active) {
|
|
@@ -15566,9 +15626,9 @@ function VideoHotspot({
|
|
|
15566
15626
|
}
|
|
15567
15627
|
|
|
15568
15628
|
// src/hotspot/audio-hotspot.tsx
|
|
15569
|
-
var
|
|
15629
|
+
var import_fiber29 = require("@react-three/fiber");
|
|
15570
15630
|
var import_react56 = require("react");
|
|
15571
|
-
var
|
|
15631
|
+
var import_three35 = require("three");
|
|
15572
15632
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
15573
15633
|
var SPEAKER_TEXTURE_SIZE = 512;
|
|
15574
15634
|
function paintSpeakerBody(context, center) {
|
|
@@ -15622,12 +15682,12 @@ function createSpeakerTexture(state) {
|
|
|
15622
15682
|
return exhaustive;
|
|
15623
15683
|
}
|
|
15624
15684
|
}
|
|
15625
|
-
const texture = new
|
|
15626
|
-
texture.colorSpace =
|
|
15627
|
-
texture.wrapS =
|
|
15628
|
-
texture.wrapT =
|
|
15629
|
-
texture.magFilter =
|
|
15630
|
-
texture.minFilter =
|
|
15685
|
+
const texture = new import_three35.CanvasTexture(canvas);
|
|
15686
|
+
texture.colorSpace = import_three35.SRGBColorSpace;
|
|
15687
|
+
texture.wrapS = import_three35.ClampToEdgeWrapping;
|
|
15688
|
+
texture.wrapT = import_three35.ClampToEdgeWrapping;
|
|
15689
|
+
texture.magFilter = import_three35.LinearFilter;
|
|
15690
|
+
texture.minFilter = import_three35.LinearMipmapLinearFilter;
|
|
15631
15691
|
texture.generateMipmaps = true;
|
|
15632
15692
|
texture.needsUpdate = true;
|
|
15633
15693
|
return texture;
|
|
@@ -15650,7 +15710,7 @@ function useSpeakerTextures(enabled) {
|
|
|
15650
15710
|
return textures;
|
|
15651
15711
|
}
|
|
15652
15712
|
function useIconTexture(icon, enabled, onError, id) {
|
|
15653
|
-
const gl = (0,
|
|
15713
|
+
const gl = (0, import_fiber29.useThree)((state) => state.gl);
|
|
15654
15714
|
const [texture, setTexture] = (0, import_react56.useState)(null);
|
|
15655
15715
|
const onErrorRef = (0, import_react56.useRef)(onError);
|
|
15656
15716
|
onErrorRef.current = onError;
|
|
@@ -15662,7 +15722,7 @@ function useIconTexture(icon, enabled, onError, id) {
|
|
|
15662
15722
|
active = false;
|
|
15663
15723
|
};
|
|
15664
15724
|
}
|
|
15665
|
-
const loader = new
|
|
15725
|
+
const loader = new import_three35.TextureLoader();
|
|
15666
15726
|
loader.load(
|
|
15667
15727
|
icon,
|
|
15668
15728
|
(loadedTexture) => {
|
|
@@ -15670,11 +15730,11 @@ function useIconTexture(icon, enabled, onError, id) {
|
|
|
15670
15730
|
loadedTexture.dispose();
|
|
15671
15731
|
return;
|
|
15672
15732
|
}
|
|
15673
|
-
loadedTexture.colorSpace =
|
|
15674
|
-
loadedTexture.wrapS =
|
|
15675
|
-
loadedTexture.wrapT =
|
|
15676
|
-
loadedTexture.magFilter =
|
|
15677
|
-
loadedTexture.minFilter =
|
|
15733
|
+
loadedTexture.colorSpace = import_three35.SRGBColorSpace;
|
|
15734
|
+
loadedTexture.wrapS = import_three35.ClampToEdgeWrapping;
|
|
15735
|
+
loadedTexture.wrapT = import_three35.ClampToEdgeWrapping;
|
|
15736
|
+
loadedTexture.magFilter = import_three35.LinearFilter;
|
|
15737
|
+
loadedTexture.minFilter = import_three35.LinearMipmapLinearFilter;
|
|
15678
15738
|
loadedTexture.generateMipmaps = true;
|
|
15679
15739
|
loadedTexture.anisotropy = gl.capabilities.getMaxAnisotropy();
|
|
15680
15740
|
loadedTexture.needsUpdate = true;
|
|
@@ -15789,7 +15849,7 @@ function AudioHotspot({
|
|
|
15789
15849
|
...anchorProps
|
|
15790
15850
|
}) {
|
|
15791
15851
|
usePanoMediaActivationIntent(playing);
|
|
15792
|
-
const camera = (0,
|
|
15852
|
+
const camera = (0, import_fiber29.useThree)((state) => state.camera);
|
|
15793
15853
|
const howl = useAudioHowl({
|
|
15794
15854
|
crossOrigin,
|
|
15795
15855
|
id,
|
|
@@ -15841,7 +15901,7 @@ function AudioHotspot({
|
|
|
15841
15901
|
document.removeEventListener("visibilitychange", handleVisibility);
|
|
15842
15902
|
};
|
|
15843
15903
|
}, [howl, pauseWhenHidden]);
|
|
15844
|
-
(0,
|
|
15904
|
+
(0, import_fiber29.useFrame)(() => {
|
|
15845
15905
|
if (!howl) {
|
|
15846
15906
|
return;
|
|
15847
15907
|
}
|
|
@@ -15859,7 +15919,7 @@ function AudioHotspot({
|
|
|
15859
15919
|
|
|
15860
15920
|
// src/hotspot/text-hotspot.tsx
|
|
15861
15921
|
var import_react57 = require("react");
|
|
15862
|
-
var
|
|
15922
|
+
var import_three36 = require("three");
|
|
15863
15923
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
15864
15924
|
var TEXT_TEXTURE_LONG_SIDE = 1024;
|
|
15865
15925
|
var DEFAULT_FONT_FAMILY = "system-ui, sans-serif";
|
|
@@ -16069,12 +16129,12 @@ function createTextTexture(text, width, height, style) {
|
|
|
16069
16129
|
throw new Error("Canvas 2D is unavailable for this text hotspot.");
|
|
16070
16130
|
}
|
|
16071
16131
|
drawTextHotspot(context, canvasWidth, canvasHeight, text, style);
|
|
16072
|
-
const texture = new
|
|
16073
|
-
texture.colorSpace =
|
|
16074
|
-
texture.wrapS =
|
|
16075
|
-
texture.wrapT =
|
|
16076
|
-
texture.magFilter =
|
|
16077
|
-
texture.minFilter =
|
|
16132
|
+
const texture = new import_three36.CanvasTexture(canvas);
|
|
16133
|
+
texture.colorSpace = import_three36.SRGBColorSpace;
|
|
16134
|
+
texture.wrapS = import_three36.ClampToEdgeWrapping;
|
|
16135
|
+
texture.wrapT = import_three36.ClampToEdgeWrapping;
|
|
16136
|
+
texture.magFilter = import_three36.LinearFilter;
|
|
16137
|
+
texture.minFilter = import_three36.LinearMipmapLinearFilter;
|
|
16078
16138
|
texture.generateMipmaps = true;
|
|
16079
16139
|
texture.needsUpdate = true;
|
|
16080
16140
|
return texture;
|
|
@@ -16182,8 +16242,8 @@ function TextHotspot({
|
|
|
16182
16242
|
}
|
|
16183
16243
|
|
|
16184
16244
|
// src/hotspot/iframe-hotspot.tsx
|
|
16185
|
-
var
|
|
16186
|
-
var
|
|
16245
|
+
var import_drei2 = require("@react-three/drei");
|
|
16246
|
+
var import_three37 = require("three");
|
|
16187
16247
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
16188
16248
|
var IFRAME_LONG_SIDE = 800;
|
|
16189
16249
|
var CSS3D_DISTANCE_FACTOR = 400;
|
|
@@ -16257,14 +16317,14 @@ function IframeHotspot({
|
|
|
16257
16317
|
{
|
|
16258
16318
|
depthWrite: false,
|
|
16259
16319
|
opacity: 0,
|
|
16260
|
-
side:
|
|
16320
|
+
side: import_three37.DoubleSide,
|
|
16261
16321
|
toneMapped: false,
|
|
16262
16322
|
transparent: true
|
|
16263
16323
|
}
|
|
16264
16324
|
)
|
|
16265
16325
|
] }),
|
|
16266
16326
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
16267
|
-
|
|
16327
|
+
import_drei2.Html,
|
|
16268
16328
|
{
|
|
16269
16329
|
distanceFactor: CSS3D_DISTANCE_FACTOR,
|
|
16270
16330
|
pointerEvents: acceptsPointer && pointerPolicy === "content" ? "auto" : "none",
|