Skip to content

Commit

Permalink
get ctx before ready callback
Browse files Browse the repository at this point in the history
  • Loading branch information
williamngan committed May 2, 2024
1 parent 7618f11 commit 32ff04b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ export class CanvasSpace extends MultiTouchSpace {
_existed = true;
}


// store canvas 2d rendering context
this._ctx = this._canvas.getContext( '2d' );

// if we created the canvas, add it to the container and observe mutation for readiness
if ( !_existed ) {
const observer = new MutationObserver( ( mutations ) => {
Expand All @@ -100,10 +104,6 @@ export class CanvasSpace extends MultiTouchSpace {
} else {
this._ready( callback );
}

// store canvas 2d rendering context
this._ctx = this._canvas.getContext( '2d' );

}


Expand Down

0 comments on commit 32ff04b

Please sign in to comment.