From cf5ed86be6ce54e6af697fb0a929c4dc8a40f193 Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Thu, 22 Jul 2021 23:06:33 +0200 Subject: fixed the label opacity --- pages/index.tsx | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'pages/index.tsx') diff --git a/pages/index.tsx b/pages/index.tsx index e5679f2..3200bb9 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -46,7 +46,7 @@ import { Flex, } from '@chakra-ui/react' -import { InfoOutlineIcon, RepeatClockIcon, ChevronDownIcon } from '@chakra-ui/icons' +import { InfoOutlineIcon, RepeatClockIcon, ChevronDownIcon, SettingsIcon } from '@chakra-ui/icons' // react-force-graph fails on import when server-rendered // https://github.com/vasturiano/react-force-graph/issues/155 @@ -182,7 +182,7 @@ export function GraphPage() { }, []) const [threeDim, setThreeDim] = useState(false) - const [showTweeks, setShowTweeks] = useState(true) + const [showTweaks, setShowTweaks] = useState(true) if (!graphData) { return null @@ -190,7 +190,7 @@ export function GraphPage() { return (
- {showTweeks && ( + {showTweaks ? ( { - setShowTweeks(false) + setShowTweaks(false) }} /> + ) : ( + + } onClick={() => setShowTweaks(true)} /> + )} - + @@ -740,8 +744,8 @@ export const Graph = function (props: GraphProps) { // draw label background ctx.fillStyle = 'rgba(20, 20, 20, ' + - (highlightedNodes.length === 0 - ? 0.5 * fadeFactor + (Object.keys(highlightedNodes).length === 0 + ? fadeFactor : highlightedNodes[node.id!] ? 0.5 : 0.15 * fadeFactor) + @@ -757,7 +761,7 @@ export const Graph = function (props: GraphProps) { ctx.textBaseline = 'middle' ctx.fillStyle = 'rgb(255, 255, 255, ' + - (highlightedNodes.length === 0 + (Object.keys(highlightedNodes).length === 0 ? fadeFactor : highlightedNodes[node.id!] ? 1 -- cgit v1.2.3