Skip to content

Commit

Permalink
[sigma] Checks hovered node and edge in setGraph
Browse files Browse the repository at this point in the history
This commit fixes #1486.
  • Loading branch information
jacomyal committed Dec 6, 2024
1 parent bd0bd4b commit 6432cc4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/sigma/src/sigma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1717,6 +1717,10 @@ export default class Sigma<
setGraph(graph: Graph<N, E, G>): void {
if (graph === this.graph) return;

// Check hoveredNode and hoveredEdge
if (this.hoveredNode && !graph.hasNode(this.hoveredNode)) this.hoveredNode = null;
if (this.hoveredEdge && !graph.hasEdge(this.hoveredEdge)) this.hoveredEdge = null;

// Unbinding handlers on the current graph
this.unbindGraphHandlers();

Expand Down

0 comments on commit 6432cc4

Please sign in to comment.