Added measure tool

This commit is contained in:
Mitchell McCaffrey
2020-06-26 12:23:06 +10:00
parent dfce8dee05
commit 57754e0ac8
10 changed files with 305 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ import MapDrawing from "./MapDrawing";
import MapFog from "./MapFog";
import MapDice from "./MapDice";
import MapGrid from "./MapGrid";
import MapMeasure from "./MapMeasure";
import TokenDataContext from "../../contexts/TokenDataContext";
import MapLoadingContext from "../../contexts/MapLoadingContext";
@@ -53,6 +54,9 @@ function Map({
type: "brush",
useBlending: true,
},
measure: {
type: "chebyshev",
},
});
function handleToolSettingChange(tool, change) {
@@ -134,6 +138,7 @@ function Map({
}
if (!map) {
disabledControls.push("pan");
disabledControls.push("measure");
}
if (!allowFogDrawing) {
disabledControls.push("fog");
@@ -277,6 +282,14 @@ function Map({
<MapGrid map={map} gridSize={gridSizeNormalized} />
);
const mapMeasure = (
<MapMeasure
active={selectedToolId === "measure"}
gridSize={gridSizeNormalized}
selectedToolSettings={toolSettings[selectedToolId]}
/>
);
return (
<MapInteraction
map={map}
@@ -296,6 +309,7 @@ function Map({
{mapDrawing}
{mapTokens}
{mapFog}
{mapMeasure}
</MapInteraction>
);
}