Refactor and fix mouse-centered zooming