dkirkby / desipano

360 degree panoramas of the DESI focal plane
MIT License
0 stars 0 forks source link

Calculate field of view based on aspect ratio? #1

Closed dkirkby closed 1 year ago

dkirkby commented 1 year ago

From @kfanning:

I noticed it seems to have a fixed FoV regardless of the aspect ratio, leading to weirdness when viewing vertically on a phone but better horizontally.

Next steps:

dkirkby commented 1 year ago

The pannellum library assumes a fixed horizontal FoV independent of the window width, which leads to a jarring change in FoV per pixel when rotating between portrait and landscape on mobile devices.

The solution I implemented is to generate the initial view with a fixed FoV of 0.09 deg / pixel, then track changes to the FoV initiated by the user (via zoom in/out), and preserve the current pixel FoV during window resize events.

So far I have only tested this in a chrome browser on a Mac.

kfanning commented 1 year ago

Tested with firefox on android rotating the phone as well as firefox on a laptop resizing the window and the new behavior feels consistent when changing aspect ratio (either through rotation or resizing) and has less distortion in vertical aspect ratios.

dkirkby commented 1 year ago

This seems to be working well - closing now.