From 8468f02d3101709faf5f8d6794146ddc8172ec18 Mon Sep 17 00:00:00 2001 From: Orion Reed Date: Mon, 16 Dec 2024 00:18:11 -0500 Subject: [PATCH] make more generic --- src/folk-graph.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/folk-graph.ts b/src/folk-graph.ts index 59f9867..938faee 100644 --- a/src/folk-graph.ts +++ b/src/folk-graph.ts @@ -2,15 +2,15 @@ import { FolkBaseSet } from './folk-base-set.ts'; import { PropertyValues } from '@lit/reactive-element'; import { Layout } from 'webcola'; import { FolkShape } from './folk-shape.ts'; -import { FolkArrow } from './folk-arrow.ts'; import { AnimationFrameController, AnimationFrameControllerHost } from './common/animation-frame-controller.ts'; +import { FolkBaseConnection } from './folk-base-connection'; export class FolkGraph extends FolkBaseSet implements AnimationFrameControllerHost { static override tagName = 'folk-graph'; private graphSim = new Layout(); private nodes = new Map(); - private arrows = new Set(); + private arrows = new Set(); #rAF = new AnimationFrameController(this); connectedCallback() { @@ -29,7 +29,7 @@ export class FolkGraph extends FolkBaseSet implements AnimationFrameControllerHo override update(changedProperties: PropertyValues) { super.update(changedProperties); - this.updateGraph(); + this.createGraph(); } tick() { @@ -48,7 +48,7 @@ export class FolkGraph extends FolkBaseSet implements AnimationFrameControllerHo }); } - private updateGraph() { + private createGraph() { this.nodes.clear(); this.arrows.clear(); @@ -77,7 +77,7 @@ export class FolkGraph extends FolkBaseSet implements AnimationFrameControllerHo private createLinks() { return Array.from(this.sourceElements) - .filter((element): element is FolkArrow => element instanceof FolkArrow) + .filter((element): element is FolkBaseConnection => element instanceof FolkBaseConnection) .map((arrow) => { this.arrows.add(arrow); const source = this.nodes.get(arrow.sourceElement as FolkShape);