You are not logged in.

## how to get coordinates of mouse position on whole picture

Friday, May 17th 2013, 4:26pm

### how to get coordinates of mouse position on whole picture

Hi there,

I can get mouse.x mouse.y with respect to my looking direction, and h and v values. However I couldn't find a place to get the mouse positions's real position on the picture. mouse.stagex gives same value with mouse.x.

Friday, May 17th 2013, 4:30pm

Hi,

what exactly do you mean with 'real position on the picture'?

Best regards,
Klaus

Friday, May 17th 2013, 5:01pm

Let's say my panoramic picture is width: 1600px, height:1400px
I am capturing mouse.x and mouse.y -> 55,65
Now I go to left 200 degree in panoramic view
I put mouse pointer to exactly same position on the screen and capture mouse.x and mouse.y -> 55,65

v and h values differ. However I cannot find out the position of my mouse on the 1600 x 1400 picture (for example like x: 1200px y: 600px)

if at the middle top of picture v=90degree and h=0degree I guess I can convert these values with javascript codes to crop the image in the server. I wanted to ask if there is a method already doing that kind of thing.

Secondly, I've created a method to determine ellipse points. However when I move backside since 179 degree and -179 degree are contiguous the ellipse function takes the long way to determine points like (179,y),(178,y),....(1,y),(-1,y)....(-178,y),(-179,y). At that part I guess I should fix the ellipse function. Is there already a function that can achieve creating rectangular or elliptical hotspots?

Friday, May 17th 2013, 5:10pm

Hi,

mouse.x and mouse.y are the screen pixel-coordinates from top-left.

By using the screentosphere action you can convert them to universal spherical coordinate.

See here what the spherical coordinates are:

They are from -180 to +180 in horizontal direction and from -90 to +90 in vertical direction.

When you known the size of your input image, you can calculate the pixel-positions this way:
source_panoimage_x = (h + 180)/360 * source_panoimage_width
source_panoimage_y = (v + 90)/180 * source_panoimage_height

Best regards,
Klaus

Friday, May 17th 2013, 5:42pm

Thank you very much,

Regards

Intermediate

Monday, August 5th 2013, 8:48pm

Is there a method for finding the x,y coordinates of a flat image (plugin)? Possibly one that is zoomed in or out. Andrey and I are trying to figure out how to create a zoom in / zoom out function on a plugin (map - like an aerial photo) that is contained within a fixed window size. For example... a monitor of 1920 x 1080... a window size of 800 x 800... an image (map) size of 1200 x 1200. Like with google or bing maps.. we can drag the map around within the window and when we center a point on the map image, then zoom into that point while maintaining it as the center of the window. AT the moment, all we have is zoom in and out to the center of the map image itself.

Thursday, August 8th 2013, 2:12pm

Hi,

### Quoted from "nefar1ous"

Is there a method for finding the x,y coordinates of a flat image
If you are talking about the pano image - enable the zoomtocursor and zoomoutcursor settings:
http://krpano.com/docu/xml/#control.zoomtocursor

If you are talking about plugin/layer/hotspot elements - there is currently no way to get the relative mouse position over these elements in xml, this would require plugin coding.

Best regards,
Klaus

Professional

Posts: 1,082

Thursday, August 8th 2013, 7:59pm

Hi!