You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

codiant

Beginner

  • "codiant" started this thread

Posts: 17

Location: India

Occupation: Web Developer

  • Send private message

1

Tuesday, May 30th 2017, 8:16am

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

Sage

Posts: 3,151

Location: Netherlands

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

  • Send private message

2

Tuesday, May 30th 2017, 2:23pm

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*
http://www.virtualtuur.com
Skype:studiotuur

codiant

Beginner

  • "codiant" started this thread

Posts: 17

Location: India

Occupation: Web Developer

  • Send private message

3

Wednesday, May 31st 2017, 6:58am

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?

This post has been edited 1 times, last edit by "codiant" (May 31st 2017, 7:11am)


Tuur

Sage

Posts: 3,151

Location: Netherlands

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

  • Send private message

4

Wednesday, May 31st 2017, 12:27pm

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*
http://www.virtualtuur.com
Skype:studiotuur

5

Tuesday, June 6th 2017, 3:29pm

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.

Source code

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


Best regards,
Klaus