@spatial-elements/core 1.0.0-beta.12 → 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 (42) hide show
  1. package/dist/spatial-element/SpatialElementPaneController.js +3 -3
  2. package/dist/spatial-element/SpatialElementPaneController.js.map +1 -1
  3. package/dist/stage/DetailWheelGesture.d.ts +9 -0
  4. package/dist/stage/DetailWheelGesture.d.ts.map +1 -0
  5. package/dist/stage/DetailWheelGesture.js +16 -0
  6. package/dist/stage/DetailWheelGesture.js.map +1 -0
  7. package/dist/stage/LiquidGlassPanel.d.ts +2 -0
  8. package/dist/stage/LiquidGlassPanel.d.ts.map +1 -1
  9. package/dist/stage/LiquidGlassPanel.js +24 -17
  10. package/dist/stage/LiquidGlassPanel.js.map +1 -1
  11. package/dist/stage/PanelPresentationController.d.ts.map +1 -1
  12. package/dist/stage/PanelPresentationController.js +2 -0
  13. package/dist/stage/PanelPresentationController.js.map +1 -1
  14. package/dist/stage/SpatialElementInteractionController.d.ts +21 -0
  15. package/dist/stage/SpatialElementInteractionController.d.ts.map +1 -1
  16. package/dist/stage/SpatialElementInteractionController.js +185 -16
  17. package/dist/stage/SpatialElementInteractionController.js.map +1 -1
  18. package/dist/stage/SpatialElementPresentationController.js +4 -4
  19. package/dist/stage/SpatialElementPresentationController.js.map +1 -1
  20. package/dist/stage/StageExperience.d.ts +8 -0
  21. package/dist/stage/StageExperience.d.ts.map +1 -1
  22. package/dist/stage/StageExperience.js +34 -19
  23. package/dist/stage/StageExperience.js.map +1 -1
  24. package/dist/stage/StageRenderPipeline.d.ts +3 -0
  25. package/dist/stage/StageRenderPipeline.d.ts.map +1 -1
  26. package/dist/stage/StageRenderPipeline.js +15 -0
  27. package/dist/stage/StageRenderPipeline.js.map +1 -1
  28. package/dist/stage/browserPinch.d.ts +5 -0
  29. package/dist/stage/browserPinch.d.ts.map +1 -0
  30. package/dist/stage/browserPinch.js +29 -0
  31. package/dist/stage/browserPinch.js.map +1 -0
  32. package/dist/stage/panelContext.d.ts +2 -1
  33. package/dist/stage/panelContext.d.ts.map +1 -1
  34. package/dist/stage/panelContext.js.map +1 -1
  35. package/dist/stage/panelFocusMath.d.ts +2 -0
  36. package/dist/stage/panelFocusMath.d.ts.map +1 -1
  37. package/dist/stage/panelFocusMath.js +8 -0
  38. package/dist/stage/panelFocusMath.js.map +1 -1
  39. package/dist/stage/stageVisualTest.d.ts +1 -0
  40. package/dist/stage/stageVisualTest.d.ts.map +1 -1
  41. package/dist/stage/stageVisualTest.js.map +1 -1
  42. 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;
