Optimize two-dimensional scrolling