You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Holding the spacebar changes the tool from drawing to panning until you release the key.
Decouple CanvasView coordinate system from a Canvas coordinate system:
When you pan, you add the drag/mouse-move vector (Δx, Δy) to a scrollOffset. Maybe part of the CanvasView itself, because it's a presentation detail.
A Canvas representation then takes care of holding on to Strokes and fetching them for a given NSRect partition of itself.
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.
Similarly, new strokes have to be translated from the CanvasView coordinates to the Canvas coordinate system.
Essentially, you just add the scrollOffset: (Δx, Δy) to the view coordinates and that should do the trick.
The text was updated successfully, but these errors were encountered:
I think this is rather simple.
CanvasView
coordinate system from aCanvas
coordinate system:(Δx, Δy)
to ascrollOffset
. Maybe part of theCanvasView
itself, because it's a presentation detail.Canvas
representation then takes care of holding on toStroke
s and fetching them for a givenNSRect
partition of itself.That's similar to drawing and scrolling tile maps in 2D games.
Canvas
is the map,CanvasView
is the viewport or camera that moves around and asks the map for everything that's inside its boundary.CanvasView
coordinates to theCanvas
coordinate system.Essentially, you just add the
scrollOffset: (Δx, Δy)
to the view coordinates and that should do the trick.The text was updated successfully, but these errors were encountered: