Sie sind nicht angemeldet.

1

Montag, 27. März 2017, 12:00

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!

2

Montag, 27. März 2017, 20:16

Hi,

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


Zitat

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

3

Montag, 27. März 2017, 22:26

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

I found one solution that works for CSS3D:

Quellcode

1
2
3
4
5
6
7
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.