Fix #15212 - Incorrect pan in continous view when zoomed

Here's a fix for the panning in continuous view.
I've changed it quite a bit to base the panning on the cursor position instead of the element.
I also based the panning on margins on each side (5% on the left and 10% on the right).