@heliguy-xyz/splat-viewer 1.0.0-rc.5 → 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.
@@ -1 +1 @@
1
- {"version":3,"file":"CameraModeManager.d.ts","sourceRoot":"","sources":["../../src/web-component/CameraModeManager.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,SAAS,CAAA;AAEhB,KAAK,MAAM,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,KAAK,IAAI,CAAA;AAEvD,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,GAAG,CAAuB;IAClC,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,KAAK,CAA0B;IACvC,OAAO,CAAC,GAAG,CAAY;IACvB,OAAO,CAAC,IAAI,CAAY;IACxB,OAAO,CAAC,IAAI,CAAQ;gBAGlB,GAAG,EAAE,qBAAqB,EAC1B,MAAM,EAAE,gBAAgB,EACxB,KAAK,EAAE,iBAAiB,GAAG,IAAI,EAC/B,GAAG,EAAE,GAAG,GAAG,IAAI,EACf,IAAI,EAAE,MAAM,EACZ,WAAW,GAAE,UAAkC;IAmB1C,OAAO,IAAI,UAAU;IAIrB,OAAO,CAAC,QAAQ,EAAE,UAAU,GAAG,IAAI;IA0BnC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,IAAI;IAMpD,YAAY,IAAI,eAAe,GAAG,IAAI;IAmBtC,WAAW,IAAI,cAAc,GAAG,IAAI;IAe3C,OAAO,CAAC,iBAAiB;IA+BzB,OAAO,CAAC,mBAAmB;IA4B3B,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,iBAAiB;CAI1B"}
1
+ {"version":3,"file":"CameraModeManager.d.ts","sourceRoot":"","sources":["../../src/web-component/CameraModeManager.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,SAAS,CAAA;AAEhB,KAAK,MAAM,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,KAAK,IAAI,CAAA;AAEvD,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,GAAG,CAAuB;IAClC,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,KAAK,CAA0B;IACvC,OAAO,CAAC,GAAG,CAAY;IACvB,OAAO,CAAC,IAAI,CAAY;IACxB,OAAO,CAAC,IAAI,CAAQ;gBAGlB,GAAG,EAAE,qBAAqB,EAC1B,MAAM,EAAE,gBAAgB,EACxB,KAAK,EAAE,iBAAiB,GAAG,IAAI,EAC/B,GAAG,EAAE,GAAG,GAAG,IAAI,EACf,IAAI,EAAE,MAAM,EACZ,WAAW,GAAE,UAAkC;IAmB1C,OAAO,IAAI,UAAU;IAIrB,OAAO,CAAC,QAAQ,EAAE,UAAU,GAAG,IAAI;IAgCnC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,IAAI;IAMpD,YAAY,IAAI,eAAe,GAAG,IAAI;IAmBtC,WAAW,IAAI,cAAc,GAAG,IAAI;IAe3C,OAAO,CAAC,iBAAiB;IA+BzB,OAAO,CAAC,mBAAmB;IA4B3B,OAAO,CAAC,eAAe;IAoBvB,OAAO,CAAC,iBAAiB;CAI1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"FlyCameraScript.d.ts","sourceRoot":"","sources":["../../src/web-component/FlyCameraScript.ts"],"names":[],"mappings":"AAsEA,wBAAgB,uBAAuB,IAAI,IAAI,CAua9C"}
1
+ {"version":3,"file":"FlyCameraScript.d.ts","sourceRoot":"","sources":["../../src/web-component/FlyCameraScript.ts"],"names":[],"mappings":"AAwEA,wBAAgB,uBAAuB,IAAI,IAAI,CAmb9C"}
@@ -104336,10 +104336,13 @@ class CameraModeManager {
104336
104336
  if (nextMode === this.mode)
104337
104337
  return;
104338
104338
  const prev = this.mode;
104339
- // Preserve camera transform
104339
+ // Preserve camera transform (position + rotation)
104340
104340
  const pos = this.camera.getPosition
104341
104341
  ? this.camera.getPosition().clone()
104342
104342
  : { x: 0, y: 0, z: 10 };
104343
+ const rot = this.camera.getRotation
104344
+ ? this.camera.getRotation().clone()
104345
+ : null;
104343
104346
  // Switch
104344
104347
  if (nextMode === 'fly') {
104345
104348
  this.deactivateOrbitMode();
@@ -104350,6 +104353,9 @@ class CameraModeManager {
104350
104353
  this.activateOrbitMode();
104351
104354
  }
104352
104355
  this.camera.setPosition(pos);
104356
+ if (rot && this.camera.setRotation) {
104357
+ this.camera.setRotation(rot);
104358
+ }
104353
104359
  this.mode = nextMode;
104354
104360
  // Emit camera-mode-changed
104355
104361
  this.emit('camera-mode-changed', { mode: nextMode, previousMode: prev });
@@ -104454,6 +104460,22 @@ class CameraModeManager {
104454
104460
  return;
104455
104461
  if (typeof this.fly.activate === 'function')
104456
104462
  this.fly.activate();
104463
+ // Align fly camera internal orientation with the current camera rotation so that
104464
+ // switching from orbit -> fly does not snap the view back to the initial direction.
104465
+ try {
104466
+ const euler = this.camera.getEulerAngles
104467
+ ? this.camera.getEulerAngles()
104468
+ : null;
104469
+ if (euler) {
104470
+ // These properties are part of the FlyCamera runtime state
104471
+ ;
104472
+ this.fly._pitch = euler.x || 0;
104473
+ this.fly._yaw = euler.y || 0;
104474
+ }
104475
+ }
104476
+ catch {
104477
+ // Best-effort sync; ignore if camera or script API differs
104478
+ }
104457
104479
  }
104458
104480
  deactivateFlyMode() {
104459
104481
  if (!this.fly)
@@ -104521,6 +104543,7 @@ function registerFlyCameraScript() {
104521
104543
  FlyCamera.prototype.initialize = function () {
104522
104544
  this._isActive = true;
104523
104545
  this._isPointerLocked = false;
104546
+ this._isLooking = false;
104524
104547
  this._pressed = new Set();
104525
104548
  this._velocity = new Vec3(0, 0, 0);
104526
104549
  this._targetVelocity = new Vec3(0, 0, 0);
@@ -104542,21 +104565,24 @@ function registerFlyCameraScript() {
104542
104565
  this._onKeyUp = this._handleKeyUp.bind(this);
104543
104566
  document.addEventListener('keydown', this._onKeyDown);
104544
104567
  document.addEventListener('keyup', this._onKeyUp);
104545
- // Mouse move when pointer locked
104568
+ // Mouse move for look (while mouse button held)
104546
104569
  this._onMouseMove = this._handleMouseMove.bind(this);
104547
104570
  document.addEventListener('mousemove', this._onMouseMove);
104548
- // Pointer lock change
104549
- this._onPointerLockChange = this._handlePointerLockChange.bind(this);
104550
- document.addEventListener('pointerlockchange', this._onPointerLockChange);
104551
- // Click on canvas to lock pointer
104571
+ // Mouse button handling: click + hold to look, release to stop
104552
104572
  const canvas = this.app.graphicsDevice.canvas;
104553
104573
  this._onClickToLock = (e) => {
104554
- // Left button to engage pointer lock
104574
+ // Left button enables look while held (no pointer lock)
104555
104575
  if (e.button === 0 && this._isActive) {
104556
- this._requestPointerLock();
104576
+ this._isLooking = true;
104557
104577
  }
104558
104578
  };
104559
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);
104560
104586
  };
104561
104587
  FlyCamera.prototype.update = function (dt) {
104562
104588
  if (!this._isActive)
@@ -104601,16 +104627,26 @@ function registerFlyCameraScript() {
104601
104627
  this._onKeyDown = this._onKeyDown || this._handleKeyDown.bind(this);
104602
104628
  this._onKeyUp = this._onKeyUp || this._handleKeyUp.bind(this);
104603
104629
  this._onMouseMove = this._onMouseMove || this._handleMouseMove.bind(this);
104604
- this._onPointerLockChange =
104605
- this._onPointerLockChange || this._handlePointerLockChange.bind(this);
104606
104630
  document.addEventListener('keydown', this._onKeyDown);
104607
104631
  document.addEventListener('keyup', this._onKeyUp);
104608
104632
  document.addEventListener('mousemove', this._onMouseMove);
104609
- document.addEventListener('pointerlockchange', this._onPointerLockChange);
104610
104633
  const canvas = this.app.graphicsDevice.canvas;
104611
104634
  this._onClickToLock =
104612
- this._onClickToLock || (() => this._requestPointerLock());
104635
+ this._onClickToLock ||
104636
+ ((e) => {
104637
+ if (e.button === 0 && this._isActive) {
104638
+ this._isLooking = true;
104639
+ }
104640
+ });
104613
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);
104614
104650
  };
104615
104651
  FlyCamera.prototype.deactivate = function () {
104616
104652
  if (!this._isActive)
@@ -104622,7 +104658,7 @@ function registerFlyCameraScript() {
104622
104658
  document.removeEventListener('keydown', this._onKeyDown);
104623
104659
  document.removeEventListener('keyup', this._onKeyUp);
104624
104660
  document.removeEventListener('mousemove', this._onMouseMove);
104625
- document.removeEventListener('pointerlockchange', this._onPointerLockChange);
104661
+ document.removeEventListener('mouseup', this._onMouseUp);
104626
104662
  const canvas = this.app?.graphicsDevice?.canvas;
104627
104663
  if (canvas && this._onClickToLock) {
104628
104664
  canvas.removeEventListener('mousedown', this._onClickToLock);
@@ -104706,7 +104742,7 @@ function registerFlyCameraScript() {
104706
104742
  }
104707
104743
  };
104708
104744
  FlyCamera.prototype._handleMouseMove = function (e) {
104709
- if (!this._isPointerLocked || !this._isActive)
104745
+ if (!this._isLooking || !this._isActive)
104710
104746
  return;
104711
104747
  // Invert horizontal (yaw) rotation: moving mouse right rotates view left, and vice versa
104712
104748
  const dx = e.movementX * this.lookSensitivity;