@spatial-elements/core 1.0.0-beta.6 → 1.0.0-beta.7

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.
Files changed (41) hide show
  1. package/dist/catalog/CarouselDeviceCamera.d.ts +12 -0
  2. package/dist/catalog/CarouselDeviceCamera.d.ts.map +1 -0
  3. package/dist/catalog/CarouselDeviceCamera.js +44 -0
  4. package/dist/catalog/CarouselDeviceCamera.js.map +1 -0
  5. package/dist/catalog/CatalogSpatialElementLayer.d.ts +15 -0
  6. package/dist/catalog/CatalogSpatialElementLayer.d.ts.map +1 -1
  7. package/dist/catalog/CatalogSpatialElementLayer.js +148 -72
  8. package/dist/catalog/CatalogSpatialElementLayer.js.map +1 -1
  9. package/dist/catalog/CatalogTransition.d.ts.map +1 -1
  10. package/dist/catalog/CatalogTransition.js +18 -5
  11. package/dist/catalog/CatalogTransition.js.map +1 -1
  12. package/dist/catalog/deviceYaw.d.ts +21 -0
  13. package/dist/catalog/deviceYaw.d.ts.map +1 -0
  14. package/dist/catalog/deviceYaw.js +87 -0
  15. package/dist/catalog/deviceYaw.js.map +1 -0
  16. package/dist/catalog/listDeviceOrientation.d.ts +15 -0
  17. package/dist/catalog/listDeviceOrientation.d.ts.map +1 -0
  18. package/dist/catalog/listDeviceOrientation.js +245 -0
  19. package/dist/catalog/listDeviceOrientation.js.map +1 -0
  20. package/dist/stage/DeviceGeometryMotion.d.ts +13 -0
  21. package/dist/stage/DeviceGeometryMotion.d.ts.map +1 -0
  22. package/dist/stage/DeviceGeometryMotion.js +37 -0
  23. package/dist/stage/DeviceGeometryMotion.js.map +1 -0
  24. package/dist/stage/MinimapController.d.ts +1 -0
  25. package/dist/stage/MinimapController.d.ts.map +1 -1
  26. package/dist/stage/MinimapController.js +7 -0
  27. package/dist/stage/MinimapController.js.map +1 -1
  28. package/dist/stage/PanelPresentationController.d.ts.map +1 -1
  29. package/dist/stage/PanelPresentationController.js +14 -9
  30. package/dist/stage/PanelPresentationController.js.map +1 -1
  31. package/dist/stage/StageExperience.d.ts +16 -0
  32. package/dist/stage/StageExperience.d.ts.map +1 -1
  33. package/dist/stage/StageExperience.js +42 -4
  34. package/dist/stage/StageExperience.js.map +1 -1
  35. package/dist/stage/StageRenderPipeline.d.ts.map +1 -1
  36. package/dist/stage/StageRenderPipeline.js +3 -1
  37. package/dist/stage/StageRenderPipeline.js.map +1 -1
  38. package/dist/stage/stageTypes.d.ts +1 -0
  39. package/dist/stage/stageTypes.d.ts.map +1 -1
  40. package/dist/stage/stageTypes.js.map +1 -1
  41. package/package.json +1 -1
