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