Avoid doing anything when the viewport isn't zoomable.

Also does a minor refactor that could be in another patch but is on this one :-).

Reviewed by: Marcelo Lira