Skip to content

Commit 87c9d2d

Browse files
committed
fix: the webglContextLost & webglContextRestored event should be triggered last
1 parent 14e5202 commit 87c9d2d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/renderer/WebGLRenderer.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,6 @@ const WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */ {
468468
}, false);
469469
},
470470
_onContextLost(e) {
471-
this.fire('webglContextLost');
472471
const gl = this.gl;
473472
this._isContextLost = true;
474473

@@ -483,13 +482,16 @@ const WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */ {
483482

484483
this._lastMaterial = null;
485484
this._lastProgram = null;
485+
486+
this.fire('webglContextLost');
486487
},
487488
_onContextRestore(e) { // eslint-disable-line no-unused-vars
488-
this.fire('webglContextRestored');
489489
const gl = this.gl;
490490
this._isContextLost = false;
491491
extensions.reset(gl);
492492
Framebuffer.reset(gl);
493+
494+
this.fire('webglContextRestored');
493495
},
494496
/**
495497
* 设置深度检测

0 commit comments

Comments
 (0)