@inweb/viewer-visualize 25.8.15 → 25.8.16

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.
@@ -17174,21 +17174,18 @@
17174
17174
  screenToWorld(position) {
17175
17175
  if (!this.visualizeJs)
17176
17176
  return { x: position.x, y: position.y, z: 0 };
17177
- const worldPoint = this.visViewer().screenToWorld(position.x * window.devicePixelRatio, position.y * window.devicePixelRatio);
17177
+ const activeView = this.visViewer().activeView;
17178
+ const worldPoint = activeView.transformScreenToWorld(position.x * window.devicePixelRatio, position.y * window.devicePixelRatio);
17178
17179
  const result = { x: worldPoint[0], y: worldPoint[1], z: worldPoint[2] };
17180
+ activeView.delete();
17179
17181
  return result;
17180
17182
  }
17181
17183
  worldToScreen(position) {
17182
17184
  if (!this.visualizeJs)
17183
17185
  return { x: position.x, y: position.y };
17184
17186
  const activeView = this.visViewer().activeView;
17185
- const worldMatrix = activeView.worldToDeviceMatrix;
17186
- const worldPoint = this.visLib().Point3d.createFromArray([position.x, position.y, position.z]);
17187
- const devicePoint = worldPoint.transformBy(worldMatrix);
17188
- const result = { x: devicePoint.x / window.devicePixelRatio, y: devicePoint.y / window.devicePixelRatio };
17189
- devicePoint.delete();
17190
- worldPoint.delete();
17191
- worldMatrix.delete();
17187
+ const devicePoint = activeView.transformWorldToScreen(position.x, position.y, position.z);
17188
+ const result = { x: devicePoint[0] / window.devicePixelRatio, y: devicePoint[1] / window.devicePixelRatio };
17192
17189
  activeView.delete();
17193
17190
  return result;
17194
17191
  }