Move to global undo and combined map action state
This commit is contained in:
@@ -17,9 +17,6 @@ import BrushTriangleIcon from "../../icons/BrushTriangleIcon";
|
||||
import EraseAllIcon from "../../icons/EraseAllIcon";
|
||||
import EraseIcon from "../../icons/EraseToolIcon";
|
||||
|
||||
import UndoButton from "./shared/UndoButton";
|
||||
import RedoButton from "./shared/RedoButton";
|
||||
|
||||
import Divider from "../Divider";
|
||||
|
||||
import { useKeyboard } from "../../contexts/KeyboardContext";
|
||||
@@ -62,10 +59,6 @@ function DrawingToolSettings({
|
||||
onSettingChange({ type: "erase" });
|
||||
} else if (shortcuts.drawBlend(event)) {
|
||||
onSettingChange({ useBlending: !settings.useBlending });
|
||||
} else if (shortcuts.redo(event) && !disabledActions.includes("redo")) {
|
||||
onToolAction("mapRedo");
|
||||
} else if (shortcuts.undo(event) && !disabledActions.includes("undo")) {
|
||||
onToolAction("mapUndo");
|
||||
}
|
||||
}
|
||||
useKeyboard(handleKeyDown);
|
||||
@@ -155,15 +148,6 @@ function DrawingToolSettings({
|
||||
useBlending={settings.useBlending}
|
||||
onBlendingChange={(useBlending) => onSettingChange({ useBlending })}
|
||||
/>
|
||||
<Divider vertical />
|
||||
<UndoButton
|
||||
onClick={() => onToolAction("mapUndo")}
|
||||
disabled={disabledActions.includes("undo")}
|
||||
/>
|
||||
<RedoButton
|
||||
onClick={() => onToolAction("mapRedo")}
|
||||
disabled={disabledActions.includes("redo")}
|
||||
/>
|
||||
</Flex>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,8 +13,6 @@ import FogRemoveIcon from "../../icons/FogRemoveIcon";
|
||||
import FogToggleIcon from "../../icons/FogToggleIcon";
|
||||
import FogRectangleIcon from "../../icons/FogRectangleIcon";
|
||||
|
||||
import UndoButton from "./shared/UndoButton";
|
||||
import RedoButton from "./shared/RedoButton";
|
||||
import ToolSection from "./shared/ToolSection";
|
||||
|
||||
import Divider from "../Divider";
|
||||
@@ -31,16 +29,9 @@ import {
|
||||
type FogToolSettingsProps = {
|
||||
settings: FogToolSettingsType;
|
||||
onSettingChange: (change: Partial<FogToolSettingsType>) => void;
|
||||
onToolAction: (action: string) => void;
|
||||
disabledActions: string[];
|
||||
};
|
||||
|
||||
function FogToolSettings({
|
||||
settings,
|
||||
onSettingChange,
|
||||
onToolAction,
|
||||
disabledActions,
|
||||
}: FogToolSettingsProps) {
|
||||
function FogToolSettings({ settings, onSettingChange }: FogToolSettingsProps) {
|
||||
// Keyboard shortcuts
|
||||
function handleKeyDown(event: KeyboardEvent) {
|
||||
if (shortcuts.fogPolygon(event)) {
|
||||
@@ -59,10 +50,6 @@ function FogToolSettings({
|
||||
onSettingChange({ useFogCut: !settings.useFogCut });
|
||||
} else if (shortcuts.fogRectangle(event)) {
|
||||
onSettingChange({ type: "rectangle" });
|
||||
} else if (shortcuts.redo(event) && !disabledActions.includes("redo")) {
|
||||
onToolAction("fogRedo");
|
||||
} else if (shortcuts.undo(event) && !disabledActions.includes("undo")) {
|
||||
onToolAction("fogUndo");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,15 +121,6 @@ function FogToolSettings({
|
||||
useFogPreview={settings.preview}
|
||||
onFogPreviewChange={(preview) => onSettingChange({ preview })}
|
||||
/>
|
||||
<Divider vertical />
|
||||
<UndoButton
|
||||
onClick={() => onToolAction("fogUndo")}
|
||||
disabled={disabledActions.includes("undo")}
|
||||
/>
|
||||
<RedoButton
|
||||
onClick={() => onToolAction("fogRedo")}
|
||||
disabled={disabledActions.includes("redo")}
|
||||
/>
|
||||
</Flex>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user