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

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 (244) hide show
  1. package/dist/catalog/CarouselDeviceCamera.d.ts +20 -0
  2. package/dist/catalog/CarouselDeviceCamera.d.ts.map +1 -0
  3. package/dist/catalog/CarouselDeviceCamera.js +58 -0
  4. package/dist/catalog/CarouselDeviceCamera.js.map +1 -0
  5. package/dist/catalog/CarouselGlassCompositor.d.ts +8 -2
  6. package/dist/catalog/CarouselGlassCompositor.d.ts.map +1 -1
  7. package/dist/catalog/CarouselGlassCompositor.js +69 -12
  8. package/dist/catalog/CarouselGlassCompositor.js.map +1 -1
  9. package/dist/catalog/CarouselGround.d.ts +22 -1
  10. package/dist/catalog/CarouselGround.d.ts.map +1 -1
  11. package/dist/catalog/CarouselGround.js +185 -24
  12. package/dist/catalog/CarouselGround.js.map +1 -1
  13. package/dist/catalog/CatalogDepthBlur.d.ts +20 -1
  14. package/dist/catalog/CatalogDepthBlur.d.ts.map +1 -1
  15. package/dist/catalog/CatalogDepthBlur.js +126 -23
  16. package/dist/catalog/CatalogDepthBlur.js.map +1 -1
  17. package/dist/catalog/CatalogGeometryFade.d.ts +5 -1
  18. package/dist/catalog/CatalogGeometryFade.d.ts.map +1 -1
  19. package/dist/catalog/CatalogGeometryFade.js +39 -7
  20. package/dist/catalog/CatalogGeometryFade.js.map +1 -1
  21. package/dist/catalog/CatalogModelOutline.d.ts +3 -1
  22. package/dist/catalog/CatalogModelOutline.d.ts.map +1 -1
  23. package/dist/catalog/CatalogModelOutline.js +11 -2
  24. package/dist/catalog/CatalogModelOutline.js.map +1 -1
  25. package/dist/catalog/CatalogPreparation.d.ts.map +1 -1
  26. package/dist/catalog/CatalogPreparation.js +8 -6
  27. package/dist/catalog/CatalogPreparation.js.map +1 -1
  28. package/dist/catalog/CatalogSpatialElementLayer.d.ts +144 -3
  29. package/dist/catalog/CatalogSpatialElementLayer.d.ts.map +1 -1
  30. package/dist/catalog/CatalogSpatialElementLayer.js +554 -103
  31. package/dist/catalog/CatalogSpatialElementLayer.js.map +1 -1
  32. package/dist/catalog/CatalogTransition.d.ts +4 -0
  33. package/dist/catalog/CatalogTransition.d.ts.map +1 -1
  34. package/dist/catalog/CatalogTransition.js +109 -27
  35. package/dist/catalog/CatalogTransition.js.map +1 -1
  36. package/dist/catalog/CatalogWarmOutputContext.d.ts +39 -0
  37. package/dist/catalog/CatalogWarmOutputContext.d.ts.map +1 -0
  38. package/dist/catalog/CatalogWarmOutputContext.js +159 -0
  39. package/dist/catalog/CatalogWarmOutputContext.js.map +1 -0
  40. package/dist/catalog/EarlyNavigationCoordinator.d.ts +35 -0
  41. package/dist/catalog/EarlyNavigationCoordinator.d.ts.map +1 -0
  42. package/dist/catalog/EarlyNavigationCoordinator.js +103 -0
  43. package/dist/catalog/EarlyNavigationCoordinator.js.map +1 -0
  44. package/dist/catalog/NavigationFeedback.d.ts +12 -0
  45. package/dist/catalog/NavigationFeedback.d.ts.map +1 -0
  46. package/dist/catalog/NavigationFeedback.js +40 -0
  47. package/dist/catalog/NavigationFeedback.js.map +1 -0
  48. package/dist/catalog/PreparationGate.d.ts +4 -0
  49. package/dist/catalog/PreparationGate.d.ts.map +1 -1
  50. package/dist/catalog/PreparationGate.js +1 -0
  51. package/dist/catalog/PreparationGate.js.map +1 -1
  52. package/dist/catalog/SourceDomClipping.d.ts +8 -0
  53. package/dist/catalog/SourceDomClipping.d.ts.map +1 -0
  54. package/dist/catalog/SourceDomClipping.js +74 -0
  55. package/dist/catalog/SourceDomClipping.js.map +1 -0
  56. package/dist/catalog/SourceDomMotion.d.ts +28 -0
  57. package/dist/catalog/SourceDomMotion.d.ts.map +1 -0
  58. package/dist/catalog/SourceDomMotion.js +111 -0
  59. package/dist/catalog/SourceDomMotion.js.map +1 -0
  60. package/dist/catalog/SpatialPageRegistry.d.ts +1 -0
  61. package/dist/catalog/SpatialPageRegistry.d.ts.map +1 -1
  62. package/dist/catalog/SpatialPageRegistry.js.map +1 -1
  63. package/dist/catalog/StagedCatalogTransition.d.ts +74 -0
  64. package/dist/catalog/StagedCatalogTransition.d.ts.map +1 -0
  65. package/dist/catalog/StagedCatalogTransition.js +270 -0
  66. package/dist/catalog/StagedCatalogTransition.js.map +1 -0
  67. package/dist/catalog/cardProjection.d.ts +31 -0
  68. package/dist/catalog/cardProjection.d.ts.map +1 -1
  69. package/dist/catalog/cardProjection.js +63 -4
  70. package/dist/catalog/cardProjection.js.map +1 -1
  71. package/dist/catalog/carouselPanelProjection.d.ts.map +1 -1
  72. package/dist/catalog/carouselPanelProjection.js +48 -11
  73. package/dist/catalog/carouselPanelProjection.js.map +1 -1
  74. package/dist/catalog/catalogActivationFocus.d.ts +5 -0
  75. package/dist/catalog/catalogActivationFocus.d.ts.map +1 -0
  76. package/dist/catalog/catalogActivationFocus.js +39 -0
  77. package/dist/catalog/catalogActivationFocus.js.map +1 -0
  78. package/dist/catalog/catalogJourney.d.ts +2 -0
  79. package/dist/catalog/catalogJourney.d.ts.map +1 -1
  80. package/dist/catalog/catalogJourney.js.map +1 -1
  81. package/dist/catalog/catalogPose.d.ts +18 -0
  82. package/dist/catalog/catalogPose.d.ts.map +1 -1
  83. package/dist/catalog/catalogPose.js +26 -5
  84. package/dist/catalog/catalogPose.js.map +1 -1
  85. package/dist/catalog/catalogTransitionViewport.d.ts +9 -0
  86. package/dist/catalog/catalogTransitionViewport.d.ts.map +1 -0
  87. package/dist/catalog/catalogTransitionViewport.js +13 -0
  88. package/dist/catalog/catalogTransitionViewport.js.map +1 -0
  89. package/dist/catalog/catalogViewLink.d.ts +2 -0
  90. package/dist/catalog/catalogViewLink.d.ts.map +1 -1
  91. package/dist/catalog/catalogViewLink.js +10 -2
  92. package/dist/catalog/catalogViewLink.js.map +1 -1
  93. package/dist/catalog/deviceYaw.d.ts +21 -0
  94. package/dist/catalog/deviceYaw.d.ts.map +1 -0
  95. package/dist/catalog/deviceYaw.js +87 -0
  96. package/dist/catalog/deviceYaw.js.map +1 -0
  97. package/dist/catalog/listDeviceOrientation.d.ts +17 -0
  98. package/dist/catalog/listDeviceOrientation.d.ts.map +1 -0
  99. package/dist/catalog/listDeviceOrientation.js +262 -0
  100. package/dist/catalog/listDeviceOrientation.js.map +1 -0
  101. package/dist/catalog/stagedDetailGeometry.d.ts +37 -0
  102. package/dist/catalog/stagedDetailGeometry.d.ts.map +1 -0
  103. package/dist/catalog/stagedDetailGeometry.js +55 -0
  104. package/dist/catalog/stagedDetailGeometry.js.map +1 -0
  105. package/dist/catalog/stagedDockGeometry.d.ts +66 -0
  106. package/dist/catalog/stagedDockGeometry.d.ts.map +1 -0
  107. package/dist/catalog/stagedDockGeometry.js +66 -0
  108. package/dist/catalog/stagedDockGeometry.js.map +1 -0
  109. package/dist/index.d.ts +2 -1
  110. package/dist/index.d.ts.map +1 -1
  111. package/dist/index.js +2 -1
  112. package/dist/index.js.map +1 -1
  113. package/dist/spatial-element/ResponsiveViewportMetrics.d.ts +18 -0
  114. package/dist/spatial-element/ResponsiveViewportMetrics.d.ts.map +1 -0
  115. package/dist/spatial-element/ResponsiveViewportMetrics.js +68 -0
  116. package/dist/spatial-element/ResponsiveViewportMetrics.js.map +1 -0
  117. package/dist/spatial-element/SectionSurfaceRegistry.d.ts +24 -0
  118. package/dist/spatial-element/SectionSurfaceRegistry.d.ts.map +1 -0
  119. package/dist/spatial-element/SectionSurfaceRegistry.js +48 -0
  120. package/dist/spatial-element/SectionSurfaceRegistry.js.map +1 -0
  121. package/dist/spatial-element/SpatialElementDockController.d.ts +19 -9
  122. package/dist/spatial-element/SpatialElementDockController.d.ts.map +1 -1
  123. package/dist/spatial-element/SpatialElementDockController.js +189 -93
  124. package/dist/spatial-element/SpatialElementDockController.js.map +1 -1
  125. package/dist/spatial-element/SpatialElementPaneController.d.ts +67 -0
  126. package/dist/spatial-element/SpatialElementPaneController.d.ts.map +1 -0
  127. package/dist/spatial-element/SpatialElementPaneController.js +245 -0
  128. package/dist/spatial-element/SpatialElementPaneController.js.map +1 -0
  129. package/dist/spatial-element/activeDetailSection.d.ts +8 -0
  130. package/dist/spatial-element/activeDetailSection.d.ts.map +1 -0
  131. package/dist/spatial-element/activeDetailSection.js +19 -0
  132. package/dist/spatial-element/activeDetailSection.js.map +1 -0
  133. package/dist/spatial-element/layoutTokens.json +53 -0
  134. package/dist/spatial-element/responsiveLayout.d.ts +1389 -0
  135. package/dist/spatial-element/responsiveLayout.d.ts.map +1 -0
  136. package/dist/spatial-element/responsiveLayout.js +265 -0
  137. package/dist/spatial-element/responsiveLayout.js.map +1 -0
  138. package/dist/spatial-element/sectionBackground.d.ts +29 -0
  139. package/dist/spatial-element/sectionBackground.d.ts.map +1 -0
  140. package/dist/spatial-element/sectionBackground.js +66 -0
  141. package/dist/spatial-element/sectionBackground.js.map +1 -0
  142. package/dist/spatial-element/spatialElement.d.ts +1 -0
  143. package/dist/spatial-element/spatialElement.d.ts.map +1 -1
  144. package/dist/spatial-element/spatialElement.js +1 -0
  145. package/dist/spatial-element/spatialElement.js.map +1 -1
  146. package/dist/spatial-element/spatialElementDock.d.ts +15 -0
  147. package/dist/spatial-element/spatialElementDock.d.ts.map +1 -1
  148. package/dist/spatial-element/spatialElementDock.js +22 -0
  149. package/dist/spatial-element/spatialElementDock.js.map +1 -1
  150. package/dist/spatial-element/spatialElementMedia.d.ts +16 -0
  151. package/dist/spatial-element/spatialElementMedia.d.ts.map +1 -0
  152. package/dist/spatial-element/spatialElementMedia.js +29 -0
  153. package/dist/spatial-element/spatialElementMedia.js.map +1 -0
  154. package/dist/spatial-element/spatialTheme.d.ts +12 -1
  155. package/dist/spatial-element/spatialTheme.d.ts.map +1 -1
  156. package/dist/spatial-element/spatialTheme.js +30 -1
  157. package/dist/spatial-element/spatialTheme.js.map +1 -1
  158. package/dist/spatial-element/types.d.ts +50 -2
  159. package/dist/spatial-element/types.d.ts.map +1 -1
  160. package/dist/spatial-element/types.js.map +1 -1
  161. package/dist/stage/BackgroundLayerOutput.d.ts +76 -0
  162. package/dist/stage/BackgroundLayerOutput.d.ts.map +1 -0
  163. package/dist/stage/BackgroundLayerOutput.js +333 -0
  164. package/dist/stage/BackgroundLayerOutput.js.map +1 -0
  165. package/dist/stage/DeviceGeometryMotion.d.ts +13 -0
  166. package/dist/stage/DeviceGeometryMotion.d.ts.map +1 -0
  167. package/dist/stage/DeviceGeometryMotion.js +37 -0
  168. package/dist/stage/DeviceGeometryMotion.js.map +1 -0
  169. package/dist/stage/LiquidGlassPanel.d.ts +3 -0
  170. package/dist/stage/LiquidGlassPanel.d.ts.map +1 -1
  171. package/dist/stage/LiquidGlassPanel.js +27 -2
  172. package/dist/stage/LiquidGlassPanel.js.map +1 -1
  173. package/dist/stage/MinimapController.d.ts +1 -0
  174. package/dist/stage/MinimapController.d.ts.map +1 -1
  175. package/dist/stage/MinimapController.js +35 -47
  176. package/dist/stage/MinimapController.js.map +1 -1
  177. package/dist/stage/PageBindingController.d.ts +4 -0
  178. package/dist/stage/PageBindingController.d.ts.map +1 -1
  179. package/dist/stage/PageBindingController.js +12 -4
  180. package/dist/stage/PageBindingController.js.map +1 -1
  181. package/dist/stage/PanelPresentationController.d.ts +17 -0
  182. package/dist/stage/PanelPresentationController.d.ts.map +1 -1
  183. package/dist/stage/PanelPresentationController.js +83 -22
  184. package/dist/stage/PanelPresentationController.js.map +1 -1
  185. package/dist/stage/SpatialElementInteractionController.d.ts +7 -0
  186. package/dist/stage/SpatialElementInteractionController.d.ts.map +1 -1
  187. package/dist/stage/SpatialElementInteractionController.js +9 -0
  188. package/dist/stage/SpatialElementInteractionController.js.map +1 -1
  189. package/dist/stage/SpatialElementPresentationController.d.ts +14 -2
  190. package/dist/stage/SpatialElementPresentationController.d.ts.map +1 -1
  191. package/dist/stage/SpatialElementPresentationController.js +47 -2
  192. package/dist/stage/SpatialElementPresentationController.js.map +1 -1
  193. package/dist/stage/SpatialElementRefinement.d.ts +34 -1
  194. package/dist/stage/SpatialElementRefinement.d.ts.map +1 -1
  195. package/dist/stage/SpatialElementRefinement.js +175 -37
  196. package/dist/stage/SpatialElementRefinement.js.map +1 -1
  197. package/dist/stage/StageExperience.d.ts +183 -5
  198. package/dist/stage/StageExperience.d.ts.map +1 -1
  199. package/dist/stage/StageExperience.js +421 -57
  200. package/dist/stage/StageExperience.js.map +1 -1
  201. package/dist/stage/StageRenderPipeline.d.ts +76 -1
  202. package/dist/stage/StageRenderPipeline.d.ts.map +1 -1
  203. package/dist/stage/StageRenderPipeline.js +424 -47
  204. package/dist/stage/StageRenderPipeline.js.map +1 -1
  205. package/dist/stage/VirtualScrollController.d.ts +7 -0
  206. package/dist/stage/VirtualScrollController.d.ts.map +1 -1
  207. package/dist/stage/VirtualScrollController.js +57 -4
  208. package/dist/stage/VirtualScrollController.js.map +1 -1
  209. package/dist/stage/minimap/MinimapModel.d.ts +2 -1
  210. package/dist/stage/minimap/MinimapModel.d.ts.map +1 -1
  211. package/dist/stage/minimap/MinimapModel.js +34 -4
  212. package/dist/stage/minimap/MinimapModel.js.map +1 -1
  213. package/dist/stage/minimap/MinimapModelGeometry.d.ts +21 -0
  214. package/dist/stage/minimap/MinimapModelGeometry.d.ts.map +1 -0
  215. package/dist/stage/minimap/MinimapModelGeometry.js +68 -0
  216. package/dist/stage/minimap/MinimapModelGeometry.js.map +1 -0
  217. package/dist/stage/minimap/MinimapState.d.ts +3 -8
  218. package/dist/stage/minimap/MinimapState.d.ts.map +1 -1
  219. package/dist/stage/minimap/MinimapState.js.map +1 -1
  220. package/dist/stage/panelContext.d.ts +7 -0
  221. package/dist/stage/panelContext.d.ts.map +1 -1
  222. package/dist/stage/panelContext.js.map +1 -1
  223. package/dist/stage/rendererState.d.ts +2 -0
  224. package/dist/stage/rendererState.d.ts.map +1 -1
  225. package/dist/stage/rendererState.js +13 -0
  226. package/dist/stage/rendererState.js.map +1 -1
  227. package/dist/stage/sceneEndpointEligibility.d.ts +20 -0
  228. package/dist/stage/sceneEndpointEligibility.d.ts.map +1 -0
  229. package/dist/stage/sceneEndpointEligibility.js +363 -0
  230. package/dist/stage/sceneEndpointEligibility.js.map +1 -0
  231. package/dist/stage/stageDom.d.ts.map +1 -1
  232. package/dist/stage/stageDom.js +6 -1
  233. package/dist/stage/stageDom.js.map +1 -1
  234. package/dist/stage/stageMath.d.ts +3 -3
  235. package/dist/stage/stageMath.d.ts.map +1 -1
  236. package/dist/stage/stageMath.js +11 -10
  237. package/dist/stage/stageMath.js.map +1 -1
  238. package/dist/stage/stageTypes.d.ts +8 -1
  239. package/dist/stage/stageTypes.d.ts.map +1 -1
  240. package/dist/stage/stageTypes.js.map +1 -1
  241. package/dist/stage/stageVisualTest.d.ts +19 -0
  242. package/dist/stage/stageVisualTest.d.ts.map +1 -1
  243. package/dist/stage/stageVisualTest.js.map +1 -1
  244. package/package.json +1 -1
