| | |
| | | const [deviceVisible, setDeviceVisible] = useState(false); |
| | | const [settingsVisible, setSettingsVisible] = useState(false); |
| | | const [batchSelectionVisible, setBatchSelectionVisible] = useState(false); |
| | | const [zoneDrawing, setZoneDrawing] = useState(false); |
| | | |
| | | const [curSprite, setCurSprite] = useState(null); |
| | | const [batchSprites, setBatchSprites] = useState([]); |
| | |
| | | {mode === MAP_MODE.ZONING_MODE && ( |
| | | <> |
| | | <Button |
| | | variant="contained" |
| | | variant={zoneDrawing ? "outlined" : "contained"} |
| | | color="primary" |
| | | sx={{ mr: 2 }} |
| | | disabled={zoneDrawing} |
| | | onClick={() => { |
| | | Tool.startZoneDrawing({ |
| | | const started = Tool.startZoneDrawing({ |
| | | promptText: translate('page.map.prompt.zoneName'), |
| | | onComplete: ({ name }) => { |
| | | if (name) { |
| | | notify.success(translate('page.map.msg.zoneCreated', { name })); |
| | | } |
| | | }, |
| | | onFinish: () => { |
| | | setZoneDrawing(false); |
| | | } |
| | | }); |
| | | if (started) { |
| | | setZoneDrawing(true); |
| | | } |
| | | }} |
| | | > |
| | | {translate('page.map.action.addZone')} |