pchen66/panolens.js

Get current center coordinates

aferrato opened this issue · 4 comments

Hello,
I would like to obtain the coordinates of the current center of the image to be able to use them later.

Let me explain, I move the panoramic image and I choose the view I prefer, how can I get the coordinates of the central point of the view?

Practically the same that can be done by pressing Ctr and moving the mouse, but referring to the center of panolens-container div.

thank you.

This is the method i wrot to get the center coordinates

export function getCameraCenterPosition(viewer: Viewer): Position {
  const position = viewer.raycaster.intersectObject(viewer.panorama, true)[0]
    .point;

  // intersectObject returns a negative x value so it must be set to the opposite to have the right x coordinate
  position.x = -position.x;

  return position;
}

hey @e-pacciani Where do i have to put your method?
i have tryed some things but i can only get the coordinates from the mouse not the center.

Have someone find out the solution? Please help me