2021-07-16 14:55:33 +10:00
|
|
|
import React from "react";
|
2021-07-17 12:48:04 +10:00
|
|
|
import Action from "../actions/Action";
|
|
|
|
|
import { Drawing } from "./Drawing";
|
|
|
|
|
import { Fog } from "./Fog";
|
2021-07-08 12:01:02 +10:00
|
|
|
import { Grid } from "./Grid";
|
|
|
|
|
|
2021-07-16 14:55:33 +10:00
|
|
|
export type MapToolId =
|
2021-07-17 12:48:04 +10:00
|
|
|
| "map"
|
2021-07-16 14:55:33 +10:00
|
|
|
| "move"
|
|
|
|
|
| "fog"
|
|
|
|
|
| "drawing"
|
|
|
|
|
| "measure"
|
|
|
|
|
| "pointer"
|
|
|
|
|
| "note";
|
|
|
|
|
|
|
|
|
|
export type MapTool = {
|
|
|
|
|
id: MapToolId;
|
|
|
|
|
icon: React.ReactNode;
|
|
|
|
|
title: string;
|
|
|
|
|
SettingsComponent?: React.ElementType;
|
|
|
|
|
};
|
|
|
|
|
|
2021-07-08 12:01:02 +10:00
|
|
|
export type BaseMap = {
|
|
|
|
|
id: string;
|
|
|
|
|
name: string;
|
|
|
|
|
owner: string;
|
|
|
|
|
grid: Grid;
|
|
|
|
|
width: number;
|
|
|
|
|
height: number;
|
|
|
|
|
type: string;
|
|
|
|
|
lastModified: number;
|
|
|
|
|
created: number;
|
|
|
|
|
showGrid: boolean;
|
|
|
|
|
snapToGrid: boolean;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type DefaultMap = BaseMap & {
|
|
|
|
|
type: "default";
|
|
|
|
|
key: string;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type FileMapResolutions = {
|
|
|
|
|
low?: string;
|
|
|
|
|
medium?: string;
|
|
|
|
|
high?: string;
|
|
|
|
|
ultra?: string;
|
|
|
|
|
};
|
|
|
|
|
|
2021-07-17 12:48:04 +10:00
|
|
|
export type MapQuality = keyof FileMapResolutions | "original";
|
|
|
|
|
|
2021-07-08 12:01:02 +10:00
|
|
|
export type FileMap = BaseMap & {
|
|
|
|
|
type: "file";
|
|
|
|
|
file: string;
|
|
|
|
|
resolutions: FileMapResolutions;
|
|
|
|
|
thumbnail: string;
|
2021-07-17 12:48:04 +10:00
|
|
|
quality: MapQuality;
|
2021-07-08 12:01:02 +10:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type Map = DefaultMap | FileMap;
|
2021-07-17 12:48:04 +10:00
|
|
|
|
|
|
|
|
export type MapActions = {
|
|
|
|
|
mapDrawActions: Action<Drawing>[];
|
|
|
|
|
mapDrawActionIndex: number;
|
|
|
|
|
fogDrawActions: Action<Fog>[];
|
|
|
|
|
fogDrawActionIndex: number;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type MapActionsKey = keyof Pick<
|
|
|
|
|
MapActions,
|
|
|
|
|
"mapDrawActions" | "fogDrawActions"
|
|
|
|
|
>;
|
|
|
|
|
export type MapActionsIndexKey = keyof Pick<
|
|
|
|
|
MapActions,
|
|
|
|
|
"mapDrawActionIndex" | "fogDrawActionIndex"
|
|
|
|
|
>;
|