@spatial-elements/core 0.1.0-beta.1 → 1.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -9
- package/dist/catalog/CarouselDeviceCamera.d.ts +20 -0
- package/dist/catalog/CarouselDeviceCamera.d.ts.map +1 -0
- package/dist/catalog/CarouselDeviceCamera.js +58 -0
- package/dist/catalog/CarouselDeviceCamera.js.map +1 -0
- package/dist/catalog/CarouselGlassCompositor.d.ts +14 -3
- package/dist/catalog/CarouselGlassCompositor.d.ts.map +1 -1
- package/dist/catalog/CarouselGlassCompositor.js +164 -28
- package/dist/catalog/CarouselGlassCompositor.js.map +1 -1
- package/dist/catalog/CarouselGround.d.ts +43 -0
- package/dist/catalog/CarouselGround.d.ts.map +1 -0
- package/dist/catalog/CarouselGround.js +270 -0
- package/dist/catalog/CarouselGround.js.map +1 -0
- package/dist/catalog/CarouselSectionSurfaces.d.ts +10 -0
- package/dist/catalog/CarouselSectionSurfaces.d.ts.map +1 -0
- package/dist/catalog/CarouselSectionSurfaces.js +55 -0
- package/dist/catalog/CarouselSectionSurfaces.js.map +1 -0
- package/dist/catalog/CatalogDepthBlur.d.ts +45 -0
- package/dist/catalog/CatalogDepthBlur.d.ts.map +1 -0
- package/dist/catalog/CatalogDepthBlur.js +190 -0
- package/dist/catalog/CatalogDepthBlur.js.map +1 -0
- package/dist/catalog/CatalogEndpointRegistry.d.ts +2 -0
- package/dist/catalog/CatalogEndpointRegistry.d.ts.map +1 -1
- package/dist/catalog/CatalogEndpointRegistry.js +2 -0
- package/dist/catalog/CatalogEndpointRegistry.js.map +1 -1
- package/dist/catalog/CatalogGeometryFade.d.ts +5 -1
- package/dist/catalog/CatalogGeometryFade.d.ts.map +1 -1
- package/dist/catalog/CatalogGeometryFade.js +45 -9
- package/dist/catalog/CatalogGeometryFade.js.map +1 -1
- package/dist/catalog/CatalogModelOutline.d.ts +33 -0
- package/dist/catalog/CatalogModelOutline.d.ts.map +1 -0
- package/dist/catalog/CatalogModelOutline.js +143 -0
- package/dist/catalog/CatalogModelOutline.js.map +1 -0
- package/dist/catalog/CatalogNavigationRegistry.d.ts +44 -0
- package/dist/catalog/CatalogNavigationRegistry.d.ts.map +1 -0
- package/dist/catalog/CatalogNavigationRegistry.js +66 -0
- package/dist/catalog/CatalogNavigationRegistry.js.map +1 -0
- package/dist/catalog/CatalogPreparation.d.ts +3 -3
- package/dist/catalog/CatalogPreparation.d.ts.map +1 -1
- package/dist/catalog/CatalogPreparation.js +10 -7
- package/dist/catalog/CatalogPreparation.js.map +1 -1
- package/dist/catalog/CatalogSpatialElementLayer.d.ts +175 -5
- package/dist/catalog/CatalogSpatialElementLayer.d.ts.map +1 -1
- package/dist/catalog/CatalogSpatialElementLayer.js +739 -121
- package/dist/catalog/CatalogSpatialElementLayer.js.map +1 -1
- package/dist/catalog/CatalogTransition.d.ts +4 -2
- package/dist/catalog/CatalogTransition.d.ts.map +1 -1
- package/dist/catalog/CatalogTransition.js +206 -90
- package/dist/catalog/CatalogTransition.js.map +1 -1
- package/dist/catalog/CatalogWarmOutputContext.d.ts +39 -0
- package/dist/catalog/CatalogWarmOutputContext.d.ts.map +1 -0
- package/dist/catalog/CatalogWarmOutputContext.js +159 -0
- package/dist/catalog/CatalogWarmOutputContext.js.map +1 -0
- package/dist/catalog/EarlyNavigationCoordinator.d.ts +35 -0
- package/dist/catalog/EarlyNavigationCoordinator.d.ts.map +1 -0
- package/dist/catalog/EarlyNavigationCoordinator.js +103 -0
- package/dist/catalog/EarlyNavigationCoordinator.js.map +1 -0
- package/dist/catalog/NavigationFeedback.d.ts +12 -0
- package/dist/catalog/NavigationFeedback.d.ts.map +1 -0
- package/dist/catalog/NavigationFeedback.js +40 -0
- package/dist/catalog/NavigationFeedback.js.map +1 -0
- package/dist/catalog/PreparationGate.d.ts +4 -0
- package/dist/catalog/PreparationGate.d.ts.map +1 -1
- package/dist/catalog/PreparationGate.js +1 -0
- package/dist/catalog/PreparationGate.js.map +1 -1
- package/dist/catalog/SourceDomClipping.d.ts +8 -0
- package/dist/catalog/SourceDomClipping.d.ts.map +1 -0
- package/dist/catalog/SourceDomClipping.js +74 -0
- package/dist/catalog/SourceDomClipping.js.map +1 -0
- package/dist/catalog/SourceDomMotion.d.ts +28 -0
- package/dist/catalog/SourceDomMotion.d.ts.map +1 -0
- package/dist/catalog/SourceDomMotion.js +111 -0
- package/dist/catalog/SourceDomMotion.js.map +1 -0
- package/dist/catalog/SpatialGeometryCapture.d.ts +9 -0
- package/dist/catalog/SpatialGeometryCapture.d.ts.map +1 -1
- package/dist/catalog/SpatialGeometryCapture.js +11 -1
- package/dist/catalog/SpatialGeometryCapture.js.map +1 -1
- package/dist/catalog/SpatialPageRegistry.d.ts +18 -0
- package/dist/catalog/SpatialPageRegistry.d.ts.map +1 -0
- package/dist/catalog/SpatialPageRegistry.js +21 -0
- package/dist/catalog/SpatialPageRegistry.js.map +1 -0
- package/dist/catalog/StagedCatalogTransition.d.ts +74 -0
- package/dist/catalog/StagedCatalogTransition.d.ts.map +1 -0
- package/dist/catalog/StagedCatalogTransition.js +270 -0
- package/dist/catalog/StagedCatalogTransition.js.map +1 -0
- package/dist/catalog/cardModelFit.d.ts +7 -0
- package/dist/catalog/cardModelFit.d.ts.map +1 -0
- package/dist/catalog/cardModelFit.js +16 -0
- package/dist/catalog/cardModelFit.js.map +1 -0
- package/dist/catalog/cardProjection.d.ts +39 -0
- package/dist/catalog/cardProjection.d.ts.map +1 -0
- package/dist/catalog/cardProjection.js +110 -0
- package/dist/catalog/cardProjection.js.map +1 -0
- package/dist/catalog/carouselMotion.d.ts +74 -0
- package/dist/catalog/carouselMotion.d.ts.map +1 -0
- package/dist/catalog/carouselMotion.js +185 -0
- package/dist/catalog/carouselMotion.js.map +1 -0
- package/dist/catalog/carouselPanelProjection.d.ts.map +1 -1
- package/dist/catalog/carouselPanelProjection.js +48 -11
- package/dist/catalog/carouselPanelProjection.js.map +1 -1
- package/dist/catalog/carouselProximity.d.ts +11 -0
- package/dist/catalog/carouselProximity.d.ts.map +1 -0
- package/dist/catalog/carouselProximity.js +13 -0
- package/dist/catalog/carouselProximity.js.map +1 -0
- package/dist/catalog/carouselSupport.d.ts +4 -0
- package/dist/catalog/carouselSupport.d.ts.map +1 -0
- package/dist/catalog/carouselSupport.js +30 -0
- package/dist/catalog/carouselSupport.js.map +1 -0
- package/dist/catalog/catalogActivationFocus.d.ts +5 -0
- package/dist/catalog/catalogActivationFocus.d.ts.map +1 -0
- package/dist/catalog/catalogActivationFocus.js +39 -0
- package/dist/catalog/catalogActivationFocus.js.map +1 -0
- package/dist/catalog/catalogDomSnapshot.d.ts +18 -0
- package/dist/catalog/catalogDomSnapshot.d.ts.map +1 -0
- package/dist/catalog/catalogDomSnapshot.js +51 -0
- package/dist/catalog/catalogDomSnapshot.js.map +1 -0
- package/dist/catalog/catalogJourney.d.ts +4 -1
- package/dist/catalog/catalogJourney.d.ts.map +1 -1
- package/dist/catalog/catalogJourney.js +7 -15
- package/dist/catalog/catalogJourney.js.map +1 -1
- package/dist/catalog/catalogPage.d.ts +7 -3
- package/dist/catalog/catalogPage.d.ts.map +1 -1
- package/dist/catalog/catalogPage.js.map +1 -1
- package/dist/catalog/catalogPose.d.ts +54 -6
- package/dist/catalog/catalogPose.d.ts.map +1 -1
- package/dist/catalog/catalogPose.js +100 -23
- package/dist/catalog/catalogPose.js.map +1 -1
- package/dist/catalog/catalogRecipes.d.ts +3 -2
- package/dist/catalog/catalogRecipes.d.ts.map +1 -1
- package/dist/catalog/catalogRecipes.js +10 -25
- package/dist/catalog/catalogRecipes.js.map +1 -1
- package/dist/catalog/catalogTransitionViewport.d.ts +9 -0
- package/dist/catalog/catalogTransitionViewport.d.ts.map +1 -0
- package/dist/catalog/catalogTransitionViewport.js +13 -0
- package/dist/catalog/catalogTransitionViewport.js.map +1 -0
- package/dist/catalog/catalogViewLink.d.ts +2 -0
- package/dist/catalog/catalogViewLink.d.ts.map +1 -1
- package/dist/catalog/catalogViewLink.js +10 -2
- package/dist/catalog/catalogViewLink.js.map +1 -1
- package/dist/catalog/deviceYaw.d.ts +21 -0
- package/dist/catalog/deviceYaw.d.ts.map +1 -0
- package/dist/catalog/deviceYaw.js +87 -0
- package/dist/catalog/deviceYaw.js.map +1 -0
- package/dist/catalog/listDeviceOrientation.d.ts +17 -0
- package/dist/catalog/listDeviceOrientation.d.ts.map +1 -0
- package/dist/catalog/listDeviceOrientation.js +262 -0
- package/dist/catalog/listDeviceOrientation.js.map +1 -0
- package/dist/catalog/spatialElementAssets.d.ts +5 -5
- package/dist/catalog/spatialElementAssets.d.ts.map +1 -1
- package/dist/catalog/spatialElementAssets.js.map +1 -1
- package/dist/catalog/spatialElementLodPair.d.ts +2 -1
- package/dist/catalog/spatialElementLodPair.d.ts.map +1 -1
- package/dist/catalog/spatialElementLodPair.js.map +1 -1
- package/dist/catalog/stagedDetailGeometry.d.ts +37 -0
- package/dist/catalog/stagedDetailGeometry.d.ts.map +1 -0
- package/dist/catalog/stagedDetailGeometry.js +55 -0
- package/dist/catalog/stagedDetailGeometry.js.map +1 -0
- package/dist/catalog/stagedDockGeometry.d.ts +66 -0
- package/dist/catalog/stagedDockGeometry.d.ts.map +1 -0
- package/dist/catalog/stagedDockGeometry.js +66 -0
- package/dist/catalog/stagedDockGeometry.js.map +1 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/spatial-element/ResponsiveViewportMetrics.d.ts +18 -0
- package/dist/spatial-element/ResponsiveViewportMetrics.d.ts.map +1 -0
- package/dist/spatial-element/ResponsiveViewportMetrics.js +68 -0
- package/dist/spatial-element/ResponsiveViewportMetrics.js.map +1 -0
- package/dist/spatial-element/SectionSurfaceRegistry.d.ts +2 -0
- package/dist/spatial-element/SectionSurfaceRegistry.d.ts.map +1 -0
- package/dist/spatial-element/SectionSurfaceRegistry.js +2 -0
- package/dist/spatial-element/SectionSurfaceRegistry.js.map +1 -0
- package/dist/spatial-element/SpatialElementDockController.d.ts +22 -10
- package/dist/spatial-element/SpatialElementDockController.d.ts.map +1 -1
- package/dist/spatial-element/SpatialElementDockController.js +228 -96
- package/dist/spatial-element/SpatialElementDockController.js.map +1 -1
- package/dist/spatial-element/SpatialElementPaneController.d.ts +67 -0
- package/dist/spatial-element/SpatialElementPaneController.d.ts.map +1 -0
- package/dist/spatial-element/SpatialElementPaneController.js +246 -0
- package/dist/spatial-element/SpatialElementPaneController.js.map +1 -0
- package/dist/spatial-element/activeDetailSection.d.ts +8 -0
- package/dist/spatial-element/activeDetailSection.d.ts.map +1 -0
- package/dist/spatial-element/activeDetailSection.js +19 -0
- package/dist/spatial-element/activeDetailSection.js.map +1 -0
- package/dist/spatial-element/layoutTokens.json +228 -0
- package/dist/spatial-element/messages.d.ts +34 -0
- package/dist/spatial-element/messages.d.ts.map +1 -0
- package/dist/spatial-element/messages.js +34 -0
- package/dist/spatial-element/messages.js.map +1 -0
- package/dist/spatial-element/responsiveLayout.d.ts +1353 -0
- package/dist/spatial-element/responsiveLayout.d.ts.map +1 -0
- package/dist/spatial-element/responsiveLayout.js +210 -0
- package/dist/spatial-element/responsiveLayout.js.map +1 -0
- package/dist/spatial-element/sectionBackground.d.ts +3 -0
- package/dist/spatial-element/sectionBackground.d.ts.map +1 -0
- package/dist/spatial-element/sectionBackground.js +2 -0
- package/dist/spatial-element/sectionBackground.js.map +1 -0
- package/dist/spatial-element/spatialElement.d.ts +17 -12
- package/dist/spatial-element/spatialElement.d.ts.map +1 -1
- package/dist/spatial-element/spatialElement.js +33 -6
- package/dist/spatial-element/spatialElement.js.map +1 -1
- package/dist/spatial-element/spatialElementDock.d.ts +15 -0
- package/dist/spatial-element/spatialElementDock.d.ts.map +1 -1
- package/dist/spatial-element/spatialElementDock.js +22 -0
- package/dist/spatial-element/spatialElementDock.js.map +1 -1
- package/dist/spatial-element/spatialElementGeometry.d.ts +22 -0
- package/dist/spatial-element/spatialElementGeometry.d.ts.map +1 -0
- package/dist/spatial-element/spatialElementGeometry.js +40 -0
- package/dist/spatial-element/spatialElementGeometry.js.map +1 -0
- package/dist/spatial-element/spatialElementMedia.d.ts +16 -0
- package/dist/spatial-element/spatialElementMedia.d.ts.map +1 -0
- package/dist/spatial-element/spatialElementMedia.js +29 -0
- package/dist/spatial-element/spatialElementMedia.js.map +1 -0
- package/dist/spatial-element/spatialElementScene.d.ts +16 -0
- package/dist/spatial-element/spatialElementScene.d.ts.map +1 -0
- package/dist/spatial-element/spatialElementScene.js +22 -0
- package/dist/spatial-element/spatialElementScene.js.map +1 -0
- package/dist/spatial-element/spatialElementSectionRegistry.d.ts +6 -25
- package/dist/spatial-element/spatialElementSectionRegistry.d.ts.map +1 -1
- package/dist/spatial-element/spatialElementSectionRegistry.js +6 -63
- package/dist/spatial-element/spatialElementSectionRegistry.js.map +1 -1
- package/dist/spatial-element/spatialTheme.d.ts +27 -0
- package/dist/spatial-element/spatialTheme.d.ts.map +1 -0
- package/dist/spatial-element/spatialTheme.js +83 -0
- package/dist/spatial-element/spatialTheme.js.map +1 -0
- package/dist/spatial-element/types.d.ts +117 -36
- package/dist/spatial-element/types.d.ts.map +1 -1
- package/dist/spatial-element/types.js.map +1 -1
- package/dist/stage/BackgroundLayerOutput.d.ts +76 -0
- package/dist/stage/BackgroundLayerOutput.d.ts.map +1 -0
- package/dist/stage/BackgroundLayerOutput.js +333 -0
- package/dist/stage/BackgroundLayerOutput.js.map +1 -0
- package/dist/stage/DeviceGeometryMotion.d.ts +13 -0
- package/dist/stage/DeviceGeometryMotion.d.ts.map +1 -0
- package/dist/stage/DeviceGeometryMotion.js +37 -0
- package/dist/stage/DeviceGeometryMotion.js.map +1 -0
- package/dist/stage/LiquidGlassPanel.d.ts +7 -0
- package/dist/stage/LiquidGlassPanel.d.ts.map +1 -1
- package/dist/stage/LiquidGlassPanel.js +46 -5
- package/dist/stage/LiquidGlassPanel.js.map +1 -1
- package/dist/stage/MinimapController.d.ts +4 -1
- package/dist/stage/MinimapController.d.ts.map +1 -1
- package/dist/stage/MinimapController.js +57 -66
- package/dist/stage/MinimapController.js.map +1 -1
- package/dist/stage/ModelPointerPreview.d.ts +22 -0
- package/dist/stage/ModelPointerPreview.d.ts.map +1 -0
- package/dist/stage/ModelPointerPreview.js +71 -0
- package/dist/stage/ModelPointerPreview.js.map +1 -0
- package/dist/stage/PageBindingController.d.ts +10 -0
- package/dist/stage/PageBindingController.d.ts.map +1 -1
- package/dist/stage/PageBindingController.js +45 -5
- package/dist/stage/PageBindingController.js.map +1 -1
- package/dist/stage/PanelPresentationController.d.ts +21 -1
- package/dist/stage/PanelPresentationController.d.ts.map +1 -1
- package/dist/stage/PanelPresentationController.js +190 -31
- package/dist/stage/PanelPresentationController.js.map +1 -1
- package/dist/stage/SpatialElementInteractionController.d.ts +19 -1
- package/dist/stage/SpatialElementInteractionController.d.ts.map +1 -1
- package/dist/stage/SpatialElementInteractionController.js +134 -13
- package/dist/stage/SpatialElementInteractionController.js.map +1 -1
- package/dist/stage/SpatialElementPresentationController.d.ts +14 -2
- package/dist/stage/SpatialElementPresentationController.d.ts.map +1 -1
- package/dist/stage/SpatialElementPresentationController.js +47 -2
- package/dist/stage/SpatialElementPresentationController.js.map +1 -1
- package/dist/stage/SpatialElementRefinement.d.ts +34 -1
- package/dist/stage/SpatialElementRefinement.d.ts.map +1 -1
- package/dist/stage/SpatialElementRefinement.js +175 -37
- package/dist/stage/SpatialElementRefinement.js.map +1 -1
- package/dist/stage/StageExperience.d.ts +263 -10
- package/dist/stage/StageExperience.d.ts.map +1 -1
- package/dist/stage/StageExperience.js +655 -124
- package/dist/stage/StageExperience.js.map +1 -1
- package/dist/stage/StageFullscreenController.d.ts +17 -0
- package/dist/stage/StageFullscreenController.d.ts.map +1 -0
- package/dist/stage/StageFullscreenController.js +90 -0
- package/dist/stage/StageFullscreenController.js.map +1 -0
- package/dist/stage/StagePanelRuntime.d.ts +2 -1
- package/dist/stage/StagePanelRuntime.d.ts.map +1 -1
- package/dist/stage/StagePanelRuntime.js.map +1 -1
- package/dist/stage/StageRenderPipeline.d.ts +90 -2
- package/dist/stage/StageRenderPipeline.d.ts.map +1 -1
- package/dist/stage/StageRenderPipeline.js +494 -119
- package/dist/stage/StageRenderPipeline.js.map +1 -1
- package/dist/stage/VirtualScrollController.d.ts +7 -0
- package/dist/stage/VirtualScrollController.d.ts.map +1 -1
- package/dist/stage/VirtualScrollController.js +63 -6
- package/dist/stage/VirtualScrollController.js.map +1 -1
- package/dist/stage/inertLease.d.ts +2 -0
- package/dist/stage/inertLease.d.ts.map +1 -0
- package/dist/stage/inertLease.js +18 -0
- package/dist/stage/inertLease.js.map +1 -0
- package/dist/stage/interactionGuidance.d.ts +22 -0
- package/dist/stage/interactionGuidance.d.ts.map +1 -0
- package/dist/stage/interactionGuidance.js +53 -0
- package/dist/stage/interactionGuidance.js.map +1 -0
- package/dist/stage/interactionOutline.d.ts +14 -0
- package/dist/stage/interactionOutline.d.ts.map +1 -0
- package/dist/stage/interactionOutline.js +59 -0
- package/dist/stage/interactionOutline.js.map +1 -0
- package/dist/stage/minimap/MinimapGeometry.d.ts.map +1 -1
- package/dist/stage/minimap/MinimapGeometry.js +29 -0
- package/dist/stage/minimap/MinimapGeometry.js.map +1 -1
- package/dist/stage/minimap/MinimapModel.d.ts +2 -1
- package/dist/stage/minimap/MinimapModel.d.ts.map +1 -1
- package/dist/stage/minimap/MinimapModel.js +34 -4
- package/dist/stage/minimap/MinimapModel.js.map +1 -1
- package/dist/stage/minimap/MinimapModelGeometry.d.ts +21 -0
- package/dist/stage/minimap/MinimapModelGeometry.d.ts.map +1 -0
- package/dist/stage/minimap/MinimapModelGeometry.js +68 -0
- package/dist/stage/minimap/MinimapModelGeometry.js.map +1 -0
- package/dist/stage/minimap/MinimapProjection.d.ts +7 -0
- package/dist/stage/minimap/MinimapProjection.d.ts.map +1 -1
- package/dist/stage/minimap/MinimapProjection.js +14 -13
- package/dist/stage/minimap/MinimapProjection.js.map +1 -1
- package/dist/stage/minimap/MinimapState.d.ts +3 -8
- package/dist/stage/minimap/MinimapState.d.ts.map +1 -1
- package/dist/stage/minimap/MinimapState.js.map +1 -1
- package/dist/stage/mouseHover.d.ts +9 -0
- package/dist/stage/mouseHover.d.ts.map +1 -0
- package/dist/stage/mouseHover.js +55 -0
- package/dist/stage/mouseHover.js.map +1 -0
- package/dist/stage/panelContext.d.ts +27 -2
- package/dist/stage/panelContext.d.ts.map +1 -1
- package/dist/stage/panelContext.js.map +1 -1
- package/dist/stage/renderSettings.d.ts +10 -0
- package/dist/stage/renderSettings.d.ts.map +1 -0
- package/dist/stage/renderSettings.js +27 -0
- package/dist/stage/renderSettings.js.map +1 -0
- package/dist/stage/renderTargetInventory.d.ts +1 -1
- package/dist/stage/renderTargetInventory.js +1 -1
- package/dist/stage/renderTargetInventory.js.map +1 -1
- package/dist/stage/rendererState.d.ts +2 -0
- package/dist/stage/rendererState.d.ts.map +1 -1
- package/dist/stage/rendererState.js +13 -0
- package/dist/stage/rendererState.js.map +1 -1
- package/dist/stage/sceneEndpointEligibility.d.ts +20 -0
- package/dist/stage/sceneEndpointEligibility.d.ts.map +1 -0
- package/dist/stage/sceneEndpointEligibility.js +363 -0
- package/dist/stage/sceneEndpointEligibility.js.map +1 -0
- package/dist/stage/scrollFrame.d.ts +2 -0
- package/dist/stage/scrollFrame.d.ts.map +1 -1
- package/dist/stage/scrollFrame.js +18 -5
- package/dist/stage/scrollFrame.js.map +1 -1
- package/dist/stage/spatialElementFrame.d.ts.map +1 -1
- package/dist/stage/spatialElementFrame.js +5 -1
- package/dist/stage/spatialElementFrame.js.map +1 -1
- package/dist/stage/stageConstants.d.ts +3 -3
- package/dist/stage/stageConstants.d.ts.map +1 -1
- package/dist/stage/stageConstants.js +6 -6
- package/dist/stage/stageConstants.js.map +1 -1
- package/dist/stage/stageDom.d.ts +2 -0
- package/dist/stage/stageDom.d.ts.map +1 -1
- package/dist/stage/stageDom.js +10 -1
- package/dist/stage/stageDom.js.map +1 -1
- package/dist/stage/stageMath.d.ts +9 -10
- package/dist/stage/stageMath.d.ts.map +1 -1
- package/dist/stage/stageMath.js +23 -21
- package/dist/stage/stageMath.js.map +1 -1
- package/dist/stage/stageTypes.d.ts +30 -3
- package/dist/stage/stageTypes.d.ts.map +1 -1
- package/dist/stage/stageTypes.js.map +1 -1
- package/dist/stage/stageVisualTest.d.ts +24 -1
- package/dist/stage/stageVisualTest.d.ts.map +1 -1
- package/dist/stage/stageVisualTest.js.map +1 -1
- package/logo.svg +188 -0
- package/package.json +7 -5
|
@@ -1,17 +1,34 @@
|
|
|
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';
|
|
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';
|
|
11
|
+
import { CatalogDepthBlur } from './CatalogDepthBlur.js';
|
|
12
|
+
import { CatalogModelOutline } from './CatalogModelOutline.js';
|
|
13
|
+
import { DEFAULT_INTERACTION_THEME } from '../stage/stageConstants.js';
|
|
2
14
|
import { recordCarouselPanel } from './carouselPanelProjection.js';
|
|
3
15
|
import { prepareSpatialElementFrame } from '../stage/spatialElementFrame.js';
|
|
4
16
|
import { resolveSpatialElementLodPair } from './spatialElementLodPair.js';
|
|
5
17
|
import * as THREE from 'three/webgpu';
|
|
18
|
+
import { getSpatialElementScene, hasSpatialElementScene } from '../spatial-element/spatialElementScene.js';
|
|
6
19
|
import { getStageVisualScrollPosition } from '../stage/scrollFrame.js';
|
|
7
20
|
import { getCameraOrbitQuaternion, getPanelPointerInfluence, getPanelPointerRotation, setPanelLocalPerspectiveMatrix } from '../stage/stageMath.js';
|
|
8
|
-
import { applyModelMaterialOverrides, centerAndScale, getMeshBounds, getMeshMaterials, isMesh } from '../stage/stageSceneUtils.js';
|
|
21
|
+
import { applyModelMaterialOverrides, centerAndScale, getMeshBounds, getMeshBoundsPoints, getMeshMaterials, isMesh } from '../stage/stageSceneUtils.js';
|
|
9
22
|
import { SpatialElementAssetManager } from './assets/SpatialElementAssetManager.js';
|
|
10
23
|
import { getSpatialElementEntityKey } from './spatialElementAssets.js';
|
|
11
24
|
import { applyCatalogMaterialOpacity, captureCatalogMaterialOpacity } from './catalogPresentation.js';
|
|
12
25
|
import { CATALOG_POSE_CHANGED } from './catalogPose.js';
|
|
13
26
|
import { getProjectiveCssMatrix3d } from '../stage/cssProjection.js';
|
|
14
27
|
import { CarouselGlassCompositor } from './CarouselGlassCompositor.js';
|
|
28
|
+
import { CarouselGround } from './CarouselGround.js';
|
|
29
|
+
import { CarouselSectionSurfaces } from './CarouselSectionSurfaces.js';
|
|
30
|
+
import { carouselProximity } from './carouselProximity.js';
|
|
31
|
+
import { carouselSupport } from './carouselSupport.js';
|
|
15
32
|
/** Removes irrelevant homogeneous scale so the reference point follows a continuous screen path. */
|
|
16
33
|
export function normalizeSpatialElementClipMatrix(matrix, point) {
|
|
17
34
|
const clip = new THREE.Vector4(point.x, point.y, point.z, 1).applyMatrix4(matrix);
|
|
@@ -54,40 +71,79 @@ export function getSpatialElementHandoffProjection(sourceClip, targetClip, progr
|
|
|
54
71
|
export class CatalogSpatialElementLayer {
|
|
55
72
|
assets;
|
|
56
73
|
invalidate;
|
|
74
|
+
interactionTheme;
|
|
57
75
|
getRenderTargets() {
|
|
58
76
|
return [
|
|
77
|
+
...this.outline.getRenderTargets(),
|
|
78
|
+
...this.depthBlur.getRenderTargets(),
|
|
59
79
|
...this.glass.getRenderTargets(),
|
|
80
|
+
...this.ground.getRenderTargets(),
|
|
60
81
|
...this.geometryFade.getRenderTargets(),
|
|
61
82
|
...(this.handoff?.blend?.getRenderTargets() ?? [])
|
|
62
83
|
];
|
|
63
84
|
}
|
|
64
85
|
scene = new THREE.Scene();
|
|
65
86
|
passes = 0;
|
|
66
|
-
|
|
87
|
+
getRenderActivity() {
|
|
88
|
+
return { camera: this.carouselDeviceCamera.getRenderActivity(), pointer: { ...this.pointer },
|
|
89
|
+
layoutDirty: this.layoutDirty, queueDirty: this.queueDirty, loadingActors: this.loadingKeys.size,
|
|
90
|
+
preparing: this.stagedPreparing, warmups: this.stagedWarmups,
|
|
91
|
+
selected: this.carouselSelection?.spatialElementId ?? null,
|
|
92
|
+
actors: [...this.actors.values()].map(actor => ({ spatialElementId: actor.spatialElementId,
|
|
93
|
+
visible: actor.root.visible, hover: actor.hover, rotationX: actor.rotationX, rotationY: actor.rotationY,
|
|
94
|
+
lift: actor.lift, deviceYaw: actor.deviceYaw, devicePitch: actor.devicePitch, deviceRoll: actor.deviceRoll,
|
|
95
|
+
materialReady: this.stagedMaterialReady(actor) })) };
|
|
96
|
+
}
|
|
97
|
+
getStats(renderer, warmOutput) {
|
|
98
|
+
const signature = renderer && (!warmOutput || warmOutput.isCurrent(renderer)) ? this.stagedSignature(renderer, warmOutput) : undefined;
|
|
99
|
+
const stagedReady = (actor) => Boolean(!this.stagedReadinessBlocked && signature &&
|
|
100
|
+
actor.rendered && actor.root.visible && this.desired.has(actor.key) && this.stagedMaterialReady(actor) &&
|
|
101
|
+
this.stagedPrepared.get(actor) === signature);
|
|
67
102
|
return {
|
|
68
103
|
instances: this.actors.size,
|
|
104
|
+
deviceCamera: { pitch: this.carouselDeviceCamera.angles.x, yaw: this.carouselDeviceCamera.angles.y, roll: this.carouselDeviceCamera.angles.z },
|
|
69
105
|
detachedInstances: this.detachedInstances,
|
|
70
106
|
visible: [...this.actors.values()].filter((actor) => actor.root.visible).length,
|
|
71
107
|
passes: this.passes,
|
|
108
|
+
stagedPreparation: { preparing: this.stagedPreparing,
|
|
109
|
+
readyActors: [...this.actors.values()].filter(stagedReady).length,
|
|
110
|
+
revision: this.stagedWarmRevision, warmups: this.stagedWarmups, failures: this.stagedWarmFailures,
|
|
111
|
+
sourceFrozen: this.stagedSourceFrozen },
|
|
72
112
|
glass: this.glass.getStats(),
|
|
113
|
+
ground: this.ground.getStats(),
|
|
114
|
+
depthBlur: this.depthBlur.getStats(),
|
|
115
|
+
outline: this.outline.getStats(),
|
|
73
116
|
actors: [...this.actors.values()].map((actor) => ({
|
|
74
117
|
spatialElementId: actor.spatialElementId,
|
|
118
|
+
stagedReady: stagedReady(actor),
|
|
119
|
+
projectedCenter: actor.view.getWorldPosition(new THREE.Vector3()).project(actor.pose ? this.carouselCamera : this.camera).toArray(),
|
|
75
120
|
band: actor.band,
|
|
76
121
|
clip: actor.clip ? { ...actor.clip } : undefined,
|
|
77
122
|
opacity: this.exitOpacity * (actor.materials[0]?.material.opacity ?? 0),
|
|
78
123
|
materialOpacity: actor.materials[0]?.material.opacity ?? 0,
|
|
79
|
-
depthWrite: actor.materials[0]?.material.depthWrite
|
|
124
|
+
depthWrite: actor.materials[0]?.material.depthWrite,
|
|
125
|
+
modelScale: actor.view.scale.x, modelDepth: actor.view.position.z,
|
|
126
|
+
blur: actor.blur ?? 0,
|
|
127
|
+
hover: actor.hover,
|
|
128
|
+
proximityTilt: { x: actor.rotationX, y: actor.rotationY },
|
|
129
|
+
deviceTilt: { yaw: actor.deviceYaw, pitch: actor.devicePitch, roll: actor.deviceRoll }
|
|
80
130
|
}))
|
|
81
131
|
};
|
|
82
132
|
}
|
|
83
|
-
|
|
133
|
+
depthBlur = new CatalogDepthBlur();
|
|
134
|
+
outline = new CatalogModelOutline();
|
|
135
|
+
sectionSurfaces = new CarouselSectionSurfaces();
|
|
136
|
+
glass = new CarouselGlassCompositor(this.depthBlur);
|
|
137
|
+
ground = new CarouselGround();
|
|
84
138
|
geometryFade = new CatalogGeometryFade();
|
|
85
139
|
handoffScene = new THREE.Scene();
|
|
86
140
|
camera = new THREE.PerspectiveCamera(45, 1, 1, 4000);
|
|
87
141
|
// The carousel sits ~2500 units from the lens. A near plane of 1 wastes depth
|
|
88
142
|
// precision and makes closely spaced CAD surfaces fight after the longer-lens change.
|
|
89
143
|
carouselCamera = new THREE.PerspectiveCamera(45, 1, 250, 6000);
|
|
90
|
-
|
|
144
|
+
carouselUiCamera = new THREE.PerspectiveCamera();
|
|
145
|
+
carouselDeviceCamera = new CarouselDeviceCamera();
|
|
146
|
+
carouselSelection;
|
|
91
147
|
handoffCamera = new THREE.PerspectiveCamera();
|
|
92
148
|
actors = new Map();
|
|
93
149
|
requests = new Set();
|
|
@@ -96,8 +152,24 @@ export class CatalogSpatialElementLayer {
|
|
|
96
152
|
loadingKeys = new Set();
|
|
97
153
|
failedKeys = new Set();
|
|
98
154
|
motion = window.matchMedia('(prefers-reduced-motion: reduce)');
|
|
99
|
-
|
|
155
|
+
unsubscribeDeviceYaw;
|
|
156
|
+
pointer = { x: 0, y: 0, active: false, pressed: false };
|
|
157
|
+
focusVisible = new WeakMap();
|
|
158
|
+
activationFocusFrame = 0;
|
|
159
|
+
activationFocusRequest;
|
|
100
160
|
handoff;
|
|
161
|
+
stagedPanel;
|
|
162
|
+
stagedPanelOpacity = 1;
|
|
163
|
+
stagedSourceFrozen = false;
|
|
164
|
+
stagedSourceCapture;
|
|
165
|
+
groundPoseSettled = false;
|
|
166
|
+
stagedPreparing = false;
|
|
167
|
+
stagedReadinessBlocked = false;
|
|
168
|
+
stagedWarmRevision = 0;
|
|
169
|
+
stagedWarmups = 0;
|
|
170
|
+
stagedWarmFailures = 0;
|
|
171
|
+
stagedPrepared = new WeakMap();
|
|
172
|
+
stagedWarmFailed = new WeakMap();
|
|
101
173
|
handoffPoint;
|
|
102
174
|
generation = 0;
|
|
103
175
|
disposed = false;
|
|
@@ -113,31 +185,111 @@ export class CatalogSpatialElementLayer {
|
|
|
113
185
|
destinationOccurrences = new Set();
|
|
114
186
|
detachedInstances = 0;
|
|
115
187
|
pointerMove = (event) => {
|
|
116
|
-
if (event.pointerType !== 'mouse'
|
|
188
|
+
if (event.pointerType !== 'mouse') {
|
|
189
|
+
this.pointerLeave();
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (this.pointer.active && this.pointer.x === event.clientX && this.pointer.y === event.clientY)
|
|
117
193
|
return;
|
|
118
194
|
this.pointer.x = event.clientX;
|
|
119
195
|
this.pointer.y = event.clientY;
|
|
120
196
|
this.pointer.active = true;
|
|
121
197
|
this.invalidate();
|
|
122
198
|
};
|
|
199
|
+
pointerDown = (event) => {
|
|
200
|
+
if (event.pointerType !== 'mouse')
|
|
201
|
+
this.pointerLeave();
|
|
202
|
+
if (this.pointer.pressed)
|
|
203
|
+
return;
|
|
204
|
+
this.pointer.pressed = true;
|
|
205
|
+
this.invalidate();
|
|
206
|
+
};
|
|
207
|
+
pointerUp = () => {
|
|
208
|
+
if (!this.pointer.pressed)
|
|
209
|
+
return;
|
|
210
|
+
this.pointer.pressed = false;
|
|
211
|
+
this.invalidate();
|
|
212
|
+
};
|
|
123
213
|
pointerLeave = () => {
|
|
214
|
+
if (!this.pointer.active)
|
|
215
|
+
return;
|
|
124
216
|
this.pointer.active = false;
|
|
217
|
+
this.pointer.pressed = false;
|
|
125
218
|
this.invalidate();
|
|
126
219
|
};
|
|
127
220
|
resize = () => {
|
|
221
|
+
this.stagedSourceCapture = undefined;
|
|
222
|
+
this.stagedWarmRevision++;
|
|
128
223
|
this.layoutDirty = true;
|
|
129
224
|
this.queueDirty = true;
|
|
130
225
|
this.invalidate();
|
|
131
226
|
};
|
|
227
|
+
readFocusVisible(target) {
|
|
228
|
+
if (!target)
|
|
229
|
+
return false;
|
|
230
|
+
const visible = target.matches?.(':focus-visible') ?? false;
|
|
231
|
+
this.focusVisible.set(target, visible);
|
|
232
|
+
return visible;
|
|
233
|
+
}
|
|
234
|
+
cancelActivationFocusRequest() {
|
|
235
|
+
if (this.activationFocusFrame)
|
|
236
|
+
cancelAnimationFrame(this.activationFocusFrame);
|
|
237
|
+
this.activationFocusFrame = 0;
|
|
238
|
+
this.activationFocusRequest = undefined;
|
|
239
|
+
}
|
|
240
|
+
deferActivationFocusRequest() {
|
|
241
|
+
if (this.activationFocusRequest)
|
|
242
|
+
return;
|
|
243
|
+
const request = this.activationFocusRequest = {};
|
|
244
|
+
this.activationFocusFrame = requestAnimationFrame(() => {
|
|
245
|
+
if (this.activationFocusRequest !== request)
|
|
246
|
+
return;
|
|
247
|
+
this.activationFocusRequest = undefined;
|
|
248
|
+
this.activationFocusFrame = 0;
|
|
249
|
+
if (!this.disposed && !this.transitionActive)
|
|
250
|
+
this.invalidate();
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
focusChange = (event) => {
|
|
254
|
+
const actor = [...this.actors.values()].find(actor => (actor.pose ? actor.hitTarget : actor.card) === event.target);
|
|
255
|
+
const target = actor && (actor.pose ? actor.hitTarget : actor.card);
|
|
256
|
+
if (!actor || !target)
|
|
257
|
+
return;
|
|
258
|
+
// focusout has already lost :focus-visible. Remember the state actually
|
|
259
|
+
// consumed by the last frame (or preceding focusin), including autofocus.
|
|
260
|
+
const before = this.focusVisible.get(target) ?? false;
|
|
261
|
+
const after = event.type === 'focusin' && (target.matches?.(':focus-visible') ?? false);
|
|
262
|
+
this.focusVisible.set(target, after);
|
|
263
|
+
if (before === after || this.transitionActive || (actor.pose && this.pointer.pressed))
|
|
264
|
+
return;
|
|
265
|
+
// A carousel pointer outline already has the same target value of one.
|
|
266
|
+
// Keep keyboard and genuine hover changes synchronous, without a timer.
|
|
267
|
+
if (actor.pose && this.pointer.active && target.hasAttribute('data-mouse-hover'))
|
|
268
|
+
return;
|
|
269
|
+
// This is only our own programmatic link focus, never Tab/hover/press work.
|
|
270
|
+
// Let Kit's first repaint opportunity stay light; an accepted transition can
|
|
271
|
+
// consume the focus in its first frame. Otherwise request the ordinary next
|
|
272
|
+
// Stage frame, even when the click was vetoed or no router is installed.
|
|
273
|
+
if (isCatalogActivationFocus(event) && actor.pose?.read().front) {
|
|
274
|
+
this.deferActivationFocusRequest();
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
this.invalidate();
|
|
278
|
+
};
|
|
132
279
|
motionChange = () => this.invalidate();
|
|
133
280
|
setPageBackground(value) {
|
|
281
|
+
this.stagedSourceCapture = undefined;
|
|
134
282
|
this.scene.fog.color.set(value);
|
|
135
|
-
this.carouselFog.color.set(value);
|
|
136
283
|
this.invalidate();
|
|
137
284
|
}
|
|
138
|
-
constructor(assets, invalidate) {
|
|
285
|
+
constructor(assets, invalidate, interactionTheme = () => DEFAULT_INTERACTION_THEME) {
|
|
139
286
|
this.assets = assets;
|
|
140
287
|
this.invalidate = invalidate;
|
|
288
|
+
this.interactionTheme = interactionTheme;
|
|
289
|
+
this.unsubscribeDeviceYaw = subscribeListDeviceYaw(() => {
|
|
290
|
+
if (!this.transitionActive && [...this.actors.values()].some(actor => actor.root.visible && actor.card?.closest('[data-device-orientation]')))
|
|
291
|
+
this.invalidate();
|
|
292
|
+
});
|
|
141
293
|
this.scene.environmentIntensity = 0.5;
|
|
142
294
|
this.scene.fog = new THREE.Fog(0xffffff, 1200, 2500);
|
|
143
295
|
this.handoffScene.fog = this.scene.fog;
|
|
@@ -147,6 +299,11 @@ export class CatalogSpatialElementLayer {
|
|
|
147
299
|
this.camera.position.z = 1000;
|
|
148
300
|
this.camera.updateMatrixWorld();
|
|
149
301
|
window.addEventListener('pointermove', this.pointerMove, { passive: true });
|
|
302
|
+
window.addEventListener('pointerdown', this.pointerDown, { capture: true, passive: true });
|
|
303
|
+
window.addEventListener('pointerup', this.pointerUp, { passive: true });
|
|
304
|
+
window.addEventListener('pointercancel', this.pointerUp, { passive: true });
|
|
305
|
+
window.addEventListener('focusin', this.focusChange);
|
|
306
|
+
window.addEventListener('focusout', this.focusChange);
|
|
150
307
|
window.addEventListener('pointerleave', this.pointerLeave);
|
|
151
308
|
window.addEventListener('blur', this.pointerLeave);
|
|
152
309
|
window.addEventListener('resize', this.resize);
|
|
@@ -156,12 +313,14 @@ export class CatalogSpatialElementLayer {
|
|
|
156
313
|
async setSpatialElements(brandId, spatialElements) {
|
|
157
314
|
if (this.disposed)
|
|
158
315
|
return;
|
|
316
|
+
this.stagedSourceCapture = undefined;
|
|
317
|
+
this.cancelActivationFocusRequest();
|
|
159
318
|
const generation = ++this.generation;
|
|
160
319
|
this.layoutObserver.disconnect();
|
|
161
320
|
const page = document.querySelector('[data-catalog-list]');
|
|
162
321
|
if (page) {
|
|
163
322
|
this.layoutObserver.observe(page);
|
|
164
|
-
for (const section of page.querySelectorAll('section'))
|
|
323
|
+
for (const section of page.querySelectorAll('section, section > .ps-section-surface'))
|
|
165
324
|
this.layoutObserver.observe(section);
|
|
166
325
|
}
|
|
167
326
|
for (const request of this.requests)
|
|
@@ -172,7 +331,7 @@ export class CatalogSpatialElementLayer {
|
|
|
172
331
|
this.desired.clear();
|
|
173
332
|
this.spatialElements.clear();
|
|
174
333
|
for (const spatialElement of spatialElements) {
|
|
175
|
-
if (!spatialElement
|
|
334
|
+
if (!hasSpatialElementScene(spatialElement))
|
|
176
335
|
continue;
|
|
177
336
|
const key = JSON.stringify([
|
|
178
337
|
getSpatialElementEntityKey(brandId, spatialElement.id),
|
|
@@ -182,13 +341,14 @@ export class CatalogSpatialElementLayer {
|
|
|
182
341
|
this.spatialElements.set(key, { brandId, spatialElement });
|
|
183
342
|
}
|
|
184
343
|
for (const actor of this.actors.values()) {
|
|
185
|
-
|
|
344
|
+
const nextElement = this.spatialElements.get(actor.key)?.spatialElement;
|
|
345
|
+
actor.pose = nextElement?.pose ?? actor.pose;
|
|
186
346
|
if (this.handoff && actor.rendered)
|
|
187
347
|
continue;
|
|
188
348
|
if (this.handoff?.actor !== actor &&
|
|
189
349
|
(!this.desired.has(actor.key) ||
|
|
190
350
|
JSON.stringify(actor.stage) !==
|
|
191
|
-
JSON.stringify(
|
|
351
|
+
JSON.stringify(nextElement && hasSpatialElementScene(nextElement) ? getSpatialElementScene(nextElement) : undefined)))
|
|
192
352
|
this.disposeActor(actor);
|
|
193
353
|
}
|
|
194
354
|
this.layoutDirty = true;
|
|
@@ -209,9 +369,10 @@ export class CatalogSpatialElementLayer {
|
|
|
209
369
|
const list = document.querySelector(`[data-catalog-list][data-brand-id="${CSS.escape(brandId)}"]`);
|
|
210
370
|
const slot = list?.querySelector(`[data-catalog-geometry][data-spatial-element-id="${CSS.escape(spatialElement.id)}"]${spatialElement.occurrence ? `[data-catalog-occurrence="${CSS.escape(spatialElement.occurrence)}"]` : ''}`);
|
|
211
371
|
const rect = slot?.getBoundingClientRect();
|
|
372
|
+
const margin = spatialElement.pose ? 700 : 300;
|
|
212
373
|
return (rect &&
|
|
213
|
-
rect.top < window.innerHeight +
|
|
214
|
-
rect.bottom > -
|
|
374
|
+
rect.top < window.innerHeight + margin &&
|
|
375
|
+
rect.bottom > -margin &&
|
|
215
376
|
rect.left < window.innerWidth &&
|
|
216
377
|
rect.right > 0);
|
|
217
378
|
})
|
|
@@ -219,17 +380,12 @@ export class CatalogSpatialElementLayer {
|
|
|
219
380
|
if (!candidates.length)
|
|
220
381
|
return;
|
|
221
382
|
await Promise.all(candidates.map(async ([key, { brandId, spatialElement }]) => {
|
|
222
|
-
if (!spatialElement
|
|
383
|
+
if (!hasSpatialElementScene(spatialElement))
|
|
223
384
|
return;
|
|
224
385
|
const request = new AbortController();
|
|
225
386
|
this.requests.add(request);
|
|
226
387
|
this.loadingKeys.add(key);
|
|
227
|
-
const lease = this.assets.acquire(
|
|
228
|
-
url: spatialElement.stage.glb,
|
|
229
|
-
format: 'glb',
|
|
230
|
-
revision: 'legacy-unversioned',
|
|
231
|
-
requirements: { decoders: ['draco'], extensions: [] }
|
|
232
|
-
}, { signal: request.signal });
|
|
388
|
+
const lease = this.assets.acquire(getSpatialElementScene(spatialElement).lodPair.low, { signal: request.signal });
|
|
233
389
|
let instance;
|
|
234
390
|
try {
|
|
235
391
|
instance = await lease.createInstance();
|
|
@@ -237,9 +393,10 @@ export class CatalogSpatialElementLayer {
|
|
|
237
393
|
instance.dispose();
|
|
238
394
|
return;
|
|
239
395
|
}
|
|
240
|
-
const actor = this.createActor(key, brandId, spatialElement.id, spatialElement
|
|
396
|
+
const actor = this.createActor(key, brandId, spatialElement.id, getSpatialElementScene(spatialElement), instance);
|
|
241
397
|
actor.occurrence = spatialElement.occurrence;
|
|
242
398
|
actor.pose = spatialElement.pose;
|
|
399
|
+
this.stagedSourceCapture = undefined;
|
|
243
400
|
this.actors.set(key, actor);
|
|
244
401
|
this.scene.add(actor.root);
|
|
245
402
|
this.layoutDirty = true;
|
|
@@ -275,6 +432,10 @@ export class CatalogSpatialElementLayer {
|
|
|
275
432
|
this.carouselCamera.aspect = width / height;
|
|
276
433
|
this.carouselCamera.fov = THREE.MathUtils.radToDeg(2 * Math.atan(height / 5000));
|
|
277
434
|
this.carouselCamera.updateProjectionMatrix();
|
|
435
|
+
this.carouselUiCamera.copy(this.carouselCamera);
|
|
436
|
+
this.carouselUiCamera.position.set(0, 0, 2500);
|
|
437
|
+
this.carouselUiCamera.quaternion.identity();
|
|
438
|
+
this.carouselUiCamera.updateMatrixWorld(true);
|
|
278
439
|
this.scene.environment = environment;
|
|
279
440
|
this.handoffScene.environment = this.handoff?.sourceEnvironment ?? environment;
|
|
280
441
|
const scroll = getStageVisualScrollPosition();
|
|
@@ -285,14 +446,22 @@ export class CatalogSpatialElementLayer {
|
|
|
285
446
|
}
|
|
286
447
|
if (this.layoutDirty)
|
|
287
448
|
this.measureActors(scroll.scrollX, scroll.scrollY);
|
|
449
|
+
this.sectionSurfaces.update(scroll.scrollX, scroll.scrollY, this.exitOpacity);
|
|
288
450
|
const delta = Math.min(this.lastTime ? (now - this.lastTime) / 1000 : 1 / 60, 0.05);
|
|
289
451
|
this.lastTime = now;
|
|
290
452
|
let animating = false;
|
|
291
|
-
|
|
453
|
+
const projectCarousels = [];
|
|
454
|
+
let selected;
|
|
455
|
+
if (this.stagedPanel)
|
|
456
|
+
this.glass.retainFrame(this.stagedPanel.card, this.stagedPanel.matrix, this.exitOpacity, this.stagedPanelOpacity);
|
|
457
|
+
else
|
|
458
|
+
this.glass.beginFrame();
|
|
459
|
+
if (!this.handoff)
|
|
460
|
+
this.ground.beginFrame();
|
|
292
461
|
for (const actor of this.actors.values()) {
|
|
293
462
|
if (this.handoff?.actor === actor)
|
|
294
463
|
continue;
|
|
295
|
-
if (this.handoff) {
|
|
464
|
+
if (this.handoff || this.stagedSourceFrozen) {
|
|
296
465
|
// The outgoing DOM has been snapshotted. Keep these already-rendered
|
|
297
466
|
// spatialElements at their captured screen pose until the shared fade completes.
|
|
298
467
|
actor.root.visible = actor.rendered && actor.root.visible && this.exitOpacity > 0.001;
|
|
@@ -313,88 +482,168 @@ export class CatalogSpatialElementLayer {
|
|
|
313
482
|
this.queueDirty = true;
|
|
314
483
|
continue;
|
|
315
484
|
}
|
|
485
|
+
// Free-standing carousel geometry may still be on screen after its
|
|
486
|
+
// semantic section has left it. Keep the same margin as asset residency.
|
|
487
|
+
const margin = actor.pose ? 700 : 96;
|
|
316
488
|
actor.root.visible =
|
|
317
489
|
this.exitOpacity > 0.001 &&
|
|
318
|
-
slot.top + dy < height +
|
|
319
|
-
slot.top + dy + slot.height > -
|
|
490
|
+
slot.top + dy < height + margin &&
|
|
491
|
+
slot.top + dy + slot.height > -margin &&
|
|
320
492
|
slot.left + dx < width &&
|
|
321
493
|
slot.left + dx + slot.width > 0;
|
|
322
494
|
if (!actor.root.visible)
|
|
323
495
|
continue;
|
|
324
496
|
if (actor.pose) {
|
|
497
|
+
actor.view.quaternion.copy(actor.viewOrientation);
|
|
325
498
|
const pose = actor.pose.read();
|
|
499
|
+
const approach = this.pointer.active && !this.pointer.pressed && !this.transitionActive &&
|
|
500
|
+
!this.motion.matches && actor.renderRect && pose.visible
|
|
501
|
+
? carouselProximity(this.pointer.x, this.pointer.y, actor.renderRect) : { x: 0, y: 0 };
|
|
502
|
+
for (const [property, target] of [['rotationX', approach.x], ['rotationY', approach.y]]) {
|
|
503
|
+
actor[property] = this.motion.matches ? 0 : THREE.MathUtils.damp(actor[property], target, 12, delta);
|
|
504
|
+
if (Math.abs(actor[property] - target) < 0.0001)
|
|
505
|
+
actor[property] = target;
|
|
506
|
+
animating ||= actor[property] !== target;
|
|
507
|
+
}
|
|
508
|
+
// Add the remaining sensor response only to the focus model. The camera keeps 25%.
|
|
509
|
+
const sensorEnabled = pose.front && !this.motion.matches && !this.transitionActive &&
|
|
510
|
+
actor.card.closest('[data-device-orientation]');
|
|
511
|
+
for (const [property, target] of [
|
|
512
|
+
['deviceYaw', sensorEnabled ? -getListDeviceYaw() * 0.75 : 0],
|
|
513
|
+
['devicePitch', sensorEnabled ? -getListDevicePitch() * 0.75 : 0],
|
|
514
|
+
['deviceRoll', sensorEnabled ? -getListDeviceRoll() * 0.75 : 0]
|
|
515
|
+
]) {
|
|
516
|
+
if (!this.motion.matches && isDeviceOrientationPaused())
|
|
517
|
+
continue;
|
|
518
|
+
actor[property] = this.motion.matches ? 0 : THREE.MathUtils.damp(actor[property], target, 40, delta);
|
|
519
|
+
if (Math.abs(actor[property] - target) < 0.01)
|
|
520
|
+
actor[property] = target;
|
|
521
|
+
animating ||= actor[property] !== target;
|
|
522
|
+
}
|
|
523
|
+
const hoverTarget = !this.transitionActive && !this.pointer.pressed &&
|
|
524
|
+
((this.pointer.active && actor.hitTarget?.hasAttribute('data-mouse-hover')) ||
|
|
525
|
+
this.readFocusVisible(actor.hitTarget)) ? 1 : 0;
|
|
526
|
+
actor.hover = this.motion.matches ? hoverTarget : THREE.MathUtils.damp(actor.hover, hoverTarget, 18, delta);
|
|
527
|
+
if (Math.abs(actor.hover - hoverTarget) < 0.01)
|
|
528
|
+
actor.hover = hoverTarget;
|
|
529
|
+
animating ||= actor.hover !== hoverTarget;
|
|
530
|
+
// Reuse the outline's settled hover state: inspecting a neighbour brings it
|
|
531
|
+
// into focus without changing selection or allocating another render target.
|
|
532
|
+
actor.blur = (pose.blur ?? 0) * (1 - actor.hover);
|
|
326
533
|
actor.band = pose.front ? 'front' : 'rear';
|
|
327
534
|
actor.root.visible &&= pose.visible;
|
|
328
535
|
applyCatalogMaterialOpacity(actor.materials, pose.opacity);
|
|
329
|
-
const
|
|
330
|
-
|
|
331
|
-
const
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
536
|
+
const framing = pose.framing;
|
|
537
|
+
const compact = framing?.compact ?? width < 840;
|
|
538
|
+
const frame = framing ? Math.min(framing.fit.width, framing.fit.height) : Math.min(slot.width, compact ? 360 : slot.height);
|
|
539
|
+
// Every seat shares one scene origin. Depth now determines projected size
|
|
540
|
+
// and spacing naturally, including scroll parallax and the foreground advance.
|
|
541
|
+
const anchorX = framing ? framing.fit.x + framing.fit.width / 2 : slot.width * (compact ? 0.5 : 0.31);
|
|
542
|
+
const anchorY = framing ? framing.fit.y + framing.fit.height / 2 : compact ? 180 : slot.height * 0.54;
|
|
543
|
+
const x = slot.left + dx + (pose.orbit ? anchorX : slot.width * (pose.x - (framing || compact ? 0 : 0.19)));
|
|
544
|
+
const y = slot.top + dy + (pose.orbit ? anchorY : slot.height * pose.y);
|
|
545
|
+
const perspective = pose.orbit ? 1 : 1 - pose.depth / 2500;
|
|
546
|
+
actor.root.matrix.makeTranslation((x - width / 2) * perspective + (pose.orbit?.x ?? 0), (height / 2 - y) * perspective + (pose.orbit?.y ?? 0), pose.depth);
|
|
335
547
|
actor.root.matrixWorldNeedsUpdate = true;
|
|
336
|
-
//
|
|
337
|
-
actor.tilt.scale.setScalar(perspective * (pose.size / 0.82));
|
|
338
|
-
actor.tilt.rotation.set(0, pose.yaw, 0);
|
|
548
|
+
// Geometry follows the seat and pointer; panel projection below excludes pointer tilt.
|
|
549
|
+
actor.tilt.scale.setScalar(pose.orbit ? 1 : perspective * (pose.size / 0.82));
|
|
550
|
+
actor.tilt.rotation.set((pose.orbit?.pitch ?? 0) + actor.rotationX, pose.yaw + actor.rotationY, 0);
|
|
339
551
|
actor.tilt.position.set(0, 0, 0);
|
|
340
|
-
|
|
341
|
-
|
|
552
|
+
// Keep compact models in the 360px visual area even as their parent shrinks.
|
|
553
|
+
// Scaling the old offset pulled side previews down into the summary panel.
|
|
554
|
+
actor.view.position.set(0, compact && !pose.orbit
|
|
555
|
+
? (slot.height - 360) * pose.y / (pose.size / 0.82)
|
|
556
|
+
: 0, 0);
|
|
557
|
+
actor.view.scale.setScalar((frame * 0.82) / (actor.radius * 2));
|
|
558
|
+
let groundMatrix;
|
|
559
|
+
if (pose.orbit && actor.root.visible) {
|
|
560
|
+
const floor = frame * 0.32;
|
|
561
|
+
const pitch = pose.orbit.pitch;
|
|
562
|
+
// Stand every model on the same plane, including wide or short assets.
|
|
563
|
+
actor.tilt.updateMatrix();
|
|
564
|
+
actor.view.updateMatrix();
|
|
565
|
+
const upright = new THREE.Matrix4().makeRotationX(-pitch).multiply(actor.tilt.matrix);
|
|
566
|
+
const bottom = Math.min(...actor.supportPoints.map(point => point.clone().applyMatrix4(actor.view.matrix).applyMatrix4(upright).y));
|
|
567
|
+
actor.view.position.y += (-floor - bottom) / upright.elements[5];
|
|
568
|
+
actor.view.updateMatrix();
|
|
569
|
+
groundMatrix = new THREE.Matrix4().makeTranslation(x - width / 2, height / 2 - y, 0)
|
|
570
|
+
.multiply(new THREE.Matrix4().makeRotationX(pitch))
|
|
571
|
+
.multiply(new THREE.Matrix4().makeTranslation(0, -floor, 0));
|
|
572
|
+
}
|
|
573
|
+
// Apply after floor fitting so the model centre and UI anchors remain fixed.
|
|
574
|
+
actor.view.quaternion.setFromEuler(new THREE.Euler(THREE.MathUtils.degToRad(actor.devicePitch), THREE.MathUtils.degToRad(actor.deviceYaw), THREE.MathUtils.degToRad(actor.deviceRoll), 'ZXY'))
|
|
575
|
+
.multiply(actor.viewOrientation);
|
|
342
576
|
actor.root.updateMatrixWorld(true);
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
top =
|
|
356
|
-
|
|
577
|
+
actor.clip = actor.sectionRect
|
|
578
|
+
? { ...actor.sectionRect, left: actor.sectionRect.left + dx, top: actor.sectionRect.top + dy }
|
|
579
|
+
: { left: 0, top: 0, width, height };
|
|
580
|
+
if (groundMatrix)
|
|
581
|
+
this.ground.shadow(actor, actor.model, groundMatrix, 0.14 * pose.opacity, actor.clip);
|
|
582
|
+
if (pose.front && actor.root.visible && (!selected || pose.panelOpacity > (selected.pose?.read().panelOpacity ?? 0)))
|
|
583
|
+
selected = actor;
|
|
584
|
+
projectCarousels.push(() => {
|
|
585
|
+
const hitTarget = actor.hitTarget;
|
|
586
|
+
if (hitTarget) {
|
|
587
|
+
// Project cached model bounds, not the framing sphere: empty foreground
|
|
588
|
+
// margins must not intercept clicks on visible neighbouring spatialElements.
|
|
589
|
+
let left = Infinity, top = Infinity, right = -Infinity, bottom = -Infinity;
|
|
590
|
+
const point = new THREE.Vector3();
|
|
591
|
+
for (const corner of actor.hitCorners) {
|
|
592
|
+
point.copy(corner).applyMatrix4(actor.view.matrixWorld).project(this.carouselCamera);
|
|
593
|
+
const px = ((point.x + 1) * width) / 2 - slot.left - dx;
|
|
594
|
+
const py = ((1 - point.y) * height) / 2 - slot.top - dy;
|
|
595
|
+
left = Math.min(left, px);
|
|
596
|
+
right = Math.max(right, px);
|
|
597
|
+
top = Math.min(top, py);
|
|
598
|
+
bottom = Math.max(bottom, py);
|
|
599
|
+
}
|
|
600
|
+
hitTarget.style.left = `${(left + right) / 2}px`;
|
|
601
|
+
hitTarget.style.top = `${(top + bottom) / 2}px`;
|
|
602
|
+
hitTarget.style.width = `${right - left}px`;
|
|
603
|
+
hitTarget.style.height = `${bottom - top}px`;
|
|
604
|
+
hitTarget.style.maxWidth = 'none';
|
|
605
|
+
actor.renderRect = { left: left + slot.left + dx, top: top + slot.top + dy,
|
|
606
|
+
width: right - left, height: bottom - top };
|
|
357
607
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
[
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
};
|
|
608
|
+
const panel = actor.summaryPanel;
|
|
609
|
+
if (panel && actor.summarySize) {
|
|
610
|
+
const { width: pw, height: ph } = actor.summarySize;
|
|
611
|
+
// The panel follows the seat and its yaw, but not the elevated
|
|
612
|
+
// product view. At rest it is parallel to the screen, also on mobile.
|
|
613
|
+
const panelFrame = pose.orbit
|
|
614
|
+
? actor.root.matrixWorld.clone().multiply(new THREE.Matrix4().makeRotationY(pose.yaw))
|
|
615
|
+
: actor.tilt.matrixWorld.clone();
|
|
616
|
+
const matrix = panelFrame
|
|
617
|
+
.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));
|
|
618
|
+
const corners = [
|
|
619
|
+
[-pw / 2, ph / 2],
|
|
620
|
+
[pw / 2, ph / 2],
|
|
621
|
+
[pw / 2, -ph / 2],
|
|
622
|
+
[-pw / 2, -ph / 2]
|
|
623
|
+
].map(([x, y]) => {
|
|
624
|
+
const point = new THREE.Vector3(x, y, 0)
|
|
625
|
+
.applyMatrix4(matrix)
|
|
626
|
+
.project(this.carouselUiCamera);
|
|
627
|
+
return {
|
|
628
|
+
x: ((point.x + 1) * width) / 2 - slot.left - dx,
|
|
629
|
+
y: ((1 - point.y) * height) / 2 - slot.top - dy
|
|
630
|
+
};
|
|
631
|
+
});
|
|
632
|
+
// The semantic summary keeps its intrinsic layout slot before and after
|
|
633
|
+
// enhancement. Project relative to that slot instead of moving it to (0, 0).
|
|
634
|
+
const origin = actor.summaryOrigin ?? { x: 0, y: 0 };
|
|
635
|
+
const localCorners = corners.map(({ x, y }) => ({
|
|
636
|
+
x: x - origin.x, y: y - origin.y
|
|
637
|
+
}));
|
|
638
|
+
panel.style.transform = getProjectiveCssMatrix3d(localCorners, pw, ph) ?? '';
|
|
639
|
+
recordCarouselPanel(panel, corners.map((point) => ({
|
|
640
|
+
x: point.x + slot.left + dx,
|
|
641
|
+
y: point.y + slot.top + dy
|
|
642
|
+
})), pw, ph);
|
|
643
|
+
const hidden = actor.card.style.visibility === 'hidden' || panel.style.visibility === 'hidden';
|
|
644
|
+
this.glass.panel(actor.card, matrix, pw, ph, hidden ? 0 : pose.panelOpacity * this.exitOpacity, (1 - pose.panelOpacity) * 6, actor.clip);
|
|
645
|
+
}
|
|
646
|
+
});
|
|
398
647
|
if (this.isDestinationActor(actor))
|
|
399
648
|
actor.root.visible = false;
|
|
400
649
|
continue;
|
|
@@ -413,16 +662,18 @@ export class CatalogSpatialElementLayer {
|
|
|
413
662
|
const targets = [
|
|
414
663
|
-THREE.MathUtils.radToDeg(rotation.x),
|
|
415
664
|
THREE.MathUtils.radToDeg(rotation.y),
|
|
416
|
-
-influence * 8
|
|
665
|
+
-influence * 8,
|
|
666
|
+
!this.motion.matches && !this.transitionActive &&
|
|
667
|
+
((this.pointer.active && distance === 0) || this.readFocusVisible(actor.card)) ? 1 : 0
|
|
417
668
|
];
|
|
418
|
-
const previous = [actor.rotationX, actor.rotationY, actor.lift];
|
|
669
|
+
const previous = [actor.rotationX, actor.rotationY, actor.lift, actor.hover];
|
|
419
670
|
const values = previous.map((value, index) => {
|
|
420
671
|
const next = this.motion.matches
|
|
421
672
|
? targets[index]
|
|
422
673
|
: THREE.MathUtils.damp(value, targets[index], 14, delta);
|
|
423
674
|
return Math.abs(next - targets[index]) < 0.01 ? targets[index] : next;
|
|
424
675
|
});
|
|
425
|
-
[actor.rotationX, actor.rotationY, actor.lift] = values;
|
|
676
|
+
[actor.rotationX, actor.rotationY, actor.lift, actor.hover] = values;
|
|
426
677
|
animating ||= values.some((value, index) => value !== targets[index]);
|
|
427
678
|
actor.card.style.setProperty('--catalog-rotate-x', `${actor.rotationX}deg`);
|
|
428
679
|
actor.card.style.setProperty('--catalog-rotate-y', `${actor.rotationY}deg`);
|
|
@@ -431,22 +682,58 @@ export class CatalogSpatialElementLayer {
|
|
|
431
682
|
actor.root.matrixWorldNeedsUpdate = true;
|
|
432
683
|
actor.tilt.rotation.set(-THREE.MathUtils.degToRad(actor.rotationX), THREE.MathUtils.degToRad(actor.rotationY), 0);
|
|
433
684
|
actor.tilt.position.y = -actor.lift;
|
|
434
|
-
actor.view.position.set(slot.left + slot.width / 2 - card.left - card.width / 2, card.top + card.height / 2 - slot.top - slot.height / 2,
|
|
435
|
-
actor.view.scale.setScalar(
|
|
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);
|
|
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);
|
|
436
705
|
if (this.isDestinationActor(actor))
|
|
437
706
|
actor.root.visible = false;
|
|
438
707
|
}
|
|
439
|
-
if (this.
|
|
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) {
|
|
440
719
|
this.queueDirty = false;
|
|
441
720
|
void this.loadVisibleSpatialElements(this.generation);
|
|
442
721
|
}
|
|
443
|
-
this.glass.endFrame();
|
|
722
|
+
this.glass.endFrame(this.stagedPanel?.card);
|
|
723
|
+
if (!this.handoff)
|
|
724
|
+
this.ground.endFrame();
|
|
725
|
+
this.groundPoseSettled = !animating;
|
|
444
726
|
return animating;
|
|
445
727
|
}
|
|
446
|
-
draw(renderer, band) {
|
|
447
|
-
this.passes++;
|
|
728
|
+
draw(renderer, band, warmOutput) {
|
|
448
729
|
const width = window.innerWidth, height = window.innerHeight;
|
|
449
730
|
const all = [...this.actors.values()].filter((actor) => actor.root.visible && this.handoff?.actor !== actor);
|
|
731
|
+
if (!all.some((actor) => (actor.band ?? 'front') === band)) {
|
|
732
|
+
if (band === 'front' && this.handoff)
|
|
733
|
+
this.renderHandoff(renderer);
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
this.passes++;
|
|
450
737
|
for (const actor of all)
|
|
451
738
|
actor.root.visible = (actor.band ?? 'front') === band;
|
|
452
739
|
this.geometryFade.render(renderer, this.exitOpacity, () => {
|
|
@@ -455,7 +742,8 @@ export class CatalogSpatialElementLayer {
|
|
|
455
742
|
const clipped = shown.filter((actor) => actor.clip);
|
|
456
743
|
for (const actor of clipped)
|
|
457
744
|
actor.root.visible = false;
|
|
458
|
-
|
|
745
|
+
if (shown.length > clipped.length)
|
|
746
|
+
renderer.render(this.scene, this.camera);
|
|
459
747
|
if (clipped.length) {
|
|
460
748
|
const oldScissor = renderer.getScissor(new THREE.Vector4());
|
|
461
749
|
const oldTest = renderer.getScissorTest();
|
|
@@ -475,12 +763,25 @@ export class CatalogSpatialElementLayer {
|
|
|
475
763
|
continue;
|
|
476
764
|
renderer.setScissor(left, top, right - left, bottom - top);
|
|
477
765
|
renderer.setScissorTest(true);
|
|
478
|
-
for (const actor of group)
|
|
479
|
-
actor.root.visible = true;
|
|
480
766
|
const fog = this.scene.fog;
|
|
481
|
-
this.scene.fog =
|
|
767
|
+
this.scene.fog = null;
|
|
482
768
|
try {
|
|
483
|
-
|
|
769
|
+
if (group.some((actor) => ((actor.blur ?? 0) >= 0.05 || actor.hover > 0) && actor.renderRect)) {
|
|
770
|
+
// Resolve far-to-near into the same output; scratch buffers are shared by every seat.
|
|
771
|
+
group.sort((a, b) => a.root.matrix.elements[14] - b.root.matrix.elements[14]);
|
|
772
|
+
for (const actor of group) {
|
|
773
|
+
actor.root.visible = true;
|
|
774
|
+
this.depthBlur.render(renderer, this.carouselCamera, actor.renderRect ?? rect, actor.blur ?? 0, (camera) => renderer.render(this.scene, camera), rect);
|
|
775
|
+
if (actor.hover > 0 && actor.renderRect)
|
|
776
|
+
this.outline.render(renderer, this.carouselCamera, actor.model, actor.renderRect, rect, actor.hover * (actor.materials[0]?.material.opacity ?? 1), this.interactionTheme(), warmOutput);
|
|
777
|
+
actor.root.visible = false;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
else {
|
|
781
|
+
for (const actor of group)
|
|
782
|
+
actor.root.visible = true;
|
|
783
|
+
renderer.render(this.scene, this.carouselCamera);
|
|
784
|
+
}
|
|
484
785
|
}
|
|
485
786
|
finally {
|
|
486
787
|
this.scene.fog = fog;
|
|
@@ -499,7 +800,7 @@ export class CatalogSpatialElementLayer {
|
|
|
499
800
|
actor.card?.setAttribute('data-catalog-model-ready', '');
|
|
500
801
|
}
|
|
501
802
|
}
|
|
502
|
-
});
|
|
803
|
+
}, warmOutput, this.frozenSourceForBand(band, warmOutput));
|
|
503
804
|
for (const actor of all)
|
|
504
805
|
actor.root.visible = true;
|
|
505
806
|
if (band === 'front' && this.handoff)
|
|
@@ -509,17 +810,50 @@ export class CatalogSpatialElementLayer {
|
|
|
509
810
|
hasCarousel() {
|
|
510
811
|
return [...this.actors.values()].some((actor) => Boolean(actor.pose));
|
|
511
812
|
}
|
|
512
|
-
|
|
513
|
-
|
|
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);
|
|
514
824
|
}
|
|
515
825
|
/** Warm the existing Low material passes in an offscreen preparation target. */
|
|
516
826
|
renderForPreparation(renderer) {
|
|
517
|
-
this.
|
|
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
|
+
});
|
|
518
850
|
}
|
|
519
851
|
/** Applies only to outgoing list actors; the shared handoff geometry keeps its authored alpha. */
|
|
520
852
|
setExitOpacity(opacity, active = false) {
|
|
521
853
|
this.exitOpacity = Number.isFinite(opacity) ? Math.min(1, Math.max(0, opacity)) : 0;
|
|
522
854
|
this.transitionActive = active;
|
|
855
|
+
if (active)
|
|
856
|
+
this.cancelActivationFocusRequest();
|
|
523
857
|
this.invalidate();
|
|
524
858
|
}
|
|
525
859
|
capture(spatialElementId, occurrence) {
|
|
@@ -530,11 +864,12 @@ export class CatalogSpatialElementLayer {
|
|
|
530
864
|
: !item.occurrence || item.card?.hasAttribute('data-catalog-selected')));
|
|
531
865
|
if (!actor?.rendered || !actor.root.visible)
|
|
532
866
|
return false;
|
|
867
|
+
this.stagedSourceCapture = undefined;
|
|
533
868
|
this.finishHandoff();
|
|
534
869
|
this.handoffPoint = undefined;
|
|
535
870
|
actor.model.updateWorldMatrix(true, true);
|
|
536
871
|
const camera = actor.pose ? this.carouselCamera : this.camera;
|
|
537
|
-
this.handoffScene.fog = actor.pose ?
|
|
872
|
+
this.handoffScene.fog = actor.pose ? null : this.scene.fog;
|
|
538
873
|
camera.updateMatrixWorld();
|
|
539
874
|
const sourceModel = actor.model.matrixWorld.clone();
|
|
540
875
|
const sourceClip = normalizeSpatialElementClipMatrix(new THREE.Matrix4()
|
|
@@ -556,6 +891,209 @@ export class CatalogSpatialElementLayer {
|
|
|
556
891
|
this.invalidate();
|
|
557
892
|
return true;
|
|
558
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
|
+
}
|
|
559
1097
|
/** Last submitted geometry position; diagnostics never advance animation or read DOM layout. */
|
|
560
1098
|
setDestinationSpatialElement(spatialElementId) {
|
|
561
1099
|
this.destinationSpatialElement = spatialElementId;
|
|
@@ -580,17 +1118,19 @@ export class CatalogSpatialElementLayer {
|
|
|
580
1118
|
if (!actor?.slot?.isConnected)
|
|
581
1119
|
return;
|
|
582
1120
|
const rect = actor.slot.getBoundingClientRect();
|
|
1121
|
+
const visibleRect = actor.pose && actor.renderRect ? actor.renderRect : rect;
|
|
583
1122
|
if (rect.width <= 0 ||
|
|
584
1123
|
rect.height <= 0 ||
|
|
585
1124
|
(actor.pose
|
|
586
|
-
?
|
|
1125
|
+
? visibleRect.left + visibleRect.width <= 0 || visibleRect.top + visibleRect.height <= 0 ||
|
|
1126
|
+
visibleRect.left >= innerWidth || visibleRect.top >= innerHeight
|
|
587
1127
|
: rect.left < 0 || rect.top < 0 || rect.right > innerWidth || rect.bottom > innerHeight))
|
|
588
1128
|
return;
|
|
589
1129
|
actor.model.updateWorldMatrix(true, true);
|
|
590
1130
|
const camera = actor.pose ? this.carouselCamera : this.camera;
|
|
591
1131
|
return {
|
|
592
1132
|
environmentIntensity: this.scene.environmentIntensity,
|
|
593
|
-
fog: actor.pose ?
|
|
1133
|
+
fog: actor.pose ? null : this.scene.fog,
|
|
594
1134
|
viewportClip: actor.clip ? { ...actor.clip } : undefined,
|
|
595
1135
|
model: actor.model.matrixWorld.clone(),
|
|
596
1136
|
camera: camera.matrixWorld.clone(),
|
|
@@ -607,6 +1147,7 @@ export class CatalogSpatialElementLayer {
|
|
|
607
1147
|
const handoff = this.handoff;
|
|
608
1148
|
if (!handoff)
|
|
609
1149
|
return;
|
|
1150
|
+
this.stagedSourceCapture = undefined;
|
|
610
1151
|
const actor = handoff.actor;
|
|
611
1152
|
const model = actor.model;
|
|
612
1153
|
model.updateWorldMatrix(true, true);
|
|
@@ -617,7 +1158,7 @@ export class CatalogSpatialElementLayer {
|
|
|
617
1158
|
: this.camera;
|
|
618
1159
|
camera.updateMatrixWorld();
|
|
619
1160
|
const projection = {
|
|
620
|
-
fog: actor.pose ?
|
|
1161
|
+
fog: actor.pose ? null : this.scene.fog,
|
|
621
1162
|
viewportClip: actor.clip ? { ...actor.clip } : undefined,
|
|
622
1163
|
model: model.matrixWorld.clone(),
|
|
623
1164
|
camera: camera.matrixWorld.clone(),
|
|
@@ -633,18 +1174,39 @@ export class CatalogSpatialElementLayer {
|
|
|
633
1174
|
this.actors.delete(actor.key);
|
|
634
1175
|
this.detachedInstances++;
|
|
635
1176
|
let released = false;
|
|
1177
|
+
const release = () => {
|
|
1178
|
+
if (released)
|
|
1179
|
+
return;
|
|
1180
|
+
released = true;
|
|
1181
|
+
this.detachedInstances--;
|
|
1182
|
+
this.disposeActor(actor);
|
|
1183
|
+
};
|
|
636
1184
|
return {
|
|
637
1185
|
model,
|
|
638
1186
|
projection,
|
|
639
1187
|
referencePoint: actor.referencePoint.clone(),
|
|
640
1188
|
environment: handoff.sourceEnvironment,
|
|
641
1189
|
highEnvironment: handoff.highEnvironment,
|
|
642
|
-
release
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
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;
|
|
647
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;
|
|
648
1210
|
}
|
|
649
1211
|
};
|
|
650
1212
|
}
|
|
@@ -667,6 +1229,7 @@ export class CatalogSpatialElementLayer {
|
|
|
667
1229
|
const handoff = this.handoff;
|
|
668
1230
|
if (!handoff)
|
|
669
1231
|
return;
|
|
1232
|
+
this.stagedSourceCapture = undefined;
|
|
670
1233
|
this.handoff = undefined;
|
|
671
1234
|
const actor = handoff.actor;
|
|
672
1235
|
applyCatalogMaterialOpacity(actor.materials, 1);
|
|
@@ -692,11 +1255,18 @@ export class CatalogSpatialElementLayer {
|
|
|
692
1255
|
applyCatalogMaterialOpacity(this.handoff.actor.materials, opacity);
|
|
693
1256
|
}
|
|
694
1257
|
dispose() {
|
|
1258
|
+
this.stagedSourceCapture = undefined;
|
|
1259
|
+
this.cancelActivationFocusRequest();
|
|
1260
|
+
this.ground.dispose();
|
|
695
1261
|
this.glass.dispose();
|
|
1262
|
+
this.sectionSurfaces.dispose();
|
|
1263
|
+
this.depthBlur.dispose();
|
|
696
1264
|
this.geometryFade.dispose();
|
|
1265
|
+
this.outline.dispose();
|
|
697
1266
|
if (this.disposed)
|
|
698
1267
|
return;
|
|
699
1268
|
this.disposed = true;
|
|
1269
|
+
this.unsubscribeDeviceYaw();
|
|
700
1270
|
this.generation += 1;
|
|
701
1271
|
for (const request of this.requests)
|
|
702
1272
|
request.abort();
|
|
@@ -705,6 +1275,11 @@ export class CatalogSpatialElementLayer {
|
|
|
705
1275
|
for (const actor of this.actors.values())
|
|
706
1276
|
this.disposeActor(actor);
|
|
707
1277
|
window.removeEventListener('pointermove', this.pointerMove);
|
|
1278
|
+
window.removeEventListener('pointerdown', this.pointerDown, true);
|
|
1279
|
+
window.removeEventListener('pointerup', this.pointerUp);
|
|
1280
|
+
window.removeEventListener('pointercancel', this.pointerUp);
|
|
1281
|
+
window.removeEventListener('focusin', this.focusChange);
|
|
1282
|
+
window.removeEventListener('focusout', this.focusChange);
|
|
708
1283
|
window.removeEventListener('pointerleave', this.pointerLeave);
|
|
709
1284
|
window.removeEventListener('blur', this.pointerLeave);
|
|
710
1285
|
window.removeEventListener('resize', this.resize);
|
|
@@ -751,17 +1326,21 @@ export class CatalogSpatialElementLayer {
|
|
|
751
1326
|
material.dispose();
|
|
752
1327
|
throw new Error('Catalog asset contains no spatialElement geometry');
|
|
753
1328
|
}
|
|
1329
|
+
const detailLowBounds = getMeshBounds(model, (mesh) => !excluded.has(mesh.name));
|
|
1330
|
+
const detailLowBoundsPoints = getMeshBoundsPoints(model, (mesh) => !excluded.has(mesh.name));
|
|
754
1331
|
const radius = Math.max(bounds.getBoundingSphere(new THREE.Sphere()).radius, 0.001);
|
|
755
1332
|
const root = new THREE.Group();
|
|
756
1333
|
root.matrixAutoUpdate = false;
|
|
757
1334
|
const tilt = new THREE.Group();
|
|
758
1335
|
const view = new THREE.Group();
|
|
759
1336
|
view.quaternion.copy(getCameraOrbitQuaternion(stage.camera?.azimuth, stage.camera?.elevation).invert());
|
|
1337
|
+
const supportPoints = carouselSupport(model, view.quaternion);
|
|
760
1338
|
root.add(tilt);
|
|
761
1339
|
tilt.add(view);
|
|
762
1340
|
view.add(model);
|
|
763
1341
|
const materials = captureCatalogMaterialOpacity(model);
|
|
764
1342
|
applyCatalogMaterialOpacity(materials, 1);
|
|
1343
|
+
const hitCorners = [bounds.min.x, bounds.max.x].flatMap((x) => [bounds.min.y, bounds.max.y].flatMap((y) => [bounds.min.z, bounds.max.z].map((z) => new THREE.Vector3(x, y, z))));
|
|
765
1344
|
return {
|
|
766
1345
|
key,
|
|
767
1346
|
brandId,
|
|
@@ -769,11 +1348,20 @@ export class CatalogSpatialElementLayer {
|
|
|
769
1348
|
stage,
|
|
770
1349
|
instance,
|
|
771
1350
|
model,
|
|
1351
|
+
detailFrame: model.matrix.clone(),
|
|
1352
|
+
detailBounds: bounds.clone(),
|
|
1353
|
+
detailLowBounds,
|
|
1354
|
+
detailLowBoundsPoints,
|
|
772
1355
|
root,
|
|
773
1356
|
tilt,
|
|
774
1357
|
view,
|
|
1358
|
+
viewOrientation: view.quaternion.clone(),
|
|
775
1359
|
radius,
|
|
776
|
-
hitCorners
|
|
1360
|
+
hitCorners,
|
|
1361
|
+
fitCorners: hitCorners.map((corner) => corner.clone().applyQuaternion(view.quaternion)),
|
|
1362
|
+
supportPoints,
|
|
1363
|
+
cardScale: 1,
|
|
1364
|
+
hover: 0,
|
|
777
1365
|
referencePoint,
|
|
778
1366
|
overrides,
|
|
779
1367
|
materials,
|
|
@@ -781,12 +1369,15 @@ export class CatalogSpatialElementLayer {
|
|
|
781
1369
|
scrollY: 0,
|
|
782
1370
|
rotationX: 0,
|
|
783
1371
|
rotationY: 0,
|
|
1372
|
+
deviceYaw: 0,
|
|
1373
|
+
devicePitch: 0,
|
|
1374
|
+
deviceRoll: 0,
|
|
784
1375
|
lift: 0,
|
|
785
1376
|
rendered: false
|
|
786
1377
|
};
|
|
787
1378
|
}
|
|
788
1379
|
measureActors(scrollX, scrollY) {
|
|
789
|
-
if (this.handoff)
|
|
1380
|
+
if (this.handoff || this.stagedSourceFrozen)
|
|
790
1381
|
return;
|
|
791
1382
|
const measured = [];
|
|
792
1383
|
for (const actor of this.actors.values()) {
|
|
@@ -802,12 +1393,35 @@ export class CatalogSpatialElementLayer {
|
|
|
802
1393
|
actor.card.style.transform = 'none';
|
|
803
1394
|
}
|
|
804
1395
|
// Batch neutral-pose writes, measurements, and restoration to avoid per-card layout thrashing.
|
|
1396
|
+
const surfaces = new Map();
|
|
805
1397
|
for (const { actor } of measured) {
|
|
806
1398
|
actor.cardRect = actor.card.getBoundingClientRect();
|
|
807
1399
|
actor.slotRect = actor.slot.getBoundingClientRect();
|
|
1400
|
+
if (!actor.pose)
|
|
1401
|
+
actor.cardScale = cardModelFit(actor.fitCorners, actor.slotRect.width, actor.slotRect.height);
|
|
1402
|
+
if (actor.pose) {
|
|
1403
|
+
const surface = actor.card.closest('[data-section-background-size]')
|
|
1404
|
+
?.querySelector(':scope > .ps-section-surface');
|
|
1405
|
+
if (surface && !surfaces.has(surface)) {
|
|
1406
|
+
const { left, top, width, height } = surface.getBoundingClientRect();
|
|
1407
|
+
surfaces.set(surface, { left, top, width, height });
|
|
1408
|
+
}
|
|
1409
|
+
actor.sectionRect = surface ? surfaces.get(surface) : undefined;
|
|
1410
|
+
actor.hitTarget = actor.card.querySelector('.spatial-element-target') ?? undefined;
|
|
1411
|
+
const panel = actor.card.querySelector('.summary') ?? undefined;
|
|
1412
|
+
if (actor.summaryPanel && actor.summaryPanel !== panel)
|
|
1413
|
+
this.layoutObserver.unobserve(actor.summaryPanel);
|
|
1414
|
+
actor.summaryPanel = panel;
|
|
1415
|
+
actor.summarySize = panel ? { width: panel.offsetWidth, height: panel.offsetHeight } : undefined;
|
|
1416
|
+
actor.summaryOrigin = panel ? { x: panel.offsetLeft ?? 0, y: panel.offsetTop ?? 0 } : undefined;
|
|
1417
|
+
// Summary content can resize without changing its section's fixed height.
|
|
1418
|
+
if (panel)
|
|
1419
|
+
this.layoutObserver.observe(panel);
|
|
1420
|
+
}
|
|
808
1421
|
actor.scrollX = scrollX;
|
|
809
1422
|
actor.scrollY = scrollY;
|
|
810
1423
|
}
|
|
1424
|
+
this.sectionSurfaces.sync(surfaces, scrollX, scrollY);
|
|
811
1425
|
for (const { actor, previousTransform } of measured)
|
|
812
1426
|
actor.card.style.transform = previousTransform;
|
|
813
1427
|
this.layoutDirty = false;
|
|
@@ -889,6 +1503,10 @@ export class CatalogSpatialElementLayer {
|
|
|
889
1503
|
};
|
|
890
1504
|
}
|
|
891
1505
|
disposeActor(actor) {
|
|
1506
|
+
this.stagedSourceCapture = undefined;
|
|
1507
|
+
this.outline.release(actor.model);
|
|
1508
|
+
if (actor.summaryPanel)
|
|
1509
|
+
this.layoutObserver.unobserve(actor.summaryPanel);
|
|
892
1510
|
actor.root.removeFromParent();
|
|
893
1511
|
actor.model.removeFromParent();
|
|
894
1512
|
actor.card?.removeAttribute('data-catalog-model-ready');
|