openseadragon/openseadragon — pull request #256 by avandecreme (2013-10-14 22:17:30+00:00)
Title: Recenter the image after switching fullscreen mode. #62 and #170

I tried to adjust the dimensions of the displayed part of the image but it is actually really tough (it depends on the image dimensions and on the aspect ratio of the container before and after switching the fullscreen mode and also whether the image is displayed entirely in the viewport or not).

It still gives a better user experience though.

Regarding the patch, it is probably not optimal to listen to the "animation-finish" event but adjusting the center before that won't work. Hopefully, if #128 get fixed toward an event model this could be fixed as well.

I also removed what seemed useless code to me. When leaving fullscreen, other viewports were re-opened which was actually introducing the problem of losing their current position and zoom.
I tested it on chromium and firefox linux, maybe there are specific browsers where it is needed?