@spatial-elements/core 1.0.0-beta.11 → 1.0.0-beta.13

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 (84) hide show
  1. package/dist/catalog/stagedDockGeometry.js +2 -2
  2. package/dist/catalog/stagedDockGeometry.js.map +1 -1
  3. package/dist/spatial-element/SpatialElementDockController.d.ts +1 -2
  4. package/dist/spatial-element/SpatialElementDockController.d.ts.map +1 -1
  5. package/dist/spatial-element/SpatialElementDockController.js +13 -31
  6. package/dist/spatial-element/SpatialElementDockController.js.map +1 -1
  7. package/dist/spatial-element/SpatialElementHeaderFields.d.ts +18 -0
  8. package/dist/spatial-element/SpatialElementHeaderFields.d.ts.map +1 -0
  9. package/dist/spatial-element/SpatialElementHeaderFields.js +100 -0
  10. package/dist/spatial-element/SpatialElementHeaderFields.js.map +1 -0
  11. package/dist/spatial-element/SpatialElementPaneController.d.ts +0 -1
  12. package/dist/spatial-element/SpatialElementPaneController.d.ts.map +1 -1
  13. package/dist/spatial-element/SpatialElementPaneController.js +3 -7
  14. package/dist/spatial-element/SpatialElementPaneController.js.map +1 -1
  15. package/dist/spatial-element/messages.d.ts +1 -0
  16. package/dist/spatial-element/messages.d.ts.map +1 -1
  17. package/dist/spatial-element/messages.js +2 -1
  18. package/dist/spatial-element/messages.js.map +1 -1
  19. package/dist/spatial-element/spatialElementDock.d.ts +1 -1
  20. package/dist/spatial-element/spatialElementDock.js +1 -1
  21. package/dist/spatial-element/spatialElementDock.js.map +1 -1
  22. package/dist/stage/DetailWheelGesture.d.ts +9 -0
  23. package/dist/stage/DetailWheelGesture.d.ts.map +1 -0
  24. package/dist/stage/DetailWheelGesture.js +16 -0
  25. package/dist/stage/DetailWheelGesture.js.map +1 -0
  26. package/dist/stage/LiquidGlassPanel.d.ts +2 -0
  27. package/dist/stage/LiquidGlassPanel.d.ts.map +1 -1
  28. package/dist/stage/LiquidGlassPanel.js +24 -17
  29. package/dist/stage/LiquidGlassPanel.js.map +1 -1
  30. package/dist/stage/MinimapController.d.ts +1 -0
  31. package/dist/stage/MinimapController.d.ts.map +1 -1
  32. package/dist/stage/MinimapController.js +10 -4
  33. package/dist/stage/MinimapController.js.map +1 -1
  34. package/dist/stage/PanelPresentationController.d.ts.map +1 -1
  35. package/dist/stage/PanelPresentationController.js +18 -1
  36. package/dist/stage/PanelPresentationController.js.map +1 -1
  37. package/dist/stage/SpatialElementInteractionController.d.ts +21 -0
  38. package/dist/stage/SpatialElementInteractionController.d.ts.map +1 -1
  39. package/dist/stage/SpatialElementInteractionController.js +185 -16
  40. package/dist/stage/SpatialElementInteractionController.js.map +1 -1
  41. package/dist/stage/SpatialElementPresentationController.js +4 -4
  42. package/dist/stage/SpatialElementPresentationController.js.map +1 -1
  43. package/dist/stage/StageExperience.d.ts +8 -0
  44. package/dist/stage/StageExperience.d.ts.map +1 -1
  45. package/dist/stage/StageExperience.js +37 -21
  46. package/dist/stage/StageExperience.js.map +1 -1
  47. package/dist/stage/StageRenderPipeline.d.ts +4 -0
  48. package/dist/stage/StageRenderPipeline.d.ts.map +1 -1
  49. package/dist/stage/StageRenderPipeline.js +37 -3
  50. package/dist/stage/StageRenderPipeline.js.map +1 -1
  51. package/dist/stage/browserPinch.d.ts +5 -0
  52. package/dist/stage/browserPinch.d.ts.map +1 -0
  53. package/dist/stage/browserPinch.js +29 -0
  54. package/dist/stage/browserPinch.js.map +1 -0
  55. package/dist/stage/minimap/MinimapModelGeometry.d.ts +2 -0
  56. package/dist/stage/minimap/MinimapModelGeometry.d.ts.map +1 -1
  57. package/dist/stage/minimap/MinimapModelGeometry.js +28 -0
  58. package/dist/stage/minimap/MinimapModelGeometry.js.map +1 -1
  59. package/dist/stage/panelContext.d.ts +3 -1
  60. package/dist/stage/panelContext.d.ts.map +1 -1
  61. package/dist/stage/panelContext.js.map +1 -1
  62. package/dist/stage/panelFocusMath.d.ts +8 -0
  63. package/dist/stage/panelFocusMath.d.ts.map +1 -1
  64. package/dist/stage/panelFocusMath.js +12 -0
  65. package/dist/stage/panelFocusMath.js.map +1 -1
  66. package/dist/stage/spaceMousePermission.d.ts +2 -0
  67. package/dist/stage/spaceMousePermission.d.ts.map +1 -1
  68. package/dist/stage/spaceMousePermission.js +10 -4
  69. package/dist/stage/spaceMousePermission.js.map +1 -1
  70. package/dist/stage/spaceMousePlatform.d.ts +1 -1
  71. package/dist/stage/spaceMousePlatform.d.ts.map +1 -1
  72. package/dist/stage/spaceMousePlatform.js +7 -1
  73. package/dist/stage/spaceMousePlatform.js.map +1 -1
  74. package/dist/stage/stageMath.d.ts +2 -7
  75. package/dist/stage/stageMath.d.ts.map +1 -1
  76. package/dist/stage/stageMath.js +4 -9
  77. package/dist/stage/stageMath.js.map +1 -1
  78. package/dist/stage/stageTypes.d.ts +1 -0
  79. package/dist/stage/stageTypes.d.ts.map +1 -1
  80. package/dist/stage/stageTypes.js.map +1 -1
  81. package/dist/stage/stageVisualTest.d.ts +1 -0
  82. package/dist/stage/stageVisualTest.d.ts.map +1 -1
  83. package/dist/stage/stageVisualTest.js.map +1 -1
  84. package/package.json +1 -1
