Added quick map select with double click

This commit is contained in:
Mitchell McCaffrey 2020-04-23 22:12:50 +10:00
parent 5539fcf16a
commit 98798235c9
3 changed files with 17 additions and 1 deletions

View File

@ -7,7 +7,14 @@ import RemoveMapIcon from "../../icons/RemoveMapIcon";
import ResetMapIcon from "../../icons/ResetMapIcon"; import ResetMapIcon from "../../icons/ResetMapIcon";
import ExpandMoreDotIcon from "../../icons/ExpandMoreDotIcon"; import ExpandMoreDotIcon from "../../icons/ExpandMoreDotIcon";
function MapTile({ map, isSelected, onMapSelect, onMapRemove, onMapReset }) { function MapTile({
map,
isSelected,
onMapSelect,
onMapRemove,
onMapReset,
onSubmit,
}) {
const [isMapTileMenuOpen, setIsTileMenuOpen] = useState(false); const [isMapTileMenuOpen, setIsTileMenuOpen] = useState(false);
const [hasMapState, setHasMapState] = useState(false); const [hasMapState, setHasMapState] = useState(false);
@ -104,6 +111,12 @@ function MapTile({ map, isSelected, onMapSelect, onMapRemove, onMapReset }) {
setIsTileMenuOpen(false); setIsTileMenuOpen(false);
onMapSelect(map); onMapSelect(map);
}} }}
onDoubleClick={(e) => {
if (!isMapTileMenuOpen) {
onMapSelect(map);
onSubmit(e);
}
}}
> >
<UIImage <UIImage
sx={{ width: "100%", height: "100%", objectFit: "contain" }} sx={{ width: "100%", height: "100%", objectFit: "contain" }}

View File

@ -12,6 +12,7 @@ function MapTiles({
onMapAdd, onMapAdd,
onMapRemove, onMapRemove,
onMapReset, onMapReset,
onSubmit,
}) { }) {
return ( return (
<Flex <Flex
@ -61,6 +62,7 @@ function MapTiles({
onMapSelect={onMapSelect} onMapSelect={onMapSelect}
onMapRemove={onMapRemove} onMapRemove={onMapRemove}
onMapReset={onMapReset} onMapReset={onMapReset}
onSubmit={onSubmit}
/> />
))} ))}
</Flex> </Flex>

View File

@ -256,6 +256,7 @@ function SelectMapModal({
selectedMap={selectedMap && selectedMap.id} selectedMap={selectedMap && selectedMap.id}
onMapSelect={handleMapSelect} onMapSelect={handleMapSelect}
onMapReset={handleMapReset} onMapReset={handleMapReset}
onSubmit={handleSubmit}
/> />
<Flex> <Flex>
<Box mb={2} mr={1} sx={{ flexGrow: 1 }}> <Box mb={2} mr={1} sx={{ flexGrow: 1 }}>