From ee8539a9351374a719c9026f85d85e7b4ea6e8f5 Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Sat, 25 Sep 2021 16:11:31 +0200 Subject: chore: move tweaks to separate subfolder --- components/PhysicsPanel.tsx | 143 -------------------------------------------- 1 file changed, 143 deletions(-) delete mode 100644 components/PhysicsPanel.tsx (limited to 'components/PhysicsPanel.tsx') diff --git a/components/PhysicsPanel.tsx b/components/PhysicsPanel.tsx deleted file mode 100644 index 1bdfaa0..0000000 --- a/components/PhysicsPanel.tsx +++ /dev/null @@ -1,143 +0,0 @@ -import { - Text, - Accordion, - AccordionButton, - AccordionIcon, - AccordionItem, - AccordionPanel, - Box, - Flex, - StackDivider, - Switch, - VStack, -} from '@chakra-ui/react' -import React, { useCallback } from 'react' -import { initialPhysics } from './config' -import { EnableSection } from './EnableSection' -import { SliderWithInfo } from './SliderWithInfo' - -export interface PhysicsPanelProps { - physics: typeof initialPhysics - setPhysics: any -} - -export const PhysicsPanel = (props: PhysicsPanelProps) => { - const { physics, setPhysics } = props - const setPhysicsCallback = useCallback((val: number, phys: string, scale: number) => { - setPhysics((curr: typeof initialPhysics) => { - return { ...curr, [phys]: val / scale } - }) - }, []) - return ( - - } - align="stretch" - paddingLeft={7} - color="gray.800" - > - setPhysics({ ...physics, gravityOn: !physics.gravityOn })} - > - - Also in local - { - setPhysics((curr: typeof initialPhysics) => { - return { ...curr, gravityLocal: !curr.gravityLocal } - }) - }} - isChecked={physics.gravityLocal} - > - - setPhysicsCallback(v, 'gravity', 10)} - /> - - setPhysicsCallback(v, 'charge', -1 / 100)} - label="Repulsive Force" - /> - setPhysics({ ...physics, collision: !physics.collision })} - > - setPhysicsCallback(v, 'collisionStrength', 1 / 5)} - label="Collision Radius" - infoText="Easy with this one, high values can lead to a real jiggly mess" - /> - - setPhysicsCallback(v, 'linkStrength', 5)} - label="Link Force" - /> - setPhysicsCallback(v, 'linkIts', 1)} - min={0} - max={6} - step={1} - infoText="How many links down the line the physics of a single node affects (Slow)" - /> - setPhysicsCallback(v, 'velocityDecay', 10)} - /> - - - - - - Advanced - - - - } - align="stretch" - paddingLeft={3} - color="gray.800" - > - setPhysicsCallback(v, 'alphaDecay', 50)} - /> - setPhysics({ ...physics, centering: !physics.centering })} - infoText="Keeps the nodes in the center of the viewport. If disabled you can drag the nodes anywhere you want." - > - setPhysicsCallback(v, 'centeringStrength', 1)} - /> - - - - - - - - ) -} -- cgit v1.2.3