3dtiles-inspector 0.2.4 → 0.2.5

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/CHANGELOG.md CHANGED
@@ -6,6 +6,13 @@ The format is based on Keep a Changelog and this project follows Semantic Versio
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.2.5] - 2026-05-05
10
+
11
+ ### Fixed
12
+
13
+ - Fixed coordinate move actions leaving the camera at the previous view by flying back to the relocated tileset after the root transform is moved.
14
+ - Fixed near-linear fly-to paths snapping to the start direction instead of interpolating toward the destination.
15
+
9
16
  ## [0.2.4] - 2026-05-04
10
17
 
11
18
  ### Added
@@ -67762,7 +67762,12 @@ function getFlyToPosition(flight, t2) {
67762
67762
  }
67763
67763
  _flyDirection.copy(_flyDirectionStart).applyAxisAngle(_flyAxis, angle * t2).normalize();
67764
67764
  } else {
67765
- _flyDirection.copy(_flyDirectionStart);
67765
+ _flyDirection.lerpVectors(_flyDirectionStart, _flyDirectionEnd, t2);
67766
+ if (_flyDirection.lengthSq() < 1e-12) {
67767
+ _flyDirection.copy(_flyDirectionEnd);
67768
+ } else {
67769
+ _flyDirection.normalize();
67770
+ }
67766
67771
  }
67767
67772
  const radius = MathUtils.lerp(startLength, endLength, t2) + Math.sin(Math.PI * t2) * arcHeight;
67768
67773
  return _flyDirection.multiplyScalar(radius);
@@ -68034,11 +68039,7 @@ function getCenterModeHeadingPitchRollForward(heading, pitch) {
68034
68039
  const sinPitch = Math.sin(pitch);
68035
68040
  const cosHeading = Math.cos(heading);
68036
68041
  const sinHeading = Math.sin(heading);
68037
- _flyForward.set(
68038
- sinHeading * cosPitch,
68039
- cosHeading * cosPitch,
68040
- sinPitch
68041
- );
68042
+ _flyForward.set(sinHeading * cosPitch, cosHeading * cosPitch, sinPitch);
68042
68043
  return _flyForward.normalize();
68043
68044
  }
