@preference-sl/pref-viewer 2.18.0 → 3.0.0-beta.0
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 +267 -31
- package/index.d.ts +75 -6
- package/package.json +8 -2
- package/src/babylonjs-animation-controller.js +18 -10
- package/src/babylonjs-animation-opening-menu.js +80 -14
- package/src/babylonjs-animation-opening.js +3 -3
- package/src/babylonjs-ar-floor-bounds.js +169 -0
- package/src/babylonjs-ar-glass.js +128 -0
- package/src/babylonjs-ar-placement-feedback.js +449 -0
- package/src/babylonjs-ar-placement.js +1038 -0
- package/src/babylonjs-camera-wheel-motion.js +35 -2
- package/src/babylonjs-controller.js +507 -125
- package/src/babylonjs-orbital-pointers-input.js +186 -0
- package/src/{render-math.js → babylonjs-render-math.js} +11 -11
- package/src/babylonjs-selection-controller.js +4 -4
- package/src/babylonjs-view-cube-canvas-controller.js +1287 -0
- package/src/babylonjs-view-cube-canvas-orbit-math.js +220 -0
- package/src/babylonjs-view-cube-canvas-renderer.js +775 -0
- package/src/babylonjs-view-cube-controller.js +74 -1103
- package/src/babylonjs-view-cube-svg-controller.js +1012 -0
- package/src/file-storage.js +7 -4
- package/src/gltf-resolver.js +13 -8
- package/src/localization/translations.js +12 -0
- package/src/panzoom-controller.js +4 -4
- package/src/pref-viewer-2d.js +2 -2
- package/src/pref-viewer-3d.js +55 -9
- package/src/pref-viewer-controls-presentation.js +292 -0
- package/src/pref-viewer-dialog.js +86 -7
- package/src/pref-viewer-menu-3d.js +134 -17
- package/src/pref-viewer-style-controller.js +320 -0
- package/src/pref-viewer.js +133 -109
- package/src/quick-look-action.js +280 -0
- package/src/styles.js +702 -98
- package/src/babylonjs-view-cube-renderer.js +0 -548
- package/src/view-cube-orbit-math.js +0 -199
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Bridges native mouse-location wheel inertia to the viewer's render and navigation lifecycle.
|
|
2
|
+
* Bridges native mouse-location wheel and midpoint-pinch inertia to the viewer's render and navigation lifecycle.
|
|
3
3
|
* Babylon 9.11 keeps coupled pan/radius inertia on its wheel input, outside the public
|
|
4
|
-
* camera offsets. Keep that version-sensitive access here; Babylon still computes all zoom.
|
|
4
|
+
* camera offsets. Keep that version-sensitive access here; Babylon still computes all zoom and coupled focal movement.
|
|
5
5
|
*/
|
|
6
6
|
export default class BabylonJSCameraWheelMotion {
|
|
7
7
|
/**
|
|
@@ -58,6 +58,39 @@ export default class BabylonJSCameraWheelMotion {
|
|
|
58
58
|
input._hitPlane = null;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Queues a native coupled radius/target increment at a two-finger client midpoint.
|
|
63
|
+
* Uses the existing wheel surface/plane lookup and inertia so the scheduler, geometry guard
|
|
64
|
+
* and ViewCube cancellation retain the same owner. Scene pointer coordinates are restored
|
|
65
|
+
* synchronously even if picking throws; no synthetic wheel event or pointer hover is emitted.
|
|
66
|
+
* @param {object|null|undefined} camera - Orbital camera with native mouse-location zoom enabled.
|
|
67
|
+
* @param {number} delta - Native pinch radius increment; positive zooms inward.
|
|
68
|
+
* @param {{x:number, y:number}} center - Touch midpoint in client CSS pixels.
|
|
69
|
+
* @returns {boolean} True when queued; false leaves ordinary radial pinch as the fallback.
|
|
70
|
+
* @throws {Error} Propagates native picking failures after restoring scene pointer coordinates.
|
|
71
|
+
*/
|
|
72
|
+
static zoomAtClientPoint(camera, delta, center) {
|
|
73
|
+
const input = this.#input(camera);
|
|
74
|
+
if (!input || !Number.isFinite(delta) || !delta || !center || !Number.isFinite(center.x) || !Number.isFinite(center.y)) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
const scene = camera.getScene();
|
|
78
|
+
const rect = camera.getEngine().getInputElementClientRect();
|
|
79
|
+
const previousX = scene.pointerX;
|
|
80
|
+
const previousY = scene.pointerY;
|
|
81
|
+
try {
|
|
82
|
+
scene.pointerX = center.x - (rect?.left ?? 0);
|
|
83
|
+
scene.pointerY = center.y - (rect?.top ?? 0);
|
|
84
|
+
input._updateHitPlane();
|
|
85
|
+
input._zoomToMouse(delta);
|
|
86
|
+
camera.movement.activeInput = true;
|
|
87
|
+
return true;
|
|
88
|
+
} finally {
|
|
89
|
+
scene.pointerX = previousX;
|
|
90
|
+
scene.pointerY = previousY;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
61
94
|
/**
|
|
62
95
|
* Makes native mouse-location zoom focus on the model surface under the pointer.
|
|
63
96
|
* Babylon otherwise intersects the pointer ray with a plane through the camera target, so the
|