Sie sind nicht angemeldet.

codiant

Anfänger

  • »codiant« ist der Autor dieses Themas

Beiträge: 17

Wohnort: India

Beruf: Web Developer

  • Nachricht senden

1

Dienstag, 30. Mai 2017, 08:16

Krpano Get Mouse Position

Hello
When i want to get mouse position on panorama, i use following code:

var krpano = document.getElementById("krpanoSWFObject");
if (krpano && krpano.get) {
var mouse_at_x = krpano.get("mouse.x");
var mouse_at_y = krpano.get("mouse.y");
if (mouse_at_x && mouse_at_y)// wait also for the jsmouse plugin
{

var hvs = krpano.get("screentosphere(" + mouse_at_x + "," + mouse_at_y + ")");
console.log(hvs);
}
}
But it gives me error that hvs is null?
how can i get exact mouse location when i drop my hotspot in panorama.
Thank You

Tuur

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Nachricht senden

2

Dienstag, 30. Mai 2017, 14:23

Hi,

maybe here you find some info.
Look in the xml for javascript action

https://krpano.com/forum/wbb/index.php?p…70660#post70660

Hope it helps!
Tuur *thumbsup*

codiant

Anfänger

  • »codiant« ist der Autor dieses Themas

Beiträge: 17

Wohnort: India

Beruf: Web Developer

  • Nachricht senden

3

Mittwoch, 31. Mai 2017, 06:58

Krpano Get Mouse Position in mobile device

Thank You. Your Code working fine for desktop but when i use this code for mobile it is not working it is only giving default ath and atv when i touch on my mobile device. How can i get ath and atv for mobile devices?

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »codiant« (31. Mai 2017, 07:11)


Tuur

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Nachricht senden

4

Mittwoch, 31. Mai 2017, 12:27

Hi,

it works perfect on iOS and android.
Not sure what you want or mean.
On mobile you finger is the mouse.
So, turn the pano, press your finger and you see the ath and atv and the x and y position of the mouse
also the horizontal and vertical lookat and the fov.
What else do you need?
What device do you use?

Tuur *thumbsup*

5

Dienstag, 6. Juni 2017, 15:29

Hi,

that syntax is wrong (or very very old):
var hvs = krpano.get("screentosphere(" + mouse_at_x + "," + mouse_at_y + ")");


Better use the direct screentosphere function from the JS API:
https://krpano.com/docu/js/#interfaceobject

E.g.

Quellcode

1
var hvs = krpano.screentosphere(mouse_at_x, mouse_at_y);


Best regards,
Klaus