68044
68045
  function getHeadingPitchRollBasis(referencePoint, heading, pitch, roll) {
@@ -68130,11 +68131,7 @@ var init_cameraFlyTo = __esm({
68130
68131
  _flyReferenceUp = new Vector3();
68131
68132
  _flyReferenceRight = new Vector3();
68132
68133
  _flyQuaternion = new Quaternion();
68133
- _ellipsoidRadii = new Vector3(
68134
- 6378137,
68135
- 6378137,
68136
- 6356752314245179e-9
68137
- );
68134
+ _ellipsoidRadii = new Vector3(6378137, 6378137, 6356752314245179e-9);
68138
68135
  _oneOverRadiiSquared = new Vector3(
68139
68136
  1 / (_ellipsoidRadii.x * _ellipsoidRadii.x),
68140
68137
  1 / (_ellipsoidRadii.y * _ellipsoidRadii.y),
@@ -71378,6 +71375,7 @@ var require_app = __commonJS({
71378
71375
  coordinate.longitude,
71379
71376
  coordinate.height
71380
71377
  );
71378
+ flyTo2.moveCameraToTiles();
71381
71379
  setStatus(
71382
71380
  "Moved tileset root to the specified coordinate using ENU orientation. Click Save to persist."
71383
71381
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "3dtiles-inspector",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "Inspect, align, and save local 3D Tiles root transforms in an interactive browser session.",
5
5
  "author": "William Liu <lyz15972107087@gmail.com>",
6
6
  "license": "Apache-2.0",
package/src/viewer/app.js CHANGED
@@ -308,7 +308,8 @@ cropController = createCropController({
308
308
  transformControls,
309
309
  viewerElements,
310
310
  cancelOtherPositionPickModes: () => setPositionController.cancelMode(),
311
- getCurrentRootTransformArray: () => rootTransform.getCurrentRootTransformArray(),
311
+ getCurrentRootTransformArray: () =>
312
+ rootTransform.getCurrentRootTransformArray(),
312
313
  getTilesetBoundingSphere,
313
314
  });
314
315
 
@@ -402,6 +403,7 @@ async function moveTilesToCoordinate() {
402
403
  coordinate.longitude,
403
404
  coordinate.height,
404
405
  );
406
+ flyTo.moveCameraToTiles();
405
407
  setStatus(
406
408
  'Moved tileset root to the specified coordinate using ENU orientation. Click Save to persist.',
407
409
  );
@@ -510,7 +512,8 @@ async function saveTransform() {
510
512
  );
511
513
 
512
514
  const currentMatrix = rootTransform.getCurrentMatrix();
513
- const incrementalMatrix = rootTransform.getIncrementalSinceSaved(currentMatrix);
515
+ const incrementalMatrix =
516
+ rootTransform.getIncrementalSinceSaved(currentMatrix);
514
517
  const saveState = geometricError.getSaveState();
515
518
  let unlockSaveUi = true;
516
519
 
@@ -30,11 +30,7 @@ const _flyCameraRight = new Vector3();
30
30
  const _flyReferenceUp = new Vector3();
31
31
  const _flyReferenceRight = new Vector3();
32
32
  const _flyQuaternion = new Quaternion();
33
- const _ellipsoidRadii = new Vector3(
34
- 6378137.0,
35
- 6378137.0,
36
- 6356752.3142451793,
37
- );
33
+ const _ellipsoidRadii = new Vector3(6378137.0, 6378137.0, 6356752.3142451793);
38
34
  const _oneOverRadiiSquared = new Vector3(
39
35
  1 / (_ellipsoidRadii.x * _ellipsoidRadii.x),
40
36
  1 / (_ellipsoidRadii.y * _ellipsoidRadii.y),
@@ -72,12 +68,7 @@ function eastNorthUpToFixedFrame(origin) {
72
68
  );
73
69
  }
74
70
 
75
- export function createCameraFlight(
76
- camera,
77
- position,
78
- target,
79
- options = {},
80
- ) {
71
+ export function createCameraFlight(camera, position, target, options = {}) {
81
72
  const duration = options.duration ?? 2500;
82
73
  const endPosition = position.clone();
83
74
  const endQuaternion = getEndQuaternion(endPosition, target, options);
@@ -98,11 +89,7 @@ export function createCameraFlight(
98
89
  });
99
90
  }
100
91
 
101
- export function createCameraPoseFlight(
102
- camera,
103
- position,
104
- options,
105
- ) {
92
+ export function createCameraPoseFlight(camera, position, options) {
106
93
  const duration = options.duration ?? 2500;
107
94
  const endPosition = position.clone();
108
95
  const endQuaternion = getHeadingPitchRollQuaternion(
@@ -165,11 +152,7 @@ export function getFlyToParamsFromBoundingSphere(
165
152
  };
166
153
  }
167
154
 
168
- export function flyTo(
169
- camera,
170
- flight,
171
- time,
172
- ) {
155
+ export function flyTo(camera, flight, time) {
173
156
  if (flight.startTime === null) {
174
157
  flight.startTime = time;
175
158
  }
@@ -227,7 +210,12 @@ function getFlyToPosition(flight, t) {
227
210
  .applyAxisAngle(_flyAxis, angle * t)
228
211
  .normalize();
229
212
  } else {
230
- _flyDirection.copy(_flyDirectionStart);
213
+ _flyDirection.lerpVectors(_flyDirectionStart, _flyDirectionEnd, t);
214
+ if (_flyDirection.lengthSq() < 1e-12) {
215
+ _flyDirection.copy(_flyDirectionEnd);
216
+ } else {
217
+ _flyDirection.normalize();
218
+ }
231
219
  }
232
220
 
233
221
  const radius =
@@ -236,11 +224,7 @@ function getFlyToPosition(flight, t) {
236
224
  return _flyDirection.multiplyScalar(radius);
237
225
  }
238
226
 
239
- function getUprightInterpolatedQuaternion(
240
- flight,
241
- position,
242
- t,
243
- ) {
227
+ function getUprightInterpolatedQuaternion(flight, position, t) {
244
228
  const heading = lerpAngle(flight.startHeading, flight.endHeading, t);
245
229
  const pitch = MathUtils.lerp(flight.startPitch, flight.endPitch, t);
246
230
  return getHeadingPitchRollQuaternion(position, heading, pitch, 0);
@@ -366,10 +350,7 @@ function getForwardFromQuaternion(quaternion, target) {
366
350
  return target.set(0, 0, -1).applyQuaternion(quaternion).normalize();
367
351
  }
368
352
 
369
- function getUprightHeadingPitchAtPose(
370
- position,
371
- quaternion,
372
- ) {
353
+ function getUprightHeadingPitchAtPose(position, quaternion) {
373
354
  if (isCenterModePosition(position)) {
374
355
  const forward = getForwardFromQuaternion(quaternion, _flyForward);
375
356
  _flyCameraRight.set(1, 0, 0).applyQuaternion(quaternion);
@@ -489,11 +470,7 @@ function getRollAtPose(position, quaternion) {
489
470
  );
490
471
  }
491
472
 
492
- function getEndQuaternion(
493
- position,
494
- target,
495
- options,
496
- ) {
473
+ function getEndQuaternion(position, target, options) {
497
474
  const { heading, pitch, roll } = options;
498
475
  if (heading === undefined && pitch === undefined && roll === undefined) {
499
476
  return getLookAtQuaternion(position, target);
@@ -516,12 +493,7 @@ function getEndQuaternion(
516
493
  );
517
494
  }
518
495
 
519
- function getBoundingSphereFlyToPosition(
520
- camera,
521
- target,
522
- range,
523
- options,
524
- ) {
496
+ function getBoundingSphereFlyToPosition(camera, target, range, options) {
525
497
  const { heading, pitch } = options;
526
498
  if (heading === undefined && pitch === undefined) {
527
499
  const direction =
@@ -554,12 +526,7 @@ function getBoundingSphereFlyToPosition(
554
526
  return _flyDirection.copy(target).addScaledVector(forward, -range);
555
527
  }
556
528
 
557
- function getHeadingPitchRollQuaternion(
558
- referencePoint,
559
- heading,
560
- pitch,
561
- roll,
562
- ) {
529
+ function getHeadingPitchRollQuaternion(referencePoint, heading, pitch, roll) {
563
530
  if (isCenterModePosition(referencePoint)) {
564
531
  getCenterModeHeadingPitchRollBasis(heading, pitch, roll);
565
532
  _matrix1.makeBasis(_flyRight, _flyUp, _flyBackward);
@@ -575,11 +542,7 @@ function getHeadingPitchRollQuaternion(
575
542
  return new Quaternion().setFromRotationMatrix(_matrix1);
576
543
  }
577
544
 
578
- function getHeadingPitchRollForward(
579
- referencePoint,
580
- heading,
581
- pitch,
582
- ) {
545
+ function getHeadingPitchRollForward(referencePoint, heading, pitch) {
583
546
  if (isCenterModePosition(referencePoint)) {
584
547
  return getCenterModeHeadingPitchRollForward(heading, pitch);
585
548
  }
@@ -604,30 +567,18 @@ function getHeadingPitchRollForward(
604
567
  return _flyForward;
605
568
  }
606
569
 
607
- function getCenterModeHeadingPitchRollForward(
608
- heading,
609
- pitch,
610
- ) {
570
+ function getCenterModeHeadingPitchRollForward(heading, pitch) {
611
571
  const cosPitch = Math.cos(pitch);
612
572
  const sinPitch = Math.sin(pitch);
613
573
  const cosHeading = Math.cos(heading);
614
574
  const sinHeading = Math.sin(heading);
615
575
 
616
- _flyForward.set(
617
- sinHeading * cosPitch,
618
- cosHeading * cosPitch,
619
- sinPitch,
620
- );
576
+ _flyForward.set(sinHeading * cosPitch, cosHeading * cosPitch, sinPitch);
621
577
 
622
578
  return _flyForward.normalize();
623
579
  }
624
580
 
625
- function getHeadingPitchRollBasis(
626
- referencePoint,
627
- heading,
628
- pitch,
629
- roll,
630
- ) {
581
+ function getHeadingPitchRollBasis(referencePoint, heading, pitch, roll) {
631
582
  if (isCenterModePosition(referencePoint)) {
632
583
  getCenterModeHeadingPitchRollBasis(heading, pitch, roll);
633
584
  return;
@@ -650,11 +601,7 @@ function getHeadingPitchRollBasis(
650
601
  _flyBackward.copy(_flyForward).negate();
651
602
  }
652
603
 
653
- function getCenterModeHeadingPitchRollBasis(
654
- heading,
655
- pitch,
656
- roll,
657
- ) {
604
+ function getCenterModeHeadingPitchRollBasis(heading, pitch, roll) {
658
605
  getCenterModeHeadingPitchRollForward(heading, pitch);
659
606
 
660
607
  _flyRight
@@ -683,13 +630,7 @@ function isCenterModePosition(position) {
683
630
  return position.lengthSq() <= CAMERA_CENTER_MODE_DISTANCE_SQ;
684
631
  }
685
632
 
686
- function getReferenceBasis(
687
- forward,
688
- east,
689
- up,
690
- rightTarget,
691
- upTarget,
692
- ) {
633
+ function getReferenceBasis(forward, east, up, rightTarget, upTarget) {
693
634
  rightTarget.crossVectors(forward, up);
694
635
  if (rightTarget.lengthSq() < 1e-6) {
695
636
  rightTarget.copy(east).projectOnPlane(forward);
@@ -712,12 +653,7 @@ function lerpAngle(start, end, t) {
712
653
  return start + delta * t;
713
654
  }
714
655
 
715
- function applyFlyToPose(
716
- camera,
717
- position,
718
- quaternion,
719
- zoom = null,
720
- ) {
656
+ function applyFlyToPose(camera, position, quaternion, zoom = null) {
721
657
  camera.position.copy(position);
722
658
  camera.quaternion.copy(quaternion);
723
659