auto_align_borders_on_zoom_out
Intent: use bounds to determine if we need to pan the canvas near edges.
Context of wanting a smoother user experience where the bounds are aligned automatically as we zoom out to keep mouse near original position and maximize screen use.
The main tricks are:
a) that we get the bounds before zooming to determine how near the edge we are.
b) that we get new the bounds after zooming to get the exact amount we should align the border to maintain a stable zoom with the borders snapped too
c) Uses absolute values for most of it to avoid cases where timing issues or the mouse crossing over the boundary causes the sign to flip
This is not perfect but a good step, and in general seems to allow the zoom out to be as smooth as the zoom in
Updated about 3 years ago