Skip to content

Commit

Permalink
feat: forceSimulation snapshot method
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-rietzke committed May 6, 2023
1 parent 9a205da commit e48d4cb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/simulation/forceSimulation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,13 @@ export default class ForceSimulation {
});
}

public snapshot(ticks: number = 0): SVGElement {
const simulation = this.simulation;
simulation.tick(ticks);
const clone = this.svgElement.cloneNode(true);
return clone as SVGElement;
}

public exportGraph() {
return exportGraph.bind(this)();
}
Expand Down

0 comments on commit e48d4cb

Please sign in to comment.