Creating hotspots with prealign="true" at click position

  • Hi,

    I have a panorama with prealign values set (the image is rotated/leveled). When I click on the panorama and create a hotspot using mouse.x and mouse.y with prealign="true", the hotspot appears at the wrong position.

    I understand that mouse.x/mouse.yreturns view-space coordinates, but a hotspot with prealign="true" expects image-space coordinates (before the prealign rotation).

    Is there a built-in way to convert view-space spherical coordinates to pre-aligned image-space coordinates? Or what is the correct math/rotation order to do this manually?

    I am doing something like that.


    The hotspot appears offset from where I clicked. What is the correct approach?
    removing prealign is not possible for my situatiuon. I am sending the coordinates to the backend and saving them. Users can add prealign (or rx/ry) of image dynamically, so I need to keep their original places.

    Thanks!

  • Hi, I did this test.

    Code
    <image prealign="0|90|0" >
    <events name="test" keep="true" 
        onclick="screentosphere(mouse.x, mouse.y, toh, tov); js(console.log(get(toh)));"  
    />

    Clicking on the screen next to the hotspot displays the correct ath coordinates.
    I created a dynamic hotspot, copied it to the tour, and after rebooting, it snaps into place correctly without prealign="true"
    I think prealign is needed for hotspots that were created before alignment.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!