Smarter simultaneous pan/zoom algorithm.