Skip to content

Commit

Permalink
fix: prevent error when width = 0
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech authored and aminya committed Nov 21, 2020
1 parent cfeba59 commit 1ec8f12
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/canvas-layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,13 @@ module.exports = class CanvasLayer {
}

copyPartFromOffscreen (srcY, destY, height) {
this.context.drawImage(
this.offscreenCanvas,
0, srcY, this.offscreenCanvas.width, height,
0, destY, this.offscreenCanvas.width, height
)
if (this.offscreenCanvas.width > 0 && this.offscreenCanvas.height > 0) {
this.context.drawImage(
this.offscreenCanvas,
0, srcY, this.offscreenCanvas.width, height,
0, destY, this.offscreenCanvas.width, height
)
}
}

clearCanvas () {
Expand Down

0 comments on commit 1ec8f12

Please sign in to comment.