From f07cb0d2745f59fe07254698402b160e7535c641 Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Thu, 15 Jul 2021 19:30:13 +0200 Subject: cleaned up tweak menu, added particle toggle --- app/components/graph/graph.tsx | 5 +++-- app/components/tweaks/tweaks.tsx | 21 +++++++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) (limited to 'app/components') diff --git a/app/components/graph/graph.tsx b/app/components/graph/graph.tsx index cd623ee..14e3b60 100644 --- a/app/components/graph/graph.tsx +++ b/app/components/graph/graph.tsx @@ -61,6 +61,7 @@ export const Graph = observer(function Graph(props: GraphProps): JSX.Element { fg.d3Force("charge").strength(physics.charge) }) + // For the expandable version of the graph const rootId = 0 const nodesById = useMemo(() => { @@ -183,7 +184,7 @@ export const Graph = observer(function Graph(props: GraphProps): JSX.Element { // nodeAutoColorBy={d => d.id%GROUPS} linkAutoColorBy={(d) => rando.nodes[d.source].id % GROUPS} linkColor={"#ffffff"} - linkDirectionalParticles={2} + linkDirectionalParticles={physics.particles} nodeColor={(node) => !node.childLinks.length ? "green" : node.collapsed ? "red" : "yellow" } @@ -200,7 +201,7 @@ export const Graph = observer(function Graph(props: GraphProps): JSX.Element { linkAutoColorBy={(d) => rando.nodes[d.source].id % GROUPS} linkColor={"#ffffff"} linkWidth={2} - linkDirectionalParticles={2} + linkDirectionalParticles={physics.particles} nodeColor={(node) => !node.childLinks.length ? "green" : node.collapsed ? "red" : "yellow" } diff --git a/app/components/tweaks/tweaks.tsx b/app/components/tweaks/tweaks.tsx index e7bbd6f..431191c 100644 --- a/app/components/tweaks/tweaks.tsx +++ b/app/components/tweaks/tweaks.tsx @@ -34,11 +34,12 @@ export const Tweaks = observer(function Tweaks(props: TweaksProps) { const styles = flatten([CONTAINER, style]) return ( - + + { setPhysics({...physics, charge: value}) }} value={physics.charge} step={1}/> @@ -58,18 +59,26 @@ export const Tweaks = observer(function Tweaks(props: TweaksProps) { value={physics.linkIts} step={1}/> - {setPhysics({...physics, collision: !physics.collision})}} /> - + + + { setPhysics({...physics, particles: value}) }} + value={physics.particles} + step={1}/> + - {setPhysics({...physics, collapse: !physics.collapse})}} /> - {setPhysics({...physics, threedim: !physics.threedim})}} /> -- cgit v1.2.3