diff options
author | Thomas F. K. Jorna <[email protected]> | 2021-07-15 13:54:55 +0200 |
---|---|---|
committer | Thomas F. K. Jorna <[email protected]> | 2021-07-15 13:54:55 +0200 |
commit | 3de8a0a99f74cef8032d718e4b51d5c9c364db56 (patch) | |
tree | e54b9268bdfc27223c2221279c79637bde2d4789 /app/screens/graph | |
parent | a23e3d6e46ed79b3406759bec5a4879124e791af (diff) |
made graph interactively tweakable
Diffstat (limited to 'app/screens/graph')
-rw-r--r-- | app/screens/graph/graph-screen.tsx | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/app/screens/graph/graph-screen.tsx b/app/screens/graph/graph-screen.tsx index 4ba2ee0..bba2955 100644 --- a/app/screens/graph/graph-screen.tsx +++ b/app/screens/graph/graph-screen.tsx @@ -1,4 +1,4 @@ -import React from "react" +import React, { useState } from "react" import { observer } from "mobx-react-lite" import { ViewStyle } from "react-native" import { Screen, Text } from "../../components" @@ -7,6 +7,9 @@ import { Screen, Text } from "../../components" import { color } from "../../theme" import { Graph } from "../../components" +import { Tweaks } from "../../components" + +import genRandomTree from "../../data/randomdata"; const ROOT: ViewStyle = { backgroundColor: color.palette.black, @@ -19,10 +22,32 @@ export const GraphScreen = observer(function GraphScreen() { // Pull in navigation via hook // const navigation = useNavigation() + const [charge, setCharge] = useState(-30); + const [collision, setCollision] = useState(false); + const [linkStrength, setLinkStrength] = useState(1); + const [linkIts, setLinkIts] = useState(1); + + const [physics, setPhysics] = useState( + { + charge: -30, + collision: false, + linkStrength: 1, + linkIts: 1 + }); + + const gData = genRandomTree(); + return ( <Screen style={ROOT} preset="scroll"> <Text preset="header" text="Graph" /> - <Graph/> + <Tweaks + physics={physics} + setPhysics={setPhysics} + /> + <Graph + physics={physics} + gData = {gData} + /> </Screen> - ) -}) + ); +}); |