Skip to content

Commit

Permalink
docs: add simulation-api snapshot section
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-rietzke committed May 6, 2023
1 parent 840f03f commit a46f9ba
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/simulation-api/environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,21 @@ The `forced` flag is only to be used if you have reason to believe that the auto
Besides that, it would harm the optimized performance of the simulation.
:::

## Snapshot

::: warning available since version 1.5.0
:::

The `ForceSimulation`s `snapshot()` method is called to render a snapshot of the force simulation and returns a static SVGElement DOM node.

```ts
const snapshow = simulation.snapshot();
```

::: tip
This is useful to render a static version of the graphly graph to use it as a preview or thumbnail for example.
:::

## Template Store

The `ForceSimulation` class contains and exposes the `templateStore` module which is used to store the shape templates that are used to render the nodes.
Expand Down

0 comments on commit a46f9ba

Please sign in to comment.