@@ -28,7 +28,7 @@ import { STAGE_PANEL_LAYOUT_EVENT, STAGE_PANEL_VISUAL_EVENT } from './panelConte
28
28
  import { DEFAULT_BACKGROUND, DEFAULT_INTERACTION_THEME, DEFAULT_PANELS, PANEL_CAMERA_FOV, PANEL_CONTENT_Z, ZOOM_FOCUS_NOTIFY_EPSILON } from './stageConstants.js';
29
29
  import { getStagePositionFromRect, isViewportRectVisible } from './stageDom.js';
30
30
  import { STAGE_SCROLL_PRIORITY, getStageVisualScrollPosition, hasPendingStageScrollFrame, subscribeStageScrollFrame } from './scrollFrame.js';
31
- import { getCameraOrbitDirection, getBoxCorners, getPanelFocusOpacity, getPerspectiveDistance, getSequencedMinimapFocus, getStageUiFocus, getZoomFocusDistanceRange, hasPanelGeometryChanged } from './stageMath.js';
31
+ import { getCameraOrbitDirection, getBoxCorners, getPanelFocusOpacity, getPerspectiveDistance, getSequencedMinimapFocus, getZoomFocusDistanceRange, hasPanelGeometryChanged } from './stageMath.js';
32
32
  import { disposeMinimapModelMaterials } from './minimap/MinimapModel.js';
33
33
  import {} from './minimap/MinimapProjection.js';
34
34
  import { disposeMaterialOnly, getMeshBounds, getMeshMaterials, isMesh } from './stageSceneUtils.js';
