@spatial-elements/core 1.0.0-beta.10 → 1.0.0-beta.12
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/catalog/CatalogEndpointRegistry.d.ts +2 -2
- package/dist/catalog/CatalogEndpointRegistry.d.ts.map +1 -1
- package/dist/catalog/CatalogEndpointRegistry.js.map +1 -1
- package/dist/catalog/CatalogModelOutline.d.ts.map +1 -1
- package/dist/catalog/CatalogModelOutline.js +4 -3
- package/dist/catalog/CatalogModelOutline.js.map +1 -1
- package/dist/catalog/CatalogTransition.d.ts +1 -1
- package/dist/catalog/CatalogTransition.js +1 -1
- package/dist/catalog/CatalogTransition.js.map +1 -1
- package/dist/catalog/catalogRecipes.js +2 -2
- package/dist/catalog/catalogRecipes.js.map +1 -1
- package/dist/catalog/listDeviceOrientation.d.ts +3 -0
- package/dist/catalog/listDeviceOrientation.d.ts.map +1 -1
- package/dist/catalog/listDeviceOrientation.js +15 -4
- package/dist/catalog/listDeviceOrientation.js.map +1 -1
- package/dist/catalog/stagedDockGeometry.js +2 -2
- package/dist/catalog/stagedDockGeometry.js.map +1 -1
- package/dist/spatial-element/SpatialElementDockController.d.ts +2 -3
- package/dist/spatial-element/SpatialElementDockController.d.ts.map +1 -1
- package/dist/spatial-element/SpatialElementDockController.js +13 -31
- package/dist/spatial-element/SpatialElementDockController.js.map +1 -1
- package/dist/spatial-element/SpatialElementHeaderFields.d.ts +18 -0
- package/dist/spatial-element/SpatialElementHeaderFields.d.ts.map +1 -0
- package/dist/spatial-element/SpatialElementHeaderFields.js +100 -0
- package/dist/spatial-element/SpatialElementHeaderFields.js.map +1 -0
- package/dist/spatial-element/SpatialElementPaneController.d.ts +0 -1
- package/dist/spatial-element/SpatialElementPaneController.d.ts.map +1 -1
- package/dist/spatial-element/SpatialElementPaneController.js +1 -5
- package/dist/spatial-element/SpatialElementPaneController.js.map +1 -1
- package/dist/spatial-element/messages.d.ts +13 -0
- package/dist/spatial-element/messages.d.ts.map +1 -1
- package/dist/spatial-element/messages.js +13 -0
- package/dist/spatial-element/messages.js.map +1 -1
- package/dist/spatial-element/spatialElementDock.d.ts +1 -1
- package/dist/spatial-element/spatialElementDock.js +1 -1
- package/dist/spatial-element/spatialElementDock.js.map +1 -1
- package/dist/stage/LiquidGlassPanel.d.ts.map +1 -1
- package/dist/stage/LiquidGlassPanel.js +5 -2
- package/dist/stage/LiquidGlassPanel.js.map +1 -1
- package/dist/stage/MinimapController.d.ts +1 -0
- package/dist/stage/MinimapController.d.ts.map +1 -1
- package/dist/stage/MinimapController.js +15 -9
- package/dist/stage/MinimapController.js.map +1 -1
- package/dist/stage/PanelPresentationController.d.ts.map +1 -1
- package/dist/stage/PanelPresentationController.js +16 -1
- package/dist/stage/PanelPresentationController.js.map +1 -1
- package/dist/stage/SpaceMouseAdapter.d.ts +10 -2
- package/dist/stage/SpaceMouseAdapter.d.ts.map +1 -1
- package/dist/stage/SpaceMouseAdapter.js +50 -8
- package/dist/stage/SpaceMouseAdapter.js.map +1 -1
- package/dist/stage/SpatialElementInteractionController.d.ts +5 -1
- package/dist/stage/SpatialElementInteractionController.d.ts.map +1 -1
- package/dist/stage/SpatialElementInteractionController.js +64 -32
- package/dist/stage/SpatialElementInteractionController.js.map +1 -1
- package/dist/stage/StageExperience.d.ts +3 -1
- package/dist/stage/StageExperience.d.ts.map +1 -1
- package/dist/stage/StageExperience.js +26 -9
- package/dist/stage/StageExperience.js.map +1 -1
- package/dist/stage/StageRenderPipeline.d.ts +1 -0
- package/dist/stage/StageRenderPipeline.d.ts.map +1 -1
- package/dist/stage/StageRenderPipeline.js +23 -5
- package/dist/stage/StageRenderPipeline.js.map +1 -1
- package/dist/stage/minimap/MinimapModelGeometry.d.ts +2 -0
- package/dist/stage/minimap/MinimapModelGeometry.d.ts.map +1 -1
- package/dist/stage/minimap/MinimapModelGeometry.js +28 -0
- package/dist/stage/minimap/MinimapModelGeometry.js.map +1 -1
- package/dist/stage/minimap/MinimapState.d.ts +3 -3
- package/dist/stage/minimap/MinimapState.d.ts.map +1 -1
- package/dist/stage/minimap/MinimapState.js.map +1 -1
- package/dist/stage/panelContext.d.ts +7 -0
- package/dist/stage/panelContext.d.ts.map +1 -1
- package/dist/stage/panelContext.js.map +1 -1
- package/dist/stage/panelFocusMath.d.ts +40 -0
- package/dist/stage/panelFocusMath.d.ts.map +1 -0
- package/dist/stage/panelFocusMath.js +83 -0
- package/dist/stage/panelFocusMath.js.map +1 -0
- package/dist/stage/scalarMath.d.ts +6 -0
- package/dist/stage/scalarMath.d.ts.map +1 -0
- package/dist/stage/scalarMath.js +6 -0
- package/dist/stage/scalarMath.js.map +1 -0
- package/dist/stage/spaceMousePermission.d.ts +13 -0
- package/dist/stage/spaceMousePermission.d.ts.map +1 -0
- package/dist/stage/spaceMousePermission.js +69 -0
- package/dist/stage/spaceMousePermission.js.map +1 -0
- package/dist/stage/spaceMousePlatform.d.ts +12 -0
- package/dist/stage/spaceMousePlatform.d.ts.map +1 -0
- package/dist/stage/spaceMousePlatform.js +19 -0
- package/dist/stage/spaceMousePlatform.js.map +1 -0
- package/dist/stage/stageConstants.d.ts.map +1 -1
- package/dist/stage/stageConstants.js +4 -4
- package/dist/stage/stageConstants.js.map +1 -1
- package/dist/stage/stageMath.d.ts +3 -36
- package/dist/stage/stageMath.d.ts.map +1 -1
- package/dist/stage/stageMath.js +28 -106
- package/dist/stage/stageMath.js.map +1 -1
- package/dist/stage/stageTypes.d.ts +3 -1
- package/dist/stage/stageTypes.d.ts.map +1 -1
- package/dist/stage/stageTypes.js.map +1 -1
- package/dist/stage/webgpuSupport.d.ts +3 -0
- package/dist/stage/webgpuSupport.d.ts.map +1 -0
- package/dist/stage/webgpuSupport.js +14 -0
- package/dist/stage/webgpuSupport.js.map +1 -0
- package/logo.svg +90 -53
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MinimapModelGeometry.d.ts","sourceRoot":"","sources":["../../../src/stage/minim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,EAAE,MAAM,EAAE,OAAO,SAAU,EAAE,YAAY,gBAAsB,UAwB9F;AAED,qGAAqG;AACrG,wBAAgB,6BAA6B,CAC5C,MAAM,EAAE,SAAS,KAAK,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,iBAAiB,EAC7F,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iBAiBnC"}
|
|
@@ -46,6 +46,34 @@ export function getMinimapTopAlignmentOffset(points, modelMatrix, camera, viewpo
|
|
|
46
46
|
}
|
|
47
47
|
return Number.isFinite(offset) ? offset : 0;
|
|
48
48
|
}
|
|
49
|
+
/** Center the visible silhouette in the header, clamping oversized/hovered models to its safe top. */
|
|
50
|
+
export function getMinimapDockAlignmentOffset(points, modelMatrix, camera, viewportHeight, safeTop, centerY = safeTop, parentMatrix = new THREE.Matrix4()) {
|
|
51
|
+
const matrix = modelMatrix.clone();
|
|
52
|
+
const direction = new THREE.Vector4(0, 1, 0, 0).applyMatrix4(parentMatrix);
|
|
53
|
+
const point = new THREE.Vector3();
|
|
54
|
+
let offset = 0;
|
|
55
|
+
// Recompute after translating: tilted parent panels can change projected height.
|
|
56
|
+
for (let iteration = 0; iteration < 4; iteration++) {
|
|
57
|
+
let top = Infinity, bottom = -Infinity;
|
|
58
|
+
for (const bound of points) {
|
|
59
|
+
point.copy(bound).applyMatrix4(matrix).project(camera);
|
|
60
|
+
const y = (1 - point.y) * viewportHeight / 2;
|
|
61
|
+
top = Math.min(top, y);
|
|
62
|
+
bottom = Math.max(bottom, y);
|
|
63
|
+
}
|
|
64
|
+
if (!Number.isFinite(top + bottom))
|
|
65
|
+
return 0;
|
|
66
|
+
const targetTop = Math.max(safeTop, centerY - (bottom - top) / 2);
|
|
67
|
+
const step = getMinimapTopAlignmentOffset(points, matrix, camera, viewportHeight, targetTop, parentMatrix);
|
|
68
|
+
offset += step;
|
|
69
|
+
matrix.elements[12] += direction.x * step;
|
|
70
|
+
matrix.elements[13] += direction.y * step;
|
|
71
|
+
matrix.elements[14] += direction.z * step;
|
|
72
|
+
if (Math.abs(top - targetTop) < 0.001)
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
return offset;
|
|
76
|
+
}
|
|
49
77
|
/** Smallest camera-right translation that keeps every projected corner inside the safe left edge. */
|
|
50
78
|
export function getMinimapLeftAlignmentOffset(points, modelMatrix, camera, viewportWidth, left) {
|
|
51
79
|
const projection = new THREE.Matrix4().multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MinimapModelGeometry.js","sourceRoot":"","sources":["../../../src/stage/minimap/MinimapModelGeometry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAGrF,8FAA8F;AAC9F,MAAM,UAAU,qBAAqB,CAAC,MAAkB,EAAE,MAAqB;IAC9E,MAAM,MAAM,GAAG,MAAM,CAAC,iBAAiB,CAAC,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5D,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC;AAC1E,CAAC;AAED,yFAAyF;AACzF,MAAM,UAAU,uBAAuB,CACtC,KAAa,EAAE,MAAc,EAAE,WAAmB,EAClD,UAAmD,EAAE,EAAE,iBAAiB,GAAG,CAAC;IAE5E,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9C,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,C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AK,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;QACnF,CAAC;IACF,CAAC;IACD,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1G,CAAC","sourcesContent":["import * as THREE from 'three/webgpu';\nimport { MINIMAP_MODEL_FILL } from '../stageConstants.js';\nimport { getCameraOrbitQuaternion, resolveMinimapModelScale } from '../stageMath.js';\nimport type { StageCameraSettings, StageMinimapDockedView } from '../stageTypes.js';\n\n/** Low geometry is fitted around the shared LOD pivot, not its own possibly offset center. */\nexport function getMinimapModelRadius(bounds: THREE.Box3, center: THREE.Vector3) {\n\tconst sphere = bounds.getBoundingSphere(new THREE.Sphere());\n\treturn Math.max(sphere.radius + sphere.center.distanceTo(center), 0.001);\n}\n\n/** Resting fit shared by mounted and pre-route minimaps; hover is applied separately. */\nexport function getMinimapModelFitScale(\n\twidth: number, height: number, modelRadius: number,\n\toptions: { inset?: number; modelScale?: number } = {}, presentationScale = 1\n) {\n\tconst inset = Math.max(options.inset ?? 0, 0);\n\tconst diameter = Math.min(Math.max(width - inset * 2, 8), Math.max(height - inset * 2, 8));\n\treturn diameter * MINIMAP_MODEL_FILL * resolveMinimapModelScale(options.modelScale) *\n\t\tTHREE.MathUtils.clamp(presentationScale, 0.2, 2) / Math.max(modelRadius * 2, 0.001);\n}\n\nexport function getMinimapRestQuaternion(camera: THREE.Quaternion, model: THREE.Quaternion) {\n\treturn camera.clone().invert().multiply(model);\n}\n\n/** Omitted dock angles retain the authored stage view, including an explicitly partial override. */\nexport function getMinimapDockedQuaternion(\n\tdocked: StageMinimapDockedView | undefined, camera: StageCameraSettings, model: THREE.Quaternion\n) {\n\tif (!Number.isFinite(docked?.azimuth) && !Number.isFinite(docked?.elevation)) return undefined;\n\treturn getCameraOrbitQuaternion(docked?.azimuth ?? camera.azimuth, docked?.elevation ?? camera.elevation)\n\t\t.invert().multiply(model);\n}\n\n/**\n * Exact translation along a parent's Y axis that puts the projected model top\n * on a viewport row. Solving each corner's homogeneous projection also handles\n * depth, hover enlargement and tilted panels without a screen-space estimate.\n */\nexport function getMinimapTopAlignmentOffset(\n\tpoints: readonly THREE.Vector3[], modelMatrix: THREE.Matrix4, camera: THREE.PerspectiveCamera,\n\tviewportHeight: number, top: number, parentMatrix = new THREE.Matrix4()\n) {\n\tconst projection = new THREE.Matrix4().multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);\n\tconst direction = new THREE.Vector4(0, 1, 0, 0).applyMatrix4(parentMatrix).applyMatrix4(projection);\n\tconst transform = projection.multiply(modelMatrix);\n\tconst targetY = 1 - top * 2 / Math.max(viewportHeight, 1);\n\tconst slope = direction.y - targetY * direction.w;\n\tif (!Number.isFinite(slope) || slope <= 0.000001) return 0;\n\tconst point = new THREE.Vector4();\n\tlet offset = Number.POSITIVE_INFINITY;\n\tfor (const bound of points) {\n\t\tpoint.set(bound.x, bound.y, bound.z, 1).applyMatrix4(transform);\n\t\tif (point.w <= 0) continue;\n\t\toffset = Math.min(offset, (targetY * point.w - point.y) / slope);\n\t}\n\treturn Number.isFinite(offset) ? offset : 0;\n}\n\n/** Smallest camera-right translation that keeps every projected corner inside the safe left edge. */\nexport function getMinimapLeftAlignmentOffset(\n\tpoints: readonly THREE.Vector3[], modelMatrix: THREE.Matrix4, camera: THREE.PerspectiveCamera,\n\tviewportWidth: number, left: number\n) {\n\tconst projection = new THREE.Matrix4().multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);\n\tconst right = new THREE.Vector4(1, 0, 0, 0).applyMatrix4(camera.matrixWorld);\n\tconst direction = right.clone().applyMatrix4(projection);\n\tconst transform = projection.multiply(modelMatrix);\n\tconst targetX = left * 2 / Math.max(viewportWidth, 1) - 1;\n\tconst slope = direction.x - targetX * direction.w;\n\tlet offset = 0;\n\tif (Number.isFinite(slope) && slope > 0.000001) {\n\t\tconst point = new THREE.Vector4();\n\t\tfor (const bound of points) {\n\t\t\tpoint.set(bound.x, bound.y, bound.z, 1).applyMatrix4(transform);\n\t\t\tif (point.w > 0) offset = Math.max(offset, (targetX * point.w - point.x) / slope);\n\t\t}\n\t}\n\treturn new THREE.Vector3(right.x, right.y, right.z).multiplyScalar(Number.isFinite(offset) ? offset : 0);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"MinimapModelGeometry.js","sourceRoot":"","sources":["../../../src/stage/minimap/MinimapModelGeometry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAGrF,8FAA8F;AAC9F,MAAM,UAAU,qBAAqB,CAAC,MAAkB,EAAE,MAAqB;IAC9E,MAAM,MAAM,GAAG,MAAM,CAAC,iBAAiB,CAAC,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5D,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC;AAC1E,CAAC;AAED,yFAAyF;AACzF,MAAM,UAAU,uBAAuB,CACtC,KAAa,EAAE,MAAc,EAAE,WAAmB,EAClD,UAAmD,EAAE,EAAE,iBAAiB,GAAG,CAAC;IAE5E,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9C,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,GA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AAC,CAAC,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC;IAClD,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,QAAQ,EAAE,CAAC;QAChD,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;QAClC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC5B,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;YAChE,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC;gBAAE,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;QACnF,CAAC;IACF,CAAC;IACD,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1G,CAAC","sourcesContent":["import * as THREE from 'three/webgpu';\nimport { MINIMAP_MODEL_FILL } from '../stageConstants.js';\nimport { getCameraOrbitQuaternion, resolveMinimapModelScale } from '../stageMath.js';\nimport type { StageCameraSettings, StageMinimapDockedView } from '../stageTypes.js';\n\n/** Low geometry is fitted around the shared LOD pivot, not its own possibly offset center. */\nexport function getMinimapModelRadius(bounds: THREE.Box3, center: THREE.Vector3) {\n\tconst sphere = bounds.getBoundingSphere(new THREE.Sphere());\n\treturn Math.max(sphere.radius + sphere.center.distanceTo(center), 0.001);\n}\n\n/** Resting fit shared by mounted and pre-route minimaps; hover is applied separately. */\nexport function getMinimapModelFitScale(\n\twidth: number, height: number, modelRadius: number,\n\toptions: { inset?: number; modelScale?: number } = {}, presentationScale = 1\n) {\n\tconst inset = Math.max(options.inset ?? 0, 0);\n\tconst diameter = Math.min(Math.max(width - inset * 2, 8), Math.max(height - inset * 2, 8));\n\treturn diameter * MINIMAP_MODEL_FILL * resolveMinimapModelScale(options.modelScale) *\n\t\tTHREE.MathUtils.clamp(presentationScale, 0.2, 2) / Math.max(modelRadius * 2, 0.001);\n}\n\nexport function getMinimapRestQuaternion(camera: THREE.Quaternion, model: THREE.Quaternion) {\n\treturn camera.clone().invert().multiply(model);\n}\n\n/** Omitted dock angles retain the authored stage view, including an explicitly partial override. */\nexport function getMinimapDockedQuaternion(\n\tdocked: StageMinimapDockedView | undefined, camera: StageCameraSettings, model: THREE.Quaternion\n) {\n\tif (!Number.isFinite(docked?.azimuth) && !Number.isFinite(docked?.elevation)) return undefined;\n\treturn getCameraOrbitQuaternion(docked?.azimuth ?? camera.azimuth, docked?.elevation ?? camera.elevation)\n\t\t.invert().multiply(model);\n}\n\n/**\n * Exact translation along a parent's Y axis that puts the projected model top\n * on a viewport row. Solving each corner's homogeneous projection also handles\n * depth, hover enlargement and tilted panels without a screen-space estimate.\n */\nexport function getMinimapTopAlignmentOffset(\n\tpoints: readonly THREE.Vector3[], modelMatrix: THREE.Matrix4, camera: THREE.PerspectiveCamera,\n\tviewportHeight: number, top: number, parentMatrix = new THREE.Matrix4()\n) {\n\tconst projection = new THREE.Matrix4().multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);\n\tconst direction = new THREE.Vector4(0, 1, 0, 0).applyMatrix4(parentMatrix).applyMatrix4(projection);\n\tconst transform = projection.multiply(modelMatrix);\n\tconst targetY = 1 - top * 2 / Math.max(viewportHeight, 1);\n\tconst slope = direction.y - targetY * direction.w;\n\tif (!Number.isFinite(slope) || slope <= 0.000001) return 0;\n\tconst point = new THREE.Vector4();\n\tlet offset = Number.POSITIVE_INFINITY;\n\tfor (const bound of points) {\n\t\tpoint.set(bound.x, bound.y, bound.z, 1).applyMatrix4(transform);\n\t\tif (point.w <= 0) continue;\n\t\toffset = Math.min(offset, (targetY * point.w - point.y) / slope);\n\t}\n\treturn Number.isFinite(offset) ? offset : 0;\n}\n\n/** Center the visible silhouette in the header, clamping oversized/hovered models to its safe top. */\nexport function getMinimapDockAlignmentOffset(\n\tpoints: readonly THREE.Vector3[], modelMatrix: THREE.Matrix4, camera: THREE.PerspectiveCamera,\n\tviewportHeight: number, safeTop: number, centerY = safeTop, parentMatrix = new THREE.Matrix4()\n) {\n\tconst matrix = modelMatrix.clone();\n\tconst direction = new THREE.Vector4(0, 1, 0, 0).applyMatrix4(parentMatrix);\n\tconst point = new THREE.Vector3();\n\tlet offset = 0;\n\t// Recompute after translating: tilted parent panels can change projected height.\n\tfor (let iteration = 0; iteration < 4; iteration++) {\n\t\tlet top = Infinity, bottom = -Infinity;\n\t\tfor (const bound of points) {\n\t\t\tpoint.copy(bound).applyMatrix4(matrix).project(camera);\n\t\t\tconst y = (1 - point.y) * viewportHeight / 2;\n\t\t\ttop = Math.min(top, y); bottom = Math.max(bottom, y);\n\t\t}\n\t\tif (!Number.isFinite(top + bottom)) return 0;\n\t\tconst targetTop = Math.max(safeTop, centerY - (bottom - top) / 2);\n\t\tconst step = getMinimapTopAlignmentOffset(points, matrix, camera, viewportHeight, targetTop, parentMatrix);\n\t\toffset += step;\n\t\tmatrix.elements[12] += direction.x * step;\n\t\tmatrix.elements[13] += direction.y * step;\n\t\tmatrix.elements[14] += direction.z * step;\n\t\tif (Math.abs(top - targetTop) < 0.001) break;\n\t}\n\treturn offset;\n}\n\n/** Smallest camera-right translation that keeps every projected corner inside the safe left edge. */\nexport function getMinimapLeftAlignmentOffset(\n\tpoints: readonly THREE.Vector3[], modelMatrix: THREE.Matrix4, camera: THREE.PerspectiveCamera,\n\tviewportWidth: number, left: number\n) {\n\tconst projection = new THREE.Matrix4().multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);\n\tconst right = new THREE.Vector4(1, 0, 0, 0).applyMatrix4(camera.matrixWorld);\n\tconst direction = right.clone().applyMatrix4(projection);\n\tconst transform = projection.multiply(modelMatrix);\n\tconst targetX = left * 2 / Math.max(viewportWidth, 1) - 1;\n\tconst slope = direction.x - targetX * direction.w;\n\tlet offset = 0;\n\tif (Number.isFinite(slope) && slope > 0.000001) {\n\t\tconst point = new THREE.Vector4();\n\t\tfor (const bound of points) {\n\t\t\tpoint.set(bound.x, bound.y, bound.z, 1).applyMatrix4(transform);\n\t\t\tif (point.w > 0) offset = Math.max(offset, (targetX * point.w - point.x) / slope);\n\t\t}\n\t}\n\treturn new THREE.Vector3(right.x, right.y, right.z).multiplyScalar(Number.isFinite(offset) ? offset : 0);\n}\n"]}
|
|
@@ -74,10 +74,10 @@ export interface StageMinimapState {
|
|
|
74
74
|
blurGuard: number;
|
|
75
75
|
captureExtentWidth: number;
|
|
76
76
|
captureExtentHeight: number;
|
|
77
|
-
overlayRing: THREE.Mesh<THREE.BufferGeometry, THREE.
|
|
77
|
+
overlayRing: THREE.Mesh<THREE.BufferGeometry, THREE.MeshBasicNodeMaterial>;
|
|
78
78
|
/** Stable depth variants avoid material recompilation on each zoom boundary. */
|
|
79
|
-
ringRestMaterial: THREE.
|
|
80
|
-
ringForegroundMaterial: THREE.
|
|
79
|
+
ringRestMaterial: THREE.MeshBasicNodeMaterial;
|
|
80
|
+
ringForegroundMaterial: THREE.MeshBasicNodeMaterial;
|
|
81
81
|
overlayProgress: number;
|
|
82
82
|
overlayGeometryWidth: number;
|
|
83
83
|
overlayGeometryHeight: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MinimapState.d.ts","sourceRoot":"","sources":["../../../src/stage/minimap/MinimapState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,EAAE,QAAQ,EAA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,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAC3E,gFAAgF;IAChF,gBAAgB,EAAE,KAAK,CAAC,qBAAqB,CAAC;IAC9C,sBAAsB,EAAE,KAAK,CAAC,qBAAqB,CAAC;IACpD,eAAe,EAAE,MAAM,CAAC;IACxB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,mFAAmF;IACnF,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,6EAA6E;IAC7E,eAAe,EAAE,OAAO,CAAC;IACzB,OAAO,EAAE,2BAA2B,CAAC;CACrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MinimapState.js","sourceRoot":"","sources":["../../../src/stage/minimap/MinimapState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC","sourcesContent":["import * as THREE from 'three/webgpu';\nimport type { Object3D } from 'three';\nimport type { MinimapMaterialOpacityState } from './MinimapModel.js';\nimport type { MinimapBlurPipeline } from '../MinimapBlurPipeline.js';\nimport type { StageMinimapOptions } from '../stageTypes.js';\n\nexport type ResolvedStageMinimapOptions = Required<Omit<StageMinimapOptions, 'dockedView'>>;\n\nexport type { MinimapMaterialOpacityState } from './MinimapModel.js';\n\n/**\n * Owns all resources and animated values for one panel-backed element minimap.\n *\n * The live display model stays separate from the isolated blur capture so pointer\n * interaction cannot change the pixels used by the overlay.\n */\nexport interface StageMinimapState {\n\tpanelIndex: number;\n\tscreenCamera: THREE.PerspectiveCamera;\n\tcamera: THREE.PerspectiveCamera;\n\tcaptureCamera: THREE.PerspectiveCamera;\n\tmodel: Object3D;\n\tsourceRoot: Object3D;\n\tdisplayModel: Object3D;\n\t/** Canonical element root within the minimap's centering/orientation hierarchy. */\n\tspatialElementRoot: Object3D;\n\t/** Per-mesh bound points expressed in the centered display model's local coordinates. */\n\tmodelBoundsPoints: THREE.Vector3[];\n\t/** Camera-relative element pose captured from the fitted initial stage view. */\n\trestQuaternion: THREE.Quaternion;\n\t/** Optional camera-relative element pose authored for the docked presentation. */\n\tdockedQuaternion?: THREE.Quaternion;\n\tdisplayMaterials: MinimapMaterialOpacityState[];\n\tdisplayOpacity: number;\n\tlayer: THREE.Group;\n\tmodelRadius: number;\n\tbaseWidth: number;\n\tbaseHeight: number;\n\tbaseRadius: number;\n\tcurrentWidth: number;\n\tcurrentHeight: number;\n\tsourceScene: THREE.Scene;\n\tcaptureLayer: THREE.Group;\n\tcontextTarget: THREE.RenderTarget;\n\tdisplayTarget: THREE.RenderTarget;\n\tpanelTarget: THREE.RenderTarget;\n\tblurPipeline: MinimapBlurPipeline;\n\tdisplayMaterial: THREE.NodeMaterial;\n\tdisplayQuad: THREE.QuadMesh;\n\toverlayComposite: THREE.Mesh<THREE.BufferGeometry, THREE.NodeMaterial>;\n\t/** Live source used to composite the glass result over the active stage capture. */\n\tstageCaptureTexture: { value: THREE.Texture };\n\t/** Matching preallocated blur capture used by frosted minimap surfaces. */\n\tstageBlurTexture: { value: THREE.Texture };\n\toverlayVisibility: { value: number };\n\toverlayPanelSize: { value: THREE.Vector2 };\n\toverlayViewportCenter: { value: THREE.Vector2 };\n\toverlayViewportHalfSize: { value: THREE.Vector2 };\n\toverlayViewportRadii: { value: THREE.Vector4 };\n\tcaptureUvScale: { value: THREE.Vector2 };\n\tblurGuard: number;\n\tcaptureExtentWidth: number;\n\tcaptureExtentHeight: number;\n\toverlayRing: THREE.Mesh<THREE.BufferGeometry, THREE.
|
|
1
|
+
{"version":3,"file":"MinimapState.js","sourceRoot":"","sources":["../../../src/stage/minimap/MinimapState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC","sourcesContent":["import * as THREE from 'three/webgpu';\nimport type { Object3D } from 'three';\nimport type { MinimapMaterialOpacityState } from './MinimapModel.js';\nimport type { MinimapBlurPipeline } from '../MinimapBlurPipeline.js';\nimport type { StageMinimapOptions } from '../stageTypes.js';\n\nexport type ResolvedStageMinimapOptions = Required<Omit<StageMinimapOptions, 'dockedView'>>;\n\nexport type { MinimapMaterialOpacityState } from './MinimapModel.js';\n\n/**\n * Owns all resources and animated values for one panel-backed element minimap.\n *\n * The live display model stays separate from the isolated blur capture so pointer\n * interaction cannot change the pixels used by the overlay.\n */\nexport interface StageMinimapState {\n\tpanelIndex: number;\n\tscreenCamera: THREE.PerspectiveCamera;\n\tcamera: THREE.PerspectiveCamera;\n\tcaptureCamera: THREE.PerspectiveCamera;\n\tmodel: Object3D;\n\tsourceRoot: Object3D;\n\tdisplayModel: Object3D;\n\t/** Canonical element root within the minimap's centering/orientation hierarchy. */\n\tspatialElementRoot: Object3D;\n\t/** Per-mesh bound points expressed in the centered display model's local coordinates. */\n\tmodelBoundsPoints: THREE.Vector3[];\n\t/** Camera-relative element pose captured from the fitted initial stage view. */\n\trestQuaternion: THREE.Quaternion;\n\t/** Optional camera-relative element pose authored for the docked presentation. */\n\tdockedQuaternion?: THREE.Quaternion;\n\tdisplayMaterials: MinimapMaterialOpacityState[];\n\tdisplayOpacity: number;\n\tlayer: THREE.Group;\n\tmodelRadius: number;\n\tbaseWidth: number;\n\tbaseHeight: number;\n\tbaseRadius: number;\n\tcurrentWidth: number;\n\tcurrentHeight: number;\n\tsourceScene: THREE.Scene;\n\tcaptureLayer: THREE.Group;\n\tcontextTarget: THREE.RenderTarget;\n\tdisplayTarget: THREE.RenderTarget;\n\tpanelTarget: THREE.RenderTarget;\n\tblurPipeline: MinimapBlurPipeline;\n\tdisplayMaterial: THREE.NodeMaterial;\n\tdisplayQuad: THREE.QuadMesh;\n\toverlayComposite: THREE.Mesh<THREE.BufferGeometry, THREE.NodeMaterial>;\n\t/** Live source used to composite the glass result over the active stage capture. */\n\tstageCaptureTexture: { value: THREE.Texture };\n\t/** Matching preallocated blur capture used by frosted minimap surfaces. */\n\tstageBlurTexture: { value: THREE.Texture };\n\toverlayVisibility: { value: number };\n\toverlayPanelSize: { value: THREE.Vector2 };\n\toverlayViewportCenter: { value: THREE.Vector2 };\n\toverlayViewportHalfSize: { value: THREE.Vector2 };\n\toverlayViewportRadii: { value: THREE.Vector4 };\n\tcaptureUvScale: { value: THREE.Vector2 };\n\tblurGuard: number;\n\tcaptureExtentWidth: number;\n\tcaptureExtentHeight: number;\n\toverlayRing: THREE.Mesh<THREE.BufferGeometry, THREE.MeshBasicNodeMaterial>;\n\t/** Stable depth variants avoid material recompilation on each zoom boundary. */\n\tringRestMaterial: THREE.MeshBasicNodeMaterial;\n\tringForegroundMaterial: THREE.MeshBasicNodeMaterial;\n\toverlayProgress: number;\n\toverlayGeometryWidth: number;\n\toverlayGeometryHeight: number;\n\toverlayGeometryDirty: boolean;\n\t/** Reusable numeric snapshot used to invalidate the expensive overlay captures. */\n\toverlayCaptureState: number[];\n\toverlayCaptureDirty: boolean;\n\toverlayCaptureValid: boolean;\n\tpanelCaptureState: number[];\n\tpanelCaptureDirty: boolean;\n\tpanelCaptureValid: boolean;\n\tpointerReveal: number;\n\t/** Whether the panel-backed minimap intersects the viewport preload area. */\n\tviewportVisible: boolean;\n\toptions: ResolvedStageMinimapOptions;\n}\n"]}
|
|
@@ -66,6 +66,7 @@ export interface StagePanelRegistration {
|
|
|
66
66
|
getMinimapDockProgress(): number;
|
|
67
67
|
/** Returns the viewport-space top edge used to anchor the rendered model. */
|
|
68
68
|
getMinimapModelTop(): number | undefined;
|
|
69
|
+
getMinimapModelCenterY?: () => number | undefined;
|
|
69
70
|
getMinimapModelLeft?(): number | undefined;
|
|
70
71
|
}
|
|
71
72
|
export interface StageViewportRegistration {
|
|
@@ -78,6 +79,12 @@ export interface StageContext {
|
|
|
78
79
|
getLayoutMetrics?(mode?: 'stable' | 'visible'): import('../spatial-element/responsiveLayout.js').ResponsiveLayoutInput | undefined;
|
|
79
80
|
/** Reactive in framework adapters; false during SSR and until the GPU has painted. */
|
|
80
81
|
isEnhanced?(): boolean;
|
|
82
|
+
/** Local-driver integration is opt-in and may trigger a browser permission prompt. */
|
|
83
|
+
setSpaceMouseEnabled?(enabled: boolean): void;
|
|
84
|
+
isSpaceMouseEnabled?(): boolean;
|
|
85
|
+
isSpaceMouseDesktop?(): boolean;
|
|
86
|
+
getSpaceMouseState?(): import('./spaceMousePlatform.js').SpaceMouseState;
|
|
87
|
+
getSpaceMousePermission?(): import('./spaceMousePermission.js').SpaceMousePermission;
|
|
81
88
|
prefetchSpatialElement?(stage: import('../spatial-element/spatialElementScene.js').SpatialElementScene): void;
|
|
82
89
|
registerPanel(panel: StagePanelRegistration): () => void;
|
|
83
90
|
/** Refresh appearance from registered getters without rebinding the page or its camera. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"panelContext.d.ts","sourceRoot":"","sources":["../../src/stage/panelContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,KAAK,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEjF,eAAO,MAAM,iBAAiB,eAAkB,CAAC;AAEjD,uFAAuF;AACvF,eAAO,MAAM,wBAAwB,uBAAuB,CAAC;AAE7D,+FAA+F;AAC/F,eAAO,MAAM,wBAAwB,uBAAuB,CAAC;AAE7D,MAAM,WAAW,cAAc;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACnC;AAED,MAAM,WAAW,eAA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AM,CAAC;IACxB,8EAA8E;IAC9E,cAAc,CAAC,IAAI,MAAM,CAAC;IAC1B,aAAa,CAAC,CAAC,UAAU,EAAE,OAAO,GAAG,IAAI,CAAC;CAC1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"panelContext.js","sourceRoot":"","sources":["../../src/stage/panelContext.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;AAEjD,uFAAuF;AACvF,MAAM,CAAC,MAAM,wBAAwB,GAAG,oBAAoB,CAAC;AAE7D,+FAA+F;AAC/F,MAAM,CAAC,MAAM,wBAAwB,GAAG,oBAAoB,CAAC","sourcesContent":["\nimport type { LiquidGlassPanelOptions } from './LiquidGlassPanel.js';\nimport type { StageMinimapDockedView, StagePanelSurface } from './stageTypes.js';\n\nexport const STAGE_CONTEXT_KEY = Symbol('stage');\n\n/** Notifies an active stage that externally positioned panel frames changed layout. */\nexport const STAGE_PANEL_LAYOUT_EVENT = 'stage:panel-layout';\n\n/** Notifies an active stage that an external panel visual changed without affecting layout. */\nexport const STAGE_PANEL_VISUAL_EVENT = 'stage:panel-visual';\n\nexport interface StagePanelPose {\n\twidth: number;\n\theight: number;\n\tposition: { x: number; y: number };\n}\n\nexport interface StagePanelShape {\n\tradius: number;\n\tcontentInset?: number;\n}\n\nexport type StagePanelTheme = Omit<\n\tLiquidGlassPanelOptions,\n\t'width' | 'height' | 'position' | 'radius'\n> & {\n\t/** Semantic surface style. Defaults to the WebGPU-backed `glass` mode. */\n\tsurface?: StagePanelSurface;\n};\n\n\n\nexport interface StagePanelMinimapOptions {\n\texpandedHeight?: number;\n\tinset?: number;\n\t/** Additional unbounded scale applied to the fitted model. Values below 0.2 are clamped. */\n\tmodelScale?: number;\n\t/** Model multiplier at full pointer hover. Use 1 to disable hover enlargement. */\n\thoverModelScale?: number;\n\t/** Hover multiplier used once the minimap is expanded by camera zoom. */\n\texpandedHoverModelScale?: number;\n\t/** Optional spatial-element-specific presentation used while the minimap is docked. */\n\tdockedView?: StageMinimapDockedView;\n\toverlayColor?: string | number;\n\toverlayOpacity?: number;\n\t/** Gaussian blur radius in CSS pixels. */\n\toverlayBlur?: number;\n\tcontextColor?: string | number;\n\tcontextOpacity?: number;\n\tviewportColor?: string | number;\n}\n\nexport interface StagePanelRegistration {\n\tgetContentInset(): number;\n\tgetElement(): HTMLElement | undefined;\n\tgetFrameElement(): HTMLElement | undefined;\n\tgetSurfaceElement(): HTMLElement | undefined;\n\tgetPointerReactive(): boolean | 'lift';\n\tgetFocusReactive?(): boolean | 'top-right';\n\t/** Neighbouring panel frame that shares a corner control's exit path. */\n\tgetFocusAnchor?(): HTMLElement | undefined;\n\tgetNativeContent?(): boolean;\n\t/** Runs synchronously before the native panel surface is measured and drawn. */\n\tupdateNativeLayout?(): void;\n\tgetVisible?(): boolean;\n\t/** Selection is read without rebuilding the minimap model. */\n\tgetMinimapSelected?(): boolean;\n\tgetMinimapOptions(): StagePanelMinimapOptions | undefined;\n\tgetOptions(): LiquidGlassPanelOptions;\n\tgetSurface(): StagePanelSurface;\n\t/** Returns the opacity of the panel surface without affecting panel content. */\n\tgetSurfaceOpacity(): number;\n\t/** Returns a transient presentation scale applied to a rendered minimap model. */\n\tgetMinimapModelScale(): number;\n\t/** Returns the animated transition from the regular to the docked minimap view. */\n\tgetMinimapDockProgress(): number;\n\t/** Returns the viewport-space top edge used to anchor the rendered model. */\n\tgetMinimapModelTop(): number | undefined;\n\tgetMinimapModelLeft?(): number | undefined;\n}\n\nexport interface StageViewportRegistration {\n\tgetElement(): HTMLElement | undefined;\n}\n\nexport interface StageContext {\n\t/** Detail-page ownership; stale route cleanup cannot reset a newer media selection. */\n\tregisterDetailMedia?(read: () => import('../spatial-element/types.js').SpatialElementMediaItem['kind']): () => void;\n\t/** Cached browser layout metrics; unavailable during SSR. */\n\tgetLayoutMetrics?(mode?: 'stable' | 'visible'): import('../spatial-element/responsiveLayout.js').ResponsiveLayoutInput | undefined;\n\t/** Reactive in framework adapters; false during SSR and until the GPU has painted. */\n\tisEnhanced?(): boolean;\n\tprefetchSpatialElement?(stage: import('../spatial-element/spatialElementScene.js').SpatialElementScene): void;\n\tregisterPanel(panel: StagePanelRegistration): () => void;\n\t/** Refresh appearance from registered getters without rebinding the page or its camera. */\n\tupdatePanelAppearance?(): void;\n\tregisterViewport(viewport: StageViewportRegistration): () => void;\n\t/** Restores the element camera to its initial fitted pose. */\n\tresetView(): void;\n\t/** True for both native fullscreen and its viewport fallback. */\n\tisFullscreen?(): boolean;\n\t/** Current camera zoom focus, from the fitted detail view (0) to close-up (1). */\n\tgetZoomFocus?(): number;\n\t/** Damped UI focus shared by panels and the document-scrolled detail pane. */\n\tgetZoomUiFocus?(): number;\n\tsetFullscreen?(fullscreen: boolean): void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"panelContext.js","sourceRoot":"","sources":["../../src/stage/panelContext.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;AAEjD,uFAAuF;AACvF,MAAM,CAAC,MAAM,wBAAwB,GAAG,oBAAoB,CAAC;AAE7D,+FAA+F;AAC/F,MAAM,CAAC,MAAM,wBAAwB,GAAG,oBAAoB,CAAC","sourcesContent":["\nimport type { LiquidGlassPanelOptions } from './LiquidGlassPanel.js';\nimport type { StageMinimapDockedView, StagePanelSurface } from './stageTypes.js';\n\nexport const STAGE_CONTEXT_KEY = Symbol('stage');\n\n/** Notifies an active stage that externally positioned panel frames changed layout. */\nexport const STAGE_PANEL_LAYOUT_EVENT = 'stage:panel-layout';\n\n/** Notifies an active stage that an external panel visual changed without affecting layout. */\nexport const STAGE_PANEL_VISUAL_EVENT = 'stage:panel-visual';\n\nexport interface StagePanelPose {\n\twidth: number;\n\theight: number;\n\tposition: { x: number; y: number };\n}\n\nexport interface StagePanelShape {\n\tradius: number;\n\tcontentInset?: number;\n}\n\nexport type StagePanelTheme = Omit<\n\tLiquidGlassPanelOptions,\n\t'width' | 'height' | 'position' | 'radius'\n> & {\n\t/** Semantic surface style. Defaults to the WebGPU-backed `glass` mode. */\n\tsurface?: StagePanelSurface;\n};\n\n\n\nexport interface StagePanelMinimapOptions {\n\texpandedHeight?: number;\n\tinset?: number;\n\t/** Additional unbounded scale applied to the fitted model. Values below 0.2 are clamped. */\n\tmodelScale?: number;\n\t/** Model multiplier at full pointer hover. Use 1 to disable hover enlargement. */\n\thoverModelScale?: number;\n\t/** Hover multiplier used once the minimap is expanded by camera zoom. */\n\texpandedHoverModelScale?: number;\n\t/** Optional spatial-element-specific presentation used while the minimap is docked. */\n\tdockedView?: StageMinimapDockedView;\n\toverlayColor?: string | number;\n\toverlayOpacity?: number;\n\t/** Gaussian blur radius in CSS pixels. */\n\toverlayBlur?: number;\n\tcontextColor?: string | number;\n\tcontextOpacity?: number;\n\tviewportColor?: string | number;\n}\n\nexport interface StagePanelRegistration {\n\tgetContentInset(): number;\n\tgetElement(): HTMLElement | undefined;\n\tgetFrameElement(): HTMLElement | undefined;\n\tgetSurfaceElement(): HTMLElement | undefined;\n\tgetPointerReactive(): boolean | 'lift';\n\tgetFocusReactive?(): boolean | 'top-right';\n\t/** Neighbouring panel frame that shares a corner control's exit path. */\n\tgetFocusAnchor?(): HTMLElement | undefined;\n\tgetNativeContent?(): boolean;\n\t/** Runs synchronously before the native panel surface is measured and drawn. */\n\tupdateNativeLayout?(): void;\n\tgetVisible?(): boolean;\n\t/** Selection is read without rebuilding the minimap model. */\n\tgetMinimapSelected?(): boolean;\n\tgetMinimapOptions(): StagePanelMinimapOptions | undefined;\n\tgetOptions(): LiquidGlassPanelOptions;\n\tgetSurface(): StagePanelSurface;\n\t/** Returns the opacity of the panel surface without affecting panel content. */\n\tgetSurfaceOpacity(): number;\n\t/** Returns a transient presentation scale applied to a rendered minimap model. */\n\tgetMinimapModelScale(): number;\n\t/** Returns the animated transition from the regular to the docked minimap view. */\n\tgetMinimapDockProgress(): number;\n\t/** Returns the viewport-space top edge used to anchor the rendered model. */\n\tgetMinimapModelTop(): number | undefined;\n\tgetMinimapModelCenterY?: () => number | undefined;\n\tgetMinimapModelLeft?(): number | undefined;\n}\n\nexport interface StageViewportRegistration {\n\tgetElement(): HTMLElement | undefined;\n}\n\nexport interface StageContext {\n\t/** Detail-page ownership; stale route cleanup cannot reset a newer media selection. */\n\tregisterDetailMedia?(read: () => import('../spatial-element/types.js').SpatialElementMediaItem['kind']): () => void;\n\t/** Cached browser layout metrics; unavailable during SSR. */\n\tgetLayoutMetrics?(mode?: 'stable' | 'visible'): import('../spatial-element/responsiveLayout.js').ResponsiveLayoutInput | undefined;\n\t/** Reactive in framework adapters; false during SSR and until the GPU has painted. */\n\tisEnhanced?(): boolean;\n\t/** Local-driver integration is opt-in and may trigger a browser permission prompt. */\n\tsetSpaceMouseEnabled?(enabled: boolean): void;\n\tisSpaceMouseEnabled?(): boolean;\n\tisSpaceMouseDesktop?(): boolean;\n\tgetSpaceMouseState?(): import('./spaceMousePlatform.js').SpaceMouseState;\n\tgetSpaceMousePermission?(): import('./spaceMousePermission.js').SpaceMousePermission;\n\tprefetchSpatialElement?(stage: import('../spatial-element/spatialElementScene.js').SpatialElementScene): void;\n\tregisterPanel(panel: StagePanelRegistration): () => void;\n\t/** Refresh appearance from registered getters without rebinding the page or its camera. */\n\tupdatePanelAppearance?(): void;\n\tregisterViewport(viewport: StageViewportRegistration): () => void;\n\t/** Restores the element camera to its initial fitted pose. */\n\tresetView(): void;\n\t/** True for both native fullscreen and its viewport fallback. */\n\tisFullscreen?(): boolean;\n\t/** Current camera zoom focus, from the fitted detail view (0) to close-up (1). */\n\tgetZoomFocus?(): number;\n\t/** Damped UI focus shared by panels and the document-scrolled detail pane. */\n\tgetZoomUiFocus?(): number;\n\tsetFullscreen?(fullscreen: boolean): void;\n}\n"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { LiquidGlassPanelOptions } from './LiquidGlassPanel.js';
|
|
2
|
+
/** Applies the cubic Hermite smoothstep curve with clamped endpoints. */
|
|
3
|
+
export declare function smoothstep(edge0: number, edge1: number, value: number): number;
|
|
4
|
+
/** Returns the perspective camera distance that maps viewport pixels to world units. */
|
|
5
|
+
export declare function getPerspectiveDistance(viewportHeight: number, fov: number): number;
|
|
6
|
+
/**
|
|
7
|
+
* Restores the outward screen-space drift that an off-axis panel would receive
|
|
8
|
+
* from the shared perspective while leaving its hover projection panel-local.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getPanelFocusPerspectiveOffset(position: {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
}, advance: number, cameraDistance: number): {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
};
|
|
17
|
+
/** Computes the camera-facing travel used to clear panels during close-up zoom. */
|
|
18
|
+
export declare function getPanelFocusOffset(options: Pick<Required<LiquidGlassPanelOptions>, 'width' | 'height' | 'position'>, focus: number, viewportWidth: number, viewportHeight: number): {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
z: number;
|
|
22
|
+
};
|
|
23
|
+
/** Chooses the least disruptive edge toward which a focused panel should travel. */
|
|
24
|
+
export declare function getPanelFocusDirection(options: Pick<Required<LiquidGlassPanelOptions>, 'width' | 'height' | 'position'>, normalizedX: number, normalizedY: number): {
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
};
|
|
28
|
+
/** Shared, eased progress for panel motion, blur, opacity and corner controls. */
|
|
29
|
+
export declare function getPanelFocusProgress(focus: number): number;
|
|
30
|
+
/** Stacked detail content leaves as one row, without sideways perspective drift. */
|
|
31
|
+
export declare function getStackedDetailFocusOffset(focus: number, viewportHeight: number): {
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
z: number;
|
|
35
|
+
};
|
|
36
|
+
/** Returns panel opacity at a normalized stage UI focus level. */
|
|
37
|
+
export declare function getPanelFocusOpacity(focus: number): number;
|
|
38
|
+
/** Returns CSS content blur at a normalized stage focus level. */
|
|
39
|
+
export declare function getPanelFocusBlur(focus: number, options: Pick<Required<LiquidGlassPanelOptions>, 'width' | 'height'>): number;
|
|
40
|
+
//# sourceMappingURL=panelFocusMath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panelFocusMath.d.ts","sourceRoot":"","sources":["../../src/stage/panelFocusMath.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AASrE,yEAAyE;AACzE,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,UAIrE;AAED,wFAAwF;AACxF,wBAAgB,sBAAsB,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,UAEzE;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAC7C,QAAQ,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EAClC,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM;;;EAiBtB;AAED,mFAAmF;AACnF,wBAAgB,mBAAmB,CAClC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAC,EACjF,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM;;;;EAqBtB;AAED,oFAAoF;AACpF,wBAAgB,sBAAsB,CACrC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAC,EACjF,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM;;;EAYnB;AAED,kFAAkF;AAClF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,UAElD;AAED,oFAAoF;AACpF,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;;;;EAEhF;AAED,kEAAkE;AAClE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,UAEjD;AAED,kEAAkE;AAClE,wBAAgB,iBAAiB,CAChC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC,UAKpE"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as ScalarMath from './scalarMath.js';
|
|
2
|
+
import { PANEL_FOCUS_PERSPECTIVE_MAX_SCALE, PANEL_FOCUS_MAX_OFFSET, PANEL_FOCUS_MAX_ADVANCE, PANEL_FOCUS_MIN_OPACITY, PANEL_FOCUS_MAX_BLUR } from './stageConstants.js';
|
|
3
|
+
/** Applies the cubic Hermite smoothstep curve with clamped endpoints. */
|
|
4
|
+
export function smoothstep(edge0, edge1, value) {
|
|
5
|
+
if (edge0 === edge1)
|
|
6
|
+
return value < edge0 ? 0 : 1;
|
|
7
|
+
const t = ScalarMath.clamp((value - edge0) / (edge1 - edge0), 0, 1);
|
|
8
|
+
return t * t * (3 - 2 * t);
|
|
9
|
+
}
|
|
10
|
+
/** Returns the perspective camera distance that maps viewport pixels to world units. */
|
|
11
|
+
export function getPerspectiveDistance(viewportHeight, fov) {
|
|
12
|
+
return (viewportHeight * 0.5) / Math.tan(ScalarMath.degToRad(fov * 0.5));
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Restores the outward screen-space drift that an off-axis panel would receive
|
|
16
|
+
* from the shared perspective while leaving its hover projection panel-local.
|
|
17
|
+
*/
|
|
18
|
+
export function getPanelFocusPerspectiveOffset(position, advance, cameraDistance) {
|
|
19
|
+
const safeCameraDistance = Math.max(Number.isFinite(cameraDistance) ? cameraDistance : 1, 1);
|
|
20
|
+
const safeAdvance = Math.max(Number.isFinite(advance) ? advance : 0, 0);
|
|
21
|
+
if (safeAdvance <= 0)
|
|
22
|
+
return { x: 0, y: 0 };
|
|
23
|
+
const projectionScale = ScalarMath.clamp(safeCameraDistance / Math.max(safeCameraDistance - safeAdvance, 1), 1, PANEL_FOCUS_PERSPECTIVE_MAX_SCALE);
|
|
24
|
+
const egressScale = projectionScale - 1;
|
|
25
|
+
return {
|
|
26
|
+
x: position.x * egressScale,
|
|
27
|
+
y: position.y * egressScale
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** Computes the camera-facing travel used to clear panels during close-up zoom. */
|
|
31
|
+
export function getPanelFocusOffset(options, focus, viewportWidth, viewportHeight) {
|
|
32
|
+
if (focus <= 0.001)
|
|
33
|
+
return { x: 0, y: 0, z: 0 };
|
|
34
|
+
const edgeDistanceX = Math.max(viewportWidth * 0.5 - options.width * 0.5, 1);
|
|
35
|
+
const edgeDistanceY = Math.max(viewportHeight * 0.5 - options.height * 0.5, 1);
|
|
36
|
+
const normalizedX = options.position.x / edgeDistanceX;
|
|
37
|
+
const normalizedY = options.position.y / edgeDistanceY;
|
|
38
|
+
const direction = getPanelFocusDirection(options, normalizedX, normalizedY);
|
|
39
|
+
const horizontal = Math.abs(direction.x) > Math.abs(direction.y);
|
|
40
|
+
const axisSize = horizontal ? options.width : options.height;
|
|
41
|
+
const travel = ScalarMath.clamp(axisSize * (horizontal ? 0.16 : 0.42), horizontal ? 48 : 18, PANEL_FOCUS_MAX_OFFSET);
|
|
42
|
+
const easedFocus = getPanelFocusProgress(focus);
|
|
43
|
+
return {
|
|
44
|
+
x: direction.x * travel * easedFocus,
|
|
45
|
+
y: direction.y * travel * easedFocus,
|
|
46
|
+
z: PANEL_FOCUS_MAX_ADVANCE * easedFocus
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/** Chooses the least disruptive edge toward which a focused panel should travel. */
|
|
50
|
+
export function getPanelFocusDirection(options, normalizedX, normalizedY) {
|
|
51
|
+
const aspect = options.width / Math.max(options.height, 1);
|
|
52
|
+
const absX = Math.abs(normalizedX);
|
|
53
|
+
const absY = Math.abs(normalizedY);
|
|
54
|
+
if (aspect >= 2.4 && absY > 0.12)
|
|
55
|
+
return { x: 0, y: Math.sign(normalizedY) || 1 };
|
|
56
|
+
if (absX > absY * 0.8)
|
|
57
|
+
return { x: Math.sign(normalizedX) || 1, y: 0 };
|
|
58
|
+
if (absY > absX * 0.8)
|
|
59
|
+
return { x: 0, y: Math.sign(normalizedY) || 1 };
|
|
60
|
+
if (normalizedX * normalizedX + normalizedY * normalizedY < 0.02)
|
|
61
|
+
return { x: 0, y: options.position.y >= 0 ? 1 : -1 };
|
|
62
|
+
const length = Math.hypot(normalizedX, normalizedY);
|
|
63
|
+
return { x: normalizedX / length, y: normalizedY / length };
|
|
64
|
+
}
|
|
65
|
+
/** Shared, eased progress for panel motion, blur, opacity and corner controls. */
|
|
66
|
+
export function getPanelFocusProgress(focus) {
|
|
67
|
+
return smoothstep(0.08, 0.96, focus);
|
|
68
|
+
}
|
|
69
|
+
/** Stacked detail content leaves as one row, without sideways perspective drift. */
|
|
70
|
+
export function getStackedDetailFocusOffset(focus, viewportHeight) {
|
|
71
|
+
return { x: 0, y: -viewportHeight * 0.6 * getPanelFocusProgress(focus), z: 0 };
|
|
72
|
+
}
|
|
73
|
+
/** Returns panel opacity at a normalized stage UI focus level. */
|
|
74
|
+
export function getPanelFocusOpacity(focus) {
|
|
75
|
+
return ScalarMath.lerp(1, PANEL_FOCUS_MIN_OPACITY, getPanelFocusProgress(focus));
|
|
76
|
+
}
|
|
77
|
+
/** Returns CSS content blur at a normalized stage focus level. */
|
|
78
|
+
export function getPanelFocusBlur(focus, options) {
|
|
79
|
+
const shortSide = Math.max(Math.min(options.width, options.height), 1);
|
|
80
|
+
const sizeScale = ScalarMath.clamp(Math.sqrt(shortSide / 240), 0.34, 1);
|
|
81
|
+
return PANEL_FOCUS_MAX_BLUR * sizeScale * getPanelFocusProgress(focus);
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=panelFocusMath.js.map
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;AAClE,MAAM,UAAU,iBAAiB,CAChC,KAAa,EACb,OAAoE;IAEpE,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;IACvE,MAAM,SAAS,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACxE,OAAO,oBAAoB,GAAG,SAAS,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;AACxE,CAAC","sourcesContent":["import * as ScalarMath from './scalarMath.js';\nimport type { LiquidGlassPanelOptions } from './LiquidGlassPanel.js';\nimport {\n\tPANEL_FOCUS_PERSPECTIVE_MAX_SCALE,\n\tPANEL_FOCUS_MAX_OFFSET,\n\tPANEL_FOCUS_MAX_ADVANCE,\n\tPANEL_FOCUS_MIN_OPACITY,\n\tPANEL_FOCUS_MAX_BLUR\n} from './stageConstants.js';\n\n/** Applies the cubic Hermite smoothstep curve with clamped endpoints. */\nexport function smoothstep(edge0: number, edge1: number, value: number) {\n\tif (edge0 === edge1) return value < edge0 ? 0 : 1;\n\tconst t = ScalarMath.clamp((value - edge0) / (edge1 - edge0), 0, 1);\n\treturn t * t * (3 - 2 * t);\n}\n\n/** Returns the perspective camera distance that maps viewport pixels to world units. */\nexport function getPerspectiveDistance(viewportHeight: number, fov: number) {\n\treturn (viewportHeight * 0.5) / Math.tan(ScalarMath.degToRad(fov * 0.5));\n}\n\n/**\n * Restores the outward screen-space drift that an off-axis panel would receive\n * from the shared perspective while leaving its hover projection panel-local.\n */\nexport function getPanelFocusPerspectiveOffset(\n\tposition: { x: number; y: number },\n\tadvance: number,\n\tcameraDistance: number\n) {\n\tconst safeCameraDistance = Math.max(Number.isFinite(cameraDistance) ? cameraDistance : 1, 1);\n\tconst safeAdvance = Math.max(Number.isFinite(advance) ? advance : 0, 0);\n\tif (safeAdvance <= 0) return { x: 0, y: 0 };\n\n\tconst projectionScale = ScalarMath.clamp(\n\t\tsafeCameraDistance / Math.max(safeCameraDistance - safeAdvance, 1),\n\t\t1,\n\t\tPANEL_FOCUS_PERSPECTIVE_MAX_SCALE\n\t);\n\tconst egressScale = projectionScale - 1;\n\n\treturn {\n\t\tx: position.x * egressScale,\n\t\ty: position.y * egressScale\n\t};\n}\n\n/** Computes the camera-facing travel used to clear panels during close-up zoom. */\nexport function getPanelFocusOffset(\n\toptions: Pick<Required<LiquidGlassPanelOptions>, 'width' | 'height' | 'position'>,\n\tfocus: number,\n\tviewportWidth: number,\n\tviewportHeight: number\n) {\n\tif (focus <= 0.001) return { x: 0, y: 0, z: 0 };\n\tconst edgeDistanceX = Math.max(viewportWidth * 0.5 - options.width * 0.5, 1);\n\tconst edgeDistanceY = Math.max(viewportHeight * 0.5 - options.height * 0.5, 1);\n\tconst normalizedX = options.position.x / edgeDistanceX;\n\tconst normalizedY = options.position.y / edgeDistanceY;\n\tconst direction = getPanelFocusDirection(options, normalizedX, normalizedY);\n\tconst horizontal = Math.abs(direction.x) > Math.abs(direction.y);\n\tconst axisSize = horizontal ? options.width : options.height;\n\tconst travel = ScalarMath.clamp(\n\t\taxisSize * (horizontal ? 0.16 : 0.42),\n\t\thorizontal ? 48 : 18,\n\t\tPANEL_FOCUS_MAX_OFFSET\n\t);\n\tconst easedFocus = getPanelFocusProgress(focus);\n\treturn {\n\t\tx: direction.x * travel * easedFocus,\n\t\ty: direction.y * travel * easedFocus,\n\t\tz: PANEL_FOCUS_MAX_ADVANCE * easedFocus\n\t};\n}\n\n/** Chooses the least disruptive edge toward which a focused panel should travel. */\nexport function getPanelFocusDirection(\n\toptions: Pick<Required<LiquidGlassPanelOptions>, 'width' | 'height' | 'position'>,\n\tnormalizedX: number,\n\tnormalizedY: number\n) {\n\tconst aspect = options.width / Math.max(options.height, 1);\n\tconst absX = Math.abs(normalizedX);\n\tconst absY = Math.abs(normalizedY);\n\tif (aspect >= 2.4 && absY > 0.12) return { x: 0, y: Math.sign(normalizedY) || 1 };\n\tif (absX > absY * 0.8) return { x: Math.sign(normalizedX) || 1, y: 0 };\n\tif (absY > absX * 0.8) return { x: 0, y: Math.sign(normalizedY) || 1 };\n\tif (normalizedX * normalizedX + normalizedY * normalizedY < 0.02)\n\t\treturn { x: 0, y: options.position.y >= 0 ? 1 : -1 };\n\tconst length = Math.hypot(normalizedX, normalizedY);\n\treturn { x: normalizedX / length, y: normalizedY / length };\n}\n\n/** Shared, eased progress for panel motion, blur, opacity and corner controls. */\nexport function getPanelFocusProgress(focus: number) {\n\treturn smoothstep(0.08, 0.96, focus);\n}\n\n/** Stacked detail content leaves as one row, without sideways perspective drift. */\nexport function getStackedDetailFocusOffset(focus: number, viewportHeight: number) {\n\treturn { x: 0, y: -viewportHeight * 0.6 * getPanelFocusProgress(focus), z: 0 };\n}\n\n/** Returns panel opacity at a normalized stage UI focus level. */\nexport function getPanelFocusOpacity(focus: number) {\n\treturn ScalarMath.lerp(1, PANEL_FOCUS_MIN_OPACITY, getPanelFocusProgress(focus));\n}\n\n/** Returns CSS content blur at a normalized stage focus level. */\nexport function getPanelFocusBlur(\n\tfocus: number,\n\toptions: Pick<Required<LiquidGlassPanelOptions>, 'width' | 'height'>\n) {\n\tconst shortSide = Math.max(Math.min(options.width, options.height), 1);\n\tconst sizeScale = ScalarMath.clamp(Math.sqrt(shortSide / 240), 0.34, 1);\n\treturn PANEL_FOCUS_MAX_BLUR * sizeScale * getPanelFocusProgress(focus);\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Scalar helpers shared by native layout and the optional renderer. */
|
|
2
|
+
export declare const clamp: (value: number, min: number, max: number) => number;
|
|
3
|
+
export declare const lerp: (start: number, end: number, progress: number) => number;
|
|
4
|
+
export declare const degToRad: (degrees: number) => number;
|
|
5
|
+
export declare const radToDeg: (radians: number) => number;
|
|
6
|
+
//# sourceMappingURL=scalarMath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scalarMath.d.ts","sourceRoot":"","sources":["../../src/stage/scalarMath.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,eAAO,MAAM,KAAK,GAAI,OAAO,MAAM,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM,WACzB,CAAC;AACrC,eAAO,MAAM,IAAI,GAAI,OAAO,MAAM,EAAE,KAAK,MAAM,EAAE,UAAU,MAAM,WACzB,CAAC;AACzC,eAAO,MAAM,QAAQ,GAAI,SAAS,MAAM,WAA8B,CAAC;AACvE,eAAO,MAAM,QAAQ,GAAI,SAAS,MAAM,WAA8B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Scalar helpers shared by native layout and the optional renderer. */
|
|
2
|
+
export const clamp = (value, min, max) => Math.max(min, Math.min(max, value));
|
|
3
|
+
export const lerp = (start, end, progress) => (1 - progress) * start + progress * end;
|
|
4
|
+
export const degToRad = (degrees) => (degrees * Math.PI) / 180;
|
|
5
|
+
export const radToDeg = (radians) => (radians * 180) / Math.PI;
|
|
6
|
+
//# sourceMappingURL=scalarMath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scalarMath.js","sourceRoot":"","sources":["../../src/stage/scalarMath.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW,EAAE,EAAE,CAChE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;AACrC,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,KAAa,EAAE,GAAW,EAAE,QAAgB,EAAE,EAAE,CACpE,CAAC,CAAC,GAAG,QAAQ,CAAC,GAAG,KAAK,GAAG,QAAQ,GAAG,GAAG,CAAC;AACzC,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;AACvE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC","sourcesContent":["/** Scalar helpers shared by native layout and the optional renderer. */\nexport const clamp = (value: number, min: number, max: number) =>\n\tMath.max(min, Math.min(max, value));\nexport const lerp = (start: number, end: number, progress: number) =>\n\t(1 - progress) * start + progress * end;\nexport const degToRad = (degrees: number) => (degrees * Math.PI) / 180;\nexport const radToDeg = (radians: number) => (radians * 180) / Math.PI;\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type SpaceMousePermission = PermissionState | 'unknown';
|
|
2
|
+
type PermissionQuery = Pick<Permissions, 'query'>;
|
|
3
|
+
/** Query only permissions covering localhost; a LAN-only grant is insufficient. */
|
|
4
|
+
export declare function querySpaceMousePermission(permissions?: PermissionQuery | undefined): Promise<PermissionStatus | undefined>;
|
|
5
|
+
/** Store successful use, never a guessed browser permission or device identifier. */
|
|
6
|
+
export declare function rememberSpaceMouseConnection(): void;
|
|
7
|
+
/** An explicit disconnect/cancel takes precedence over a browser permission grant. */
|
|
8
|
+
export declare function rememberSpaceMouseDisabled(): void;
|
|
9
|
+
export declare function shouldReconnectSpaceMouse(permission: SpaceMousePermission): boolean;
|
|
10
|
+
/** Observe permission without contacting the local driver or enumerating devices. */
|
|
11
|
+
export declare function observeSpaceMousePermission(onChange: (state: SpaceMousePermission) => void, permissions?: PermissionQuery | undefined): () => void;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=spaceMousePermission.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spaceMousePermission.d.ts","sourceRoot":"","sources":["../../src/stage/spaceMousePermission.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG,eAAe,GAAG,SAAS,CAAC;AAE/D,KAAK,eAAe,GAAG,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AAGlD,mFAAmF;AACnF,wBAAsB,yBAAyB,CAC9C,WAAW,GAAE,eAAe,GAAG,SAA6C,GAC1E,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CASvC;AAED,qFAAqF;AACrF,wBAAgB,4BAA4B,SAE3C;AAED,sFAAsF;AACtF,wBAAgB,0BAA0B,SAEzC;AAED,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,oBAAoB,GAAG,OAAO,CAQnF;AAED,qFAAqF;AACrF,wBAAgB,2BAA2B,CAC1C,QAAQ,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,EAC/C,WAAW,GAAE,eAAe,GAAG,SAA6C,cAkB5E"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
const connectionKey = 'spatial-elements-spacemouse-connected';
|
|
2
|
+
/** Query only permissions covering localhost; a LAN-only grant is insufficient. */
|
|
3
|
+
export async function querySpaceMousePermission(permissions = globalThis.navigator?.permissions) {
|
|
4
|
+
if (!permissions)
|
|
5
|
+
return;
|
|
6
|
+
for (const name of ['loopback-network', 'local-network-access']) {
|
|
7
|
+
try {
|
|
8
|
+
return await permissions.query({ name: name });
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
// Some browsers expose only the older combined permission, or neither name.
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/** Store successful use, never a guessed browser permission or device identifier. */
|
|
16
|
+
export function rememberSpaceMouseConnection() {
|
|
17
|
+
try {
|
|
18
|
+
globalThis.localStorage?.setItem(connectionKey, 'true');
|
|
19
|
+
}
|
|
20
|
+
catch { /* Storage may be blocked. */ }
|
|
21
|
+
}
|
|
22
|
+
/** An explicit disconnect/cancel takes precedence over a browser permission grant. */
|
|
23
|
+
export function rememberSpaceMouseDisabled() {
|
|
24
|
+
try {
|
|
25
|
+
globalThis.localStorage?.setItem(connectionKey, 'false');
|
|
26
|
+
}
|
|
27
|
+
catch { /* Storage may be blocked. */ }
|
|
28
|
+
}
|
|
29
|
+
export function shouldReconnectSpaceMouse(permission) {
|
|
30
|
+
if (permission === 'denied')
|
|
31
|
+
return false;
|
|
32
|
+
// A working driver connection need not change the query from `prompt` (e.g. localhost).
|
|
33
|
+
// Remember successful use so reloads reconnect, while first visits still require a click.
|
|
34
|
+
try {
|
|
35
|
+
const preference = globalThis.localStorage?.getItem(connectionKey);
|
|
36
|
+
return preference !== 'false' && (permission === 'granted' || preference === 'true');
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return permission === 'granted';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** Observe permission without contacting the local driver or enumerating devices. */
|
|
43
|
+
export function observeSpaceMousePermission(onChange, permissions = globalThis.navigator?.permissions) {
|
|
44
|
+
let disposed = false;
|
|
45
|
+
let status;
|
|
46
|
+
const notify = () => { if (!disposed && status)
|
|
47
|
+
onChange(status.state); };
|
|
48
|
+
void (async () => {
|
|
49
|
+
try {
|
|
50
|
+
const result = await querySpaceMousePermission(permissions);
|
|
51
|
+
if (disposed)
|
|
52
|
+
return;
|
|
53
|
+
status = result;
|
|
54
|
+
if (status) {
|
|
55
|
+
status.addEventListener('change', notify);
|
|
56
|
+
notify();
|
|
57
|
+
}
|
|
58
|
+
else
|
|
59
|
+
onChange('unknown');
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
// An unreadable permission can use a previously successful connection as a hint.
|
|
63
|
+
if (!disposed)
|
|
64
|
+
onChange('unknown');
|
|
65
|
+
}
|
|
66
|
+
})();
|
|
67
|
+
return () => { disposed = true; status?.removeEventListener('change', notify); };
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=spaceMousePermission.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spaceMousePermission.js","sourceRoot":"","sources":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AAU,KAAK,SAAS,CAAC;IAAC,CAAC;AAC7C,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,2BAA2B,CAC1C,QAA+C,EAC/C,cAA2C,UAAU,CAAC,SAAS,EAAE,WAAW;IAE5E,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,IAAI,MAAoC,CAAC;IACzC,MAAM,MAAM,GAAG,GAAG,EAAE,GAAG,IAAI,CAAC,QAAQ,IAAI,MAAM;QAAE,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1E,KAAK,CAAC,KAAK,IAAI,EAAE;QAChB,IAAI,CAAC;YACJ,MAAM,MAAM,GAAG,MAAM,yBAAyB,CAAC,WAAW,CAAC,CAAC;YAC5D,IAAI,QAAQ;gBAAE,OAAO;YACrB,MAAM,GAAG,MAAM,CAAC;YAChB,IAAI,MAAM,EAAE,CAAC;gBAAC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;gBAAC,MAAM,EAAE,CAAC;YAAC,CAAC;;gBAC/D,QAAQ,CAAC,SAAS,CAAC,CAAC;QAC1B,CAAC;QAAC,MAAM,CAAC;YACR,iFAAiF;YACjF,IAAI,CAAC,QAAQ;gBAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;QACpC,CAAC;IACF,CAAC,CAAC,EAAE,CAAC;IACL,OAAO,GAAG,EAAE,GAAG,QAAQ,GAAG,IAAI,CAAC,CAAC,MAAM,EAAE,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAClF,CAAC","sourcesContent":["export type SpaceMousePermission = PermissionState | 'unknown';\n\ntype PermissionQuery = Pick<Permissions, 'query'>;\nconst connectionKey = 'spatial-elements-spacemouse-connected';\n\n/** Query only permissions covering localhost; a LAN-only grant is insufficient. */\nexport async function querySpaceMousePermission(\n\tpermissions: PermissionQuery | undefined = globalThis.navigator?.permissions\n): Promise<PermissionStatus | undefined> {\n\tif (!permissions) return;\n\tfor (const name of ['loopback-network', 'local-network-access']) {\n\t\ttry {\n\t\t\treturn await permissions.query({ name: name as PermissionName });\n\t\t} catch {\n\t\t\t// Some browsers expose only the older combined permission, or neither name.\n\t\t}\n\t}\n}\n\n/** Store successful use, never a guessed browser permission or device identifier. */\nexport function rememberSpaceMouseConnection() {\n\ttry { globalThis.localStorage?.setItem(connectionKey, 'true'); } catch { /* Storage may be blocked. */ }\n}\n\n/** An explicit disconnect/cancel takes precedence over a browser permission grant. */\nexport function rememberSpaceMouseDisabled() {\n\ttry { globalThis.localStorage?.setItem(connectionKey, 'false'); } catch { /* Storage may be blocked. */ }\n}\n\nexport function shouldReconnectSpaceMouse(permission: SpaceMousePermission): boolean {\n\tif (permission === 'denied') return false;\n\t// A working driver connection need not change the query from `prompt` (e.g. localhost).\n\t// Remember successful use so reloads reconnect, while first visits still require a click.\n\ttry {\n\t\tconst preference = globalThis.localStorage?.getItem(connectionKey);\n\t\treturn preference !== 'false' && (permission === 'granted' || preference === 'true');\n\t} catch { return permission === 'granted'; }\n}\n\n/** Observe permission without contacting the local driver or enumerating devices. */\nexport function observeSpaceMousePermission(\n\tonChange: (state: SpaceMousePermission) => void,\n\tpermissions: PermissionQuery | undefined = globalThis.navigator?.permissions\n) {\n\tlet disposed = false;\n\tlet status: PermissionStatus | undefined;\n\tconst notify = () => { if (!disposed && status) onChange(status.state); };\n\tvoid (async () => {\n\t\ttry {\n\t\t\tconst result = await querySpaceMousePermission(permissions);\n\t\t\tif (disposed) return;\n\t\t\tstatus = result;\n\t\t\tif (status) { status.addEventListener('change', notify); notify(); }\n\t\t\telse onChange('unknown');\n\t\t} catch {\n\t\t\t// An unreadable permission can use a previously successful connection as a hint.\n\t\t\tif (!disposed) onChange('unknown');\n\t\t}\n\t})();\n\treturn () => { disposed = true; status?.removeEventListener('change', notify); };\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Supported desktop OS families, never hardware detection. */
|
|
2
|
+
export declare function isSpaceMouseDesktop(navigator?: {
|
|
3
|
+
userAgent: string;
|
|
4
|
+
platform?: string;
|
|
5
|
+
maxTouchPoints?: number;
|
|
6
|
+
userAgentData?: {
|
|
7
|
+
platform: string;
|
|
8
|
+
mobile?: boolean;
|
|
9
|
+
};
|
|
10
|
+
}): boolean;
|
|
11
|
+
export type SpaceMouseState = 'idle' | 'connecting' | 'connected' | 'permission-required' | 'unavailable';
|
|
12
|
+
//# sourceMappingURL=spaceMousePlatform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spaceMousePlatform.d.ts","sourceRoot":"","sources":["../../src/stage/spaceMousePlatform.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,wBAAgB,mBAAmB,CAAC,SAAS,CAAC,EAAE;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CACvD,GAAG,OAAO,CAYV;AAED,MAAM,MAAM,eAAe,GACxB,MAAM,GACN,YAAY,GACZ,WAAW,GACX,qBAAqB,GACrB,aAAa,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Supported desktop OS families, never hardware detection. */
|
|
2
|
+
export function isSpaceMouseDesktop(navigator) {
|
|
3
|
+
if (!navigator)
|
|
4
|
+
return false;
|
|
5
|
+
if (navigator.userAgentData?.mobile || /Android|iPhone|iPad|iPod/i.test(navigator.userAgent))
|
|
6
|
+
return false;
|
|
7
|
+
const platform = navigator.userAgentData?.platform || navigator.platform || navigator.userAgent;
|
|
8
|
+
// iPadOS can present a desktop Mac user agent.
|
|
9
|
+
if (/Mac/i.test(platform) && (navigator.maxTouchPoints ?? 0) > 1)
|
|
10
|
+
return false;
|
|
11
|
+
// Android desktop mode can remove every Android/mobile hint and report Linux.
|
|
12
|
+
// Prefer hiding an optional control on ambiguous Linux touch devices.
|
|
13
|
+
if (/Linux/i.test(platform) && (navigator.maxTouchPoints ?? 0) > 0)
|
|
14
|
+
return false;
|
|
15
|
+
if (/CrOS|Chrome OS|Android|iOS/i.test(platform + ' ' + navigator.userAgent))
|
|
16
|
+
return false;
|
|
17
|
+
return /Win|Mac|Linux/i.test(platform);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=spaceMousePlatform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spaceMousePlatform.js","sourceRoot":"","sources":["../../src/stage/spaceMousePlatform.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,MAAM,UAAU,mBAAmB,CAAC,SAKnC;IACA,IAAI,CAAC,SAAS;QAAE,OAAO,KAAK,CAAC;IAC7B,IAAI,SAAS,CAAC,aAAa,EAAE,MAAM,IAAI,2BAA2B,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;QAC3F,OAAO,KAAK,CAAC;IACd,MAAM,QAAQ,GAAG,SAAS,CAAC,aAAa,EAAE,QAAQ,IAAI,SAAS,CAAC,QAAQ,IAAI,SAAS,CAAC,SAAS,CAAC;IAChG,+CAA+C;IAC/C,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,IAAI,CAAC,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IAC/E,8EAA8E;IAC9E,sEAAsE;IACtE,IAAI,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,IAAI,CAAC,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IACjF,IAAI,6BAA6B,CAAC,IAAI,CAAC,QAAQ,GAAG,GAAG,GAAG,SAAS,CAAC,SAAS,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3F,OAAO,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACxC,CAAC","sourcesContent":["/** Supported desktop OS families, never hardware detection. */\nexport function isSpaceMouseDesktop(navigator?: {\n\tuserAgent: string;\n\tplatform?: string;\n\tmaxTouchPoints?: number;\n\tuserAgentData?: { platform: string; mobile?: boolean };\n}): boolean {\n\tif (!navigator) return false;\n\tif (navigator.userAgentData?.mobile || /Android|iPhone|iPad|iPod/i.test(navigator.userAgent))\n\t\treturn false;\n\tconst platform = navigator.userAgentData?.platform || navigator.platform || navigator.userAgent;\n\t// iPadOS can present a desktop Mac user agent.\n\tif (/Mac/i.test(platform) && (navigator.maxTouchPoints ?? 0) > 1) return false;\n\t// Android desktop mode can remove every Android/mobile hint and report Linux.\n\t// Prefer hiding an optional control on ambiguous Linux touch devices.\n\tif (/Linux/i.test(platform) && (navigator.maxTouchPoints ?? 0) > 0) return false;\n\tif (/CrOS|Chrome OS|Android|iOS/i.test(platform + ' ' + navigator.userAgent)) return false;\n\treturn /Win|Mac|Linux/i.test(platform);\n}\n\nexport type SpaceMouseState =\n\t| 'idle'\n\t| 'connecting'\n\t| 'connected'\n\t| 'permission-required'\n\t| 'unavailable';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stageConstants.d.ts","sourceRoot":"","sources":["../../src/stage/stageConstants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stageConstants.d.ts","sourceRoot":"","sources":["../../src/stage/stageConstants.ts"],"names":[],"mappings":"AAKA,0FAA0F;AAC1F,eAAO,MAAM,kBAAkB;;;;CAID,CAAC;AAE/B,2FAA2F;AAC3F,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;GAgBU,CAAC;AAEtC,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,eAAO,MAAM,eAAe,IAAI,CAAC;AACjC,6DAA6D;AAC7D,eAAO,MAAM,sBAAsB,QAA0B,CAAC;AAC9D,eAAO,MAAM,sBAAsB,IAAI,CAAC;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kB,OAAO,CAAC;AACvC,2FAA2F;AAC3F,eAAO,MAAM,yBAAyB,WAAW,CAAC;AAClD,8FAA8F;AAC9F,eAAO,MAAM,iCAAiC,IAAI,CAAC;AACnD,wFAAwF;AACxF,eAAO,MAAM,sBAAsB,QAA2C,CAAC;AAC/E,eAAO,MAAM,wBAAwB,QAEpC,CAAC;AACF,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,WAAW,KAAK,CAAC;AAE9B,uFAAuF;AACvF,eAAO,MAAM,yBAAyB;;;;;;CAML,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as ScalarMath from './scalarMath.js';
|
|
2
2
|
/** Default environment presentation used when a route supplies no background settings. */
|
|
3
3
|
export const DEFAULT_BACKGROUND = {
|
|
4
4
|
blurriness: 0.2,
|
|
@@ -26,7 +26,7 @@ export const DEFAULT_PANELS = [
|
|
|
26
26
|
export const PANEL_CAMERA_FOV = 36;
|
|
27
27
|
export const PANEL_CONTENT_Z = 0;
|
|
28
28
|
/** Shared maximum tilt for every panel at a pointer edge. */
|
|
29
|
-
export const PANEL_POINTER_MAX_TILT =
|
|
29
|
+
export const PANEL_POINTER_MAX_TILT = ScalarMath.degToRad(10);
|
|
30
30
|
export const PANEL_POINTER_MAX_LIFT = 8;
|
|
31
31
|
export const PANEL_POINTER_DAMPING = 12;
|
|
32
32
|
/** Pointer approach distance derived from the short side with a capped aspect correction. */
|
|
@@ -70,8 +70,8 @@ export const ZOOM_FOCUS_NOTIFY_EPSILON = 0.000001;
|
|
|
70
70
|
/** Responsive spatial-element-fit margin that lets authored silhouettes fill the viewport. */
|
|
71
71
|
export const SPATIAL_ELEMENT_CAMERA_FIT_MARGIN = 1;
|
|
72
72
|
/** Existing default view expressed as orbit angles for backwards-compatible framing. */
|
|
73
|
-
export const DEFAULT_CAMERA_AZIMUTH =
|
|
74
|
-
export const DEFAULT_CAMERA_ELEVATION =
|
|
73
|
+
export const DEFAULT_CAMERA_AZIMUTH = ScalarMath.radToDeg(Math.atan2(0.45, 1));
|
|
74
|
+
export const DEFAULT_CAMERA_ELEVATION = ScalarMath.radToDeg(Math.asin(0.28 / Math.hypot(0.45, 0.28, 1)));
|
|
75
75
|
export const DEFAULT_HDR = '';
|
|
76
76
|
export const DEFAULT_GLB = '';
|
|
77
77
|
/** Default element hover outline, tuned to remain visible on light and dark scenes. */
|