@@ -0,0 +1,21 @@
1
+ import { Quaternion } from 'three/webgpu';
2
+ /** W3C intrinsic Z-X-Y orientation, expressed in the current screen frame. */
3
+ export declare function screenOrientation(alpha: number, beta: number, gamma: number, angle: number): Quaternion;
4
+ /** Bounded screen-relative yaw, pitch and roll, in degrees, without a render loop. */
5
+ export declare class DeviceYawFilter {
6
+ private reference?;
7
+ private previous?;
8
+ private time;
9
+ private quietUntil;
10
+ private filtered;
11
+ private filteredPitch;
12
+ private filteredRoll;
13
+ value: number;
14
+ pitch: number;
15
+ roll: number;
16
+ reset(): void;
17
+ /** Re-anchor to the new grip, retaining output so it can ease back to neutral. */
18
+ resume(q: Quaternion, now: number): void;
19
+ update(q: Quaternion, now: number, smoothingMs?: number): number;
20
+ }
21
+ //# sourceMappingURL=deviceYaw.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deviceYaw.d.ts","sourceRoot":"","sources":["../../src/catalog/deviceYaw.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,UAAU,EAAsB,MAAM,cAAc,CAAC;AAErE,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,cAI1F;AAED,sFAAsF;AACtF,qBAAa,eAAe;IAC3B,OAAO,CAAC,SAAS,CAAC,CAAa;IAC/B,OAAO,CAAC,QAAQ,CAAC,CAAa;IAC9B,OAAO,CAAC,IAAI,CAAK;IACjB,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,YAAY,CAAK;IACzB,KAAK,SAAK;IACV,KAAK,SAAK;IACV,IAAI,SAAK;IACT,KAAK;IAML,kFAAkF;IAClF,MAAM,CAAC,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM;IAMjC,MAAM,CAAC,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,SAAK;CA8CnD"}
@@ -0,0 +1,87 @@
1
+ import { Euler, Quaternion, Vector3, MathUtils } from 'three/webgpu';
2
+ /** W3C intrinsic Z-X-Y orientation, expressed in the current screen frame. */
3
+ export function screenOrientation(alpha, beta, gamma, angle) {
4
+ return new Quaternion().setFromEuler(new Euler(MathUtils.degToRad(beta), MathUtils.degToRad(gamma), MathUtils.degToRad(alpha), 'ZXY')).multiply(new Quaternion().setFromAxisAngle(new Vector3(0, 0, 1), -MathUtils.degToRad(angle)));
5
+ }
6
+ /** Bounded screen-relative yaw, pitch and roll, in degrees, without a render loop. */
7
+ export class DeviceYawFilter {
8
+ reference;
9
+ previous;
10
+ time = 0;
11
+ quietUntil = 0;
12
+ filtered = 0;
13
+ filteredPitch = 0;
14
+ filteredRoll = 0;
15
+ value = 0;
16
+ pitch = 0;
17
+ roll = 0;
18
+ reset() {
19
+ this.reference = this.previous = undefined;
20
+ this.filtered = this.value = 0;
21
+ this.filteredPitch = this.pitch = 0;
22
+ this.filteredRoll = this.roll = 0;
23
+ }
24
+ /** Re-anchor to the new grip, retaining output so it can ease back to neutral. */
25
+ resume(q, now) {
26
+ this.reference = q.clone();
27
+ this.previous = q.clone();
28
+ this.time = now - 16;
29
+ this.quietUntil = 0;
30
+ }
31
+ update(q, now, smoothingMs = 60) {
32
+ const dt = now - this.time;
33
+ if (!this.reference || !this.previous || dt > 1500 || dt <= 0) {
34
+ this.reference = q.clone();
35
+ this.previous = q.clone();
36
+ this.time = now;
37
+ this.quietUntil = now;
38
+ this.filteredPitch = this.pitch = 0;
39
+ this.filteredRoll = this.roll = 0;
40
+ return this.value = this.filtered = 0;
41
+ }
42
+ const step = MathUtils.radToDeg(this.previous.angleTo(q));
43
+ const speed = step / (dt / 1000);
44
+ this.previous.copy(q);
45
+ this.time = now;
46
+ // Re-anchor after abrupt movement; wait for a quiet grip before responding again.
47
+ // Do not mistake an ordinary deliberate turn or a small noisy sample for travel.
48
+ if (speed > 240 && step > 12)
49
+ this.quietUntil = now + 400;
50
+ let target = 0;
51
+ let pitchTarget = 0;
52
+ let rollTarget = 0;
53
+ if (now < this.quietUntil)
54
+ this.reference.copy(q);
55
+ else {
56
+ const relative = this.reference.clone().invert().multiply(q);
57
+ if (relative.w < 0)
58
+ relative.set(-relative.x, -relative.y, -relative.z, -relative.w);
59
+ const yaw = MathUtils.radToDeg(2 * Math.atan2(relative.y, relative.w));
60
+ const pitch = MathUtils.radToDeg(2 * Math.atan2(relative.x, relative.w));
61
+ const roll = MathUtils.radToDeg(2 * Math.atan2(relative.z, relative.w));
62
+ // Preserve a noise floor while making small intentional turns clearly visible.
63
+ target = Math.sign(yaw) * Math.min(16, Math.max(0, Math.abs(yaw) - 1.2) * 0.55);
64
+ pitchTarget = Math.sign(pitch) * Math.min(10, Math.max(0, Math.abs(pitch) - 1.5) * 0.4);
65
+ rollTarget = Math.sign(roll) * Math.min(6, Math.max(0, Math.abs(roll) - 2) * 0.25);
66
+ }
67
+ const blend = 1 - Math.exp(-Math.min(dt, smoothingMs === 60 ? dt : 50) / smoothingMs);
68
+ this.filtered += (target - this.filtered) * blend;
69
+ this.filteredPitch += (pitchTarget - this.filteredPitch) * blend;
70
+ this.filteredRoll += (rollTarget - this.filteredRoll) * blend;
71
+ if (Math.abs(this.filtered) < 0.08 && target === 0)
72
+ this.filtered = 0;
73
+ if (Math.abs(this.filteredPitch) < 0.08 && pitchTarget === 0)
74
+ this.filteredPitch = 0;
75
+ if (Math.abs(this.filteredRoll) < 0.08 && rollTarget === 0)
76
+ this.filteredRoll = 0;
77
+ // Hysteresis, not rounding: noise at a quantization boundary must not wake rendering.
78
+ if (Math.abs(this.filtered - this.value) >= 0.12 || this.filtered === 0)
79
+ this.value = this.filtered;
80
+ if (Math.abs(this.filteredPitch - this.pitch) >= 0.12 || this.filteredPitch === 0)
81
+ this.pitch = this.filteredPitch;
82
+ if (Math.abs(this.filteredRoll - this.roll) >= 0.12 || this.filteredRoll === 0)
83
+ this.roll = this.filteredRoll;
84
+ return this.value;
85
+ }
86
+ }
87
+ //# sourceMappingURL=deviceYaw.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deviceYaw.js","sourceRoot":"","sources":["../../src/catalog/deviceYaw.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAErE,8EAA8E;AAC9E,MAAM,UAAU,iBAAiB,CAAC,KAAa,EAAE,IAAY,EAAE,KAAa,EAAE,KAAa;IAC1F,OAAO,IAAI,UAAU,EAAE,CAAC,YAAY,CAAC,IAAI,KAAK,CAC7C,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CACrF,CAAC,CAAC,QAAQ,CAAC,IAAI,UAAU,EAAE,CAAC,gBAAgB,CAAC,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAClG,CAAC;AAED,sFAAsF;AACtF,MAAM,OAAO,eAAe;IACnB,SAAS,CAAc;IACvB,QAAQ,CAAc;IACtB,IAAI,GAAG,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,CAAC,YAAY,KAAK,CAAC;YAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC;QAC9G,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;CACD","sourcesContent":["import { Euler, Quaternion, Vector3, MathUtils } from 'three/webgpu';\n\n/** W3C intrinsic Z-X-Y orientation, expressed in the current screen frame. */\nexport function screenOrientation(alpha: number, beta: number, gamma: number, angle: number) {\n\treturn new Quaternion().setFromEuler(new Euler(\n\t\tMathUtils.degToRad(beta), MathUtils.degToRad(gamma), MathUtils.degToRad(alpha), 'ZXY'\n\t)).multiply(new Quaternion().setFromAxisAngle(new Vector3(0, 0, 1), -MathUtils.degToRad(angle)));\n}\n\n/** Bounded screen-relative yaw, pitch and roll, in degrees, without a render loop. */\nexport class DeviceYawFilter {\n\tprivate reference?: Quaternion;\n\tprivate previous?: Quaternion;\n\tprivate time = 0;\n\tprivate quietUntil = 0;\n\tprivate filtered = 0;\n\tprivate filteredPitch = 0;\n\tprivate filteredRoll = 0;\n\tvalue = 0;\n\tpitch = 0;\n\troll = 0;\n\treset() {\n\t\tthis.reference = this.previous = undefined;\n\t\tthis.filtered = this.value = 0;\n\t\tthis.filteredPitch = this.pitch = 0;\n\t\tthis.filteredRoll = this.roll = 0;\n\t}\n\t/** Re-anchor to the new grip, retaining output so it can ease back to neutral. */\n\tresume(q: Quaternion, now: number) {\n\t\tthis.reference = q.clone();\n\t\tthis.previous = q.clone();\n\t\tthis.time = now - 16;\n\t\tthis.quietUntil = 0;\n\t}\n\tupdate(q: Quaternion, now: number, smoothingMs = 60) {\n\t\tconst dt = now - this.time;\n\t\tif (!this.reference || !this.previous || dt > 1500 || dt <= 0) {\n\t\t\tthis.reference = q.clone();\n\t\t\tthis.previous = q.clone();\n\t\t\tthis.time = now;\n\t\t\tthis.quietUntil = now;\n\t\t\tthis.filteredPitch = this.pitch = 0;\n\t\t\tthis.filteredRoll = this.roll = 0;\n\t\t\treturn this.value = this.filtered = 0;\n\t\t}\n\t\tconst step = MathUtils.radToDeg(this.previous.angleTo(q));\n\t\tconst speed = step / (dt / 1000);\n\t\tthis.previous.copy(q);\n\t\tthis.time = now;\n\t\t// Re-anchor after abrupt movement; wait for a quiet grip before responding again.\n\t\t// Do not mistake an ordinary deliberate turn or a small noisy sample for travel.\n\t\tif (speed > 240 && step > 12) this.quietUntil = now + 400;\n\t\tlet target = 0;\n\t\tlet pitchTarget = 0;\n\t\tlet rollTarget = 0;\n\t\tif (now < this.quietUntil) this.reference.copy(q);\n\t\telse {\n\t\t\tconst relative = this.reference.clone().invert().multiply(q);\n\t\t\tif (relative.w < 0) relative.set(-relative.x, -relative.y, -relative.z, -relative.w);\n\t\t\tconst yaw = MathUtils.radToDeg(2 * Math.atan2(relative.y, relative.w));\n\t\t\tconst pitch = MathUtils.radToDeg(2 * Math.atan2(relative.x, relative.w));\n\t\t\tconst roll = MathUtils.radToDeg(2 * Math.atan2(relative.z, relative.w));\n\t\t\t// Preserve a noise floor while making small intentional turns clearly visible.\n\t\t\ttarget = Math.sign(yaw) * Math.min(16, Math.max(0, Math.abs(yaw) - 1.2) * 0.55);\n\t\t\tpitchTarget = Math.sign(pitch) * Math.min(10, Math.max(0, Math.abs(pitch) - 1.5) * 0.4);\n\t\t\trollTarget = Math.sign(roll) * Math.min(6, Math.max(0, Math.abs(roll) - 2) * 0.25);\n\t\t}\n\t\tconst blend = 1 - Math.exp(-Math.min(dt, smoothingMs === 60 ? dt : 50) / smoothingMs);\n\t\tthis.filtered += (target - this.filtered) * blend;\n\t\tthis.filteredPitch += (pitchTarget - this.filteredPitch) * blend;\n\t\tthis.filteredRoll += (rollTarget - this.filteredRoll) * blend;\n\t\tif (Math.abs(this.filtered) < 0.08 && target === 0) this.filtered = 0;\n\t\tif (Math.abs(this.filteredPitch) < 0.08 && pitchTarget === 0) this.filteredPitch = 0;\n\t\tif (Math.abs(this.filteredRoll) < 0.08 && rollTarget === 0) this.filteredRoll = 0;\n\t\t// Hysteresis, not rounding: noise at a quantization boundary must not wake rendering.\n\t\tif (Math.abs(this.filtered - this.value) >= 0.12 || this.filtered === 0) this.value = this.filtered;\n\t\tif (Math.abs(this.filteredPitch - this.pitch) >= 0.12 || this.filteredPitch === 0) this.pitch = this.filteredPitch;\n\t\tif (Math.abs(this.filteredRoll - this.roll) >= 0.12 || this.filteredRoll === 0) this.roll = this.filteredRoll;\n\t\treturn this.value;\n\t}\n}\n"]}
@@ -0,0 +1,15 @@
1
+ export type OrientationStatus = 'unavailable' | 'permission' | 'active' | 'denied';
2
+ export declare const isDeviceOrientationPaused: () => boolean;
3
+ /** Called by native scrolling and the stage's virtual-scroll frame stream. */
4
+ export declare function pauseDeviceOrientationForScroll(): void;
5
+ export declare const getListDeviceYaw: () => number;
6
+ export declare const getListDevicePitch: () => number;
7
+ export declare const getListDeviceRoll: () => number;
8
+ export declare function subscribeListDeviceYaw(callback: () => void): () => void;
9
+ /** A silent probe can recover existing consent; a prompt requires a navigation click. */
10
+ export declare function requestListDeviceOrientation(fromNavigation?: boolean): Promise<void>;
11
+ /** Mount in the application shell so entry via detail/carousel pages also works. */
12
+ export declare function retainDeviceOrientationPermission(): () => void;
13
+ /** One shared sensor listener for all visible opted-in sections, with complete teardown. */
14
+ export declare function retainListDeviceOrientation(node: HTMLElement, callback: (status: OrientationStatus) => void): () => void;
15
+ //# sourceMappingURL=listDeviceOrientation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listDeviceOrientation.d.ts","sourceRoot":"","sources":["../../src/catalog/listDeviceOrientation.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG,YAAY,GAAG,QAAQ,GAAG,QAAQ,CAAC;AA0BnF,eAAO,MAAM,yBAAyB,eAAiF,CAAC;AAkBxH,8EAA8E;AAC9E,wBAAgB,+BAA+B,SAG9C;AAED,eAAO,MAAM,gBAAgB,cAAY,CAAC;AAC1C,eAAO,MAAM,kBAAkB,cAAc,CAAC;AAC9C,eAAO,MAAM,iBAAiB,cAAa,CAAC;AAC5C,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,IAAI,cAG1D;AA4DD,yFAAyF;AACzF,wBAAgB,4BAA4B,CAAC,cAAc,UAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBjF;AAuBD,oFAAoF;AACpF,wBAAgB,iCAAiC,eAShD;AAED,4FAA4F;AAC5F,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,cAoD3G"}
@@ -0,0 +1,245 @@
1
+ import { DeviceYawFilter, screenOrientation } from './deviceYaw.js';
2
+ const listeners = new Set();
3
+ const owners = new Map();
4
+ const visible = new Set();
5
+ const filter = new DeviceYawFilter();
6
+ let status = 'unavailable';
7
+ let yaw = 0;
8
+ let pitch = 0;
9
+ let roll = 0;
10
+ let calibratingUntil = 0;
11
+ let observer;
12
+ let motion;
13
+ let lastSample = -Infinity;
14
+ let screenAngle = 0;
15
+ let listening = false;
16
+ let granted = false;
17
+ let denied = false;
18
+ let permissionPending;
19
+ let probedPermission = false;
20
+ let permissionOwners = 0;
21
+ let hasHeading;
22
+ let scrollUntil = 0;
23
+ let scrollPaused = false;
24
+ let recoverUntil = 0;
25
+ const touchPointers = new Set();
26
+ let touches = 0;
27
+ export const isDeviceOrientationPaused = () => touches > 0 || touchPointers.size > 0 || performance.now() < scrollUntil;
28
+ function pointerStart(event) {
29
+ if (event.pointerType !== 'touch')
30
+ return;
31
+ touchPointers.add(event.pointerId);
32
+ pauseDeviceOrientationForScroll();
33
+ }
34
+ function pointerEnd(event) {
35
+ if (touchPointers.delete(event.pointerId))
36
+ pauseDeviceOrientationForScroll();
37
+ }
38
+ function touchChange(event) {
39
+ touches = event.touches.length;
40
+ pauseDeviceOrientationForScroll();
41
+ }
42
+ function releaseTouches() {
43
+ touches = 0;
44
+ touchPointers.clear();
45
+ }
46
+ /** Called by native scrolling and the stage's virtual-scroll frame stream. */
47
+ export function pauseDeviceOrientationForScroll() {
48
+ scrollUntil = performance.now() + 160;
49
+ scrollPaused = true;
50
+ }
51
+ export const getListDeviceYaw = () => yaw;
52
+ export const getListDevicePitch = () => pitch;
53
+ export const getListDeviceRoll = () => roll;
54
+ export function subscribeListDeviceYaw(callback) {
55
+ listeners.add(callback);
56
+ return () => { listeners.delete(callback); };
57
+ }
58
+ function publish(value, pitchValue = 0, rollValue = 0) {
59
+ if (value === yaw && pitchValue === pitch && rollValue === roll)
60
+ return;
61
+ yaw = value;
62
+ pitch = pitchValue;
63
+ roll = rollValue;
64
+ for (const callback of listeners)
65
+ callback();
66
+ }
67
+ function reset() {
68
+ filter.reset();
69
+ lastSample = -Infinity;
70
+ publish(0);
71
+ }
72
+ function readScreenAngle() {
73
+ return window.screen.orientation?.angle ?? window.orientation ?? 0;
74
+ }
75
+ function recalibrateScreen() {
76
+ screenAngle = readScreenAngle();
77
+ calibratingUntil = performance.now() + 300;
78
+ reset();
79
+ }
80
+ function sample(event) {
81
+ const now = performance.now();
82
+ // Do not parse, filter, allocate quaternions or invalidate GPU rendering during scrolling.
83
+ if (isDeviceOrientationPaused())
84
+ return;
85
+ const { alpha, beta, gamma } = event;
86
+ if (![beta, gamma].every(value => typeof value === 'number' && Number.isFinite(value))) {
87
+ reset();
88
+ return;
89
+ }
90
+ if (readScreenAngle() !== screenAngle)
91
+ recalibrateScreen();
92
+ // Screen rotation and sensor events can arrive in either order. Let the screen settle.
93
+ if (now < calibratingUntil)
94
+ return;
95
+ if (now - lastSample < 1000 / 60 - 1)
96
+ return;
97
+ lastSample = now;
98
+ // Some sensor/browser combinations expose tilt without a heading. Keep tilt usable.
99
+ const headingAvailable = typeof alpha === 'number' && Number.isFinite(alpha);
100
+ if (hasHeading !== headingAvailable) {
101
+ hasHeading = headingAvailable;
102
+ reset();
103
+ }
104
+ const orientation = screenOrientation(headingAvailable ? alpha : 0, beta, gamma, screenAngle);
105
+ if (scrollPaused) {
106
+ scrollPaused = false;
107
+ filter.resume(orientation, now);
108
+ recoverUntil = now + 700;
109
+ }
110
+ publish(filter.update(orientation, now, now < recoverUntil ? 400 : 60), filter.pitch, filter.roll);
111
+ }
112
+ function sync() {
113
+ // Pointer media queries describe input devices, not sensor availability (e.g. Surface).
114
+ const available = window.isSecureContext && 'DeviceOrientationEvent' in window && !motion?.matches;
115
+ status = !available ? 'unavailable' : granted ? 'active'
116
+ : window.DeviceOrientationEvent.requestPermission ? (denied ? 'denied' : 'permission') : 'active';
117
+ const active = status === 'active' && visible.size > 0 && !document.hidden;
118
+ if (active !== listening) {
119
+ listening = active;
120
+ if (active)
121
+ window.addEventListener('deviceorientation', sample, { passive: true });
122
+ else
123
+ window.removeEventListener('deviceorientation', sample);
124
+ reset();
125
+ }
126
+ for (const callback of owners.values())
127
+ callback(status);
128
+ }
129
+ /** A silent probe can recover existing consent; a prompt requires a navigation click. */
130
+ export function requestListDeviceOrientation(fromNavigation = true) {
131
+ if (granted || denied)
132
+ return Promise.resolve();
133
+ if (permissionPending)
134
+ return permissionPending;
135
+ const attempt = async () => {
136
+ try {
137
+ const permission = window.DeviceOrientationEvent.requestPermission;
138
+ granted = !permission || await permission.call(window.DeviceOrientationEvent) === 'granted';
139
+ denied = !granted;
140
+ }
141
+ catch {
142
+ // NotAllowedError without user activation is not a user denial.
143
+ if (fromNavigation)
144
+ denied = true;
145
+ }
146
+ if (owners.size)
147
+ sync();
148
+ };
149
+ permissionPending = attempt().finally(() => { permissionPending = undefined; });
150
+ return permissionPending;
151
+ }
152
+ function permissionAvailable() {
153
+ return window.isSecureContext && 'DeviceOrientationEvent' in window &&
154
+ !window.matchMedia('(prefers-reduced-motion: reduce)').matches;
155
+ }
156
+ function autoPermission() {
157
+ if (!permissionAvailable() || probedPermission)
158
+ return;
159
+ probedPermission = true;
160
+ void requestListDeviceOrientation(false);
161
+ }
162
+ function navigationPermission(event) {
163
+ if (!event.isTrusted || event.defaultPrevented || event.button !== 0 || event.metaKey ||
164
+ event.ctrlKey || event.shiftKey || event.altKey || !permissionAvailable())
165
+ return;
166
+ const anchor = event.composedPath().find(node => node instanceof HTMLAnchorElement);
167
+ if (!anchor || !anchor.hasAttribute('href') || anchor.hasAttribute('download') ||
168
+ (anchor.target && anchor.target !== '_self'))
169
+ return;
170
+ const destination = new URL(anchor.href, window.location.href);
171
+ if (destination.origin !== window.location.origin || !['http:', 'https:'].includes(destination.protocol))
172
+ return;
173
+ // Invoke synchronously, before the router handles the click; never hold up navigation.
174
+ void requestListDeviceOrientation(true);
175
+ }
176
+ /** Mount in the application shell so entry via detail/carousel pages also works. */
177
+ export function retainDeviceOrientationPermission() {
178
+ const preference = window.matchMedia('(prefers-reduced-motion: reduce)');
179
+ if (permissionOwners++ === 0)
180
+ document.addEventListener('click', navigationPermission, true);
181
+ preference.addEventListener('change', autoPermission);
182
+ autoPermission();
183
+ return () => {
184
+ preference.removeEventListener('change', autoPermission);
185
+ if (--permissionOwners === 0)
186
+ document.removeEventListener('click', navigationPermission, true);
187
+ };
188
+ }
189
+ /** One shared sensor listener for all visible opted-in sections, with complete teardown. */
190
+ export function retainListDeviceOrientation(node, callback) {
191
+ const releasePermission = retainDeviceOrientationPermission();
192
+ owners.set(node, callback);
193
+ if (owners.size === 1) {
194
+ scrollUntil = recoverUntil = 0;
195
+ scrollPaused = false;
196
+ window.addEventListener('scroll', pauseDeviceOrientationForScroll, { passive: true, capture: true });
197
+ window.addEventListener('pointerdown', pointerStart, { passive: true, capture: true });
198
+ window.addEventListener('pointerup', pointerEnd, { passive: true, capture: true });
199
+ window.addEventListener('pointercancel', pointerEnd, { passive: true, capture: true });
200
+ for (const name of ['touchstart', 'touchend', 'touchcancel'])
201
+ window.addEventListener(name, touchChange, { passive: true, capture: true });
202
+ window.addEventListener('blur', releaseTouches);
203
+ screenAngle = readScreenAngle();
204
+ calibratingUntil = 0;
205
+ window.screen.orientation?.addEventListener?.('change', recalibrateScreen);
206
+ window.addEventListener('orientationchange', recalibrateScreen);
207
+ motion = window.matchMedia('(prefers-reduced-motion: reduce)');
208
+ motion.addEventListener('change', sync);
209
+ document.addEventListener('visibilitychange', sync);
210
+ observer = new IntersectionObserver(entries => {
211
+ for (const entry of entries) {
212
+ if (entry.isIntersecting)
213
+ visible.add(entry.target);
214
+ else
215
+ visible.delete(entry.target);
216
+ }
217
+ sync();
218
+ });
219
+ }
220
+ observer.observe(node);
221
+ sync();
222
+ return () => {
223
+ releasePermission();
224
+ observer?.unobserve(node);
225
+ visible.delete(node);
226
+ owners.delete(node);
227
+ if (!owners.size) {
228
+ window.removeEventListener('scroll', pauseDeviceOrientationForScroll, true);
229
+ window.removeEventListener('pointerdown', pointerStart, true);
230
+ window.removeEventListener('pointerup', pointerEnd, true);
231
+ window.removeEventListener('pointercancel', pointerEnd, true);
232
+ for (const name of ['touchstart', 'touchend', 'touchcancel'])
233
+ window.removeEventListener(name, touchChange, true);
234
+ window.removeEventListener('blur', releaseTouches);
235
+ releaseTouches();
236
+ window.screen.orientation?.removeEventListener?.('change', recalibrateScreen);
237
+ window.removeEventListener('orientationchange', recalibrateScreen);
238
+ observer?.disconnect();
239
+ motion?.removeEventListener('change', sync);
240
+ document.removeEventListener('visibilitychange', sync);
241
+ }
242
+ sync();
243
+ };
244
+ }
245
+ //# sourceMappingURL=listDeviceOrientation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listDeviceOrientation.js","sourceRoot":"","sources":["../../src/catalog/listDeviceOrientation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAMpE,MAAM,SAAS,GAAG,IAAI,GAAG,EAAc,CAAC;AACxC,MAAM,MAAM,GAAG,IAAI,GAAG,EAAoD,CAAC;AAC3E,MAAM,OAAO,GAAG,IAAI,GAAG,EAAe,CAAC;AACvC,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;AACrC,IAAI,MAAM,GAAsB,aAAa,CAAC;AAC9C,IAAI,GAAG,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C5E,MAAM,CAAC,mBAAmB,CAAC,aAAa,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;YAC9D,MAAM,CAAC,mBAAmB,CAAC,WAAW,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;YAC1D,MAAM,CAAC,mBAAmB,CAAC,eAAe,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;YAC9D,KAAK,MAAM,IAAI,IAAI,CAAC,YAAY,EAAE,UAAU,EAAE,aAAa,CAAU;gBACpE,MAAM,CAAC,mBAAmB,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;YACrD,MAAM,CAAC,mBAAmB,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;YACnD,cAAc,EAAE,CAAC;YACjB,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,mBAAmB,EAAE,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;YAC9E,MAAM,CAAC,mBAAmB,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,CAAC;YACnE,QAAQ,EAAE,UAAU,EAAE,CAAC;YACvB,MAAM,EAAE,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YAC5C,QAAQ,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC;QACxD,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;AACH,CAAC","sourcesContent":["import { DeviceYawFilter, screenOrientation } from './deviceYaw.js';\n\ntype PermissionConstructor = typeof DeviceOrientationEvent & {\n\trequestPermission?: () => Promise<PermissionState>;\n};\nexport type OrientationStatus = 'unavailable' | 'permission' | 'active' | 'denied';\nconst listeners = new Set<() => void>();\nconst owners = new Map<HTMLElement, (status: OrientationStatus) => void>();\nconst visible = new Set<HTMLElement>();\nconst filter = new DeviceYawFilter();\nlet status: OrientationStatus = 'unavailable';\nlet yaw = 0;\nlet pitch = 0;\nlet roll = 0;\nlet calibratingUntil = 0;\nlet observer: IntersectionObserver | undefined;\nlet motion: MediaQueryList | undefined;\nlet lastSample = -Infinity;\nlet screenAngle = 0;\nlet listening = false;\nlet granted = false;\nlet denied = false;\nlet permissionPending: Promise<void> | undefined;\nlet probedPermission = false;\nlet permissionOwners = 0;\nlet hasHeading: boolean | undefined;\nlet scrollUntil = 0;\nlet scrollPaused = false;\nlet recoverUntil = 0;\nconst touchPointers = new Set<number>();\nlet touches = 0;\nexport const isDeviceOrientationPaused = () => touches > 0 || touchPointers.size > 0 || performance.now() < scrollUntil;\nfunction pointerStart(event: PointerEvent) {\n\tif (event.pointerType !== 'touch') return;\n\ttouchPointers.add(event.pointerId);\n\tpauseDeviceOrientationForScroll();\n}\nfunction pointerEnd(event: PointerEvent) {\n\tif (touchPointers.delete(event.pointerId)) pauseDeviceOrientationForScroll();\n}\nfunction touchChange(event: TouchEvent) {\n\ttouches = event.touches.length;\n\tpauseDeviceOrientationForScroll();\n}\nfunction releaseTouches() {\n\ttouches = 0;\n\ttouchPointers.clear();\n}\n\n/** Called by native scrolling and the stage's virtual-scroll frame stream. */\nexport function pauseDeviceOrientationForScroll() {\n\tscrollUntil = performance.now() + 160;\n\tscrollPaused = true;\n}\n\nexport const getListDeviceYaw = () => yaw;\nexport const getListDevicePitch = () => pitch;\nexport const getListDeviceRoll = () => roll;\nexport function subscribeListDeviceYaw(callback: () => void) {\n\tlisteners.add(callback);\n\treturn () => { listeners.delete(callback); };\n}\nfunction publish(value: number, pitchValue = 0, rollValue = 0) {\n\tif (value === yaw && pitchValue === pitch && rollValue === roll) return;\n\tyaw = value;\n\tpitch = pitchValue;\n\troll = rollValue;\n\tfor (const callback of listeners) callback();\n}\nfunction reset() {\n\tfilter.reset();\n\tlastSample = -Infinity;\n\tpublish(0);\n}\nfunction readScreenAngle() {\n\treturn window.screen.orientation?.angle ?? (window as Window & { orientation?: number }).orientation ?? 0;\n}\nfunction recalibrateScreen() {\n\tscreenAngle = readScreenAngle();\n\tcalibratingUntil = performance.now() + 300;\n\treset();\n}\nfunction sample(event: DeviceOrientationEvent) {\n\tconst now = performance.now();\n\t// Do not parse, filter, allocate quaternions or invalidate GPU rendering during scrolling.\n\tif (isDeviceOrientationPaused()) return;\n\tconst { alpha, beta, gamma } = event;\n\tif (![beta, gamma].every(value => typeof value === 'number' && Number.isFinite(value))) {\n\t\treset();\n\t\treturn;\n\t}\n\tif (readScreenAngle() !== screenAngle) recalibrateScreen();\n\t// Screen rotation and sensor events can arrive in either order. Let the screen settle.\n\tif (now < calibratingUntil) return;\n\tif (now - lastSample < 1000 / 60 - 1) return;\n\tlastSample = now;\n\t// Some sensor/browser combinations expose tilt without a heading. Keep tilt usable.\n\tconst headingAvailable = typeof alpha === 'number' && Number.isFinite(alpha);\n\tif (hasHeading !== headingAvailable) { hasHeading = headingAvailable; reset(); }\n\tconst orientation = screenOrientation(headingAvailable ? alpha! : 0, beta!, gamma!, screenAngle);\n\tif (scrollPaused) {\n\t\tscrollPaused = false;\n\t\tfilter.resume(orientation, now);\n\t\trecoverUntil = now + 700;\n\t}\n\tpublish(filter.update(orientation, now, now < recoverUntil ? 400 : 60), filter.pitch, filter.roll);\n}\nfunction sync() {\n\t// Pointer media queries describe input devices, not sensor availability (e.g. Surface).\n\tconst available = window.isSecureContext && 'DeviceOrientationEvent' in window && !motion?.matches;\n\tstatus = !available ? 'unavailable' : granted ? 'active'\n\t\t: (window.DeviceOrientationEvent as PermissionConstructor).requestPermission ? (denied ? 'denied' : 'permission') : 'active';\n\tconst active = status === 'active' && visible.size > 0 && !document.hidden;\n\tif (active !== listening) {\n\t\tlistening = active;\n\t\tif (active) window.addEventListener('deviceorientation', sample, { passive: true });\n\t\telse window.removeEventListener('deviceorientation', sample);\n\t\treset();\n\t}\n\tfor (const callback of owners.values()) callback(status);\n}\n/** A silent probe can recover existing consent; a prompt requires a navigation click. */\nexport function requestListDeviceOrientation(fromNavigation = true): Promise<void> {\n\tif (granted || denied) return Promise.resolve();\n\tif (permissionPending) return permissionPending;\n\tconst attempt = async () => {\n\t\ttry {\n\t\t\tconst permission = (window.DeviceOrientationEvent as PermissionConstructor).requestPermission;\n\t\t\tgranted = !permission || await permission.call(window.DeviceOrientationEvent) === 'granted';\n\t\t\tdenied = !granted;\n\t\t} catch {\n\t\t\t// NotAllowedError without user activation is not a user denial.\n\t\t\tif (fromNavigation) denied = true;\n\t\t}\n\t\tif (owners.size) sync();\n\t};\n\tpermissionPending = attempt().finally(() => { permissionPending = undefined; });\n\treturn permissionPending;\n}\n\nfunction permissionAvailable() {\n\treturn window.isSecureContext && 'DeviceOrientationEvent' in window &&\n\t\t!window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n}\nfunction autoPermission() {\n\tif (!permissionAvailable() || probedPermission) return;\n\tprobedPermission = true;\n\tvoid requestListDeviceOrientation(false);\n}\nfunction navigationPermission(event: MouseEvent) {\n\tif (!event.isTrusted || event.defaultPrevented || event.button !== 0 || event.metaKey ||\n\t\tevent.ctrlKey || event.shiftKey || event.altKey || !permissionAvailable()) return;\n\tconst anchor = event.composedPath().find(node => node instanceof HTMLAnchorElement) as HTMLAnchorElement | undefined;\n\tif (!anchor || !anchor.hasAttribute('href') || anchor.hasAttribute('download') ||\n\t\t(anchor.target && anchor.target !== '_self')) return;\n\tconst destination = new URL(anchor.href, window.location.href);\n\tif (destination.origin !== window.location.origin || !['http:', 'https:'].includes(destination.protocol)) return;\n\t// Invoke synchronously, before the router handles the click; never hold up navigation.\n\tvoid requestListDeviceOrientation(true);\n}\n\n/** Mount in the application shell so entry via detail/carousel pages also works. */\nexport function retainDeviceOrientationPermission() {\n\tconst preference = window.matchMedia('(prefers-reduced-motion: reduce)');\n\tif (permissionOwners++ === 0) document.addEventListener('click', navigationPermission, true);\n\tpreference.addEventListener('change', autoPermission);\n\tautoPermission();\n\treturn () => {\n\t\tpreference.removeEventListener('change', autoPermission);\n\t\tif (--permissionOwners === 0) document.removeEventListener('click', navigationPermission, true);\n\t};\n}\n\n/** One shared sensor listener for all visible opted-in sections, with complete teardown. */\nexport function retainListDeviceOrientation(node: HTMLElement, callback: (status: OrientationStatus) => void) {\n\tconst releasePermission = retainDeviceOrientationPermission();\n\towners.set(node, callback);\n\tif (owners.size === 1) {\n\t\tscrollUntil = recoverUntil = 0;\n\t\tscrollPaused = false;\n\t\twindow.addEventListener('scroll', pauseDeviceOrientationForScroll, { passive: true, capture: true });\n\t\twindow.addEventListener('pointerdown', pointerStart, { passive: true, capture: true });\n\t\twindow.addEventListener('pointerup', pointerEnd, { passive: true, capture: true });\n\t\twindow.addEventListener('pointercancel', pointerEnd, { passive: true, capture: true });\n\t\tfor (const name of ['touchstart', 'touchend', 'touchcancel'] as const)\n\t\t\twindow.addEventListener(name, touchChange, { passive: true, capture: true });\n\t\twindow.addEventListener('blur', releaseTouches);\n\t\tscreenAngle = readScreenAngle();\n\t\tcalibratingUntil = 0;\n\t\twindow.screen.orientation?.addEventListener?.('change', recalibrateScreen);\n\t\twindow.addEventListener('orientationchange', recalibrateScreen);\n\t\tmotion = window.matchMedia('(prefers-reduced-motion: reduce)');\n\t\tmotion.addEventListener('change', sync);\n\t\tdocument.addEventListener('visibilitychange', sync);\n\t\tobserver = new IntersectionObserver(entries => {\n\t\t\tfor (const entry of entries) {\n\t\t\t\tif (entry.isIntersecting) visible.add(entry.target as HTMLElement);\n\t\t\t\telse visible.delete(entry.target as HTMLElement);\n\t\t\t}\n\t\t\tsync();\n\t\t});\n\t}\n\tobserver!.observe(node);\n\tsync();\n\treturn () => {\n\t\treleasePermission();\n\t\tobserver?.unobserve(node);\n\t\tvisible.delete(node);\n\t\towners.delete(node);\n\t\tif (!owners.size) {\n\t\t\twindow.removeEventListener('scroll', pauseDeviceOrientationForScroll, true);\n\t\t\twindow.removeEventListener('pointerdown', pointerStart, true);\n\t\t\twindow.removeEventListener('pointerup', pointerEnd, true);\n\t\t\twindow.removeEventListener('pointercancel', pointerEnd, true);\n\t\t\tfor (const name of ['touchstart', 'touchend', 'touchcancel'] as const)\n\t\t\t\twindow.removeEventListener(name, touchChange, true);\n\t\t\twindow.removeEventListener('blur', releaseTouches);\n\t\t\treleaseTouches();\n\t\t\twindow.screen.orientation?.removeEventListener?.('change', recalibrateScreen);\n\t\t\twindow.removeEventListener('orientationchange', recalibrateScreen);\n\t\t\tobserver?.disconnect();\n\t\t\tmotion?.removeEventListener('change', sync);\n\t\t\tdocument.removeEventListener('visibilitychange', sync);\n\t\t}\n\t\tsync();\n\t};\n}\n"]}
@@ -0,0 +1,13 @@
1
+ import { Object3D, Quaternion, Vector3 } from 'three/webgpu';
2
+ /** Add screen-relative motion without changing the authored model or camera pose. */
3
+ export declare class DeviceGeometryMotion {
4
+ readonly rotation: Quaternion;
5
+ private readonly angles;
6
+ private readonly euler;
7
+ private readonly world;
8
+ private readonly inverseCamera;
9
+ private readonly base;
10
+ update(yaw: number, pitch: number, roll: number, delta: number): boolean;
11
+ apply(model: Object3D, camera: Object3D, center: Vector3): void;
12
+ }
13
+ //# sourceMappingURL=DeviceGeometryMotion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeviceGeometryMotion.d.ts","sourceRoot":"","sources":["../../src/stage/DeviceGeometryMotion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE/E,qFAAqF;AACrF,qBAAa,oBAAoB;IAChC,QAAQ,CAAC,QAAQ,aAAoB;IACrC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;IACxC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA6B;IACnD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoB;IAC1C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAoB;IAClD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAwE;IAC7F,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAY9D,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO;CAaxD"}
@@ -0,0 +1,37 @@
1
+ import { Euler, MathUtils, Object3D, Quaternion, Vector3 } from 'three/webgpu';
2
+ /** Add screen-relative motion without changing the authored model or camera pose. */
3
+ export class DeviceGeometryMotion {
4
+ rotation = new Quaternion();
5
+ angles = new Vector3();
6
+ euler = new Euler(0, 0, 0, 'ZXY');
7
+ world = new Quaternion();
8
+ inverseCamera = new Quaternion();
9
+ base = new WeakMap();
10
+ update(yaw, pitch, roll, delta) {
11
+ const targets = [-pitch, -yaw, -roll];
12
+ let animating = false;
13
+ for (let index = 0; index < 3; index++) {
14
+ let next = MathUtils.damp(this.angles.getComponent(index), targets[index], 40, delta);
15
+ if (Math.abs(next - targets[index]) < 0.01)
16
+ next = targets[index];
17
+ this.angles.setComponent(index, next);
18
+ animating ||= next !== targets[index];
19
+ }
20
+ this.rotation.setFromEuler(this.euler.set(MathUtils.degToRad(this.angles.x), MathUtils.degToRad(this.angles.y), MathUtils.degToRad(this.angles.z), 'ZXY'));
21
+ return animating;
22
+ }
23
+ apply(model, camera, center) {
24
+ let base = this.base.get(model);
25
+ if (!base) {
26
+ base = { rotation: model.quaternion.clone(), position: model.position.clone() };
27
+ this.base.set(model, base);
28
+ }
29
+ camera.getWorldQuaternion(this.world);
30
+ this.inverseCamera.copy(this.world).invert();
31
+ this.world.multiply(this.rotation).multiply(this.inverseCamera);
32
+ model.quaternion.copy(base.rotation).premultiply(this.world);
33
+ model.position.copy(base.position).sub(center).applyQuaternion(this.world).add(center);
34
+ model.updateMatrixWorld(true);
35
+ }
36
+ }
37
+ //# sourceMappingURL=DeviceGeometryMotion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeviceGeometryMotion.js","sourceRoot":"","sources":["../../src/stage/DeviceGeometryMotion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,cA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tils, Object3D, Quaternion, Vector3 } from 'three/webgpu';\n\n/** Add screen-relative motion without changing the authored model or camera pose. */\nexport class DeviceGeometryMotion {\n\treadonly rotation = new Quaternion();\n\tprivate readonly angles = new Vector3();\n\tprivate readonly euler = new Euler(0, 0, 0, 'ZXY');\n\tprivate readonly world = new Quaternion();\n\tprivate readonly inverseCamera = new Quaternion();\n\tprivate readonly base = new WeakMap<Object3D, { rotation: Quaternion; position: Vector3 }>();\n\tupdate(yaw: number, pitch: number, roll: number, delta: number) {\n\t\tconst targets = [-pitch, -yaw, -roll];\n\t\tlet animating = false;\n\t\tfor (let index = 0; index < 3; index++) {\n\t\t\tlet next = MathUtils.damp(this.angles.getComponent(index), targets[index], 40, delta);\n\t\t\tif (Math.abs(next - targets[index]) < 0.01) next = targets[index];\n\t\t\tthis.angles.setComponent(index, next);\n\t\t\tanimating ||= next !== targets[index];\n\t\t}\n\t\tthis.rotation.setFromEuler(this.euler.set(MathUtils.degToRad(this.angles.x), MathUtils.degToRad(this.angles.y), MathUtils.degToRad(this.angles.z), 'ZXY'));\n\t\treturn animating;\n\t}\n\tapply(model: Object3D, camera: Object3D, center: Vector3) {\n\t\tlet base = this.base.get(model);\n\t\tif (!base) {\n\t\t\tbase = { rotation: model.quaternion.clone(), position: model.position.clone() };\n\t\t\tthis.base.set(model, base);\n\t\t}\n\t\tcamera.getWorldQuaternion(this.world);\n\t\tthis.inverseCamera.copy(this.world).invert();\n\t\tthis.world.multiply(this.rotation).multiply(this.inverseCamera);\n\t\tmodel.quaternion.copy(base.rotation).premultiply(this.world);\n\t\tmodel.position.copy(base.position).sub(center).applyQuaternion(this.world).add(center);\n\t\tmodel.updateMatrixWorld(true);\n\t}\n}\n"]}
@@ -6,6 +6,7 @@ import type { StageMinimapState } from './minimap/MinimapState.js';
6
6
  import type { StageCameraSettings, StageMinimapOptions, StagePanelTarget } from './stageTypes.js';
