Skip to content

Commit

Permalink
fix: 2d canvas fallback logic (#7295)
Browse files Browse the repository at this point in the history
  • Loading branch information
ozyx authored Dec 12, 2023
1 parent 86d4244 commit 40373ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/plugins/plot/chart/MctChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ export default {
this.overlay = overlayCanvas;
this.drawAPI = DrawLoader.getFallbackDrawAPI(this.canvas, this.overlay);
this.$emit('plot-reinitialize-canvas');
console.warn(`📈 fallback to 2D canvas`);
},
removeChartElement(series) {
const elements = this.seriesElements.get(toRaw(series));
Expand Down
10 changes: 5 additions & 5 deletions src/plugins/plot/draw/DrawWebGL.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,14 @@ DrawWebGL.prototype.initContext = function () {
DrawWebGL.prototype.destroy = function () {
// Lose the context and delete all associated resources
// https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/WebGL_best_practices#lose_contexts_eagerly
this.gl.getExtension('WEBGL_lose_context').loseContext();
this.gl.deleteBuffer(this.buffer);
this.gl?.getExtension('WEBGL_lose_context')?.loseContext();
this.gl?.deleteBuffer(this.buffer);
this.buffer = undefined;
this.gl.deleteProgram(this.program);
this.gl?.deleteProgram(this.program);
this.program = undefined;
this.gl.deleteShader(this.vertexShader);
this.gl?.deleteShader(this.vertexShader);
this.vertexShader = undefined;
this.gl.deleteShader(this.fragmentShader);
this.gl?.deleteShader(this.fragmentShader);
this.fragmentShader = undefined;
this.gl = undefined;

Expand Down

0 comments on commit 40373ab

Please sign in to comment.