| | |
| | | const [filterSensorList, setFilterSensorList] = React.useState([]); |
| | | const [curSensorLabel, setCurSensorLabel] = React.useState(null); |
| | | |
| | | // first select |
| | | React.useEffect(() => { |
| | | if (!Utils.getMapContainer()) { return; } |
| | | const resetSearch = () => { |
| | | let sensorListAll = getAllSensorList(curSensorType); |
| | | setSensorList(sensorListAll); |
| | | setFilterSensorList(sensorListAll); |
| | | setCurSensorLabel(null); |
| | | }, [curSensorType]) |
| | | } |
| | | |
| | | // second select |
| | | // first select and switch floor |
| | | React.useEffect(() => { |
| | | if (!Utils.getMapContainer()) { return } |
| | | setTimeout(() => { |
| | | resetSearch(); |
| | | }, 200) |
| | | }, [curSensorType, props.curFloor]) |
| | | |
| | | // second select condition |
| | | React.useEffect(() => { |
| | | if (!Utils.getMapContainer()) { return; } |
| | | if ((curSensorLabel !== null || curSensorLabel != undefined) |
| | |
| | | // avoid model modify which will clear spriteBySettings |
| | | setTimeout(() => { |
| | | setSpriteBySettings(selectSensor); |
| | | }, 300) |
| | | }, 200) |
| | | break; |
| | | case ModelEnum.SETTINGS_MODEL: |
| | | setSpriteBySettings(selectSensor); |