I think this is rather simple.
That's similar to drawing and scrolling tile maps in 2D games. Canvasis the map, CanvasView is the viewport or camera that moves around and asks the map for everything that's inside its boundary.
Essentially, you just add the scrollOffset: (Δx, Δy) to the view coordinates and that should do the trick.
I think this is rather simple.
CanvasViewcoordinate system from aCanvascoordinate system:(Δx, Δy)to ascrollOffset. Maybe part of theCanvasViewitself, because it's a presentation detail.Canvasrepresentation then takes care of holding on toStrokes and fetching them for a givenNSRectpartition of itself.That's similar to drawing and scrolling tile maps in 2D games.
Canvasis the map,CanvasViewis the viewport or camera that moves around and asks the map for everything that's inside its boundary.CanvasViewcoordinates to theCanvascoordinate system.Essentially, you just add the
scrollOffset: (Δx, Δy)to the view coordinates and that should do the trick.