only create graph when needed

This commit is contained in:
Orion Reed 2024-12-16 01:46:03 -05:00
parent f2e32b9795
commit 2e336f1e39
2 changed files with 4 additions and 3 deletions

View File

@ -48,9 +48,9 @@
<script type="module">
import '../src/standalone/folk-shape.ts';
import '../src/standalone/folk-graph.ts';
import '../src/standalone/folk-arrow.ts';
import '../src/standalone/folk-rope.ts';
import '../src/standalone/folk-graph.ts';
</script>
</body>
</html>

View File

@ -29,8 +29,9 @@ export class FolkGraph extends FolkBaseSet implements AnimationFrameControllerHo
override update(changedProperties: PropertyValues<this>) {
super.update(changedProperties);
// TODO: we're recreating the graph every frame, need to.. not do that...
this.createGraph();
if (changedProperties.has('sourceElements')) {
this.createGraph();
}
}
tick() {