Refine zooming and panning for note and data layers

Fixes #629
Fixes #643