mpetroff / pannellum

Pannellum is a lightweight, free, and open source panorama viewer for the web.
https://pannellum.org/
MIT License
4.16k stars 711 forks source link

Marker rotation with yaw angle value taken from panoramic image #1081

Closed MASPCHINE closed 2 years ago

MASPCHINE commented 2 years ago

Hi,

I am working on a website where we can view panoramic photos and scroll through the photos with the help of the library you have created. Like this; image I can get the yaw angle of the panoramic image with the getYaw() method in the library. I use mousedown function as mouse event and I can get yaw angle as a result of every mousedown movement on the panoramic image.

Like this; image

With the help of this data I received, I want to add a marker that can move according to the yaw angle, like the compass you added.

image

but when I send the values ​​of the yaw angle I obtained to the yaw angle value of the marker, I can only send the last yaw angle value and the next marker is rotated according to the yaw angle value I obtained. How can I get the dynamic structure that works like the compass you added?

Thank you for your reply...

mpetroff commented 2 years ago

I'm not entirely certain what you mean by "I can only send the last yaw angle value and the next marker is rotated according to the yaw angle value I obtained" or by "the dynamic structure."

If you mean a value that updates whenever the yaw value changes, there's currently no good way to do that. In that case, this question is a duplicate of #310.

MASPCHINE commented 2 years ago

actually what i want to add is to create like the compass you add. Can I add something like this or change the display properties of the compass from the library?

mpetroff commented 2 years ago

Okay, but to do that outside the viewer would require an event listener that's triggered when the yaw value changes, which is something that doesn't currently exist. Otherwise, you'd have to edit the library itself and add something into the render() function.

If you want to just change the look of the existing compass, you can override the CSS (pnlm-compass class).

MASPCHINE commented 2 years ago

thank you for your reply