@@ -1,5 +1,13 @@
1
1
  import { CatalogGeometryFade } from './CatalogGeometryFade.js';
2
+ import { CarouselDeviceCamera } from './CarouselDeviceCamera.js';
3
+ import { isCatalogActivationFocus } from './catalogActivationFocus.js';
4
+ import { isDeviceOrientationPaused, getListDeviceYaw, getListDevicePitch, getListDeviceRoll, subscribeListDeviceYaw } from './listDeviceOrientation.js';
2
5
  import { cardModelFit } from './cardModelFit.js';
6
+ import { createStagedDetailGeometry } from './stagedDetailGeometry.js';
7
+ import { createStagedDockGeometry } from './stagedDockGeometry.js';
8
+ import { sourceDomProjectiveMatrix } from './SourceDomMotion.js';
9
+ import { withRendererState } from '../stage/rendererState.js';
10
+ import { resolveDetailLayout } from '../spatial-element/responsiveLayout.js';
3
11
  import { CatalogDepthBlur } from './CatalogDepthBlur.js';
4
12
  import { CatalogModelOutline } from './CatalogModelOutline.js';
5
13
  import { DEFAULT_INTERACTION_THEME } from '../stage/stageConstants.js';
@@ -10,7 +18,7 @@ import * as THREE from 'three/webgpu';
10
18
  import { getSpatialElementScene, hasSpatialElementScene } from '../spatial-element/spatialElementScene.js';
