Last active
October 6, 2021 00:15
-
-
Save colinfwren/a8ba83c0af64385148817ef2b187fcbc to your computer and use it in GitHub Desktop.
Map component using isInSelectMode value
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useContext } from "react"; | |
import { Stage } from "react-konva"; | |
import AppContext, { AppConsumer, AppProvider } from "./AppContext"; | |
import { MapContent } from "./MapContent"; | |
export function Map() { | |
const { isInSelectMode } = useContext(AppContext); | |
return ( | |
<AppConsumer> | |
{(appState) => ( | |
<Stage | |
width={window.innerWidth} | |
height={window.innerHeight} | |
draggable={!isInSelectMode} | |
listening={!isInSelectMode} | |
> | |
<AppProvider value={appState}> | |
<MapContent /> | |
</AppProvider> | |
</Stage> | |
)} | |
</AppConsumer> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment