The spheretoscreen function seems to return bad values when running on an iphone. I am running krpano version 1.16.5, testing on an iPhone 4s, IOS version 6.1.3.
My application, which only uses the html5 viewer, does extensive overlays over the panorama. I dynamically calculate coordinates for the overlay elements using the spheretoscreen function. The calculations and the resulting overlays work perfectly in all the other environments I have tested, which include Mac/PC IE/Chrome/Firefox/Safari/Opera desktop environments, IPad2 and IPad Retina IOS, and an Android Nexus 7 using Chrome/Firefox.
But on my iPhone I get strange values and the overlays as a result are misplaced. Suspecting that it might have something to do with device pixel ratio of the retina display on the iPhone, I came up with a test where I took the current pan and tilt of the panorama and called spheretoscreen with those values. If spheretoscreen is working properly I should get back values corresponding to the center of the div containing the panorama, and on all platforms that I tested, except the iPhone, that is exactly what I got back, within a tiny rounding error. But my device pixel ratio theory is wrong, since if that is what the problem is, with the device pixel ratio of the iPhone 4s being 2, I should get back doubled values. But that is not what I got:
In portrait orientation:
actual center point x: 140.5, actual center point y: 178
spheretoscreen center point x: 300, spheretoscreen center point y: 251
In landscape orientation:
actual center point x: 220.5, actual center point y: 104
spheretoscreen center point x: 460, spheretoscreen center point y: 103
Very screwy. Note that in both orientations x more than doubles, but the ratios are not quite the same. Y increases by 41% in portrait, while it is only off by 1 in landscape. So clearly no simple doubling is going on.
I tested on the iPhone using both the built-in Safari browser and Chrome. Both browsers returned the same incorrect values. Note that I also downloaded krpano 1.17 and attempted to test with it, but alas, at least for now, 1.17 has broken my application. I am still investigating that, and I'll only post about that if I can't figure out a fix. Also unfortunately I can't give you a web url to hit - for now my application is running only on localhost - I'm testing the other devices by hitting the fixed IP of my development machine within my LAN.
Not Cheers,
Larry Wieland