Added proper cursors for the selected tool

This commit is contained in:
Mitchell McCaffrey 2020-05-22 15:10:20 +10:00
parent d26932d17c
commit 14c9151405

View File

@ -99,6 +99,19 @@ function MapInteraction({ map, children, controls, selectedToolId }) {
stageHeightRef.current = height; stageHeightRef.current = height;
} }
function getCursorForTool(tool) {
switch (tool) {
case "pan":
return "move";
case "fog":
case "brush":
case "shape":
return "crosshair";
default:
return "default";
}
}
const containerRef = useRef(); const containerRef = useRef();
usePreventOverscroll(containerRef); usePreventOverscroll(containerRef);
@ -124,7 +137,11 @@ function MapInteraction({ map, children, controls, selectedToolId }) {
return ( return (
<Box <Box
sx={{ flexGrow: 1, position: "relative" }} sx={{
flexGrow: 1,
position: "relative",
cursor: getCursorForTool(selectedToolId),
}}
ref={containerRef} ref={containerRef}
{...bind()} {...bind()}
className="map" className="map"