Added sending of default maps

This commit is contained in:
Mitchell McCaffrey
2020-04-23 13:31:54 +10:00
parent 22c5b5cf75
commit 8681864ddc
3 changed files with 61 additions and 16 deletions

View File

@@ -82,6 +82,15 @@ function AddMapModal({ isOpen, onRequestClose, onDone }) {
}
}
function handleMapSelect(mapId) {
setCurrentMap(mapId);
setGridX(maps[mapId].gridX);
setGridY(maps[mapId].gridY);
}
/**
* Drag and Drop
*/
const [dragging, setDragging] = useState(false);
function handleImageDragEnter(event) {
event.preventDefault();
@@ -130,7 +139,12 @@ function AddMapModal({ isOpen, onRequestClose, onDone }) {
<Label pt={2} pb={1}>
Add map
</Label>
<MapSelect maps={maps} onMapAdd={openImageDialog} />
<MapSelect
maps={maps}
onMapAdd={openImageDialog}
selectedMap={currentMap}
onMapSelected={handleMapSelect}
/>
<Flex>
<Box mb={2} mr={1} sx={{ flexGrow: 1 }}>
<Label htmlFor="gridX">Columns</Label>