@inweb/viewer-visualize 25.8.8 → 25.8.9

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.
@@ -16,6 +16,7 @@ export declare class MeasureLineDragger extends OdBaseDragger {
16
16
  updatePreview(): void;
17
17
  resize(): void;
18
18
  getSnapPointRadius(): number;
19
+ start(x: number, y: number): void;
19
20
  drag(x: number, y: number): void;
20
21
  end(): void;
21
22
  createNewMeasureIfNeed(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inweb/viewer-visualize",
3
- "version": "25.8.8",
3
+ "version": "25.8.9",
4
4
  "description": "3D CAD and BIM data Viewer powered by Visualize",
5
5
  "homepage": "https://cloud.opendesign.com/docs/index.html",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -29,10 +29,10 @@
29
29
  "docs": "typedoc"
30
30
  },
31
31
  "dependencies": {
32
- "@inweb/client": "~25.8.8",
33
- "@inweb/eventemitter2": "~25.8.8",
34
- "@inweb/markup": "~25.8.8",
35
- "@inweb/viewer-core": "~25.8.8"
32
+ "@inweb/client": "~25.8.9",
33
+ "@inweb/eventemitter2": "~25.8.9",
34
+ "@inweb/markup": "~25.8.9",
35
+ "@inweb/viewer-core": "~25.8.9"
36
36
  },
37
37
  "visualizeJS": "https://opencloud.azureedge.net/libs/visualizejs/master/Visualize.js"
38
38
  }
@@ -109,6 +109,16 @@ export class MeasureLineDragger extends OdBaseDragger {
109
109
  return Math.min(pt2[0], pt2[1]) / 120;
110
110
  }
111
111
 
112
+ override start(x: number, y: number): void {
113
+ this.createNewMeasureIfNeed();
114
+ const point = this.getViewer().getSnapPoint(x, y, this.gripingRadius);
115
+
116
+ if (point) {
117
+ this.firstPoint = point;
118
+ this.previewMeasureLine.setStartPoint(this.firstPoint);
119
+ }
120
+ }
121
+
112
122
  override drag(x: number, y: number): void {
113
123
  this.createNewMeasureIfNeed();
114
124
  const point = this.getViewer().getSnapPoint(x, y, this.gripingRadius);
@@ -741,11 +741,19 @@ export class Viewer
741
741
  }
742
742
 
743
743
  screenToWorld(position: { x: number; y: number }): { x: number; y: number; z: number } {
744
- return this.visViewer().screenToWorld(position.x * window.devicePixelRatio, position.y * window.devicePixelRatio);
744
+ if (!this.visualizeJs) return { x: position.x, y: position.y, z: 0 };
745
+
746
+ const worldPoint = this.visViewer().screenToWorld(
747
+ position.x * window.devicePixelRatio,
748
+ position.y * window.devicePixelRatio
749
+ );
750
+ const result = { x: worldPoint[0], y: worldPoint[1], z: worldPoint[2] };
751
+
752
+ return result;
745
753
  }
746
754
 
747
755
  worldToScreen(position: { x: number; y: number; z: number }): { x: number; y: number } {
748
- if (!this.visualizeJs) return position;
756
+ if (!this.visualizeJs) return { x: position.x, y: position.y };
749
757
 
750
758
  const activeView = this.visViewer().activeView;
751
759
  const worldMatrix = activeView.worldToDeviceMatrix;
@@ -768,14 +776,14 @@ export class Viewer
768
776
  const projMatrix = this.visViewer().activeView.projectionMatrix;
769
777
  const tolerance = 1.0e-6;
770
778
 
771
- const x = projMatrix.get(1, 1);
772
- if (x > tolerance || x < -tolerance) result.x = 1 / result.x;
779
+ const x = projMatrix.get(0, 0);
780
+ if (x > tolerance || x < -tolerance) result.x = 1 / x;
773
781
 
774
782
  const y = projMatrix.get(1, 1);
775
- if (y > tolerance || y < -tolerance) result.y = 1 / result.y;
783
+ if (y > tolerance || y < -tolerance) result.y = 1 / y;
776
784
 
777
785
  const z = projMatrix.get(2, 2);
778
- if (z > tolerance || z < -tolerance) result.z = 1 / result.z;
786
+ if (z > tolerance || z < -tolerance) result.z = 1 / z;
779
787
 
780
788
  return result;
781
789
  }