Skip to content

Commit

Permalink
Remove debounce on cal_min and cal_max
Browse files Browse the repository at this point in the history
  • Loading branch information
jennydaman committed Nov 29, 2023
1 parent f2a8d77 commit e1ae3ea
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions src/AppLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,6 @@ const MyPage = ({
children: ComponentChildren;
}) => {
const [prevSubjectName, setPrevSubjectName] = useState<string | null>(null);
const calMinTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
const calMaxTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);

const leftSurfaces = visualState.meshes.filter((mesh) =>
mesh.name.startsWith("lh."),
Expand All @@ -198,23 +196,11 @@ const MyPage = ({
};

const onCalMinChanged = (_e: any, value: number) => {
if (calMinTimeoutRef.current !== null) {
clearTimeout(calMinTimeoutRef.current);
}
calMinTimeoutRef.current = setTimeout(() => {
calMinTimeoutRef.current = null;
changeCalMin(value);
}, 500);
changeCalMin(value);
};

const onCalMaxChanged = (_e: any, value: number) => {
if (calMaxTimeoutRef.current !== null) {
clearTimeout(calMaxTimeoutRef.current);
}
calMaxTimeoutRef.current = setTimeout(() => {
calMaxTimeoutRef.current = null;
changeCalMax(value);
}, 500);
changeCalMax(value);
};

const changeCalMin = (value: number) => {
Expand Down Expand Up @@ -350,14 +336,14 @@ const MyPage = ({
<Text component={TextVariants.h3}>cal_min</Text>
<Slider
min={-20}
max={visualState.globalMeshOverlaySettings.cal_max}
max={20}
onChange={onCalMinChanged}
value={visualState.globalMeshOverlaySettings.cal_min}
></Slider>

<Text component={TextVariants.h3}>cal_max</Text>
<Slider
min={visualState.globalMeshOverlaySettings.cal_min}
min={0}
max={20}
onChange={onCalMaxChanged}
value={visualState.globalMeshOverlaySettings.cal_max}
Expand Down

0 comments on commit e1ae3ea

Please sign in to comment.