How to determine the coordinates of inside distorted hotspot

  • Hi Klaus!

    In your example, "drag hotspot" determined coordinates of the center hotspot.
    The problem is that when you drag the hotspot, the cursor does not adhere to the starting position of the mouse.
    Is it possible to determine the coordinates of any start point inside the hotspot?

    Thank you!

  • Hi,

    do you mean that example:
    https://krpano.com/examples/usage/#dragable-hotspots


    Quote

    Is it possible to determine the coordinates of any start point inside the hotspot?

    When krpano renders the hotspots by WebGL, then krpano internally determines the 2d coordinates on the hotspot image for the 'hit-testing' - and it would be theoretically possible to expose them (btw - I have also added a note for myself to consider exposing them ;-)). But the problem is, they would be only available for the WebGL rendering - when only CSS3D or with Flash rendering would be available, then they wouldn't be available. So as current 'lowest common denominator' the decision was not exposing them yet for the moment...

    Best regards,
    Klaus

  • Thank you for your reply! )
    Yes, this example I have in mind.

    I found one solution that works for CSS3D:

    Code
    var spot = krpano.hotspot.getItem("test").sprite;
    
    
    spot.onclick = function(event)
    {
    	console.log(event.offsetX);	// for Chrome
    	console.log(event.layerX);	// for FF
    }


    Thus, we get a discrete coordinates inside DIV-element in perspective.
    Regardless of the values of: rx, ry, rz, ox, oy, ath, atv, fov, hlookat and vlookat.

    If you can realize this function for WebGL - it will be very good.

Participate now!

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