three-cad-viewer 1.6.2 → 1.6.3

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.
@@ -51197,8 +51197,8 @@ function TEMPLATE(id) {
51197
51197
  <label for='tcv_axes_${id}' class="tcv_label">Axes</label>
51198
51198
  </span>
51199
51199
  <div class="tcv_grid-dropdown">
51200
- <input class='tcv_grid tcv_check' id='tcv_grid' type="checkbox" /><label for='tcv_grid'
51201
- class="tcv_label">Grid</label>
51200
+ <input class='tcv_grid tcv_check' id='tcv_grid_${id}' type="checkbox" />
51201
+ <label for='tcv_grid_${id}' class="tcv_label">Grid</label>
51202
51202
  <div class="tcv_grid-content tcv_dropdown-content">
51203
51203
  <div class="tcv_tooltip" data-tooltip="Show xy grid">
51204
51204
  <input class='tcv_grid-xy tcv_check tcv_dropdown-entry' id='tcv_grid-xy_${id}' type="checkbox">
@@ -57360,14 +57360,31 @@ class Controls {
57360
57360
  }
57361
57361
 
57362
57362
  const defaultDirections = {
57363
- iso: new Vector3(1, 1, 1),
57364
- front: new Vector3(1, 0, 0),
57365
- rear: new Vector3(-1, 0, 0),
57366
- left: new Vector3(0, 1, 0),
57367
- right: new Vector3(0, -1, 0),
57368
- top: new Vector3(0, 0, 1),
57369
- bottom: new Vector3(0, 0, -1),
57363
+ y_up: {
57364
+ iso: new Vector3(1, 1, 1),
57365
+ front: new Vector3(0, 0, 1),
57366
+ rear: new Vector3(0, 0, -1),
57367
+ left: new Vector3(-1, 0, 0), // compatible to fusion 360
57368
+ right: new Vector3(1, 0, 0), // compatible to fusion 360
57369
+ top: new Vector3(0, 1, 0),
57370
+ bottom: new Vector3(0, -1, 0),
57371
+ },
57372
+ z_up: {
57373
+ iso: new Vector3(1, 1, 1),
57374
+ front: new Vector3(1, 0, 0),
57375
+ rear: new Vector3(-1, 0, 0),
57376
+ left: new Vector3(0, 1, 0),
57377
+ right: new Vector3(0, -1, 0),
57378
+ top: new Vector3(0, 0, 1),
57379
+ bottom: new Vector3(0, 0, -1),
57380
+ }
57381
+ };
57382
+
57383
+ const cameraUp = {
57384
+ y_up: [0, 1, 0],
57385
+ z_up: [0, 0, 1],
57370
57386
  };
57387
+
57371
57388
  class Camera {
57372
57389
  /**
57373
57390
  * Create a combined camera (orthographic and persepctive).
@@ -57376,11 +57393,12 @@ class Camera {
57376
57393
  * @param {number} distance - distance from the lookAt point.
57377
57394
  * @param {THREE.Vector3} target - target (Vector3) to look at.
57378
57395
  * @param {boolean} ortho - flag whether the initial camera should be orthographic.
57396
+ * @param {string} up - Z or Y to define whether Z or Y direction is camera up.
57379
57397
  **/
57380
- constructor(width, height, distance, target, ortho) {
57398
+ constructor(width, height, distance, target, ortho, up) {
57381
57399
  this.target = new Vector3(...target);
57382
57400
  this.ortho = ortho;
57383
-
57401
+ this.up = (up == "Y") ? "y_up" : "z_up";
57384
57402
  this.yaxis = new Vector3(0, 1, 0);
57385
57403
  this.zaxis = new Vector3(0, 0, 1);
57386
57404
 
@@ -57399,7 +57417,7 @@ class Camera {
57399
57417
  0.1,
57400
57418
  100 * distance,
57401
57419
  );
57402
- this.pCamera.up.set(0, 0, 1);
57420
+ this.pCamera.up.set(...cameraUp[this.up]);
57403
57421
  this.pCamera.lookAt(this.target);
57404
57422
 
57405
57423
  // define the orthographic camera
@@ -57415,11 +57433,11 @@ class Camera {
57415
57433
  0.1,
57416
57434
  100 * distance,
57417
57435
  );
57418
- this.oCamera.up.set(0, 0, 1);
57436
+ this.oCamera.up.set(...cameraUp[this.up]);
57419
57437
  this.oCamera.lookAt(this.target);
57420
57438
 
57421
57439
  this.camera = ortho ? this.oCamera : this.pCamera;
57422
- this.camera.up.set(0, 0, 1);
57440
+ this.camera.up.set(...cameraUp[this.up]);
57423
57441
  }
57424
57442
 
57425
57443
  /**
@@ -57516,7 +57534,7 @@ class Camera {
57516
57534
  zoom = this.camera.zoom;
57517
57535
  }
57518
57536
  // For the default directions quaternion can be ignored, it will be reset automatically
57519
- this.setupCamera(true, defaultDirections[dir], null, zoom);
57537
+ this.setupCamera(true, defaultDirections[this.up][dir], null, zoom);
57520
57538
  this.lookAtTarget();
57521
57539
  }
57522
57540
 
@@ -57585,7 +57603,7 @@ class Camera {
57585
57603
 
57586
57604
  /**
57587
57605
  * Set camera quaternion.
57588
- * @param {(Array(4)|THREE.Vector3)} quaternion - quaternion as 4 dim Array or as Quaternion.
57606
+ * @param {(Array(4)|THREE.Quaternion)} quaternion - quaternion as 4 dim Array or as Quaternion.
57589
57607
  **/
57590
57608
  setQuaternion(quaternion) {
57591
57609
  const scope = this;
@@ -57625,7 +57643,7 @@ class Camera {
57625
57643
  }
57626
57644
  }
57627
57645
 
57628
- const version="1.6.2";
57646
+ const version="1.6.3";
57629
57647
 
57630
57648
  class Viewer {
57631
57649
  /**
@@ -58249,7 +58267,7 @@ class Viewer {
58249
58267
  this.bb_radius,
58250
58268
  options.target == null ? this.bbox.center() : options.target,
58251
58269
  this.ortho,
58252
- this.control,
58270
+ options.up,
58253
58271
  );
58254
58272
 
58255
58273
  //