@@ -269,6 +269,8 @@ export class StageExperience {
269
269
  pointerDown = (event) => this.handlePointerDown(event);
270
270
  pointerUp = (event) => this.handlePointerUp(event);
271
271
  touchStart = (event) => this.interaction.handleTouchStart(event);
272
+ touchMove = (event) => this.interaction.handleTouchMove(event);
273
+ touchEnd = (event) => this.interaction.handleTouchEnd(event);
272
274
  wheel = (event) => this.handleWheel(event);
273
275
  scroll = (frame) => this.handleScrollFrame(frame);
274
276
  finishScroll = () => {
@@ -351,8 +353,11 @@ export class StageExperience {
351
353
  return;
352
354
  const layout = resolveDetailLayout(input);
353
355
  const split = layout.composition === 'split';
356
+ const container = this.container;
354
357
  return { media: this.detailMedia, split,
355
- paneHidden: split && (this.fullscreen || this.panelUiFocus >= 0.99),
358
+ paneHidden: this.fullscreen || getPanelFocusOpacity(this.panelUiFocus) < 0.12,
359
+ uiFocus: this.panelUiFocus,
360
+ get contentTop() { return container.querySelector('.spatial-element-section-list')?.getBoundingClientRect().top; },
356
361
  paneLeft: layout.base.pane.x };
357
362
  }
358
363
  fullscreen = false;
@@ -467,6 +472,7 @@ export class StageExperience {
467
472
  hovering: this.modelHover,
468
473
  interacting: this.modelInteractionActive,
469
474
  scrolling: this.scrollActive,
475
+ minimapFocus: this.minimapFocus,
470
476
  fullscreen: this.fullscreen
471
477
  }),
472
478
  environment: () => this.environmentTarget,
@@ -558,6 +564,7 @@ export class StageExperience {
558
564
  stageViewportVisible: this.stageViewportVisible,
559
565
  detailMediaActive: this.detailMediaActive,
560
566
  modelHover: this.modelHover,
567
+ outlineOpacity: this.interaction.outlineOpacity,
561
568
  modelInteractionActive: this.modelInteractionActive,
562
569
  catalog: this.catalog,
563
570
  pageModelReady: this.pageModelReady,
@@ -648,8 +655,11 @@ export class StageExperience {
648
655
  window.addEventListener('blur', this.pointerLeave);
649
656
  document.addEventListener('visibilitychange', this.visibilityChange);
650
657
  this.backgroundCanvas.addEventListener('pointerdown', this.pointerDown, { capture: true });
651
- this.backgroundCanvas.addEventListener('touchstart', this.touchStart, { passive: false });
652
- this.backgroundCanvas.addEventListener('wheel', this.wheel, {
658
+ window.addEventListener('touchstart', this.touchStart, { capture: true, passive: false });
659
+ window.addEventListener('touchmove', this.touchMove, { capture: true, passive: false });
660
+ window.addEventListener('touchend', this.touchEnd, true);
661
+ window.addEventListener('touchcancel', this.touchEnd, true);
662
+ window.addEventListener('wheel', this.wheel, {
653
663
  capture: true,
654
664
  passive: false
655
665
  });
@@ -691,8 +701,11 @@ export class StageExperience {
691
701
  this.backgroundCanvas.removeEventListener('pointerdown', this.pointerDown, {
692
702
  capture: true
693
703
  });
694
- this.backgroundCanvas.removeEventListener('wheel', this.wheel, { capture: true });
695
- this.backgroundCanvas.removeEventListener('touchstart', this.touchStart);
704
+ window.removeEventListener('wheel', this.wheel, { capture: true });
705
+ window.removeEventListener('touchstart', this.touchStart, true);
706
+ window.removeEventListener('touchmove', this.touchMove, true);
707
+ window.removeEventListener('touchend', this.touchEnd, true);
708
+ window.removeEventListener('touchcancel', this.touchEnd, true);
696
709
  if (this.renderRequestId)
697
710
  cancelAnimationFrame(this.renderRequestId);
698
711
  this.renderRequestId = 0;
@@ -861,13 +874,7 @@ export class StageExperience {
861
874
  if (previousExcludeMesh !== this.interactionTheme.excludeMesh && this.model) {
862
875
  const pickModel = this.refinementState === 'high' && this.highPose ? this.highPose : this.model;
863
876
  this.collectModelPickTargets(pickModel);
864
- if (pickModel === this.model)
865
- this.pipeline.createModelOutline(this.model);
866
- else {
867
- const outline = this.model.clone(false);
868
- outline.add(pickModel.clone(true));
869
- this.pipeline.createModelOutline(outline);
870
- }
877
+ this.pipeline.createModelOutline(pickModel);
871
878
  }
872
879
  const changed = [];
873
880
  let surfaceChanged = false;
@@ -1438,7 +1445,9 @@ export class StageExperience {
1438
1445
  this.pageModelReady = false;
1439
1446
  this.spatialCapture = new SpatialGeometryCapture(model, projection, {
1440
1447
  environment: this.scene.environment,
1441
- outlineTheme: this.modelHover ? this.interactionTheme : undefined,
1448
+ outlineTheme: this.modelHover && this.interaction.outlineOpacity > 0 ? {
1449
+ ...this.interactionTheme, outlineOpacity: this.interactionTheme.outlineOpacity * this.interaction.outlineOpacity
1450
+ } : undefined,
1442
1451
  environmentIntensity: this.scene.environmentIntensity,
1443
1452
  lights: this.scene.children.filter((child) => child instanceof THREE.Light),
1444
1453
  high: highPose,
@@ -1747,9 +1756,7 @@ export class StageExperience {
1747
1756
  this.presentation.finishHandoff(this.catalogMode === 'synchronous');
1748
1757
  if (!this.disposed && this.highPose && this.model && this.refinementState === 'high') {
1749
1758
  this.collectModelPickTargets(this.highPose);
1750
- const outline = this.model.clone(false);
1751
- outline.add(this.highPose.clone(true));
1752
- this.pipeline.createModelOutline(outline);
1759
+ this.pipeline.createModelOutline(this.highPose);
1753
1760
  }
1754
1761
  if (this.pageModelReady && !this.disposed)
1755
1762
  this.startHighRequest();
@@ -1801,8 +1808,8 @@ export class StageExperience {
1801
1808
  this.camera.updateMatrixWorld(true);
1802
1809
  this.controls.update();
1803
1810
  this.panelFocus = this.getZoomFocusFactor();
1804
- this.panelUiFocus = getStageUiFocus(this.panelFocus);
1805
- this.minimapFocus = getSequencedMinimapFocus(this.panelFocus, this.panelUiFocus);
1811
+ this.panelUiFocus = this.interaction.getUiFocus(this.panelFocus);
1812
+ this.minimapFocus = getSequencedMinimapFocus(this.panelFocus, this.panelUiFocus, window.innerWidth);
1806
1813
  this.layoutDirty = true;
1807
1814
  this.lastFrameTime = performance.now();
1808
1815
  this.requestRender();
@@ -1898,6 +1905,14 @@ export class StageExperience {
1898
1905
  return this.getDockProjection(true)?.clip.toArray() ?? null;
1899
1906
  return this.model ? captureSpatialElementProjection(this.model, this.camera).clip.toArray() : null;
1900
1907
  }
1908
+ /** Compare the last rendered mask with the live representation, including High refinement. */
1909
+ getVisualTestOutlinePose() {
1910
+ const model = this.refinementState === 'high' && this.highPose ? this.highPose : this.model;
1911
+ if (!model)
1912
+ return null;
1913
+ model.updateWorldMatrix(true, false);
1914
+ return { model: model.matrixWorld.toArray(), mask: this.pipeline.getOutlineWorldMatrix(), high: this.refinementState === 'high' };
1915
+ }
1901
1916
  /** Returns the main element's projected bounds for query-gated layout regressions. */
1902
1917
  getVisualTestModelRect() {
1903
1918
  if (!this.model || this.modelBounds.isEmpty())
@@ -2895,9 +2910,10 @@ export class StageExperience {
2895
2910
  // The damped camera distance is the single animation clock for geometry and
2896
2911
  // every close-up UI phase. Phase remapping remains, temporal lag does not.
2897
2912
  this.panelFocus = this.detailMediaActive ? this.getZoomFocusFactor() : 0;
2898
- this.panelUiFocus = this.fullscreen ? 1 : getStageUiFocus(this.panelFocus);
2899
- this.minimapFocus = this.fullscreen ? 1 : getSequencedMinimapFocus(this.panelFocus, this.panelUiFocus);
2913
+ this.panelUiFocus = this.fullscreen ? 1 : this.interaction.getUiFocus(this.panelFocus);
2914
+ this.minimapFocus = this.fullscreen ? 1 : getSequencedMinimapFocus(this.panelFocus, this.panelUiFocus, window.innerWidth);
2900
2915
  this.updateStageCameraProjection();
2916
+ this.interaction.compensateZoomAnchor();
2901
2917
  this.reportZoomFocus({
2902
2918
  focus: this.panelFocus,
2903
2919
  uiFocus: this.panelUiFocus,