From f2a1bfdd8efc5612efa98b265ec983154823108a Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Mon, 26 Jul 2021 05:30:53 +0200 Subject: added buggy mouse action switcher --- components/tweaks.tsx | 147 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 110 insertions(+), 37 deletions(-) (limited to 'components/tweaks.tsx') diff --git a/components/tweaks.tsx b/components/tweaks.tsx index 61eecf4..a26d479 100644 --- a/components/tweaks.tsx +++ b/components/tweaks.tsx @@ -38,7 +38,7 @@ import { } from '@chakra-ui/react' import React, { useState } from 'react' import Scrollbars from 'react-custom-scrollbars-2' -import { initialPhysics, initialFilter } from './config' +import { initialPhysics, initialFilter, initialMouse } from './config' export interface TweakProps { physics: typeof initialPhysics @@ -47,19 +47,22 @@ export interface TweakProps { setThreeDim: (newValue: boolean) => void filter: typeof initialFilter setFilter: any + mouse: typeof initialMouse + setMouse: any } export const Tweaks = (props: TweakProps) => { - const { physics, setPhysics, threeDim, filter, setFilter } = props + const { physics, setPhysics, threeDim, setThreeDim, mouse, setMouse, filter, setFilter } = props const [showTweaks, setShowTweaks] = useState(true) + const mouseArray = ['Never', 'Hover', 'Click', 'Double Click', 'Right Click'] return ( <> { - - - } - onClick={() => setPhysics(initialPhysics)} + + + + + + + } + onClick={() => setPhysics(initialPhysics)} + colorScheme="purple" + variant="none" + size="sm" + /> + + } + aria-label="Close Tweak Panel" + variant="ghost" + onClick={() => setShowTweaks(false)} /> - - } - aria-label="Close Tweak Panel" - variant="ghost" - onClick={() => setShowTweaks(false)} - /> + { paddingLeft={7} color="gray.800" > - - Hover Higlight + + + Open preview window on... + + }> - {physics.hover} + {mouseArray[mouse.open]} - - Off - On + + setMouse({ ...mouse, open: 0 })}>Never + setMouse({ ...mouse, open: 1 })}>Hover + setMouse({ ...mouse, open: 2 })}>Click + setMouse({ ...mouse, open: 3 })}> + Double Click + + setMouse({ ...mouse, open: 4 })}> + Right Click + - - - Click - - - Double-click - + + + + Enter local graph on... + + + + }> + {mouseArray[mouse.local]} + + + setMouse({ ...mouse, local: 0 })}> + Never + + setMouse({ ...mouse, local: 1 })}> + Hover + + setMouse({ ...mouse, local: 2 })}> + Click + + setMouse({ ...mouse, local: 3 })}> + Double Click + + setMouse({ ...mouse, local: 4 })}> + Right Click + + + + + + Open node in emacs on... + + }> + {mouseArray[mouse.follow]} + + + setMouse({ ...mouse, follow: 0 })}> + Never + + setMouse({ ...mouse, follow: 1 })}> + Hover + + setMouse({ ...mouse, follow: 2 })}> + Click + + setMouse({ ...mouse, follow: 3 })}> + Double Click + + setMouse({ ...mouse, follow: 4 })}> + Right Click + + + + -- cgit v1.2.3