@heliguy-xyz/splat-viewer 1.0.0-rc.6 → 1.0.0-rc.7
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/web-component/FlyCameraScript.d.ts.map +1 -1
- package/dist/web-component/splat-viewer.esm.js +27 -13
- package/dist/web-component/splat-viewer.esm.min.js +1 -1
- package/dist/web-component/splat-viewer.js +27 -13
- package/dist/web-component/splat-viewer.min.js +1 -1
- package/dist/web-component/types/FlyCameraScript.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -104550,6 +104550,7 @@ fn fragmentMain(input: FragmentInput) -> FragmentOutput {
|
|
|
104550
104550
|
FlyCamera.prototype.initialize = function () {
|
|
104551
104551
|
this._isActive = true;
|
|
104552
104552
|
this._isPointerLocked = false;
|
|
104553
|
+
this._isLooking = false;
|
|
104553
104554
|
this._pressed = new Set();
|
|
104554
104555
|
this._velocity = new Vec3(0, 0, 0);
|
|
104555
104556
|
this._targetVelocity = new Vec3(0, 0, 0);
|
|
@@ -104571,21 +104572,24 @@ fn fragmentMain(input: FragmentInput) -> FragmentOutput {
|
|
|
104571
104572
|
this._onKeyUp = this._handleKeyUp.bind(this);
|
|
104572
104573
|
document.addEventListener('keydown', this._onKeyDown);
|
|
104573
104574
|
document.addEventListener('keyup', this._onKeyUp);
|
|
104574
|
-
// Mouse move
|
|
104575
|
+
// Mouse move for look (while mouse button held)
|
|
104575
104576
|
this._onMouseMove = this._handleMouseMove.bind(this);
|
|
104576
104577
|
document.addEventListener('mousemove', this._onMouseMove);
|
|
104577
|
-
//
|
|
104578
|
-
this._onPointerLockChange = this._handlePointerLockChange.bind(this);
|
|
104579
|
-
document.addEventListener('pointerlockchange', this._onPointerLockChange);
|
|
104580
|
-
// Click on canvas to lock pointer
|
|
104578
|
+
// Mouse button handling: click + hold to look, release to stop
|
|
104581
104579
|
const canvas = this.app.graphicsDevice.canvas;
|
|
104582
104580
|
this._onClickToLock = (e) => {
|
|
104583
|
-
// Left button
|
|
104581
|
+
// Left button enables look while held (no pointer lock)
|
|
104584
104582
|
if (e.button === 0 && this._isActive) {
|
|
104585
|
-
this.
|
|
104583
|
+
this._isLooking = true;
|
|
104586
104584
|
}
|
|
104587
104585
|
};
|
|
104588
104586
|
canvas.addEventListener('mousedown', this._onClickToLock);
|
|
104587
|
+
this._onMouseUp = (e) => {
|
|
104588
|
+
if (e.button === 0) {
|
|
104589
|
+
this._isLooking = false;
|
|
104590
|
+
}
|
|
104591
|
+
};
|
|
104592
|
+
document.addEventListener('mouseup', this._onMouseUp);
|
|
104589
104593
|
};
|
|
104590
104594
|
FlyCamera.prototype.update = function (dt) {
|
|
104591
104595
|
if (!this._isActive)
|
|
@@ -104630,16 +104634,26 @@ fn fragmentMain(input: FragmentInput) -> FragmentOutput {
|
|
|
104630
104634
|
this._onKeyDown = this._onKeyDown || this._handleKeyDown.bind(this);
|
|
104631
104635
|
this._onKeyUp = this._onKeyUp || this._handleKeyUp.bind(this);
|
|
104632
104636
|
this._onMouseMove = this._onMouseMove || this._handleMouseMove.bind(this);
|
|
104633
|
-
this._onPointerLockChange =
|
|
104634
|
-
this._onPointerLockChange || this._handlePointerLockChange.bind(this);
|
|
104635
104637
|
document.addEventListener('keydown', this._onKeyDown);
|
|
104636
104638
|
document.addEventListener('keyup', this._onKeyUp);
|
|
104637
104639
|
document.addEventListener('mousemove', this._onMouseMove);
|
|
104638
|
-
document.addEventListener('pointerlockchange', this._onPointerLockChange);
|
|
104639
104640
|
const canvas = this.app.graphicsDevice.canvas;
|
|
104640
104641
|
this._onClickToLock =
|
|
104641
|
-
this._onClickToLock ||
|
|
104642
|
+
this._onClickToLock ||
|
|
104643
|
+
((e) => {
|
|
104644
|
+
if (e.button === 0 && this._isActive) {
|
|
104645
|
+
this._isLooking = true;
|
|
104646
|
+
}
|
|
104647
|
+
});
|
|
104642
104648
|
canvas.addEventListener('mousedown', this._onClickToLock);
|
|
104649
|
+
this._onMouseUp =
|
|
104650
|
+
this._onMouseUp ||
|
|
104651
|
+
((e) => {
|
|
104652
|
+
if (e.button === 0) {
|
|
104653
|
+
this._isLooking = false;
|
|
104654
|
+
}
|
|
104655
|
+
});
|
|
104656
|
+
document.addEventListener('mouseup', this._onMouseUp);
|
|
104643
104657
|
};
|
|
104644
104658
|
FlyCamera.prototype.deactivate = function () {
|
|
104645
104659
|
if (!this._isActive)
|
|
@@ -104651,7 +104665,7 @@ fn fragmentMain(input: FragmentInput) -> FragmentOutput {
|
|
|
104651
104665
|
document.removeEventListener('keydown', this._onKeyDown);
|
|
104652
104666
|
document.removeEventListener('keyup', this._onKeyUp);
|
|
104653
104667
|
document.removeEventListener('mousemove', this._onMouseMove);
|
|
104654
|
-
document.removeEventListener('
|
|
104668
|
+
document.removeEventListener('mouseup', this._onMouseUp);
|
|
104655
104669
|
const canvas = this.app?.graphicsDevice?.canvas;
|
|
104656
104670
|
if (canvas && this._onClickToLock) {
|
|
104657
104671
|
canvas.removeEventListener('mousedown', this._onClickToLock);
|
|
@@ -104735,7 +104749,7 @@ fn fragmentMain(input: FragmentInput) -> FragmentOutput {
|
|
|
104735
104749
|
}
|
|
104736
104750
|
};
|
|
104737
104751
|
FlyCamera.prototype._handleMouseMove = function (e) {
|
|
104738
|
-
if (!this.
|
|
104752
|
+
if (!this._isLooking || !this._isActive)
|
|
104739
104753
|
return;
|
|
104740
104754
|
// Invert horizontal (yaw) rotation: moving mouse right rotates view left, and vice versa
|
|
104741
104755
|
const dx = e.movementX * this.lookSensitivity;
|