File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -1180,23 +1180,26 @@ p5.RendererGL = class RendererGL extends p5.Renderer {
11801180
11811181 erase ( opacityFill , opacityStroke ) {
11821182 if ( ! this . _isErasing ) {
1183- this . _applyBlendMode ( constants . REMOVE ) ;
1183+ this . _cachedBlendMode = this . curBlendMode ;
11841184 this . _isErasing = true ;
1185-
1185+ this . blendMode ( constants . REMOVE ) ;
11861186 this . _cachedFillStyle = this . curFillColor . slice ( ) ;
11871187 this . curFillColor = [ 1 , 1 , 1 , opacityFill / 255 ] ;
1188-
11891188 this . _cachedStrokeStyle = this . curStrokeColor . slice ( ) ;
11901189 this . curStrokeColor = [ 1 , 1 , 1 , opacityStroke / 255 ] ;
11911190 }
11921191 }
11931192
11941193 noErase ( ) {
11951194 if ( this . _isErasing ) {
1196- this . _isErasing = false ;
11971195 this . curFillColor = this . _cachedFillStyle . slice ( ) ;
11981196 this . curStrokeColor = this . _cachedStrokeStyle . slice ( ) ;
1197+ // It's necessary to restore post-erase state. Needs rework
1198+ let temp = this . curBlendMode ;
11991199 this . blendMode ( this . _cachedBlendMode ) ;
1200+ this . _cachedBlendMode = temp ; // If we don't do this, applyBlendMode() returns null
1201+ this . _isErasing = false ;
1202+ this . _applyBlendMode ( ) ; // This sets _cachedBlendMode back to the original blendmode
12001203 }
12011204 }
12021205
You can’t perform that action at this time.
0 commit comments