@@ -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