@playcanvas/supersplat-viewer 1.30.1 → 1.30.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 +47 -18
- package/public/index.js.map +1 -1
package/package.json
CHANGED
package/public/index.js
CHANGED
|
@@ -83415,7 +83415,7 @@ const importSettings = (settings) => {
|
|
|
83415
83415
|
return result;
|
|
83416
83416
|
};
|
|
83417
83417
|
|
|
83418
|
-
var version = "1.30.
|
|
83418
|
+
var version = "1.30.2";
|
|
83419
83419
|
|
|
83420
83420
|
class Tooltip {
|
|
83421
83421
|
register;
|
|
@@ -84078,7 +84078,7 @@ const initUI = (global) => {
|
|
|
84078
84078
|
events.on('animationLength:changed', updateSlider);
|
|
84079
84079
|
const handleScrub = (event) => {
|
|
84080
84080
|
const rect = dom.timelineContainer.getBoundingClientRect();
|
|
84081
|
-
const t = Math.max(0, Math.min(rect.width
|
|
84081
|
+
const t = Math.max(0, Math.min(rect.width, event.clientX - rect.left)) / rect.width;
|
|
84082
84082
|
events.fire('scrubAnim', state.animationDuration * t);
|
|
84083
84083
|
showUI();
|
|
84084
84084
|
};
|
|
@@ -85226,8 +85226,15 @@ class AnimCursor {
|
|
|
85226
85226
|
this.timer = 0;
|
|
85227
85227
|
this.cursor = 0;
|
|
85228
85228
|
}
|
|
85229
|
+
// true once a play-once animation has reached the end of the track
|
|
85230
|
+
get ended() {
|
|
85231
|
+
return this.loopMode === 'none' && this.cursor >= this.duration;
|
|
85232
|
+
}
|
|
85229
85233
|
set value(value) {
|
|
85230
|
-
|
|
85234
|
+
// 'repeat' wraps (the end is the start); 'none' and 'pingpong' clamp so a
|
|
85235
|
+
// scrub to the exact end parks on the last frame instead of wrapping to 0
|
|
85236
|
+
this.cursor =
|
|
85237
|
+
this.loopMode === 'repeat' ? mod(value, this.duration) : Math.max(0, Math.min(this.duration, value));
|
|
85231
85238
|
}
|
|
85232
85239
|
get value() {
|
|
85233
85240
|
return this.cursor > this.duration ? 2 * this.duration - this.cursor : this.cursor;
|
|
@@ -85274,7 +85281,11 @@ class AnimState {
|
|
|
85274
85281
|
points.push(fov[i]);
|
|
85275
85282
|
}
|
|
85276
85283
|
const extra = duration === times[times.length - 1] / frameRate ? 1 : 0;
|
|
85277
|
-
|
|
85284
|
+
// 'repeat' wraps the path from the last key back to the first; 'none' and
|
|
85285
|
+
// 'pingpong' clamp at the outer keys, holding the end poses instead
|
|
85286
|
+
const spline = loopMode === 'repeat'
|
|
85287
|
+
? CubicSpline.fromPointsLooping((duration + extra) * frameRate, times, points, smoothness)
|
|
85288
|
+
: CubicSpline.fromPoints(times, points, smoothness);
|
|
85278
85289
|
return new AnimState(spline, duration, loopMode, frameRate);
|
|
85279
85290
|
}
|
|
85280
85291
|
}
|
|
@@ -86652,6 +86663,10 @@ class CameraManager {
|
|
|
86652
86663
|
// update animation timeline
|
|
86653
86664
|
if (state.cameraMode === 'anim') {
|
|
86654
86665
|
state.animationTime = controllers.anim.animState.cursor.value;
|
|
86666
|
+
// a play-once animation pauses once it reaches the end of the track
|
|
86667
|
+
if (!state.animationPaused && controllers.anim.animState.cursor.ended) {
|
|
86668
|
+
state.animationPaused = true;
|
|
86669
|
+
}
|
|
86655
86670
|
}
|
|
86656
86671
|
if (clearOrbitTargetOnTransitionEnd && prevTransitionTimer < 1 && transitionTimer === 1) {
|
|
86657
86672
|
clearOrbitTargetOnTransitionEnd = false;
|
|
@@ -86742,6 +86757,17 @@ class CameraManager {
|
|
|
86742
86757
|
const newController = getController(value);
|
|
86743
86758
|
newController.onEnter(this.camera);
|
|
86744
86759
|
});
|
|
86760
|
+
// pressing play at (or within a frame of) the end of a play-once animation
|
|
86761
|
+
// restarts it from the beginning (a scrub can park just short of the end)
|
|
86762
|
+
events.on('animationPaused:changed', (paused) => {
|
|
86763
|
+
const animState = controllers.anim?.animState;
|
|
86764
|
+
if (!paused && animState) {
|
|
86765
|
+
const { cursor } = animState;
|
|
86766
|
+
if (cursor.loopMode === 'none' && cursor.duration - cursor.value < 1 / animState.frameRate) {
|
|
86767
|
+
cursor.value = 0;
|
|
86768
|
+
}
|
|
86769
|
+
}
|
|
86770
|
+
});
|
|
86745
86771
|
// handle user scrubbing the animation timeline
|
|
86746
86772
|
events.on('scrubAnim', (time) => {
|
|
86747
86773
|
// switch to animation camera if we're not already there
|
|
@@ -87719,26 +87745,29 @@ class NavInteraction {
|
|
|
87719
87745
|
if (!(event instanceof MouseEvent))
|
|
87720
87746
|
return;
|
|
87721
87747
|
const { events, state } = global;
|
|
87722
|
-
// dblclick
|
|
87723
|
-
|
|
87724
|
-
|
|
87748
|
+
// dblclick in captured walk mode does nothing, like click
|
|
87749
|
+
if (state.cameraMode === 'walk' && state.gamingControls)
|
|
87750
|
+
return;
|
|
87725
87751
|
const request = ++this._targetPickRequest;
|
|
87726
87752
|
const target = await this._pickSceneTarget(event.offsetX, event.offsetY);
|
|
87727
87753
|
if (!target || request !== this._targetPickRequest)
|
|
87728
87754
|
return;
|
|
87729
|
-
const
|
|
87730
|
-
if (
|
|
87731
|
-
|
|
87732
|
-
|
|
87755
|
+
const currentState = this._global?.state;
|
|
87756
|
+
if (!currentState)
|
|
87757
|
+
return;
|
|
87758
|
+
if (currentState.cameraMode === 'walk') {
|
|
87759
|
+
if (!currentState.gamingControls) {
|
|
87760
|
+
// run to the picked point (same multiplier as shift-click)
|
|
87761
|
+
events.fire('navigateTo', target.position, target.normal, 2);
|
|
87762
|
+
}
|
|
87763
|
+
}
|
|
87764
|
+
else {
|
|
87765
|
+
// in other modes dblclick focuses orbit on the picked point.
|
|
87766
|
+
// 'pick' switches mode to orbit, which cancels any active navigation
|
|
87767
|
+
// and would clobber a pre-set orbit target — set it after.
|
|
87733
87768
|
events.fire('pick', target.position);
|
|
87734
87769
|
events.fire('orbitTarget:set', target.position, target.normal);
|
|
87735
87770
|
}
|
|
87736
|
-
else if (currentMode === 'orbit' || currentMode === 'walk') {
|
|
87737
|
-
state.cameraMode = 'fly';
|
|
87738
|
-
// Modifiers apply against the destination mode (fly), not the source.
|
|
87739
|
-
const speedMul = computeClickSpeedMul(event, 'fly');
|
|
87740
|
-
events.fire('navigateTo', target.position, target.normal, speedMul);
|
|
87741
|
-
}
|
|
87742
87771
|
};
|
|
87743
87772
|
_onMobileTap = () => {
|
|
87744
87773
|
const global = this._global;
|
|
@@ -87769,7 +87798,7 @@ class NavInteraction {
|
|
|
87769
87798
|
canvas.addEventListener('pointerdown', this._onPointerDown);
|
|
87770
87799
|
canvas.addEventListener('pointermove', this._onPointerMove);
|
|
87771
87800
|
canvas.addEventListener('pointerup', this._onPointerUp);
|
|
87772
|
-
// double-click/tap fallback ->
|
|
87801
|
+
// double-click/tap fallback -> run to walk target or orbit focus
|
|
87773
87802
|
events.on('inputEvent', this._onInputEvent);
|
|
87774
87803
|
// mobile tap (no movement) → walk/fly target or orbit focus
|
|
87775
87804
|
events.on('mobileTap', this._onMobileTap);
|