@inweb/viewer-three 26.10.4 → 26.10.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.
@@ -10,6 +10,9 @@ export declare class OrbitDragger implements IDragger {
10
10
  dispose(): void;
11
11
  updateControls: () => void;
12
12
  updateControlsCamera: () => void;
13
+ optionsChange: ({ data: options }: {
14
+ data: any;
15
+ }) => void;
13
16
  controlsStart: () => void;
14
17
  controlsChange: () => void;
15
18
  stopContextMenu: (event: PointerEvent) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inweb/viewer-three",
3
- "version": "26.10.4",
3
+ "version": "26.10.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,18 +35,18 @@
35
35
  "docs": "typedoc"
36
36
  },
37
37
  "dependencies": {
38
- "@inweb/client": "~26.10.4",
39
- "@inweb/eventemitter2": "~26.10.4",
40
- "@inweb/markup": "~26.10.4",
41
- "@inweb/viewer-core": "~26.10.4"
38
+ "@inweb/client": "~26.10.6",
39
+ "@inweb/eventemitter2": "~26.10.6",
40
+ "@inweb/markup": "~26.10.6",
41
+ "@inweb/viewer-core": "~26.10.6"
42
42
  },
43
43
  "devDependencies": {
44
- "@types/three": "^0.179.0",
44
+ "@types/three": "^0.180.0",
45
45
  "potree-core": "^2.0.11",
46
- "three": "^0.179.1"
46
+ "three": "^0.180.0"
47
47
  },
48
48
  "peerDependencies": {
49
- "@types/three": "^0.179.0",
50
- "three": "^0.179.1"
49
+ "@types/three": "^0.180.0",
50
+ "three": "^0.180.0"
51
51
  }
52
52
  }
@@ -30,7 +30,7 @@
30
30
  // published under MIT license
31
31
 
32
32
  /* eslint-disable lines-between-class-members */
33
- /* eslint-disable @typescript-eslint/no-unused-vars */
33
+ /* eslint-disable no-unused-vars */
34
34
  /* eslint-disable prefer-const */
35
35
  /* eslint-disable no-useless-catch */
36
36
 
@@ -35,7 +35,7 @@ import { LineSegmentsGeometry } from "three/examples/jsm/lines/LineSegmentsGeome
35
35
  import { Wireframe } from "three/examples/jsm/lines/Wireframe.js";
36
36
  import { LineMaterial } from "three/examples/jsm/lines/LineMaterial.js";
37
37
 
38
- import { IComponent, ResizeEvent } from "@inweb/viewer-core";
38
+ import { IComponent, Options, ResizeEvent } from "@inweb/viewer-core";
39
39
  import { Viewer } from "../Viewer";
40
40
  import { HighlighterUtils } from "./HighlighterUtils";
41
41
 
@@ -178,8 +178,10 @@ export class HighlighterComponent implements IComponent {
178
178
  };
179
179
 
180
180
  syncHighlightColors() {
181
- const { facesColor, facesTransparancy, facesOverlap } = this.viewer.options;
182
- const { edgesColor, edgesVisibility, edgesOverlap } = this.viewer.options;
181
+ const options = this.viewer.options.enableCustomHighlight ? this.viewer.options : Options.defaults();
182
+
183
+ const { facesColor, facesTransparancy, facesOverlap } = options;
184
+ const { edgesColor, edgesVisibility, edgesOverlap } = options;
183
185
 
184
186
  this.facesMaterial.color.setRGB(facesColor.r / 255, facesColor.g / 255, facesColor.b / 255);
185
187
  this.facesMaterial.opacity = (255 - facesTransparancy) / 255;
@@ -285,7 +285,6 @@ class OrbitControls extends EventDispatcher {
285
285
  // internals
286
286
  //
287
287
 
288
- // eslint-disable-next-line @typescript-eslint/no-this-alias
289
288
  const scope = this;
290
289
 
291
290
  scope.state = STATE.NONE;
@@ -367,7 +367,7 @@ class MeasureOverlay {
367
367
  if (!this.canvas.parentElement) return;
368
368
 
369
369
  this.canvas.parentElement.appendChild(this.container);
370
- this.resizeObserver.observe(this.canvas.parentElement);
370
+ this.resizeObserver.observe(this.canvas);
371
371
  }
372
372
 
373
373
  dispose() {
@@ -403,13 +403,16 @@ class MeasureOverlay {
403
403
  this.lines = this.lines.filter((x) => x !== line);
404
404
  }
405
405
 
406
- resizeContainer = (entries: ResizeObserverEntry[]) => {
407
- const { width, height } = entries[0].contentRect;
406
+ resizeContainer = () => {
407
+ const { offsetLeft, offsetTop, offsetWidth, offsetHeight } = this.canvas;
408
408
 
409
- if (!width || !height) return; // <- invisible canvas, or canvas with parent removed
409
+ if (!offsetWidth || !offsetHeight) return; // <- invisible canvas, or canvas with parent removed
410
410
 
411
- this.container.style.width = `${width}px`;
412
- this.container.style.height = `${height}px`;
411
+ this.container.style.left = `${offsetLeft}px`;
412
+ this.container.style.top = `${offsetTop}px`;
413
+
414
+ this.container.style.width = `${offsetWidth}px`;
415
+ this.container.style.height = `${offsetHeight}px`;
413
416
  };
414
417
  }
415
418
 
@@ -47,6 +47,7 @@ export class OrbitDragger implements IDragger {
47
47
  this.viewer.addEventListener("zoom", this.updateControls);
48
48
  this.viewer.addEventListener("drawviewpoint", this.updateControls);
49
49
  this.viewer.addEventListener("changecameramode", this.updateControlsCamera);
50
+ this.viewer.addEventListener("optionschange", this.optionsChange);
50
51
  this.viewer.addEventListener("contextmenu", this.stopContextMenu);
51
52
  this.updateControls();
52
53
  }
@@ -59,6 +60,7 @@ export class OrbitDragger implements IDragger {
59
60
  this.viewer.removeEventListener("zoom", this.updateControls);
60
61
  this.viewer.removeEventListener("drawviewpoint", this.updateControls);
61
62
  this.viewer.removeEventListener("changecameramode", this.updateControlsCamera);
63
+ this.viewer.removeEventListener("optionschange", this.optionsChange);
62
64
  this.viewer.removeEventListener("contextmenu", this.stopContextMenu);
63
65
 
64
66
  this.orbit.removeEventListener("start", this.controlsStart);
@@ -78,6 +80,10 @@ export class OrbitDragger implements IDragger {
78
80
  this.orbit.update();
79
81
  };
80
82
 
83
+ optionsChange = ({ data: options }) => {
84
+ this.orbit.zoomSpeed = Math.abs(this.orbit.zoomSpeed) * (options.reverseZoomWheel ? -1 : 1);
85
+ };
86
+
81
87
  controlsStart = () => {
82
88
  this.changed = false;
83
89
  };