From 144c2f66c54196bcc06e9096818317fc222ea009 Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Sat, 31 Jul 2021 15:02:46 +0200 Subject: tried to add expanding follow, and failed --- components/config.ts | 6 ++-- components/tweaks.tsx | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 87 insertions(+), 3 deletions(-) (limited to 'components') diff --git a/components/config.ts b/components/config.ts index c2f8ff5..cc2beb8 100644 --- a/components/config.ts +++ b/components/config.ts @@ -80,8 +80,10 @@ export const initialVisuals = { } export const initialBehavior = { - follow: 'Zoom', - followLocalOrZoom: true, + follow: 'zoom', + localSame: 'add', + zoomPadding: 200, + zoomSpeed: 2000, } export const initialMouse = { diff --git a/components/tweaks.tsx b/components/tweaks.tsx index 35ce3e9..3da32cc 100644 --- a/components/tweaks.tsx +++ b/components/tweaks.tsx @@ -41,7 +41,13 @@ import { } from '@chakra-ui/react' import React, { useState, useContext } from 'react' import Scrollbars from 'react-custom-scrollbars-2' -import { initialPhysics, initialFilter, initialVisuals, initialMouse } from './config' +import { + initialPhysics, + initialFilter, + initialVisuals, + initialMouse, + initialBehavior, +} from './config' import { ThemeContext } from '../pages/themecontext' @@ -56,6 +62,8 @@ export interface TweakProps { setVisuals: any mouse: typeof initialMouse setMouse: any + behavior: typeof initialBehavior + setBehavior: any } export const Tweaks = (props: TweakProps) => { @@ -70,6 +78,8 @@ export const Tweaks = (props: TweakProps) => { setVisuals, mouse, setMouse, + behavior, + setBehavior, } = props const [showTweaks, setShowTweaks] = useState(true) const { highlightColor, setHighlightColor } = useContext(ThemeContext) @@ -1188,6 +1198,78 @@ export const Tweaks = (props: TweakProps) => { + + Follow Emacs by... + + } + colorScheme="" + color="black" + > + {behavior.follow[0].toUpperCase() + behavior.follow.slice(1)} + + + {' '} + + setBehavior({ ...behavior, follow: 'local' })}> + Opening the local graph + + setBehavior({ ...behavior, follow: 'zoom' })}> + Zooming to the current node + + + + + + + + Follow local graph + + + + } + colorScheme="" + color="black" + > + {behavior.localSame === 'add' ? 'Add' : 'New'} + + + {' '} + + setBehavior({ ...behavior, localSame: 'new' })} + > + Open that nodes graph + + setBehavior({ ...behavior, localSame: 'add' })} + > + Add node to local graph + + + + + + setBehavior({ ...behavior, zoomSpeed: value })} + /> + setBehavior({ ...behavior, zoomPadding: value })} + infoText="How much to zoom out to accomodate all nodes when changing the view." + /> -- cgit v1.2.3