11
19
  import { getStageVisualScrollPosition } from '../stage/scrollFrame.js';
12
20
  import { getCameraOrbitQuaternion, getPanelPointerInfluence, getPanelPointerRotation, setPanelLocalPerspectiveMatrix } from '../stage/stageMath.js';
13
- import { applyModelMaterialOverrides, centerAndScale, getMeshBounds, getMeshMaterials, isMesh } from '../stage/stageSceneUtils.js';
21
+ import { applyModelMaterialOverrides, centerAndScale, getMeshBounds, getMeshBoundsPoints, getMeshMaterials, isMesh } from '../stage/stageSceneUtils.js';
14
22
  import { SpatialElementAssetManager } from './assets/SpatialElementAssetManager.js';
15
23
  import { getSpatialElementEntityKey } from './spatialElementAssets.js';
16
24
  import { applyCatalogMaterialOpacity, captureCatalogMaterialOpacity } from './catalogPresentation.js';
@@ -75,18 +83,39 @@ export class CatalogSpatialElementLayer {
75
83
  }
76
84
  scene = new THREE.Scene();
77
85
  passes = 0;
78
- getStats() {
86
+ getRenderActivity() {
87
+ return { camera: this.carouselDeviceCamera.getRenderActivity(), pointer: { ...this.pointer },
88
+ layoutDirty: this.layoutDirty, queueDirty: this.queueDirty, loadingActors: this.loadingKeys.size,
89
+ preparing: this.stagedPreparing, warmups: this.stagedWarmups,
90
+ selected: this.carouselSelection?.spatialElementId ?? null,
91
+ actors: [...this.actors.values()].map(actor => ({ spatialElementId: actor.spatialElementId,
92
+ visible: actor.root.visible, hover: actor.hover, rotationX: actor.rotationX, rotationY: actor.rotationY,
93
+ lift: actor.lift, deviceYaw: actor.deviceYaw, devicePitch: actor.devicePitch, deviceRoll: actor.deviceRoll,
94
+ materialReady: this.stagedMaterialReady(actor) })) };
95
+ }
96
+ getStats(renderer, warmOutput) {
97
+ const signature = renderer && (!warmOutput || warmOutput.isCurrent(renderer)) ? this.stagedSignature(renderer, warmOutput) : undefined;
98
+ const stagedReady = (actor) => Boolean(!this.stagedReadinessBlocked && signature &&
99
+ actor.rendered && actor.root.visible && this.desired.has(actor.key) && this.stagedMaterialReady(actor) &&
100
+ this.stagedPrepared.get(actor) === signature);
79
101
  return {
80
102
  instances: this.actors.size,
103
+ deviceCamera: { pitch: this.carouselDeviceCamera.angles.x, yaw: this.carouselDeviceCamera.angles.y, roll: this.carouselDeviceCamera.angles.z },
81
104
  detachedInstances: this.detachedInstances,
82
105
  visible: [...this.actors.values()].filter((actor) => actor.root.visible).length,
83
106
  passes: this.passes,
107
+ stagedPreparation: { preparing: this.stagedPreparing,
108
+ readyActors: [...this.actors.values()].filter(stagedReady).length,
109
+ revision: this.stagedWarmRevision, warmups: this.stagedWarmups, failures: this.stagedWarmFailures,
110
+ sourceFrozen: this.stagedSourceFrozen },
84
111
  glass: this.glass.getStats(),
85
112
  ground: this.ground.getStats(),
86
113
  depthBlur: this.depthBlur.getStats(),
87
114
  outline: this.outline.getStats(),
88
115
  actors: [...this.actors.values()].map((actor) => ({
89
116
  spatialElementId: actor.spatialElementId,
117
+ stagedReady: stagedReady(actor),
118
+ projectedCenter: actor.view.getWorldPosition(new THREE.Vector3()).project(actor.pose ? this.carouselCamera : this.camera).toArray(),
90
119
  band: actor.band,
91
120
  clip: actor.clip ? { ...actor.clip } : undefined,
92
121
  opacity: this.exitOpacity * (actor.materials[0]?.material.opacity ?? 0),
@@ -95,7 +124,8 @@ export class CatalogSpatialElementLayer {
95
124
  modelScale: actor.view.scale.x, modelDepth: actor.view.position.z,
96
125
  blur: actor.blur ?? 0,
97
126
  hover: actor.hover,
98
- proximityTilt: { x: actor.rotationX, y: actor.rotationY }
127
+ proximityTilt: { x: actor.rotationX, y: actor.rotationY },
128
+ deviceTilt: { yaw: actor.deviceYaw, pitch: actor.devicePitch, roll: actor.deviceRoll }
99
129
  }))
100
130
  };
101
131
  }
@@ -109,6 +139,9 @@ export class CatalogSpatialElementLayer {
109
139
  // The carousel sits ~2500 units from the lens. A near plane of 1 wastes depth
110
140
  // precision and makes closely spaced CAD surfaces fight after the longer-lens change.
111
141
  carouselCamera = new THREE.PerspectiveCamera(45, 1, 250, 6000);
142
+ carouselUiCamera = new THREE.PerspectiveCamera();
143
+ carouselDeviceCamera = new CarouselDeviceCamera();
144
+ carouselSelection;
112
145
  handoffCamera = new THREE.PerspectiveCamera();
113
146
  actors = new Map();
114
147
  requests = new Set();
@@ -117,8 +150,24 @@ export class CatalogSpatialElementLayer {
117
150
  loadingKeys = new Set();
118
151
  failedKeys = new Set();
119
152
  motion = window.matchMedia('(prefers-reduced-motion: reduce)');
153
+ unsubscribeDeviceYaw;
120
154
  pointer = { x: 0, y: 0, active: false, pressed: false };
155
+ focusVisible = new WeakMap();
156
+ activationFocusFrame = 0;
157
+ activationFocusRequest;
121
158
  handoff;
159
+ stagedPanel;
160
+ stagedPanelOpacity = 1;
161
+ stagedSourceFrozen = false;
162
+ stagedSourceCapture;
163
+ groundPoseSettled = false;
164
+ stagedPreparing = false;
165
+ stagedReadinessBlocked = false;
166
+ stagedWarmRevision = 0;
167
+ stagedWarmups = 0;
168
+ stagedWarmFailures = 0;
169
+ stagedPrepared = new WeakMap();
170
+ stagedWarmFailed = new WeakMap();
122
171
  handoffPoint;
123
172
  generation = 0;
124
173
  disposed = false;
@@ -148,10 +197,14 @@ export class CatalogSpatialElementLayer {
148
197
  pointerDown = (event) => {
149
198
  if (event.pointerType !== 'mouse')
150
199
  this.pointerLeave();
200
+ if (this.pointer.pressed)
201
+ return;
151
202
  this.pointer.pressed = true;
152
203
  this.invalidate();
153
204
  };
154
205
  pointerUp = () => {
206
+ if (!this.pointer.pressed)
207
+ return;
155
208
  this.pointer.pressed = false;
156
209
  this.invalidate();
157
210
  };
@@ -163,12 +216,67 @@ export class CatalogSpatialElementLayer {
163
216
  this.invalidate();
164
217
  };
165
218
  resize = () => {
219
+ this.stagedSourceCapture = undefined;
220
+ this.stagedWarmRevision++;
166
221
  this.layoutDirty = true;
167
222
  this.queueDirty = true;
168
223
  this.invalidate();
169
224
  };
225
+ readFocusVisible(target) {
226
+ if (!target)
227
+ return false;
228
+ const visible = target.matches?.(':focus-visible') ?? false;
229
+ this.focusVisible.set(target, visible);
230
+ return visible;
231
+ }
232
+ cancelActivationFocusRequest() {
233
+ if (this.activationFocusFrame)
234
+ cancelAnimationFrame(this.activationFocusFrame);
235
+ this.activationFocusFrame = 0;
236
+ this.activationFocusRequest = undefined;
237
+ }
238
+ deferActivationFocusRequest() {
239
+ if (this.activationFocusRequest)
240
+ return;
241
+ const request = this.activationFocusRequest = {};
242
+ this.activationFocusFrame = requestAnimationFrame(() => {
243
+ if (this.activationFocusRequest !== request)
244
+ return;
245
+ this.activationFocusRequest = undefined;
246
+ this.activationFocusFrame = 0;
247
+ if (!this.disposed && !this.transitionActive)
248
+ this.invalidate();
249
+ });
250
+ }
251
+ focusChange = (event) => {
252
+ const actor = [...this.actors.values()].find(actor => (actor.pose ? actor.hitTarget : actor.card) === event.target);
253
+ const target = actor && (actor.pose ? actor.hitTarget : actor.card);
254
+ if (!actor || !target)
255
+ return;
256
+ // focusout has already lost :focus-visible. Remember the state actually
257
+ // consumed by the last frame (or preceding focusin), including autofocus.
258
+ const before = this.focusVisible.get(target) ?? false;
259
+ const after = event.type === 'focusin' && (target.matches?.(':focus-visible') ?? false);
260
+ this.focusVisible.set(target, after);
261
+ if (before === after || this.transitionActive || (actor.pose && this.pointer.pressed))
262
+ return;
263
+ // A carousel pointer outline already has the same target value of one.
264
+ // Keep keyboard and genuine hover changes synchronous, without a timer.
265
+ if (actor.pose && this.pointer.active && target.hasAttribute('data-mouse-hover'))
266
+ return;
267
+ // This is only our own programmatic link focus, never Tab/hover/press work.
268
+ // Let Kit's first repaint opportunity stay light; an accepted transition can
269
+ // consume the focus in its first frame. Otherwise request the ordinary next
270
+ // Stage frame, even when the click was vetoed or no router is installed.
271
+ if (isCatalogActivationFocus(event) && actor.pose?.read().front) {
272
+ this.deferActivationFocusRequest();
273
+ return;
274
+ }
275
+ this.invalidate();
276
+ };
170
277
  motionChange = () => this.invalidate();
171
278
  setPageBackground(value) {
279
+ this.stagedSourceCapture = undefined;
172
280
  this.scene.fog.color.set(value);
173
281
  this.invalidate();
174
282
  }
@@ -176,6 +284,10 @@ export class CatalogSpatialElementLayer {
176
284
  this.assets = assets;
177
285
  this.invalidate = invalidate;
178
286
  this.interactionTheme = interactionTheme;
287
+ this.unsubscribeDeviceYaw = subscribeListDeviceYaw(() => {
288
+ if (!this.transitionActive && [...this.actors.values()].some(actor => actor.root.visible && actor.card?.closest('[data-device-orientation]')))
289
+ this.invalidate();
290
+ });
179
291
  this.scene.environmentIntensity = 0.5;
180
292
  this.scene.fog = new THREE.Fog(0xffffff, 1200, 2500);
181
293
  this.handoffScene.fog = this.scene.fog;
@@ -188,8 +300,8 @@ export class CatalogSpatialElementLayer {
188
300
  window.addEventListener('pointerdown', this.pointerDown, { capture: true, passive: true });
189
301
  window.addEventListener('pointerup', this.pointerUp, { passive: true });
190
302
  window.addEventListener('pointercancel', this.pointerUp, { passive: true });
191
- window.addEventListener('focusin', this.motionChange);
192
- window.addEventListener('focusout', this.motionChange);
303
+ window.addEventListener('focusin', this.focusChange);
304
+ window.addEventListener('focusout', this.focusChange);
193
305
  window.addEventListener('pointerleave', this.pointerLeave);
194
306
  window.addEventListener('blur', this.pointerLeave);
195
307
  window.addEventListener('resize', this.resize);
@@ -199,6 +311,8 @@ export class CatalogSpatialElementLayer {
199
311
  async setSpatialElements(brandId, spatialElements) {
200
312
  if (this.disposed)
201
313
  return;
314
+ this.stagedSourceCapture = undefined;
315
+ this.cancelActivationFocusRequest();
202
316
  const generation = ++this.generation;
203
317
  this.layoutObserver.disconnect();
204
318
  const page = document.querySelector('[data-catalog-list]');
@@ -280,6 +394,7 @@ export class CatalogSpatialElementLayer {
280
394
  const actor = this.createActor(key, brandId, spatialElement.id, getSpatialElementScene(spatialElement), instance);
281
395
  actor.occurrence = spatialElement.occurrence;
282
396
  actor.pose = spatialElement.pose;
397
+ this.stagedSourceCapture = undefined;
283
398
  this.actors.set(key, actor);
284
399
  this.scene.add(actor.root);
285
400
  this.layoutDirty = true;
@@ -315,6 +430,10 @@ export class CatalogSpatialElementLayer {
315
430
  this.carouselCamera.aspect = width / height;
316
431
  this.carouselCamera.fov = THREE.MathUtils.radToDeg(2 * Math.atan(height / 5000));
317
432
  this.carouselCamera.updateProjectionMatrix();
433
+ this.carouselUiCamera.copy(this.carouselCamera);
434
+ this.carouselUiCamera.position.set(0, 0, 2500);
435
+ this.carouselUiCamera.quaternion.identity();
436
+ this.carouselUiCamera.updateMatrixWorld(true);
318
437
  this.scene.environment = environment;
319
438
  this.handoffScene.environment = this.handoff?.sourceEnvironment ?? environment;
320
439
  const scroll = getStageVisualScrollPosition();
@@ -328,13 +447,18 @@ export class CatalogSpatialElementLayer {
328
447
  const delta = Math.min(this.lastTime ? (now - this.lastTime) / 1000 : 1 / 60, 0.05);
329
448
  this.lastTime = now;
330
449
  let animating = false;
331
- this.glass.beginFrame();
450
+ const projectCarousels = [];
451
+ let selected;
452
+ if (this.stagedPanel)
453
+ this.glass.retainFrame(this.stagedPanel.card, this.stagedPanel.matrix, this.exitOpacity, this.stagedPanelOpacity);
454
+ else
455
+ this.glass.beginFrame();
332
456
  if (!this.handoff)
333
457
  this.ground.beginFrame();
334
458
  for (const actor of this.actors.values()) {
335
459
  if (this.handoff?.actor === actor)
336
460
  continue;
337
- if (this.handoff) {
461
+ if (this.handoff || this.stagedSourceFrozen) {
338
462
  // The outgoing DOM has been snapshotted. Keep these already-rendered
339
463
  // spatialElements at their captured screen pose until the shared fade completes.
340
464
  actor.root.visible = actor.rendered && actor.root.visible && this.exitOpacity > 0.001;
@@ -367,6 +491,7 @@ export class CatalogSpatialElementLayer {
367
491
  if (!actor.root.visible)
368
492
  continue;
369
493
  if (actor.pose) {
494
+ actor.view.quaternion.copy(actor.viewOrientation);
370
495
  const pose = actor.pose.read();
371
496
  const approach = this.pointer.active && !this.pointer.pressed && !this.transitionActive &&
372
497
  !this.motion.matches && actor.renderRect && pose.visible
@@ -377,9 +502,24 @@ export class CatalogSpatialElementLayer {
377
502
  actor[property] = target;
378
503
  animating ||= actor[property] !== target;
379
504
  }
505
+ // Add the remaining sensor response only to the focus model. The camera keeps 25%.
506
+ const sensorEnabled = pose.front && !this.motion.matches && !this.transitionActive &&
507
+ actor.card.closest('[data-device-orientation]');
508
+ for (const [property, target] of [
509
+ ['deviceYaw', sensorEnabled ? -getListDeviceYaw() * 0.75 : 0],
510
+ ['devicePitch', sensorEnabled ? -getListDevicePitch() * 0.75 : 0],
511
+ ['deviceRoll', sensorEnabled ? -getListDeviceRoll() * 0.75 : 0]
512
+ ]) {
513
+ if (!this.motion.matches && isDeviceOrientationPaused())
514
+ continue;
515
+ actor[property] = this.motion.matches ? 0 : THREE.MathUtils.damp(actor[property], target, 40, delta);
516
+ if (Math.abs(actor[property] - target) < 0.01)
517
+ actor[property] = target;
518
+ animating ||= actor[property] !== target;
519
+ }
380
520
  const hoverTarget = !this.transitionActive && !this.pointer.pressed &&
381
521
  ((this.pointer.active && actor.hitTarget?.hasAttribute('data-mouse-hover')) ||
382
- actor.hitTarget?.matches(':focus-visible')) ? 1 : 0;
522
+ this.readFocusVisible(actor.hitTarget)) ? 1 : 0;
383
523
  actor.hover = this.motion.matches ? hoverTarget : THREE.MathUtils.damp(actor.hover, hoverTarget, 18, delta);
384
524
  if (Math.abs(actor.hover - hoverTarget) < 0.01)
385
525
  actor.hover = hoverTarget;
@@ -390,12 +530,16 @@ export class CatalogSpatialElementLayer {
390
530
  actor.band = pose.front ? 'front' : 'rear';
391
531
  actor.root.visible &&= pose.visible;
392
532
  applyCatalogMaterialOpacity(actor.materials, pose.opacity);
393
- const compact = slot.width < 700;
533
+ const framing = pose.framing;
534
+ const compact = framing?.compact ?? width < 840;
535
+ const frame = framing ? Math.min(framing.fit.width, framing.fit.height) : Math.min(slot.width, compact ? 360 : slot.height);
394
536
  // Every seat shares one scene origin. Depth now determines projected size
395
537
  // and spacing naturally, including scroll parallax and the foreground advance.
396
- const x = slot.left + dx + slot.width * (pose.orbit ? (compact ? 0.5 : 0.31) : pose.x - (compact ? 0 : 0.19));
397
- const y = slot.top + dy + (pose.orbit ? (compact ? 180 : slot.height * 0.54) : slot.height * pose.y);
398
- const perspective = pose.orbit ? 1 : 1 - pose.depth / this.carouselCamera.position.z;
538
+ const anchorX = framing ? framing.fit.x + framing.fit.width / 2 : slot.width * (compact ? 0.5 : 0.31);
539
+ const anchorY = framing ? framing.fit.y + framing.fit.height / 2 : compact ? 180 : slot.height * 0.54;
540
+ const x = slot.left + dx + (pose.orbit ? anchorX : slot.width * (pose.x - (framing || compact ? 0 : 0.19)));
541
+ const y = slot.top + dy + (pose.orbit ? anchorY : slot.height * pose.y);
542
+ const perspective = pose.orbit ? 1 : 1 - pose.depth / 2500;
399
543
  actor.root.matrix.makeTranslation((x - width / 2) * perspective + (pose.orbit?.x ?? 0), (height / 2 - y) * perspective + (pose.orbit?.y ?? 0), pose.depth);
400
544
  actor.root.matrixWorldNeedsUpdate = true;
401
545
  // Geometry follows the seat and pointer; panel projection below excludes pointer tilt.
@@ -407,9 +551,9 @@ export class CatalogSpatialElementLayer {
407
551
  actor.view.position.set(0, compact && !pose.orbit
408
552
  ? (slot.height - 360) * pose.y / (pose.size / 0.82)
409
553
  : 0, 0);
410
- actor.view.scale.setScalar((Math.min(slot.width, compact ? 360 : slot.height) * 0.82) / (actor.radius * 2));
554
+ actor.view.scale.setScalar((frame * 0.82) / (actor.radius * 2));
555
+ let groundMatrix;
411
556
  if (pose.orbit && actor.root.visible) {
412
- const frame = Math.min(slot.width, compact ? 360 : slot.height);
413
557
  const floor = frame * 0.32;
414
558
  const pitch = pose.orbit.pitch;
415
559
  // Stand every model on the same plane, including wide or short assets.
@@ -419,80 +563,87 @@ export class CatalogSpatialElementLayer {
419
563
  const bottom = Math.min(...actor.supportPoints.map(point => point.clone().applyMatrix4(actor.view.matrix).applyMatrix4(upright).y));
420
564
  actor.view.position.y += (-floor - bottom) / upright.elements[5];
421
565
  actor.view.updateMatrix();
422
- const groundMatrix = new THREE.Matrix4().makeTranslation(x - width / 2, height / 2 - y, 0)
566
+ groundMatrix = new THREE.Matrix4().makeTranslation(x - width / 2, height / 2 - y, 0)
423
567
  .multiply(new THREE.Matrix4().makeRotationX(pitch))
424
568
  .multiply(new THREE.Matrix4().makeTranslation(0, -floor, 0));
425
- actor.root.updateMatrixWorld(true);
426
- this.ground.shadow(actor, actor.model, groundMatrix, 0.14 * pose.opacity);
427
569
  }
570
+ // Apply after floor fitting so the model centre and UI anchors remain fixed.
571
+ actor.view.quaternion.setFromEuler(new THREE.Euler(THREE.MathUtils.degToRad(actor.devicePitch), THREE.MathUtils.degToRad(actor.deviceYaw), THREE.MathUtils.degToRad(actor.deviceRoll), 'ZXY'))
572
+ .multiply(actor.viewOrientation);
428
573
  actor.root.updateMatrixWorld(true);
429
- const hitTarget = actor.hitTarget;
430
- if (hitTarget) {
431
- // Project cached model bounds, not the framing sphere: empty foreground
432
- // margins must not intercept clicks on visible neighbouring spatialElements.
433
- let left = Infinity, top = Infinity, right = -Infinity, bottom = -Infinity;
434
- const point = new THREE.Vector3();
435
- for (const corner of actor.hitCorners) {
436
- point.copy(corner).applyMatrix4(actor.view.matrixWorld).project(this.carouselCamera);
437
- const px = ((point.x + 1) * width) / 2 - slot.left - dx;
438
- const py = ((1 - point.y) * height) / 2 - slot.top - dy;
439
- left = Math.min(left, px);
440
- right = Math.max(right, px);
441
- top = Math.min(top, py);
442
- bottom = Math.max(bottom, py);
574
+ if (groundMatrix)
575
+ this.ground.shadow(actor, actor.model, groundMatrix, 0.14 * pose.opacity);
576
+ if (pose.front && actor.root.visible && (!selected || pose.panelOpacity > (selected.pose?.read().panelOpacity ?? 0)))
577
+ selected = actor;
578
+ projectCarousels.push(() => {
579
+ const hitTarget = actor.hitTarget;
580
+ if (hitTarget) {
581
+ // Project cached model bounds, not the framing sphere: empty foreground
582
+ // margins must not intercept clicks on visible neighbouring spatialElements.
583
+ let left = Infinity, top = Infinity, right = -Infinity, bottom = -Infinity;
584
+ const point = new THREE.Vector3();
585
+ for (const corner of actor.hitCorners) {
586
+ point.copy(corner).applyMatrix4(actor.view.matrixWorld).project(this.carouselCamera);
587
+ const px = ((point.x + 1) * width) / 2 - slot.left - dx;
588
+ const py = ((1 - point.y) * height) / 2 - slot.top - dy;
589
+ left = Math.min(left, px);
590
+ right = Math.max(right, px);
591
+ top = Math.min(top, py);
592
+ bottom = Math.max(bottom, py);
593
+ }
594
+ hitTarget.style.left = `${(left + right) / 2}px`;
595
+ hitTarget.style.top = `${(top + bottom) / 2}px`;
596
+ hitTarget.style.width = `${right - left}px`;
597
+ hitTarget.style.height = `${bottom - top}px`;
598
+ hitTarget.style.maxWidth = 'none';
599
+ actor.renderRect = { left: left + slot.left + dx, top: top + slot.top + dy,
600
+ width: right - left, height: bottom - top };
443
601
  }
444
- hitTarget.style.left = `${(left + right) / 2}px`;
445
- hitTarget.style.top = `${(top + bottom) / 2}px`;
446
- hitTarget.style.width = `${right - left}px`;
447
- hitTarget.style.height = `${bottom - top}px`;
448
- hitTarget.style.maxWidth = 'none';
449
- actor.renderRect = { left: left + slot.left + dx, top: top + slot.top + dy,
450
- width: right - left, height: bottom - top };
451
- }
452
- const panel = actor.summaryPanel;
453
- if (panel && actor.summarySize) {
454
- const { width: pw, height: ph } = actor.summarySize;
455
- // The panel follows the seat and its yaw, but not the elevated
456
- // product view. At rest it is parallel to the screen, also on mobile.
457
- const panelFrame = pose.orbit
458
- ? actor.root.matrixWorld.clone().multiply(new THREE.Matrix4().makeRotationY(pose.yaw))
459
- : actor.tilt.matrixWorld.clone();
460
- const matrix = panelFrame
461
- .multiply(new THREE.Matrix4().makeTranslation(compact ? 0 : slot.width * 0.39, compact ? (pose.orbit ? 180 : slot.height / 2) - 360 - ph / 2 : 0, 0));
462
- const corners = [
463
- [-pw / 2, ph / 2],
464
- [pw / 2, ph / 2],
465
- [pw / 2, -ph / 2],
466
- [-pw / 2, -ph / 2]
467
- ].map(([x, y]) => {
468
- const point = new THREE.Vector3(x, y, 0)
469
- .applyMatrix4(matrix)
470
- .project(this.carouselCamera);
471
- return {
472
- x: ((point.x + 1) * width) / 2 - slot.left - dx,
473
- y: ((1 - point.y) * height) / 2 - slot.top - dy
474
- };
475
- });
476
- // The semantic summary keeps its intrinsic layout slot before and after
477
- // enhancement. Project relative to that slot instead of moving it to (0, 0).
478
- const origin = actor.summaryOrigin ?? { x: 0, y: 0 };
479
- const localCorners = corners.map(({ x, y }) => ({
480
- x: x - origin.x, y: y - origin.y
481
- }));
482
- panel.style.transform = getProjectiveCssMatrix3d(localCorners, pw, ph) ?? '';
483
- recordCarouselPanel(panel, corners.map((point) => ({
484
- x: point.x + slot.left + dx,
485
- y: point.y + slot.top + dy
486
- })), pw, ph);
487
- const hidden = actor.card.style.visibility === 'hidden' || panel.style.visibility === 'hidden';
488
- this.glass.panel(actor.card, matrix, pw, ph, hidden ? 0 : pose.panelOpacity * this.exitOpacity, (1 - pose.panelOpacity) * 6);
489
- }
490
- actor.clip = {
491
- left: 0,
492
- top: 0,
493
- width,
494
- height
495
- };
602
+ const panel = actor.summaryPanel;
603
+ if (panel && actor.summarySize) {
604
+ const { width: pw, height: ph } = actor.summarySize;
605
+ // The panel follows the seat and its yaw, but not the elevated
606
+ // product view. At rest it is parallel to the screen, also on mobile.
607
+ const panelFrame = pose.orbit
608
+ ? actor.root.matrixWorld.clone().multiply(new THREE.Matrix4().makeRotationY(pose.yaw))
609
+ : actor.tilt.matrixWorld.clone();
610
+ const matrix = panelFrame
611
+ .multiply(new THREE.Matrix4().makeTranslation(framing ? framing.summary.x + pw / 2 - anchorX : compact ? 0 : slot.width * 0.39, framing ? anchorY - (framing.summary.anchorY - (framing.summary.alignment === 'end' ? ph / 2 : 0)) : compact ? (pose.orbit ? 180 : slot.height / 2) - 360 - ph / 2 : 0, 0));
612
+ const corners = [
613
+ [-pw / 2, ph / 2],
614
+ [pw / 2, ph / 2],
615
+ [pw / 2, -ph / 2],
616
+ [-pw / 2, -ph / 2]
617
+ ].map(([x, y]) => {
618
+ const point = new THREE.Vector3(x, y, 0)
619
+ .applyMatrix4(matrix)
620
+ .project(this.carouselUiCamera);
621
+ return {
622
+ x: ((point.x + 1) * width) / 2 - slot.left - dx,
623
+ y: ((1 - point.y) * height) / 2 - slot.top - dy
624
+ };
625
+ });
626
+ // The semantic summary keeps its intrinsic layout slot before and after
627
+ // enhancement. Project relative to that slot instead of moving it to (0, 0).
628
+ const origin = actor.summaryOrigin ?? { x: 0, y: 0 };
629
+ const localCorners = corners.map(({ x, y }) => ({
630
+ x: x - origin.x, y: y - origin.y
631
+ }));
632
+ panel.style.transform = getProjectiveCssMatrix3d(localCorners, pw, ph) ?? '';
633
+ recordCarouselPanel(panel, corners.map((point) => ({
634
+ x: point.x + slot.left + dx,
635
+ y: point.y + slot.top + dy
636
+ })), pw, ph);
637
+ const hidden = actor.card.style.visibility === 'hidden' || panel.style.visibility === 'hidden';
638
+ this.glass.panel(actor.card, matrix, pw, ph, hidden ? 0 : pose.panelOpacity * this.exitOpacity, (1 - pose.panelOpacity) * 6);
639
+ }
640
+ actor.clip = {
641
+ left: 0,
642
+ top: 0,
643
+ width,
644
+ height
645
+ };
646
+ });
496
647
  if (this.isDestinationActor(actor))
497
648
  actor.root.visible = false;
498
649
  continue;
@@ -513,7 +664,7 @@ export class CatalogSpatialElementLayer {
513
664
  THREE.MathUtils.radToDeg(rotation.y),
514
665
  -influence * 8,
515
666
  !this.motion.matches && !this.transitionActive &&
516
- ((this.pointer.active && distance === 0) || actor.card.matches?.(':focus-visible')) ? 1 : 0
667
+ ((this.pointer.active && distance === 0) || this.readFocusVisible(actor.card)) ? 1 : 0
517
668
  ];
518
669
  const previous = [actor.rotationX, actor.rotationY, actor.lift, actor.hover];
519
670
  const values = previous.map((value, index) => {
@@ -533,19 +684,48 @@ export class CatalogSpatialElementLayer {
533
684
  actor.tilt.position.y = -actor.lift;
534
685
  actor.view.position.set(slot.left + slot.width / 2 - card.left - card.width / 2, card.top + card.height / 2 - slot.top - slot.height / 2, 96 * actor.hover);
535
686
  actor.view.scale.setScalar(actor.cardScale * (1 + 0.12 * actor.hover));
687
+ const deviceEnabled = !this.motion.matches && !this.transitionActive &&
688
+ actor.card.closest('[data-device-orientation]');
689
+ // Sensor motion remains available on hybrids even with a stationary mouse cursor.
690
+ for (const [property, target] of [
691
+ ['deviceYaw', deviceEnabled ? -getListDeviceYaw() : 0],
692
+ ['devicePitch', deviceEnabled ? -getListDevicePitch() : 0],
693
+ ['deviceRoll', deviceEnabled ? -getListDeviceRoll() : 0]
694
+ ]) {
695
+ if (!this.motion.matches && isDeviceOrientationPaused())
696
+ continue;
697
+ actor[property] = this.motion.matches ? 0 : THREE.MathUtils.damp(actor[property], target, 40, delta);
698
+ if (Math.abs(actor[property] - target) < 0.01)
699
+ actor[property] = target;
700
+ animating ||= actor[property] !== target;
701
+ }
702
+ // Rotate around the model's own centre, leaving the panel and copy still.
703
+ actor.view.rotation.set(THREE.MathUtils.degToRad(actor.devicePitch), THREE.MathUtils.degToRad(actor.deviceYaw), THREE.MathUtils.degToRad(actor.deviceRoll), 'ZXY');
704
+ actor.view.quaternion.multiply(actor.viewOrientation);
536
705
  if (this.isDestinationActor(actor))
537
706
  actor.root.visible = false;
538
707
  }
539
- if (this.queueDirty) {
708
+ if (!this.transitionActive && !this.handoff && !this.stagedSourceFrozen) {
709
+ const pivot = selected?.view.getWorldPosition(new THREE.Vector3()) ?? new THREE.Vector3();
710
+ const enabled = selected?.card?.closest('[data-device-orientation]');
711
+ if (this.motion.matches || !isDeviceOrientationPaused())
712
+ animating = this.carouselDeviceCamera.update(this.carouselCamera, enabled ? getListDeviceYaw() : 0, enabled ? getListDevicePitch() : 0, enabled ? getListDeviceRoll() : 0, delta, this.motion.matches) || animating;
713
+ animating = this.carouselDeviceCamera.orbit(this.carouselCamera, pivot, delta, !this.motion.matches && (this.pointer.pressed || this.carouselSelection !== selected)) || animating;
714
+ this.carouselSelection = selected;
715
+ }
716
+ for (const project of projectCarousels)
717
+ project();
718
+ if (this.queueDirty && !this.handoff && !this.stagedSourceFrozen) {
540
719
  this.queueDirty = false;
541
720
  void this.loadVisibleSpatialElements(this.generation);
542
721
  }
543
- this.glass.endFrame();
722
+ this.glass.endFrame(this.stagedPanel?.card);
544
723
  if (!this.handoff)
545
724
  this.ground.endFrame();
725
+ this.groundPoseSettled = !animating;
546
726
  return animating;
547
727
  }
548
- draw(renderer, band) {
728
+ draw(renderer, band, warmOutput) {
549
729
  const width = window.innerWidth, height = window.innerHeight;
550
730
  const all = [...this.actors.values()].filter((actor) => actor.root.visible && this.handoff?.actor !== actor);
551
731
  if (!all.some((actor) => (actor.band ?? 'front') === band)) {
@@ -593,7 +773,7 @@ export class CatalogSpatialElementLayer {
593
773
  actor.root.visible = true;
594
774
  this.depthBlur.render(renderer, this.carouselCamera, actor.renderRect ?? rect, actor.blur ?? 0, (camera) => renderer.render(this.scene, camera), rect);
595
775
  if (actor.hover > 0 && actor.renderRect)
596
- this.outline.render(renderer, this.carouselCamera, actor.model, actor.renderRect, rect, actor.hover * (actor.materials[0]?.material.opacity ?? 1), this.interactionTheme());
776
+ this.outline.render(renderer, this.carouselCamera, actor.model, actor.renderRect, rect, actor.hover * (actor.materials[0]?.material.opacity ?? 1), this.interactionTheme(), warmOutput);
597
777
  actor.root.visible = false;
598
778
  }
599
779
  }
@@ -620,7 +800,7 @@ export class CatalogSpatialElementLayer {
620
800
  actor.card?.setAttribute('data-catalog-model-ready', '');
621
801
  }
622
802
  }
623
- });
803
+ }, warmOutput, this.frozenSourceForBand(band, warmOutput));
624
804
  for (const actor of all)
625
805
  actor.root.visible = true;
626
806
  if (band === 'front' && this.handoff)
@@ -630,20 +810,50 @@ export class CatalogSpatialElementLayer {
630
810
  hasCarousel() {
631
811
  return [...this.actors.values()].some((actor) => Boolean(actor.pose));
632
812
  }
633
- renderRear(renderer) {
634
- this.glass.render(renderer, this.carouselCamera, () => {
635
- this.ground.draw(renderer, this.carouselCamera, this.exitOpacity);
636
- this.draw(renderer, 'rear');
637
- });
813
+ /** A retained glass panel outlives its source actors during staged reveal. */
814
+ hasRearOutput() {
815
+ return this.glass.hasActivePanels() || (this.exitOpacity > 0 && this.hasCarousel());
816
+ }
817
+ renderRear(renderer, warmOutput) {
818
+ this.glass.render(renderer, this.carouselUiCamera, () => {
819
+ // The full per-shadow signature is valid during normal focus/hover frames too;
820
+ // any changed source/camera pose falls back to live rendering immediately.
821
+ this.ground.draw(renderer, this.carouselCamera, this.exitOpacity, true, this.stagedSignature(renderer), this.stagedPreparing, warmOutput);
822
+ this.draw(renderer, 'rear', warmOutput);
823
+ }, this.exitOpacity === 0);
638
824
  }
639
825
  /** Warm the existing Low material passes in an offscreen preparation target. */
640
826
  renderForPreparation(renderer) {
641
- this.geometryFade.render(renderer, 0.5, () => renderer.render(this.scene, this.camera));
827
+ const visible = [...this.actors.values()].filter(actor => actor.root.visible);
828
+ this.geometryFade.render(renderer, 0.5, () => {
829
+ const fog = this.scene.fog;
830
+ try {
831
+ // Three shares a mesh/material/context owner across cameras. Rendering a
832
+ // Carousel mesh with List fog replaces its live no-fog owner and bindings.
833
+ for (const actor of visible)
834
+ actor.root.visible = !actor.pose;
835
+ if (visible.some(actor => !actor.pose))
836
+ renderer.render(this.scene, this.camera);
837
+ for (const actor of visible)
838
+ actor.root.visible = Boolean(actor.pose);
839
+ if (visible.some(actor => actor.pose)) {
840
+ this.scene.fog = null;
841
+ renderer.render(this.scene, this.carouselCamera);
842
+ }
843
+ }
844
+ finally {
845
+ this.scene.fog = fog;
846
+ for (const actor of visible)
847
+ actor.root.visible = true;
848
+ }
849
+ });
642
850
  }
643
851
  /** Applies only to outgoing list actors; the shared handoff geometry keeps its authored alpha. */
644
852
  setExitOpacity(opacity, active = false) {
645
853
  this.exitOpacity = Number.isFinite(opacity) ? Math.min(1, Math.max(0, opacity)) : 0;
646
854
  this.transitionActive = active;
855
+ if (active)
856
+ this.cancelActivationFocusRequest();
647
857
  this.invalidate();
648
858
  }
649
859
  capture(spatialElementId, occurrence) {
@@ -654,6 +864,7 @@ export class CatalogSpatialElementLayer {
654
864
  : !item.occurrence || item.card?.hasAttribute('data-catalog-selected')));
655
865
  if (!actor?.rendered || !actor.root.visible)
656
866
  return false;
867
+ this.stagedSourceCapture = undefined;
657
868
  this.finishHandoff();
658
869
  this.handoffPoint = undefined;
659
870
  actor.model.updateWorldMatrix(true, true);
@@ -680,6 +891,209 @@ export class CatalogSpatialElementLayer {
680
891
  this.invalidate();
681
892
  return true;
682
893
  }
894
+ /** Computes the known detail endpoint from an already prepared Low actor, before any route mounts. */
895
+ getStagedDetailTarget(spatialElementId, occurrence, fit, viewport, target, coordinateSystem = THREE.WebGPUCoordinateSystem) {
896
+ const actor = [...this.actors.values()].find(item => item.spatialElementId === spatialElementId &&
897
+ this.desired.has(item.key) && (occurrence ? item.occurrence === occurrence :
898
+ !item.occurrence || item.card?.hasAttribute('data-catalog-selected')));
899
+ if (!actor?.rendered || !actor.root.visible)
900
+ return;
901
+ if (target && resolveDetailLayout(target.layout).dock) {
902
+ return createStagedDockGeometry({ layout: target.layout, viewport,
903
+ lowBounds: actor.detailLowBounds, lowBoundsPoints: actor.detailLowBoundsPoints, modelMatrix: actor.detailFrame,
904
+ center: actor.detailBounds.getCenter(new THREE.Vector3()),
905
+ camera: actor.stage.camera ?? {}, minimap: target.minimap, coordinateSystem });
906
+ }
907
+ return createStagedDetailGeometry(actor.detailBounds, actor.detailFrame, actor.stage.camera ?? {}, viewport, fit, coordinateSystem);
908
+ }
909
+ stagedSignature(renderer, warmOutput) {
910
+ const size = renderer.getDrawingBufferSize(new THREE.Vector2());
911
+ return `${this.stagedWarmRevision}:${innerWidth}:${innerHeight}:${size.x}:${size.y}:${renderer.coordinateSystem}:${this.scene.environment?.uuid ?? ''}${warmOutput ? `:${warmOutput.profileKey}` : ''}`;
912
+ }
913
+ stagedCandidates(renderer, warmOutput) {
914
+ const signature = this.stagedSignature(renderer, warmOutput);
915
+ return [...this.actors.values()].filter(actor => actor.rendered && actor.root.visible &&
916
+ this.stagedMaterialReady(actor) &&
917
+ this.stagedPrepared.get(actor) !== signature && this.stagedWarmFailed.get(actor) !== signature);
918
+ }
919
+ stagedMaterialReady(actor) {
920
+ // Capture restores authored opacity. A still-fading carousel seat would
921
+ // otherwise change transparent/depth-write pipeline variants at the click.
922
+ return actor.materials.every(({ material, transparent, depthWrite }) => material.transparent === transparent && material.depthWrite === depthWrite);
923
+ }
924
+ needsStagedPreparation(renderer, warmOutput) {
925
+ return (!warmOutput || warmOutput.isCurrent(renderer)) && !this.disposed && !this.stagedPreparing && !this.handoff && !this.stagedSourceFrozen &&
926
+ (this.stagedCandidates(renderer, warmOutput).length > 0 || (this.groundPoseSettled &&
927
+ this.ground.needsCachePreparation(this.carouselCamera, this.stagedSignature(renderer))));
928
+ }
929
+ isStagedDetailReady(spatialElementId, occurrence, renderer, warmOutput) {
930
+ const actor = [...this.actors.values()].find(item => item.spatialElementId === spatialElementId &&
931
+ this.desired.has(item.key) && (occurrence ? item.occurrence === occurrence :
932
+ !item.occurrence || item.card?.hasAttribute('data-catalog-selected')));
933
+ return Boolean((!warmOutput || warmOutput.isCurrent(renderer)) && !this.stagedReadinessBlocked && actor?.rendered && actor.root.visible && this.stagedMaterialReady(actor) &&
934
+ this.stagedPrepared.get(actor) === this.stagedSignature(renderer, warmOutput));
935
+ }
936
+ /** Idle-only: warm the exact existing Low fade and handoff passes before a click can claim them. */
937
+ async prepareStagedNavigation(renderer, warmOutput) {
938
+ if (!this.needsStagedPreparation(renderer, warmOutput))
939
+ return;
940
+ const actors = this.stagedCandidates(renderer, warmOutput), signature = this.stagedSignature(renderer, warmOutput);
941
+ // Ground pixels are independent of the outer composite profile. Preserve their live-draw key.
942
+ const groundSignature = this.stagedSignature(renderer);
943
+ const warmRear = actors.some(actor => Boolean(actor.pose)) || (this.groundPoseSettled &&
944
+ this.ground.needsCachePreparation(this.carouselCamera, groundSignature));
945
+ this.stagedPreparing = true;
946
+ this.stagedReadinessBlocked = true;
947
+ const fog = this.scene.fog, environment = this.handoffScene.environment, handoffFog = this.handoffScene.fog;
948
+ const exitOpacity = this.exitOpacity;
949
+ const outlines = actors.filter(actor => actor.pose && actor.clip && actor.renderRect);
950
+ const hover = outlines.map(actor => actor.hover);
951
+ const handoffCamera = this.handoffCamera.clone();
952
+ try {
953
+ try {
954
+ const draw = () => withRendererState(renderer, () => {
955
+ // The default keeps the real Canvas output variant. An opt-in scratch
956
+ // context retains Canvas-semantic owners without drawing to a Canvas.
957
+ renderer.setRenderTarget(warmOutput?.target ?? null);
958
+ renderer.setScissor(0, 0, 0, 0);
959
+ renderer.setScissorTest(true);
960
+ // Exercise the actual output bands. A glass carousel renders its rear
961
+ // actors into an RGBA8 backdrop before compositing, and defocused seats
962
+ // use additional resolve passes. A direct scene render misses those
963
+ // target/pipeline variants despite compiling the same model shaders.
964
+ this.exitOpacity = 0.5;
965
+ // Focus fires before Kit's beforeNavigate callback. Prepare its first
966
+ // outline while idle so that pre-navigation frame cannot compile it.
967
+ for (const actor of outlines)
968
+ actor.hover = Math.max(actor.hover, 0.5);
969
+ if (warmRear) {
970
+ if (this.groundPoseSettled)
971
+ this.ground.prepareCaches(renderer, this.carouselCamera, groundSignature);
972
+ this.renderRear(renderer, warmOutput);
973
+ this.ground.prepareWindingVariants(renderer, this.carouselCamera);
974
+ }
975
+ this.draw(renderer, 'front', warmOutput);
976
+ // The fade pass warms offscreen output. The ordinary focused source
977
+ // needs the Canvas variant too, without submitting visible pixels.
978
+ for (const actor of outlines) {
979
+ renderer.setRenderTarget(warmOutput?.target ?? null);
980
+ renderer.setScissor(0, 0, 0, 0);
981
+ renderer.setScissorTest(true);
982
+ this.outline.render(renderer, this.carouselCamera, actor.model, actor.renderRect, actor.clip, 0.5, this.interactionTheme(), warmOutput);
983
+ }
984
+ this.handoffScene.environment = this.scene.environment;
985
+ for (const actor of actors) {
986
+ const model = actor.model, parent = model.parent;
987
+ const matrix = model.matrix.clone(), auto = model.matrixAutoUpdate;
988
+ model.updateWorldMatrix(true, true);
989
+ const world = model.matrixWorld.clone();
990
+ try {
991
+ this.handoffScene.fog = actor.pose ? null : fog;
992
+ this.handoffCamera.copy(actor.pose ? this.carouselCamera : this.camera);
993
+ this.handoffCamera.coordinateSystem = renderer.coordinateSystem;
994
+ this.handoffCamera.updateProjectionMatrix();
995
+ this.handoffScene.add(model);
996
+ model.matrixAutoUpdate = false;
997
+ model.matrix.copy(world);
998
+ model.matrixWorldNeedsUpdate = true;
999
+ renderer.render(this.handoffScene, this.handoffCamera);
1000
+ }
1001
+ finally {
1002
+ if (parent)
1003
+ parent.add(model);
1004
+ else
1005
+ model.removeFromParent();
1006
+ model.matrixAutoUpdate = auto;
1007
+ model.matrix.copy(matrix);
1008
+ model.matrixWorldNeedsUpdate = true;
1009
+ }
1010
+ }
1011
+ });
1012
+ if (warmOutput)
1013
+ warmOutput.borrow(renderer, draw);
1014
+ else
1015
+ draw();
1016
+ }
1017
+ finally {
1018
+ // Restore borrowed scene state before yielding to GPU completion; a
1019
+ // normal render or fallback navigation can run while that wait is pending.
1020
+ this.exitOpacity = exitOpacity;
1021
+ outlines.forEach((actor, index) => { actor.hover = hover[index]; });
1022
+ this.scene.fog = fog;
1023
+ this.handoffScene.environment = environment;
1024
+ this.handoffScene.fog = handoffFog;
1025
+ this.handoffCamera.copy(handoffCamera);
1026
+ // Optional shadow pixels must not revoke already fenced actor readiness.
1027
+ // Keep preparation serialized, but unblock only after every borrowed
1028
+ // render/scene value is restored. New actor passes still await the fence.
1029
+ if (!actors.length)
1030
+ this.stagedReadinessBlocked = false;
1031
+ }
1032
+ const device = renderer.backend.device;
1033
+ await device?.queue.onSubmittedWorkDone();
1034
+ if ((!warmOutput || warmOutput.isCurrent(renderer)) && !this.disposed && !this.handoff && !this.stagedSourceFrozen && signature === this.stagedSignature(renderer, warmOutput)) {
1035
+ this.stagedWarmups++;
1036
+ for (const actor of actors)
1037
+ if (this.actors.get(actor.key) === actor)
1038
+ this.stagedPrepared.set(actor, signature);
1039
+ }
1040
+ }
1041
+ catch (error) {
1042
+ this.stagedWarmFailures++;
1043
+ for (const actor of actors)
1044
+ this.stagedWarmFailed.set(actor, signature);
1045
+ throw error;
1046
+ }
1047
+ finally {
1048
+ this.stagedPreparing = false;
1049
+ this.stagedReadinessBlocked = false;
1050
+ }
1051
+ }
1052
+ freezeStagedSource() {
1053
+ this.stagedSourceFrozen = true;
1054
+ this.stagedSourceCapture = { front: {}, rear: {} };
1055
+ }
1056
+ frozenSourceForBand(band, warmOutput) {
1057
+ const capture = this.stagedSourceCapture;
1058
+ if (!this.stagedSourceFrozen || !capture || this.stagedPreparing || warmOutput)
1059
+ return;
1060
+ // Frozen actors keep their pose, but projection, HDR or outline settings can
1061
+ // still change through the stage. Any such change ends reuse for this freeze.
1062
+ const fog = this.scene.fog;
1063
+ const signature = JSON.stringify([window.innerWidth, window.innerHeight,
1064
+ this.scene.environment?.uuid, this.scene.environment?.version, this.scene.environmentIntensity,
1065
+ fog?.color.getHex(), fog?.near, fog?.far, this.interactionTheme()]);
1066
+ if (capture.signature !== undefined && capture.signature !== signature) {
1067
+ this.stagedSourceCapture = undefined;
1068
+ return;
1069
+ }
1070
+ capture.signature = signature;
1071
+ return capture[band];
1072
+ }
1073
+ /** Move the existing glass mesh with the actual DOM quad, without resizing its resources. */
1074
+ setStagedPanel(card, corners, width, height) {
1075
+ if (card.dataset.carouselSurface !== 'glass')
1076
+ return true;
1077
+ if (!this.glass.hasPanel(card))
1078
+ return false;
1079
+ const matrix = sourceDomProjectiveMatrix(corners, width, height);
1080
+ if (!matrix)
1081
+ return false;
1082
+ const screenToWorld = new THREE.Matrix4().makeTranslation(-innerWidth / 2, innerHeight / 2, 0)
1083
+ .multiply(new THREE.Matrix4().makeScale(1, -1, 1));
1084
+ const planeToLocal = new THREE.Matrix4().makeTranslation(width / 2, height / 2, 0)
1085
+ .multiply(new THREE.Matrix4().makeScale(1, -1, 1));
1086
+ this.stagedPanel = { card, matrix: screenToWorld.multiply(new THREE.Matrix4().fromArray(matrix)).multiply(planeToLocal) };
1087
+ return true;
1088
+ }
1089
+ setStagedPanelOpacity(opacity) { this.stagedPanelOpacity = THREE.MathUtils.clamp(opacity, 0, 1); this.invalidate(); }
1090
+ finishStagedPanel() {
1091
+ this.stagedPanel = undefined;
1092
+ this.stagedSourceFrozen = false;
1093
+ this.stagedSourceCapture = undefined;
1094
+ this.stagedPanelOpacity = 1;
1095
+ this.invalidate();
1096
+ }
683
1097
  /** Last submitted geometry position; diagnostics never advance animation or read DOM layout. */
684
1098
  setDestinationSpatialElement(spatialElementId) {
685
1099
  this.destinationSpatialElement = spatialElementId;
@@ -733,6 +1147,7 @@ export class CatalogSpatialElementLayer {
733
1147
  const handoff = this.handoff;
734
1148
  if (!handoff)
735
1149
  return;
1150
+ this.stagedSourceCapture = undefined;
736
1151
  const actor = handoff.actor;
737
1152
  const model = actor.model;
738
1153
  model.updateWorldMatrix(true, true);
@@ -759,18 +1174,39 @@ export class CatalogSpatialElementLayer {
759
1174
  this.actors.delete(actor.key);
760
1175
  this.detachedInstances++;
761
1176
  let released = false;
1177
+ const release = () => {
1178
+ if (released)
1179
+ return;
1180
+ released = true;
1181
+ this.detachedInstances--;
1182
+ this.disposeActor(actor);
1183
+ };
762
1184
  return {
763
1185
  model,
764
1186
  projection,
765
1187
  referencePoint: actor.referencePoint.clone(),
766
1188
  environment: handoff.sourceEnvironment,
767
1189
  highEnvironment: handoff.highEnvironment,
768
- release: () => {
769
- if (!released) {
770
- released = true;
771
- this.detachedInstances--;
772
- this.disposeActor(actor);
1190
+ release,
1191
+ /** A pre-commit cancellation returns the same prepared instance to its live source. */
1192
+ restore: () => {
1193
+ if (released)
1194
+ return false;
1195
+ if (this.disposed || !this.desired.has(actor.key) || !actor.slot?.isConnected) {
1196
+ release();
1197
+ return false;
773
1198
  }
1199
+ released = true;
1200
+ this.detachedInstances--;
1201
+ this.stagedSourceCapture = undefined;
1202
+ actor.model.matrixAutoUpdate = true;
1203
+ actor.model.updateMatrix();
1204
+ actor.view.add(actor.model);
1205
+ this.scene.add(actor.root);
1206
+ this.actors.set(actor.key, actor);
1207
+ this.layoutDirty = true;
1208
+ this.invalidate();
1209
+ return true;
774
1210
  }
775
1211
  };
776
1212
  }
@@ -793,6 +1229,7 @@ export class CatalogSpatialElementLayer {
793
1229
  const handoff = this.handoff;
794
1230
  if (!handoff)
795
1231
  return;
1232
+ this.stagedSourceCapture = undefined;
796
1233
  this.handoff = undefined;
797
1234
  const actor = handoff.actor;
798
1235
  applyCatalogMaterialOpacity(actor.materials, 1);
@@ -818,6 +1255,8 @@ export class CatalogSpatialElementLayer {
818
1255
  applyCatalogMaterialOpacity(this.handoff.actor.materials, opacity);
819
1256
  }
820
1257
  dispose() {
1258
+ this.stagedSourceCapture = undefined;
1259
+ this.cancelActivationFocusRequest();
821
1260
  this.ground.dispose();
822
1261
  this.glass.dispose();
823
1262
  this.depthBlur.dispose();
@@ -826,6 +1265,7 @@ export class CatalogSpatialElementLayer {
826
1265
  if (this.disposed)
827
1266
  return;
828
1267
  this.disposed = true;
1268
+ this.unsubscribeDeviceYaw();
829
1269
  this.generation += 1;
830
1270
  for (const request of this.requests)
831
1271
  request.abort();
@@ -837,8 +1277,8 @@ export class CatalogSpatialElementLayer {
837
1277
  window.removeEventListener('pointerdown', this.pointerDown, true);
838
1278
  window.removeEventListener('pointerup', this.pointerUp);
839
1279
  window.removeEventListener('pointercancel', this.pointerUp);
840
- window.removeEventListener('focusin', this.motionChange);
841
- window.removeEventListener('focusout', this.motionChange);
1280
+ window.removeEventListener('focusin', this.focusChange);
1281
+ window.removeEventListener('focusout', this.focusChange);
842
1282
  window.removeEventListener('pointerleave', this.pointerLeave);
843
1283
  window.removeEventListener('blur', this.pointerLeave);
844
1284
  window.removeEventListener('resize', this.resize);
@@ -885,6 +1325,8 @@ export class CatalogSpatialElementLayer {
885
1325
  material.dispose();
886
1326
  throw new Error('Catalog asset contains no spatialElement geometry');
887
1327
  }
1328
+ const detailLowBounds = getMeshBounds(model, (mesh) => !excluded.has(mesh.name));
1329
+ const detailLowBoundsPoints = getMeshBoundsPoints(model, (mesh) => !excluded.has(mesh.name));
888
1330
  const radius = Math.max(bounds.getBoundingSphere(new THREE.Sphere()).radius, 0.001);
889
1331
  const root = new THREE.Group();
890
1332
  root.matrixAutoUpdate = false;
@@ -905,9 +1347,14 @@ export class CatalogSpatialElementLayer {
905
1347
  stage,
906
1348
  instance,
907
1349
  model,
1350
+ detailFrame: model.matrix.clone(),
1351
+ detailBounds: bounds.clone(),
1352
+ detailLowBounds,
1353
+ detailLowBoundsPoints,
908
1354
  root,
909
1355
  tilt,
910
1356
  view,
1357
+ viewOrientation: view.quaternion.clone(),
911
1358
  radius,
912
1359
  hitCorners,
913
1360
  fitCorners: hitCorners.map((corner) => corner.clone().applyQuaternion(view.quaternion)),
@@ -921,12 +1368,15 @@ export class CatalogSpatialElementLayer {
921
1368
  scrollY: 0,
922
1369
  rotationX: 0,
923
1370
  rotationY: 0,
1371
+ deviceYaw: 0,
1372
+ devicePitch: 0,
1373
+ deviceRoll: 0,
924
1374
  lift: 0,
925
1375
  rendered: false
926
1376
  };
927
1377
  }
928
1378
  measureActors(scrollX, scrollY) {
929
- if (this.handoff)
1379
+ if (this.handoff || this.stagedSourceFrozen)
930
1380
  return;
931
1381
  const measured = [];
932
1382
  for (const actor of this.actors.values()) {
@@ -1043,6 +1493,7 @@ export class CatalogSpatialElementLayer {
1043
1493
  };
1044
1494
  }
1045
1495
  disposeActor(actor) {
1496
+ this.stagedSourceCapture = undefined;
1046
1497
  this.outline.release(actor.model);
1047
1498
  if (actor.summaryPanel)
1048
1499
  this.layoutObserver.unobserve(actor.summaryPanel);