@heliguy-xyz/splat-viewer 1.0.0-rc.5 → 1.0.0-rc.6

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.
@@ -104343,10 +104343,13 @@ fn fragmentMain(input: FragmentInput) -> FragmentOutput {
104343
104343
  if (nextMode === this.mode)
104344
104344
  return;
104345
104345
  const prev = this.mode;
104346
- // Preserve camera transform
104346
+ // Preserve camera transform (position + rotation)
104347
104347
  const pos = this.camera.getPosition
104348
104348
  ? this.camera.getPosition().clone()
104349
104349
  : { x: 0, y: 0, z: 10 };
104350
+ const rot = this.camera.getRotation
104351
+ ? this.camera.getRotation().clone()
104352
+ : null;
104350
104353
  // Switch
104351
104354
  if (nextMode === 'fly') {
104352
104355
  this.deactivateOrbitMode();
@@ -104357,6 +104360,9 @@ fn fragmentMain(input: FragmentInput) -> FragmentOutput {
104357
104360
  this.activateOrbitMode();
104358
104361
  }
104359
104362
  this.camera.setPosition(pos);
104363
+ if (rot && this.camera.setRotation) {
104364
+ this.camera.setRotation(rot);
104365
+ }
104360
104366
  this.mode = nextMode;
104361
104367
  // Emit camera-mode-changed
104362
104368
  this.emit('camera-mode-changed', { mode: nextMode, previousMode: prev });
@@ -104461,6 +104467,22 @@ fn fragmentMain(input: FragmentInput) -> FragmentOutput {
104461
104467
  return;
104462
104468
  if (typeof this.fly.activate === 'function')
104463
104469
  this.fly.activate();
104470
+ // Align fly camera internal orientation with the current camera rotation so that
104471
+ // switching from orbit -> fly does not snap the view back to the initial direction.
104472
+ try {
104473
+ const euler = this.camera.getEulerAngles
104474
+ ? this.camera.getEulerAngles()
104475
+ : null;
104476
+ if (euler) {
104477
+ // These properties are part of the FlyCamera runtime state
104478
+ ;
104479
+ this.fly._pitch = euler.x || 0;
104480
+ this.fly._yaw = euler.y || 0;
104481
+ }
104482
+ }
104483
+ catch {
104484
+ // Best-effort sync; ignore if camera or script API differs
104485
+ }
104464
104486
  }
104465
104487
  deactivateFlyMode() {
104466
104488
  if (!this.fly)