Skip to content

Commit 53ef5e1

Browse files
authored
Merge pull request #713 from atom-ide-community/squashed-minimap-4upstream
2 parents 1de64b1 + 1ec8f12 commit 53ef5e1

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

lib/canvas-layer.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,25 @@ module.exports = class CanvasLayer {
6161
}
6262

6363
copyToOffscreen () {
64-
this.offscreenContext.drawImage(this.canvas, 0, 0)
64+
if (this.canvas.width > 0 && this.canvas.height > 0) {
65+
this.offscreenContext.drawImage(this.canvas, 0, 0)
66+
}
6567
}
6668

6769
copyFromOffscreen () {
68-
this.context.drawImage(this.offscreenCanvas, 0, 0)
70+
if (this.offscreenCanvas.width > 0 && this.offscreenCanvas.height > 0) {
71+
this.context.drawImage(this.offscreenCanvas, 0, 0)
72+
}
6973
}
7074

7175
copyPartFromOffscreen (srcY, destY, height) {
72-
this.context.drawImage(
73-
this.offscreenCanvas,
74-
0, srcY, this.offscreenCanvas.width, height,
75-
0, destY, this.offscreenCanvas.width, height
76-
)
76+
if (this.offscreenCanvas.width > 0 && this.offscreenCanvas.height > 0) {
77+
this.context.drawImage(
78+
this.offscreenCanvas,
79+
0, srcY, this.offscreenCanvas.width, height,
80+
0, destY, this.offscreenCanvas.width, height
81+
)
82+
}
7783
}
7884

7985
clearCanvas () {

0 commit comments

Comments
 (0)