From 2e336f1e397ae8ca5b08ae927d755e411023a06e Mon Sep 17 00:00:00 2001 From: Orion Reed Date: Mon, 16 Dec 2024 01:46:03 -0500 Subject: [PATCH] only create graph when needed --- demo/graph-layout.html | 2 +- src/folk-graph.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/demo/graph-layout.html b/demo/graph-layout.html index cb0ecd4..e73e70f 100644 --- a/demo/graph-layout.html +++ b/demo/graph-layout.html @@ -48,9 +48,9 @@ diff --git a/src/folk-graph.ts b/src/folk-graph.ts index 91cb77a..6c5e5e1 100644 --- a/src/folk-graph.ts +++ b/src/folk-graph.ts @@ -29,8 +29,9 @@ export class FolkGraph extends FolkBaseSet implements AnimationFrameControllerHo override update(changedProperties: PropertyValues) { 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() {