@@ -559,6 +564,7 @@ export class StageExperience {
559
564
  stageViewportVisible: this.stageViewportVisible,
560
565
  detailMediaActive: this.detailMediaActive,
561
566
  modelHover: this.modelHover,
567
+ outlineOpacity: this.interaction.outlineOpacity,
562
568
  modelInteractionActive: this.modelInteractionActive,
563
569
  catalog: this.catalog,
564
570
  pageModelReady: this.pageModelReady,
@@ -649,8 +655,11 @@ export class StageExperience {
649
655
  window.addEventListener('blur', this.pointerLeave);
650
656
  document.addEventListener('visibilitychange', this.visibilityChange);
651
657
  this.backgroundCanvas.addEventListener('pointerdown', this.pointerDown, { capture: true });
652
- this.backgroundCanvas.addEventListener('touchstart', this.touchStart, { passive: false });
653
- 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, {
654
663
  capture: true,
655
664
  passive: false
656
665
  });
@@ -692,8 +701,11 @@ export class StageExperience {
692
701
  this.backgroundCanvas.removeEventListener('pointerdown', this.pointerDown, {
693
702
  capture: true
694
703
  });
695
- this.backgroundCanvas.removeEventListener('wheel', this.wheel, { capture: true });
696
- 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);
697
709
  if (this.renderRequestId)
698
710
  cancelAnimationFrame(this.renderRequestId);
699
711
  this.renderRequestId = 0;
@@ -862,13 +874,7 @@ export class StageExperience {
862
874
  if (previousExcludeMesh !== this.interactionTheme.excludeMesh && this.model) {
863
875
  const pickModel = this.refinementState === 'high' && this.highPose ? this.highPose : this.model;
864
876
  this.collectModelPickTargets(pickModel);
865
- if (pickModel === this.model)
866
- this.pipeline.createModelOutline(this.model);
867
- else {
868
- const outline = this.model.clone(false);
869
- outline.add(pickModel.clone(true));
870
- this.pipeline.createModelOutline(outline);
871
- }
877
+ this.pipeline.createModelOutline(pickModel);
872
878
  }
873
879
  const changed = [];
874
880
  let surfaceChanged = false;
@@ -1439,7 +1445,9 @@ export class StageExperience {
1439
1445
  this.pageModelReady = false;
1440
1446
  this.spatialCapture = new SpatialGeometryCapture(model, projection, {
1441
1447
  environment: this.scene.environment,
1442
- 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,
1443
1451
  environmentIntensity: this.scene.environmentIntensity,
1444
1452
  lights: this.scene.children.filter((child) => child instanceof THREE.Light),
1445
1453
  high: highPose,
@@ -1748,9 +1756,7 @@ export class StageExperience {
1748
1756
  this.presentation.finishHandoff(this.catalogMode === 'synchronous');
1749
1757
  if (!this.disposed && this.highPose && this.model && this.refinementState === 'high') {
1750
1758
  this.collectModelPickTargets(this.highPose);
1751
- const outline = this.model.clone(false);
1752
- outline.add(this.highPose.clone(true));
1753
- this.pipeline.createModelOutline(outline);
1759
+ this.pipeline.createModelOutline(this.highPose);
1754
1760
  }
1755
1761
  if (this.pageModelReady && !this.disposed)
1756
1762
  this.startHighRequest();
@@ -1802,7 +1808,7 @@ export class StageExperience {
1802
1808
  this.camera.updateMatrixWorld(true);
1803
1809
  this.controls.update();
1804
1810
  this.panelFocus = this.getZoomFocusFactor();
1805
- this.panelUiFocus = getStageUiFocus(this.panelFocus);
1811
+ this.panelUiFocus = this.interaction.getUiFocus(this.panelFocus);
1806
1812
  this.minimapFocus = getSequencedMinimapFocus(this.panelFocus, this.panelUiFocus, window.innerWidth);
1807
1813
  this.layoutDirty = true;
1808
1814
  this.lastFrameTime = performance.now();
@@ -1899,6 +1905,14 @@ export class StageExperience {
1899
1905
  return this.getDockProjection(true)?.clip.toArray() ?? null;
1900
1906
  return this.model ? captureSpatialElementProjection(this.model, this.camera).clip.toArray() : null;
1901
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
+ }
1902
1916
  /** Returns the main element's projected bounds for query-gated layout regressions. */
1903
1917
  getVisualTestModelRect() {
1904
1918
  if (!this.model || this.modelBounds.isEmpty())
@@ -2896,9 +2910,10 @@ export class StageExperience {
2896
2910
  // The damped camera distance is the single animation clock for geometry and
2897
2911
  // every close-up UI phase. Phase remapping remains, temporal lag does not.
2898
2912
  this.panelFocus = this.detailMediaActive ? this.getZoomFocusFactor() : 0;
2899
- this.panelUiFocus = this.fullscreen ? 1 : getStageUiFocus(this.panelFocus);
2913
+ this.panelUiFocus = this.fullscreen ? 1 : this.interaction.getUiFocus(this.panelFocus);
2900
2914
  this.minimapFocus = this.fullscreen ? 1 : getSequencedMinimapFocus(this.panelFocus, this.panelUiFocus, window.innerWidth);
2901
2915
  this.updateStageCameraProjection();
2916
+ this.interaction.compensateZoomAnchor();
2902
2917
  this.reportZoomFocus({
2903
2918
  focus: this.panelFocus,
2904
2919
  uiFocus: this.panelUiFocus,