Renamed pan to move and updated docs for 1.8.0
This commit is contained in:
@@ -50,7 +50,7 @@ function Map({
|
||||
}) {
|
||||
const { tokensById } = useTokenData();
|
||||
|
||||
const [selectedToolId, setSelectedToolId] = useState("pan");
|
||||
const [selectedToolId, setSelectedToolId] = useState("move");
|
||||
const { settings, setSettings } = useSettings();
|
||||
|
||||
function handleToolSettingChange(tool, change) {
|
||||
@@ -113,7 +113,7 @@ function Map({
|
||||
disabledControls.push("drawing");
|
||||
}
|
||||
if (!map) {
|
||||
disabledControls.push("pan");
|
||||
disabledControls.push("move");
|
||||
disabledControls.push("measure");
|
||||
disabledControls.push("pointer");
|
||||
}
|
||||
@@ -301,7 +301,7 @@ function Map({
|
||||
onNoteMenuOpen={handleNoteMenuOpen}
|
||||
draggable={
|
||||
allowNoteEditing &&
|
||||
(selectedToolId === "note" || selectedToolId === "pan")
|
||||
(selectedToolId === "note" || selectedToolId === "move")
|
||||
}
|
||||
onNoteDragStart={(e, noteId) =>
|
||||
setNoteDraggingOptions({ dragging: true, noteId, noteGroup: e.target })
|
||||
|
||||
@@ -10,7 +10,7 @@ import FogToolSettings from "./controls/FogToolSettings";
|
||||
import DrawingToolSettings from "./controls/DrawingToolSettings";
|
||||
import PointerToolSettings from "./controls/PointerToolSettings";
|
||||
|
||||
import PanToolIcon from "../../icons/PanToolIcon";
|
||||
import MoveToolIcon from "../../icons/MoveToolIcon";
|
||||
import FogToolIcon from "../../icons/FogToolIcon";
|
||||
import BrushToolIcon from "../../icons/BrushToolIcon";
|
||||
import MeasureToolIcon from "../../icons/MeasureToolIcon";
|
||||
@@ -39,10 +39,10 @@ function MapContols({
|
||||
const [fullScreen, setFullScreen] = useSetting("map.fullScreen");
|
||||
|
||||
const toolsById = {
|
||||
pan: {
|
||||
id: "pan",
|
||||
icon: <PanToolIcon />,
|
||||
title: "Pan Tool (W)",
|
||||
move: {
|
||||
id: "move",
|
||||
icon: <MoveToolIcon />,
|
||||
title: "Move Tool (W)",
|
||||
},
|
||||
fog: {
|
||||
id: "fog",
|
||||
@@ -73,7 +73,7 @@ function MapContols({
|
||||
title: "Note Tool (N)",
|
||||
},
|
||||
};
|
||||
const tools = ["pan", "fog", "drawing", "measure", "pointer", "note"];
|
||||
const tools = ["move", "fog", "drawing", "measure", "pointer", "note"];
|
||||
|
||||
const sections = [
|
||||
{
|
||||
|
||||
@@ -63,7 +63,7 @@ function MapEditor({ map, onSettingsChange }) {
|
||||
stageTranslateRef,
|
||||
mapLayerRef.current,
|
||||
getGridMaxZoom(map.grid),
|
||||
"pan",
|
||||
"move",
|
||||
preventMapInteraction
|
||||
);
|
||||
|
||||
|
||||
@@ -95,9 +95,9 @@ function MapInteraction({
|
||||
preventMapInteraction,
|
||||
{
|
||||
onPinchStart: () => {
|
||||
// Change to pan tool when pinching and zooming
|
||||
// Change to move tool when pinching and zooming
|
||||
previousSelectedToolRef.current = selectedToolId;
|
||||
onSelectedToolChange("pan");
|
||||
onSelectedToolChange("move");
|
||||
},
|
||||
onPinchEnd: () => {
|
||||
onSelectedToolChange(previousSelectedToolRef.current);
|
||||
@@ -115,24 +115,24 @@ function MapInteraction({
|
||||
);
|
||||
|
||||
function handleKeyDown(event) {
|
||||
// Change to pan tool when pressing space
|
||||
if (event.key === " " && selectedToolId === "pan") {
|
||||
// Stop active state on pan icon from being selected
|
||||
// Change to move tool when pressing space
|
||||
if (event.key === " " && selectedToolId === "move") {
|
||||
// Stop active state on move icon from being selected
|
||||
event.preventDefault();
|
||||
}
|
||||
if (
|
||||
event.key === " " &&
|
||||
selectedToolId !== "pan" &&
|
||||
!disabledControls.includes("pan")
|
||||
selectedToolId !== "move" &&
|
||||
!disabledControls.includes("move")
|
||||
) {
|
||||
event.preventDefault();
|
||||
previousSelectedToolRef.current = selectedToolId;
|
||||
onSelectedToolChange("pan");
|
||||
onSelectedToolChange("move");
|
||||
}
|
||||
|
||||
// Basic keyboard shortcuts
|
||||
if (event.key === "w" && !disabledControls.includes("pan")) {
|
||||
onSelectedToolChange("pan");
|
||||
if (event.key === "w" && !disabledControls.includes("move")) {
|
||||
onSelectedToolChange("move");
|
||||
}
|
||||
if (event.key === "d" && !disabledControls.includes("drawing")) {
|
||||
onSelectedToolChange("drawing");
|
||||
@@ -152,7 +152,7 @@ function MapInteraction({
|
||||
}
|
||||
|
||||
function handleKeyUp(event) {
|
||||
if (event.key === " " && selectedToolId === "pan") {
|
||||
if (event.key === " " && selectedToolId === "move") {
|
||||
onSelectedToolChange(previousSelectedToolRef.current);
|
||||
}
|
||||
}
|
||||
@@ -163,7 +163,7 @@ function MapInteraction({
|
||||
|
||||
function getCursorForTool(tool) {
|
||||
switch (tool) {
|
||||
case "pan":
|
||||
case "move":
|
||||
return "move";
|
||||
case "fog":
|
||||
case "drawing":
|
||||
|
||||
@@ -115,7 +115,7 @@ function MapTokens({
|
||||
})
|
||||
}
|
||||
draggable={
|
||||
selectedToolId === "pan" &&
|
||||
selectedToolId === "move" &&
|
||||
!(tokenState.id in disabledTokens) &&
|
||||
!tokenState.locked
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user