[Refactor] Improve clarity of slider logic by inverting label filtering.

This commit is contained in:
Sakamoto Shiina
2025-11-06 13:04:35 +09:00
parent c76b2981c6
commit e23bf223ae
2 changed files with 5 additions and 8 deletions

View File

@@ -212,16 +212,13 @@ export const useSliderLogic = ({
min, min,
max, max,
step = 1, step = 1,
hidden_label_values show_label_values
}) => { }) => {
const [ui_value, setUiValue] = useState(current_value.data); const [ui_value, setUiValue] = useState(current_value.data);
const labelFormatter = useCallback((value) => { const labelFormatter = useCallback((value) => {
if (hidden_label_values && hidden_label_values.includes(value)) { return (show_label_values && show_label_values.includes(value)) ? value : "";
return ""; }, [show_label_values]);
}
return value;
}, [hidden_label_values]);
const marks = useMemo(() => { const marks = useMemo(() => {
return createMarks(min, max, step, labelFormatter); return createMarks(min, max, step, labelFormatter);

View File

@@ -70,7 +70,7 @@ const UiScalingContainer = () => {
min: 40, min: 40,
max: 200, max: 200,
step: 10, step: 10,
hidden_label_values: [50, 70, 90, 110, 130, 150, 170, 190], show_label_values: [40, 60, 80, 100, 120, 140, 160, 180, 200],
}); });
return ( return (
@@ -104,7 +104,7 @@ export const MessageLogUiScalingContainer = () => {
min: 40, min: 40,
max: 200, max: 200,
step: 10, step: 10,
hidden_label_values: [50, 70, 90, 110, 130, 150, 170, 190], show_label_values: [40, 60, 80, 100, 120, 140, 160, 180, 200],
}); });
return ( return (