7
7
  import type { StagePanelRuntime } from './StagePanelRuntime.js';
8
8
  export interface MinimapPorts {
9
+ sensorRotation?(): THREE.Quaternion;
9
10
  renderer: THREE.WebGPURenderer;
10
11
  camera: THREE.PerspectiveCamera;
11
12
  panelCamera: THREE.PerspectiveCamera;
@@ -1 +1 @@
1
- {"version":3,"file":"MinimapController.d.ts","sourceRoot":"","sources":["../../src/stage/MinimapController.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAuBtC,OAAO,KAAK,EAAE,IAAI,EAAY,MAAM,OAAO,CAAC;AAC5C,OAAO,EAGN,KAAK,uBAAuB,EAC5B,MAAM,uBAAuB,CAAC;AAmC/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAQvE,OAAO,KAAK,EAA+B,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEhG,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAElG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,MAAM,WAAW,YAAY;IAC5B,QAAQ,EAAE,KAAK,CAAC,cAAc,CAAC;IAC/B,MAAM,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAChC,WAAW,EAAE,KAAK,CAAC,iBAAiB,CAAC;IACrC,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC;IACxB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAAC;IACpD,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAAC;IACpD,cAAc,IAAI;QACjB,KAAK,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC;QACvB,GAAG,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC;QACrB,MAAM,EAAE,mBAAmB,CAAC;QAC5B,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC;QAC7B,SAAS,EAAE,KAAK,CAAC,UAAU,CAAC;QAC5B,WAAW,EAAE,OAA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,EACb,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM;IAwCd,uBAAuB,CACtB,OAAO,EAAE,iBAAiB,EAC1B,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,kBAAkB,EAC/B,eAAe,EAAE,MAAM;IAkDxB,8BAA8B,CAAC,OAAO,EAAE,iBAAiB;IAiCzD,6BAA6B,CAAC,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM;IAiBzE,iBAAiB,CAAC,OAAO,EAAE,iBAAiB;IA8B5C,yBAAyB,CAAC,OAAO,EAAE,iBAAiB;IAsBpD,2BAA2B,CAAC,OAAO,EAAE,iBAAiB;CAkBtD"}
@@ -520,6 +520,11 @@ export class MinimapController {
520
520
  this.model?.getWorldQuaternion(modelWorldQuaternion);
521
521
  this.camera.getWorldQuaternion(mainCameraWorldQuaternion);
522
522
  liveQuaternion.copy(mainCameraWorldQuaternion).invert().multiply(modelWorldQuaternion);
523
+ const sensor = this.ports.sensorRotation?.();
524
+ // Main geometry already includes the sensor pose. Remove it before blending
525
+ // rest/live/dock views, then apply it once to every minimap presentation.
526
+ if (sensor)
527
+ liveQuaternion.premultiply(sensor.clone().invert());
523
528
  baseQuaternion.slerpQuaternions(minimap.restQuaternion, liveQuaternion, THREE.MathUtils.clamp(focus, 0, 1));
524
529
  if (minimap.dockedQuaternion && !this.ports.frame().fullscreen) {
525
530
  minimap.displayModel.quaternion.slerpQuaternions(baseQuaternion, minimap.dockedQuaternion, THREE.MathUtils.clamp(this.ports.target(minimap.panelIndex)?.getMinimapDockProgress?.() ?? 0, 0, 1));
@@ -528,6 +533,8 @@ export class MinimapController {
528
533
  minimap.displayModel.quaternion.copy(baseQuaternion);
529
534
  }
530
535
  minimap.displayModel.scale.setScalar(targetScale);
536
+ if (sensor)
537
+ minimap.displayModel.quaternion.premultiply(sensor);
531
538
  minimap.displayModel.position.set(0, 0, modelZ);
532
539
  }
533
540
  alignMinimapModelToDockTop(minimap) {