From 15fdbd4e9e36c858709651e035fe1339dba3a1e9 Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Sat, 16 Oct 2021 22:21:24 +0200 Subject: feat(labels): better ui for labels --- components/Tweaks/LabelsPanel.tsx | 217 +++++++++++++++++++++----------------- 1 file changed, 120 insertions(+), 97 deletions(-) (limited to 'components/Tweaks/LabelsPanel.tsx') diff --git a/components/Tweaks/LabelsPanel.tsx b/components/Tweaks/LabelsPanel.tsx index 013409e..c40b689 100644 --- a/components/Tweaks/LabelsPanel.tsx +++ b/components/Tweaks/LabelsPanel.tsx @@ -28,112 +28,135 @@ export const LabelsPanel = (props: LabelsPanelProps) => { } + divider={} align="stretch" color="gray.800" > - - - Show labels - - }> - {!visuals.labels ? 'Never' : visuals.labels < 2 ? 'On Highlight' : 'Always'} - - - {' '} - - setVisuals({ ...visuals, labels: 0 })}>Never - setVisuals({ ...visuals, labels: 1 })}> - On Highlight - - setVisuals({ ...visuals, labels: 2 })}>Always - setVisuals({ ...visuals, labels: 3 })}> - Always (even in 3D) - - - - - - } - align="stretch" - paddingLeft={2} - color="gray.800" - > - setVisuals({ ...visuals, labelFontSize: value })} - /> - setVisuals({ ...visuals, labelLength: value })} - /> + + Show labels + + }> + {!visuals.labels ? 'Never' : visuals.labels < 2 ? 'On Highlight' : 'Always'} + + + {' '} + + setVisuals({ ...visuals, labels: 0 })}>Never + setVisuals({ ...visuals, labels: 1 })}> + On Highlight + + setVisuals({ ...visuals, labels: 2 })}>Always + setVisuals({ ...visuals, labels: 3 })}> + Always (even in 3D) + + + + + + 1} animateOpacity> + setVisuals({ ...visuals, labelWordWrap: value })} + label="Label Appearance Scale" + value={visuals.labelScale * 2} + onChange={(value) => setVisuals({ ...visuals, labelScale: value / 2 })} /> + + setVisuals({ ...visuals, labelLineSpace: value })} + label="Label dynamicity" + infoText="By default, labels of nodes with more links will appear earlier than those with fewer. This slider changes the strength of this effect, put it at zero to disable it." + value={visuals.labelDynamicStrength} + min={0} + max={1} + step={0.05} + onChange={(value) => + setVisuals((curr: typeof initialVisuals) => ({ + ...curr, + labelDynamicStrength: value, + })) + } /> - - - - - { - console.log(visuals.labelBackgroundOpacity) - setVisuals({ ...visuals, labelBackgroundOpacity: value }) - }} - min={0} - max={1} - step={0.01} - /> - + 0}> + + setVisuals((curr: typeof initialVisuals) => ({ + ...curr, + labelDynamicDegree: value, + })) + } + /> - 1} animateOpacity> - - setVisuals({ ...visuals, labelScale: value / 5 })} - /> - - - + + + + + + + + { + console.log(visuals.labelBackgroundOpacity) + setVisuals({ ...visuals, labelBackgroundOpacity: value }) + }} + min={0} + max={1} + step={0.01} + /> + + + setVisuals({ ...visuals, labelFontSize: value })} + /> + setVisuals({ ...visuals, labelLength: value })} + /> + setVisuals({ ...visuals, labelWordWrap: value })} + /> + setVisuals({ ...visuals, labelLineSpace: value })} + /> ) } -- cgit v1.2.3