@inweb/viewer-three 26.12.0 → 26.12.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.
@@ -54214,14 +54214,13 @@ js: import "konva/skia-backend";
54214
54214
  });
54215
54215
  };
54216
54216
  this.pan = () => {
54217
- this.getObjects().forEach((markupObject) => {
54218
- markupObject.updateScreenCoordinates();
54219
- });
54217
+ this.updateScreenCoordinatesForAll();
54220
54218
  };
54221
54219
  this.zoomAt = () => {
54222
- this.getObjects().forEach((markupObject) => {
54223
- markupObject.updateScreenCoordinates();
54224
- });
54220
+ this.updateScreenCoordinatesForAll();
54221
+ };
54222
+ this.changeCameraMode = () => {
54223
+ this.clearOverlay();
54225
54224
  };
54226
54225
  this.redirectToViewer = (event) => {
54227
54226
  if (this._viewer)
@@ -54255,11 +54254,13 @@ js: import "konva/skia-backend";
54255
54254
  this._viewer.addEventListener("changeactivedragger", this.changeActiveDragger);
54256
54255
  this._viewer.addEventListener("pan", this.pan);
54257
54256
  this._viewer.addEventListener("zoomat", this.zoomAt);
54257
+ this._viewer.addEventListener("changecameramode", this.changeCameraMode);
54258
54258
  }
54259
54259
  }
54260
54260
  dispose() {
54261
54261
  var _a, _b;
54262
54262
  if (this._viewer) {
54263
+ this._viewer.removeEventListener("changecameramode", this.changeCameraMode);
54263
54264
  this._viewer.removeEventListener("zoomat", this.zoomAt);
54264
54265
  this._viewer.removeEventListener("pan", this.pan);
54265
54266
  this._viewer.removeEventListener("changeactivedragger", this.changeActiveDragger);
@@ -54434,6 +54435,11 @@ js: import "konva/skia-backend";
54434
54435
  ref.parent === this._groupGeometry ||
54435
54436
  ref.parent === this._groupTexts);
54436
54437
  }
54438
+ updateScreenCoordinatesForAll() {
54439
+ this.getObjects().forEach((markupObject) => {
54440
+ markupObject.updateScreenCoordinates();
54441
+ });
54442
+ }
54437
54443
  initializeKonva() {
54438
54444
  const stage = new Konva.Stage({
54439
54445
  container: this._markupContainer,
@@ -55531,9 +55537,27 @@ js: import "konva/skia-backend";
55531
55537
  const rect = this.canvas.getBoundingClientRect();
55532
55538
  const x = position.x / (rect.width / 2) - 1;
55533
55539
  const y = -position.y / (rect.height / 2) + 1;
55534
- const point = new Vector3(x, y, -1);
55535
- point.unproject(this.camera);
55536
- return { x: point.x, y: point.y, z: point.z };
55540
+ if (this.camera["isPerspectiveCamera"]) {
55541
+ const raycaster = new Raycaster();
55542
+ const mouse = new Vector2(x, y);
55543
+ raycaster.setFromCamera(mouse, this.camera);
55544
+ const cameraDirection = new Vector3();
55545
+ this.camera.getWorldDirection(cameraDirection);
55546
+ const targetPlane = new Plane().setFromNormalAndCoplanarPoint(cameraDirection, this.target);
55547
+ const intersectionPoint = new Vector3();
55548
+ raycaster.ray.intersectPlane(targetPlane, intersectionPoint);
55549
+ if (!intersectionPoint) {
55550
+ const point = new Vector3(x, y, -1);
55551
+ point.unproject(this.camera);
55552
+ return { x: point.x, y: point.y, z: point.z };
55553
+ }
55554
+ return { x: intersectionPoint.x, y: intersectionPoint.y, z: intersectionPoint.z };
55555
+ }
55556
+ else {
55557
+ const point = new Vector3(x, y, -1);
55558
+ point.unproject(this.camera);
55559
+ return { x: point.x, y: point.y, z: point.z };
55560
+ }
55537
55561
  }
55538
55562
  worldToScreen(position) {
55539
55563
  if (!this.renderer)