three-cad-viewer 1.8.3 → 1.8.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.
@@ -55858,11 +55858,15 @@ class OrientationMarker {
55858
55858
 
55859
55859
  // handler (bound to OrientationMarker instance)
55860
55860
 
55861
- update(position, rotation, quaternion) {
55861
+ update(position, quaternion) {
55862
55862
  if (this.ready) {
55863
- this.camera.position.copy(position);
55864
- this.camera.position.setLength(300);
55865
- this.camera.rotation.copy(rotation);
55863
+ let q = new Quaternion().setFromUnitVectors(
55864
+ new Vector3(0, 0, 1), position.normalize()
55865
+ );
55866
+ this.camera.position.set(0, 0, 1).applyQuaternion(q).multiplyScalar(300);
55867
+
55868
+ this.camera.quaternion.copy(quaternion);
55869
+
55866
55870
  for (var i = 0; i < 3; i++) {
55867
55871
  this.labels[i].position.set(
55868
55872
  i == 0 ? distance : 0,
@@ -58723,7 +58727,7 @@ class Camera {
58723
58727
  }
58724
58728
  }
58725
58729
 
58726
- const version="1.8.3";
58730
+ const version="1.8.5";
58727
58731
 
58728
58732
  class Viewer {
58729
58733
  /**
@@ -59164,7 +59168,6 @@ class Viewer {
59164
59168
 
59165
59169
  this.orientationMarker.update(
59166
59170
  this.camera.getPosition().clone().sub(this.controls.getTarget()),
59167
- this.camera.getRotation(),
59168
59171
  this.camera.getQuaternion(),
59169
59172
  );
59170
59173
  this.orientationMarker.render(this.renderer);
@@ -59498,8 +59501,8 @@ class Viewer {
59498
59501
 
59499
59502
  const theme =
59500
59503
  this.theme === "dark" ||
59501
- (this.theme === "browser" &&
59502
- window.matchMedia("(prefers-color-scheme: dark)").matches)
59504
+ (this.theme === "browser" &&
59505
+ window.matchMedia("(prefers-color-scheme: dark)").matches)
59503
59506
  ? "dark"
59504
59507
  : "light";
59505
59508
 
@@ -59615,7 +59618,9 @@ class Viewer {
59615
59618
  * @param {boolean} [notify=true] - whether to send notification or not.
59616
59619
  */
59617
59620
  presetCamera = (dir, zoom = null, notify = true) => {
59621
+ this.camera.target = new Vector3(...this.bbox.center());
59618
59622
  this.camera.presetCamera(dir, zoom, notify);
59623
+ this.controls.setTarget(this.camera.target);
59619
59624
  this.update(true, notify);
59620
59625
  };
59621
59626
 
@@ -60722,6 +60727,14 @@ class Viewer {
60722
60727
  // update the this
60723
60728
  this.update(true);
60724
60729
  }
60730
+
60731
+ vector3(x = 0, y = 0, z = 0) {
60732
+ return new Vector3(x, y, z);
60733
+ }
60734
+
60735
+ quaternion(x = 0, y = 0, z = 0, w = 1) {
60736
+ return new Quaternion(x, y, z, w);
60737
+ }
60725
60738
  }
60726
60739
 
60727
60740
  export { Display, Timer, Viewer };