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/config.ts | 28 ++++------ components/tweaks.tsx | 147 +++++++++++++++++++++++++++++++++++++------------- 2 files changed, 120 insertions(+), 55 deletions(-) (limited to 'components') diff --git a/components/config.ts b/components/config.ts index e7a51e2..a60c626 100644 --- a/components/config.ts +++ b/components/config.ts @@ -49,25 +49,17 @@ export const initialFilter = { date: [], } +// 0: never +// 1: hover +// 2: click +// 3: doubleclick +// 4: rightclick export const initialMouse = { - hover: { - highlight: true, - select: false, - follow: false, - local: false, - }, - click: { - highlight: true, - select: false, - follow: true, - local: true, - }, - doubleClick: { - highlight: true, - select: false, - follow: false, - local: false, - }, + highlight: 1, + select: 2, + open: 2, + local: 3, + follow: 4, } function getAlgos(option?: boolean) { 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