Clamp vertical scroll position into valid range.
double clampY(double y, double zoomRatio) => y.clamp(0.0, getScrollableMaxY(zoomRatio));