Moved timer tool out of the map controls and into the party controls
This commit is contained in:
@@ -153,7 +153,6 @@ function Map({
|
||||
disabledControls.push("pan");
|
||||
disabledControls.push("measure");
|
||||
disabledControls.push("pointer");
|
||||
disabledControls.push("timer");
|
||||
}
|
||||
if (!allowFogDrawing) {
|
||||
disabledControls.push("fog");
|
||||
|
||||
@@ -9,7 +9,6 @@ import SelectMapButton from "./SelectMapButton";
|
||||
import FogToolSettings from "./controls/FogToolSettings";
|
||||
import DrawingToolSettings from "./controls/DrawingToolSettings";
|
||||
import MeasureToolSettings from "./controls/MeasureToolSettings";
|
||||
import TimerToolSettings from "./controls/TimerToolSettings";
|
||||
|
||||
import PanToolIcon from "../../icons/PanToolIcon";
|
||||
import FogToolIcon from "../../icons/FogToolIcon";
|
||||
@@ -17,7 +16,6 @@ import BrushToolIcon from "../../icons/BrushToolIcon";
|
||||
import MeasureToolIcon from "../../icons/MeasureToolIcon";
|
||||
import ExpandMoreIcon from "../../icons/ExpandMoreIcon";
|
||||
import PointerToolIcon from "../../icons/PointerToolIcon";
|
||||
import TimerToolIcon from "../../icons/TimerToolIcon";
|
||||
|
||||
function MapContols({
|
||||
onMapChange,
|
||||
@@ -63,14 +61,8 @@ function MapContols({
|
||||
icon: <PointerToolIcon />,
|
||||
title: "Pointer Tool",
|
||||
},
|
||||
timer: {
|
||||
id: "timer",
|
||||
icon: <TimerToolIcon />,
|
||||
title: "Timer Tool",
|
||||
SettingsComponent: TimerToolSettings,
|
||||
},
|
||||
};
|
||||
const tools = ["pan", "fog", "drawing", "measure", "pointer", "timer"];
|
||||
const tools = ["pan", "fog", "drawing", "measure", "pointer"];
|
||||
|
||||
const sections = [
|
||||
{
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
import React, { useEffect, useContext } from "react";
|
||||
import { Flex, Input, Text, IconButton } from "theme-ui";
|
||||
|
||||
import Divider from "../../Divider";
|
||||
|
||||
import MapInteractionContext from "../../../contexts/MapInteractionContext";
|
||||
import TimerStartIcon from "../../../icons/TimerStartIcon";
|
||||
|
||||
function MeasureToolSettings({ settings, onSettingChange, onToolAction }) {
|
||||
const { interactionEmitter } = useContext(MapInteractionContext);
|
||||
|
||||
// Keyboard shortcuts
|
||||
useEffect(() => {
|
||||
function handleKeyDown({ key }) {}
|
||||
interactionEmitter.on("keyDown", handleKeyDown);
|
||||
|
||||
return () => {
|
||||
interactionEmitter.off("keyDown", handleKeyDown);
|
||||
};
|
||||
});
|
||||
|
||||
const inputStyle = {
|
||||
width: "40px",
|
||||
border: "none",
|
||||
":focus": {
|
||||
outline: "none",
|
||||
},
|
||||
lineHeight: 1.2,
|
||||
padding: 1,
|
||||
paddingRight: 0,
|
||||
};
|
||||
|
||||
return (
|
||||
<Flex sx={{ alignItems: "center" }}>
|
||||
<Text as="label" variant="body2" sx={{ fontSize: "16px" }} p={1}>
|
||||
h:
|
||||
</Text>
|
||||
<Input
|
||||
sx={inputStyle}
|
||||
value={settings.hour}
|
||||
onChange={(e) => onSettingChange({ hour: parseInt(e.target.value) })}
|
||||
type="number"
|
||||
min={0}
|
||||
max={99}
|
||||
/>
|
||||
<Text as="label" variant="body2" sx={{ fontSize: "16px" }} p={1}>
|
||||
m:
|
||||
</Text>
|
||||
<Input
|
||||
sx={inputStyle}
|
||||
value={settings.minute}
|
||||
onChange={(e) => onSettingChange({ minute: parseInt(e.target.value) })}
|
||||
type="number"
|
||||
min={0}
|
||||
max={59}
|
||||
/>
|
||||
<Text as="label" variant="body2" sx={{ fontSize: "16px" }} p={1}>
|
||||
s:
|
||||
</Text>
|
||||
<Input
|
||||
sx={inputStyle}
|
||||
value={settings.second}
|
||||
onChange={(e) => onSettingChange({ second: parseInt(e.target.value) })}
|
||||
type="number"
|
||||
min={0}
|
||||
max={59}
|
||||
/>
|
||||
<IconButton
|
||||
aria-label="Start Timer"
|
||||
title="Start Timer"
|
||||
onClick={() => onToolAction("timerStart")}
|
||||
disabled={
|
||||
settings.hour === 0 && settings.minute === 0 && settings.second === 0
|
||||
}
|
||||
>
|
||||
<TimerStartIcon />
|
||||
</IconButton>
|
||||
</Flex>
|
||||
);
|
||||
}
|
||||
|
||||
export default MeasureToolSettings;
|
||||
Reference in New Issue
Block a user