Skip to content

Commit d6702bf

Browse files
committed
refactored mask modal
1 parent 3f62c8c commit d6702bf

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

Eplant/views/eFP/Viewer/EFPViewer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export const EFPViewer = ({
208208
/>
209209
</div>
210210
<MaskModal
211-
state={state}
211+
threshold={state.maskThreshold}
212212
isVisible={state.maskModalVisible}
213213
onClose={() =>
214214
setViewState({ ...state, maskModalVisible: false })

Eplant/views/eFP/Viewer/MaskModal.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,28 @@ import {
1010
useTheme,
1111
} from '@mui/material'
1212

13-
import { EFPViewerState } from './types'
14-
1513
// Modal component with a slider
1614
interface MaskModalProps {
1715
isVisible: boolean
18-
state: EFPViewerState
16+
threshold: number
1917
onClose: () => void
2018
onSubmit: (threshhold: number) => void
2119
}
2220

23-
const MaskModal = ({ isVisible, state, onClose, onSubmit }: MaskModalProps) => {
24-
const [sliderValue, setSliderValue] = useState<number>(state.maskThreshold)
21+
const MaskModal = ({
22+
isVisible,
23+
threshold,
24+
onClose,
25+
onSubmit,
26+
}: MaskModalProps) => {
27+
const [sliderValue, setSliderValue] = useState<number>(threshold)
2528
const theme = useTheme()
2629
const handleSliderChange = (event: Event, newValue: number | number[]) => {
2730
setSliderValue(newValue as number)
2831
}
2932

3033
const handleClose = () => {
31-
setSliderValue(state.maskThreshold)
34+
setSliderValue(threshold)
3235
onClose()
3336
}
3437

0 commit comments

Comments
 (0)