@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlyCameraScript.d.ts","sourceRoot":"","sources":["../../src/web-component/FlyCameraScript.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FlyCameraScript.d.ts","sourceRoot":"","sources":["../../src/web-component/FlyCameraScript.ts"],"names":[],"mappings":"AAwEA,wBAAgB,uBAAuB,IAAI,IAAI,CAmb9C"}
|
|
@@ -104543,6 +104543,7 @@ function registerFlyCameraScript() {
|
|
|
104543
104543
|
FlyCamera.prototype.initialize = function () {
|
|
104544
104544
|
this._isActive = true;
|
|
104545
104545
|
this._isPointerLocked = false;
|
|
104546
|
+
this._isLooking = false;
|
|
104546
104547
|
this._pressed = new Set();
|
|
104547
104548
|
this._velocity = new Vec3(0, 0, 0);
|
|
104548
104549
|
this._targetVelocity = new Vec3(0, 0, 0);
|
|
@@ -104564,21 +104565,24 @@ function registerFlyCameraScript() {
|
|
|
104564
104565
|
this._onKeyUp = this._handleKeyUp.bind(this);
|
|
104565
104566
|
document.addEventListener('keydown', this._onKeyDown);
|
|
104566
104567
|
document.addEventListener('keyup', this._onKeyUp);
|
|
104567
|
-
// Mouse move
|
|
104568
|
+
// Mouse move for look (while mouse button held)
|
|
104568
104569
|
this._onMouseMove = this._handleMouseMove.bind(this);
|
|
104569
104570
|
document.addEventListener('mousemove', this._onMouseMove);
|
|
104570
|
-
//
|
|
104571
|
-
this._onPointerLockChange = this._handlePointerLockChange.bind(this);
|
|
104572
|
-
document.addEventListener('pointerlockchange', this._onPointerLockChange);
|
|
104573
|
-
// Click on canvas to lock pointer
|
|
104571
|
+
// Mouse button handling: click + hold to look, release to stop
|
|
104574
104572
|
const canvas = this.app.graphicsDevice.canvas;
|
|
104575
104573
|
this._onClickToLock = (e) => {
|
|
104576
|
-
// Left button
|
|
104574
|
+
// Left button enables look while held (no pointer lock)
|
|
104577
104575
|
if (e.button === 0 && this._isActive) {
|
|
104578
|
-
this.
|
|
104576
|
+
this._isLooking = true;
|
|
104579
104577
|
}
|
|
104580
104578
|
};
|
|
104581
104579
|
canvas.addEventListener('mousedown', this._onClickToLock);
|
|
104580
|
+
this._onMouseUp = (e) => {
|
|
104581
|
+
if (e.button === 0) {
|
|
104582
|
+
this._isLooking = false;
|
|
104583
|
+
}
|
|
104584
|
+
};
|
|
104585
|
+
document.addEventListener('mouseup', this._onMouseUp);
|
|
104582
104586
|
};
|
|
104583
104587
|
FlyCamera.prototype.update = function (dt) {
|
|
104584
104588
|
if (!this._isActive)
|
|
@@ -104623,16 +104627,26 @@ function registerFlyCameraScript() {
|
|
|
104623
104627
|
this._onKeyDown = this._onKeyDown || this._handleKeyDown.bind(this);
|
|
104624
104628
|
this._onKeyUp = this._onKeyUp || this._handleKeyUp.bind(this);
|
|
104625
104629
|
this._onMouseMove = this._onMouseMove || this._handleMouseMove.bind(this);
|
|
104626
|
-
this._onPointerLockChange =
|
|
104627
|
-
this._onPointerLockChange || this._handlePointerLockChange.bind(this);
|
|
104628
104630
|
document.addEventListener('keydown', this._onKeyDown);
|
|
104629
104631
|
document.addEventListener('keyup', this._onKeyUp);
|
|
104630
104632
|
document.addEventListener('mousemove', this._onMouseMove);
|
|
104631
|
-
document.addEventListener('pointerlockchange', this._onPointerLockChange);
|
|
104632
104633
|
const canvas = this.app.graphicsDevice.canvas;
|
|
104633
104634
|
this._onClickToLock =
|
|
104634
|
-
this._onClickToLock ||
|
|
104635
|
+
this._onClickToLock ||
|
|
104636
|
+
((e) => {
|
|
104637
|
+
if (e.button === 0 && this._isActive) {
|
|
104638
|
+
this._isLooking = true;
|
|
104639
|
+
}
|
|
104640
|
+
});
|
|
104635
104641
|
canvas.addEventListener('mousedown', this._onClickToLock);
|
|
104642
|
+
this._onMouseUp =
|
|
104643
|
+
this._onMouseUp ||
|
|
104644
|
+
((e) => {
|
|
104645
|
+
if (e.button === 0) {
|
|
104646
|
+
this._isLooking = false;
|
|
104647
|
+
}
|
|
104648
|
+
});
|
|
104649
|
+
document.addEventListener('mouseup', this._onMouseUp);
|
|
104636
104650
|
};
|
|
104637
104651
|
FlyCamera.prototype.deactivate = function () {
|
|
104638
104652
|
if (!this._isActive)
|
|
@@ -104644,7 +104658,7 @@ function registerFlyCameraScript() {
|
|
|
104644
104658
|
document.removeEventListener('keydown', this._onKeyDown);
|
|
104645
104659
|
document.removeEventListener('keyup', this._onKeyUp);
|
|
104646
104660
|
document.removeEventListener('mousemove', this._onMouseMove);
|
|
104647
|
-
document.removeEventListener('
|
|
104661
|
+
document.removeEventListener('mouseup', this._onMouseUp);
|
|
104648
104662
|
const canvas = this.app?.graphicsDevice?.canvas;
|
|
104649
104663
|
if (canvas && this._onClickToLock) {
|
|
104650
104664
|
canvas.removeEventListener('mousedown', this._onClickToLock);
|
|
@@ -104728,7 +104742,7 @@ function registerFlyCameraScript() {
|
|
|
104728
104742
|
}
|
|
104729
104743
|
};
|
|
104730
104744
|
FlyCamera.prototype._handleMouseMove = function (e) {
|
|
104731
|
-
if (!this.
|
|
104745
|
+
if (!this._isLooking || !this._isActive)
|
|
104732
104746
|
return;
|
|
104733
104747
|
// Invert horizontal (yaw) rotation: moving mouse right rotates view left, and vice versa
|
|
104734
104748
|
const dx = e.movementX * this.lookSensitivity;
|