@inweb/viewer-three 25.10.1 → 25.11.1

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.
@@ -49,7 +49,7 @@ export class DefaultPositionComponent implements IDisposable {
49
49
  this.viewer.camera.updateMatrixWorld();
50
50
  this.viewer.camera.updateProjectionMatrix();
51
51
 
52
- // this.viewer.executeCommand("setDefaultViewPosition", "sw");
52
+ this.viewer.executeCommand("setDefaultViewPosition", "sw");
53
53
  this.viewer.executeCommand("zoomToExtents");
54
54
  };
55
55
  }
@@ -85,18 +85,17 @@ export class SelectionComponent implements IDisposable {
85
85
  this.viewer.executeCommand("zoomToSelected");
86
86
  };
87
87
 
88
- getMousePosition(event: MouseEvent, position: Vector2): Vector2 {
89
- const rect = this.viewer.canvas.getBoundingClientRect();
90
-
91
- position.setX((event.clientX - rect.left) / rect.width);
92
- position.setY((event.clientY - rect.top) / rect.height);
93
-
94
- return position;
88
+ getMousePosition(event: MouseEvent, target: Vector2): Vector2 {
89
+ return target.set(event.clientX, event.clientY);
95
90
  }
96
91
 
97
- getPointerIntersects(position: Vector2): Array<Intersection<Object3D>> {
98
- const mouse = new Vector2(position.x * 2 - 1, -(position.y * 2) + 1);
99
- this.raycaster.setFromCamera(mouse, this.viewer.camera);
92
+ getPointerIntersects(mouse: Vector2): Array<Intersection<Object3D>> {
93
+ const rect = this.viewer.canvas.getBoundingClientRect();
94
+ const x = ((mouse.x - rect.left) / rect.width) * 2 - 1;
95
+ const y = (-(mouse.y - rect.top) / rect.height) * 2 + 1;
96
+
97
+ const coords = new Vector2(x, y);
98
+ this.raycaster.setFromCamera(coords, this.viewer.camera);
100
99
 
101
100
  const objects = [];
102
101
  this.viewer.scene.traverseVisible((child) => objects.push(child));