Move to global undo and combined map action state

This commit is contained in:
Mitchell McCaffrey
2021-07-20 21:45:18 +10:00
parent b703a08d2c
commit 54bc3502df
9 changed files with 128 additions and 190 deletions
+18 -13
View File
@@ -3,6 +3,8 @@ import Action from "../actions/Action";
import { DrawingState } from "./Drawing";
import { FogState } from "./Fog";
import { Grid } from "./Grid";
import { Notes } from "./Note";
import { TokenStates } from "./TokenState";
export type MapToolId =
| "map"
@@ -59,18 +61,21 @@ export type FileMap = BaseMap & {
export type Map = DefaultMap | FileMap;
export type MapActions = {
mapDrawActions: Action<DrawingState>[];
mapDrawActionIndex: number;
fogDrawActions: Action<FogState>[];
fogDrawActionIndex: number;
export type DrawingsAction = {
type: "drawings";
action: Action<DrawingState>;
};
export type FogsAction = { type: "fogs"; action: Action<FogState> };
export type TokensAction = { type: "tokens"; action: Action<TokenStates> };
export type NotesAction = { type: "notes"; action: Action<Notes> };
export type MapActionsKey = keyof Pick<
MapActions,
"mapDrawActions" | "fogDrawActions"
>;
export type MapActionsIndexKey = keyof Pick<
MapActions,
"mapDrawActionIndex" | "fogDrawActionIndex"
>;
export type MapAction =
| DrawingsAction
| FogsAction
| TokensAction
| NotesAction;
export type MapActions = {
actions: MapAction[][];
actionIndex: number;
};