@playcanvas/supersplat-viewer 1.16.0 → 1.16.2
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/dist/index.js +1 -1
- package/package.json +1 -1
- package/public/index.js +53 -11
- package/public/index.js.map +1 -1
package/package.json
CHANGED
package/public/index.js
CHANGED
|
@@ -69740,11 +69740,11 @@ const initUI = (global) => {
|
|
|
69740
69740
|
dom.enterFullscreen.classList[value ? 'add' : 'remove']('hidden');
|
|
69741
69741
|
dom.exitFullscreen.classList[value ? 'remove' : 'add']('hidden');
|
|
69742
69742
|
});
|
|
69743
|
-
// HQ mode
|
|
69744
|
-
dom.hqOption.addEventListener('click', () => {
|
|
69743
|
+
// HQ mode (click anywhere in the row, not just the label)
|
|
69744
|
+
dom.hqOption.parentElement.addEventListener('click', () => {
|
|
69745
69745
|
state.hqMode = true;
|
|
69746
69746
|
});
|
|
69747
|
-
dom.lqOption.addEventListener('click', () => {
|
|
69747
|
+
dom.lqOption.parentElement.addEventListener('click', () => {
|
|
69748
69748
|
state.hqMode = false;
|
|
69749
69749
|
});
|
|
69750
69750
|
const updateHQ = () => {
|
|
@@ -69757,10 +69757,10 @@ const initUI = (global) => {
|
|
|
69757
69757
|
});
|
|
69758
69758
|
updateHQ();
|
|
69759
69759
|
// Touch control scheme toggle (only visible on touch devices)
|
|
69760
|
-
dom.
|
|
69760
|
+
dom.joystickSchemeRow.addEventListener('click', () => {
|
|
69761
69761
|
state.touchControlScheme = 'joystick';
|
|
69762
69762
|
});
|
|
69763
|
-
dom.
|
|
69763
|
+
dom.pinchSchemeRow.addEventListener('click', () => {
|
|
69764
69764
|
state.touchControlScheme = 'pinch';
|
|
69765
69765
|
});
|
|
69766
69766
|
const updateTouchControlScheme = () => {
|
|
@@ -71563,6 +71563,15 @@ const orbitRotate = new Vec3();
|
|
|
71563
71563
|
const flyRotate = new Vec3();
|
|
71564
71564
|
const stickMove = new Vec3();
|
|
71565
71565
|
const stickRotate = new Vec3();
|
|
71566
|
+
/** Maximum accumulated touch movement (px) to still count as a tap */
|
|
71567
|
+
const TAP_EPSILON = 15;
|
|
71568
|
+
/**
|
|
71569
|
+
* Displacement-based inputs (mouse, touch, wheel, pinch) return accumulated pixel
|
|
71570
|
+
* offsets that already scale with frame time. This factor converts rate-based speed
|
|
71571
|
+
* constants (tuned for degrees-per-second) to work with per-frame displacements,
|
|
71572
|
+
* making them frame-rate-independent.
|
|
71573
|
+
*/
|
|
71574
|
+
const DISPLACEMENT_SCALE = 1 / 60;
|
|
71566
71575
|
/**
|
|
71567
71576
|
* Converts screen space mouse deltas to world space pan vector.
|
|
71568
71577
|
*
|
|
@@ -71646,6 +71655,10 @@ class InputController {
|
|
|
71646
71655
|
pinchVelocitySensitivity = 0.006;
|
|
71647
71656
|
// Sensitivity for two-finger pan delta → velocity conversion
|
|
71648
71657
|
panVelocitySensitivity = 0.005;
|
|
71658
|
+
// Tap-to-jump state (uses existing MultiTouchSource count/touch deltas)
|
|
71659
|
+
_tapTouches = 0;
|
|
71660
|
+
_tapDelta = 0;
|
|
71661
|
+
_tapJump = false;
|
|
71649
71662
|
// this gets overridden by the viewer based on scene size
|
|
71650
71663
|
moveSpeed = 4;
|
|
71651
71664
|
orbitSpeed = 18;
|
|
@@ -71694,6 +71707,8 @@ class InputController {
|
|
|
71694
71707
|
events.on('inputEvent', async (eventName, event) => {
|
|
71695
71708
|
switch (eventName) {
|
|
71696
71709
|
case 'dblclick': {
|
|
71710
|
+
if (state.cameraMode === 'fps')
|
|
71711
|
+
break;
|
|
71697
71712
|
if (!picker) {
|
|
71698
71713
|
picker = new Picker(app, camera);
|
|
71699
71714
|
}
|
|
@@ -71827,6 +71842,28 @@ class InputController {
|
|
|
71827
71842
|
this._state.shift += key[keyCode.SHIFT];
|
|
71828
71843
|
this._state.ctrl += key[keyCode.CTRL];
|
|
71829
71844
|
const isFps = state.cameraMode === 'fps';
|
|
71845
|
+
// Tap-to-jump detection using existing MultiTouchSource deltas
|
|
71846
|
+
if (isFps) {
|
|
71847
|
+
const prevTaps = this._tapTouches;
|
|
71848
|
+
this._tapTouches = Math.max(0, this._tapTouches + count[0]);
|
|
71849
|
+
// Touch just started (0 → 1+)
|
|
71850
|
+
if (prevTaps === 0 && this._tapTouches > 0) {
|
|
71851
|
+
this._tapDelta = 0;
|
|
71852
|
+
}
|
|
71853
|
+
// Accumulate movement while touch is active
|
|
71854
|
+
if (this._tapTouches > 0) {
|
|
71855
|
+
this._tapDelta += Math.abs(touch[0]) + Math.abs(touch[1]);
|
|
71856
|
+
}
|
|
71857
|
+
// Touch just ended (1+ → 0): check if it was a tap
|
|
71858
|
+
if (prevTaps > 0 && this._tapTouches === 0) {
|
|
71859
|
+
if (this._tapDelta < TAP_EPSILON) {
|
|
71860
|
+
this._tapJump = true;
|
|
71861
|
+
}
|
|
71862
|
+
}
|
|
71863
|
+
}
|
|
71864
|
+
else {
|
|
71865
|
+
this._tapTouches = 0;
|
|
71866
|
+
}
|
|
71830
71867
|
const isFirstPerson = state.cameraMode === 'fly' || isFps;
|
|
71831
71868
|
// Accumulate pinch and pan deltas into velocity when using pinch control scheme
|
|
71832
71869
|
// pinch[0] = oldDist - newDist: negative when spreading, positive when closing
|
|
@@ -71872,13 +71909,13 @@ class InputController {
|
|
|
71872
71909
|
const panMove = screenToWorld(camera, mouse[0], mouse[1], distance);
|
|
71873
71910
|
v.add(panMove.mulScalar(pan));
|
|
71874
71911
|
const wheelMove = new Vec3(0, 0, -wheel[0]);
|
|
71875
|
-
v.add(wheelMove.mulScalar(this.wheelSpeed *
|
|
71912
|
+
v.add(wheelMove.mulScalar(this.wheelSpeed * DISPLACEMENT_SCALE));
|
|
71876
71913
|
// FIXME: need to flip z axis for orbit camera
|
|
71877
71914
|
deltas.move.append([v.x, v.y, orbit ? -v.z : v.z]);
|
|
71878
71915
|
// desktop rotate
|
|
71879
71916
|
v.set(0, 0, 0);
|
|
71880
71917
|
mouseRotate.set(mouse[0], mouse[1], 0);
|
|
71881
|
-
v.add(mouseRotate.mulScalar((1 - pan) * this.orbitSpeed * orbitFactor *
|
|
71918
|
+
v.add(mouseRotate.mulScalar((1 - pan) * this.orbitSpeed * orbitFactor * DISPLACEMENT_SCALE));
|
|
71882
71919
|
deltas.rotate.append([v.x, v.y, v.z]);
|
|
71883
71920
|
// mobile move
|
|
71884
71921
|
v.set(0, 0, 0);
|
|
@@ -71898,16 +71935,21 @@ class InputController {
|
|
|
71898
71935
|
v.add(flyMove.mulScalar(fly * 1.5 * this.moveSpeed * dt));
|
|
71899
71936
|
}
|
|
71900
71937
|
pinchMove.set(0, 0, pinch[0]);
|
|
71901
|
-
v.add(pinchMove.mulScalar(orbit * double * this.pinchSpeed *
|
|
71938
|
+
v.add(pinchMove.mulScalar(orbit * double * this.pinchSpeed * DISPLACEMENT_SCALE));
|
|
71939
|
+
// Tap-to-jump for mobile FPS mode
|
|
71940
|
+
if (isFps && this._tapJump) {
|
|
71941
|
+
v.y = 1;
|
|
71942
|
+
this._tapJump = false;
|
|
71943
|
+
}
|
|
71902
71944
|
deltas.move.append([v.x, v.y, v.z]);
|
|
71903
71945
|
// mobile rotate
|
|
71904
71946
|
v.set(0, 0, 0);
|
|
71905
71947
|
orbitRotate.set(touch[0], touch[1], 0);
|
|
71906
|
-
v.add(orbitRotate.mulScalar(orbit * (1 - pan) * this.orbitSpeed *
|
|
71948
|
+
v.add(orbitRotate.mulScalar(orbit * (1 - pan) * this.orbitSpeed * DISPLACEMENT_SCALE));
|
|
71907
71949
|
// In fly mode, use single touch for look-around (inverted direction)
|
|
71908
71950
|
// Exclude multi-touch (double) to avoid interference with pinch/strafe gestures
|
|
71909
71951
|
flyRotate.set(touch[0], touch[1], 0);
|
|
71910
|
-
v.add(flyRotate.mulScalar(fly * (1 - double) * this.orbitSpeed * orbitFactor * 1.25 *
|
|
71952
|
+
v.add(flyRotate.mulScalar(fly * (1 - double) * this.orbitSpeed * orbitFactor * 1.25 * DISPLACEMENT_SCALE));
|
|
71911
71953
|
deltas.rotate.append([v.x, v.y, v.z]);
|
|
71912
71954
|
// gamepad move
|
|
71913
71955
|
v.set(0, 0, 0);
|
|
@@ -74468,7 +74510,7 @@ const initXr = (global) => {
|
|
|
74468
74510
|
});
|
|
74469
74511
|
};
|
|
74470
74512
|
|
|
74471
|
-
var version = "1.16.
|
|
74513
|
+
var version = "1.16.2";
|
|
74472
74514
|
|
|
74473
74515
|
const loadGsplat = async (app, config, progressCallback) => {
|
|
74474
74516
|
const { contents, contentUrl, unified, aa } = config;
|