@inweb/viewer-three 26.12.4 → 26.12.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.
@@ -6,5 +6,5 @@ export declare class ResetComponent implements IComponent {
6
6
  constructor(viewer: Viewer);
7
7
  dispose(): void;
8
8
  onDatabaseChunk: () => void;
9
- resetCameraPosition(): void;
9
+ resetCameraPosition: () => void;
10
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inweb/viewer-three",
3
- "version": "26.12.4",
3
+ "version": "26.12.6",
4
4
  "description": "JavaScript library for rendering CAD and BIM files in a browser using Three.js",
5
5
  "homepage": "https://cloud.opendesign.com/docs/index.html",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -35,10 +35,10 @@
35
35
  "docs": "typedoc"
36
36
  },
37
37
  "dependencies": {
38
- "@inweb/client": "~26.12.4",
39
- "@inweb/eventemitter2": "~26.12.4",
40
- "@inweb/markup": "~26.12.4",
41
- "@inweb/viewer-core": "~26.12.4"
38
+ "@inweb/client": "~26.12.6",
39
+ "@inweb/eventemitter2": "~26.12.6",
40
+ "@inweb/markup": "~26.12.6",
41
+ "@inweb/viewer-core": "~26.12.6"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/three": "^0.180.0",
@@ -22,11 +22,8 @@
22
22
  ///////////////////////////////////////////////////////////////////////////////
23
23
 
24
24
  import type { Viewer } from "../Viewer";
25
- import type { ResetComponent } from "../components/ResetComponent";
26
25
 
27
26
  export function resetView(viewer: Viewer): void {
28
- const reset = viewer.getComponent("ResetComponent") as ResetComponent;
29
-
30
27
  viewer.executeCommand("setActiveDragger");
31
28
  viewer.executeCommand("clearSlices");
32
29
  viewer.executeCommand("clearOverlay");
@@ -36,7 +33,5 @@ export function resetView(viewer: Viewer): void {
36
33
  viewer.executeCommand("explode", 0);
37
34
  viewer.executeCommand("zoomToExtents", true);
38
35
 
39
- reset.resetCameraPosition();
40
-
41
36
  viewer.emit({ type: "resetview" });
42
37
  }
@@ -40,9 +40,11 @@ export class ResetComponent implements IComponent {
40
40
  constructor(viewer: Viewer) {
41
41
  this.viewer = viewer;
42
42
  this.viewer.addEventListener("databasechunk", this.onDatabaseChunk);
43
+ this.viewer.on("resetview", this.resetCameraPosition);
43
44
  }
44
45
 
45
46
  dispose() {
47
+ this.viewer.off("resetview", this.resetCameraPosition);
46
48
  this.viewer.removeEventListener("databasechunk", this.onDatabaseChunk);
47
49
  }
48
50
 
@@ -54,11 +56,12 @@ export class ResetComponent implements IComponent {
54
56
  };
55
57
  };
56
58
 
57
- resetCameraPosition() {
59
+ resetCameraPosition = () => {
58
60
  if (this.savedCameraPosition) {
59
61
  this.viewer.camera.position.copy(this.savedCameraPosition.position);
60
62
  this.viewer.camera.up.copy(this.savedCameraPosition.up);
61
63
  this.viewer.camera.lookAt(this.savedCameraPosition.position.clone().add(this.savedCameraPosition.direction));
64
+ this.viewer.camera.updateProjectionMatrix();
62
65
  }
63
- }
66
+ };
64
67
  }
@@ -89,7 +89,7 @@ export class JoyStickControls extends Controls<JoyStickControlsEventMap> {
89
89
  this.overlayElement.style.position = "fixed";
90
90
  this.overlayElement.style.zIndex = "0";
91
91
  this.overlayElement.style.touchAction = "none";
92
- document.body.appendChild(this.overlayElement);
92
+ canvasElement.parentElement.appendChild(this.overlayElement);
93
93
 
94
94
  this.joyStickCanvas = document.createElement("canvas");
95
95
  this.joyStickCanvas.id = "joyStickCanvas";