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 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 [hasMapState, setHasMapState] = useState(false);
@ -104,6 +111,12 @@ function MapTile({ map, isSelected, onMapSelect, onMapRemove, onMapReset }) {
setIsTileMenuOpen(false);
onMapSelect(map);
}}
onDoubleClick={(e) => {
if (!isMapTileMenuOpen) {
onMapSelect(map);
onSubmit(e);
}
}}
>
<UIImage
sx={{ width: "100%", height: "100%", objectFit: "contain" }}

View File

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

View File

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