Skip to content

Commit

Permalink
[sigma] Fixes clearing WebGL contexts
Browse files Browse the repository at this point in the history
This commit fixes #1404.
Basically, when picking was enabled, sometimes we were cleaning the
wrong buffer.
  • Loading branch information
jacomyal committed Jan 30, 2024
1 parent 2e38e0b commit 1536c06
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/sigma/src/sigma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1728,9 +1728,11 @@ export default class Sigma<GraphType extends Graph = Graph> extends TypedEventEm
* @return {Sigma}
*/
clear(): this {
this.webGLContexts.nodes.clear(this.webGLContexts.nodes.COLOR_BUFFER_BIT);
this.webGLContexts.edges.clear(this.webGLContexts.edges.COLOR_BUFFER_BIT);
this.webGLContexts.hoverNodes.clear(this.webGLContexts.hoverNodes.COLOR_BUFFER_BIT);
this.webGLContexts.nodes.bindFramebuffer(WebGLRenderingContext.FRAMEBUFFER, null);
this.webGLContexts.nodes.clear(WebGLRenderingContext.COLOR_BUFFER_BIT);
this.webGLContexts.edges.bindFramebuffer(WebGLRenderingContext.FRAMEBUFFER, null);
this.webGLContexts.edges.clear(WebGLRenderingContext.COLOR_BUFFER_BIT);
this.webGLContexts.hoverNodes.clear(WebGLRenderingContext.COLOR_BUFFER_BIT);
this.canvasContexts.labels.clearRect(0, 0, this.width, this.height);
this.canvasContexts.hovers.clearRect(0, 0, this.width, this.height);
this.canvasContexts.edgeLabels.clearRect(0, 0, this.width, this.height);
Expand Down

0 comments on commit 1536c06

Please sign in to comment.