Very basic graph parameters

This commit is contained in:
space-nuko
2023-06-02 21:01:30 -05:00
parent 59aad9183d
commit 4f237d01a5
6 changed files with 323 additions and 71 deletions

View File

@@ -12,12 +12,17 @@
import GraphStyles from "./GraphStyles"
import type { EdgeDataDefinition } from "cytoscape";
import type { NodeDataDefinition } from "cytoscape";
import { createEventDispatcher } from "svelte";
export let nodes: ReadonlyArray<NodeDataDefinition>;
export let edges: ReadonlyArray<EdgeDataDefinition>;
export let style: string = ""
const dispatch = createEventDispatcher<{
rebuilt: { cyto: cytoscape.Core };
}>();
$: if (nodes != null && edges != null && refElement != null) {
rebuildGraph()
}
@@ -35,6 +40,7 @@
container: refElement,
style: GraphStyles,
wheelSensitivity: 0.1,
maxZoom: 1,
})
cyInstance.on("add", () => {
@@ -60,6 +66,8 @@
data: { ...edge }
})
}
dispatch("rebuilt", { cyto: cyInstance })
}
let refElement = null