Rename token create and remove handlers

This commit is contained in:
Mitchell McCaffrey 2021-07-20 18:53:03 +10:00
parent eb5999bd03
commit fe8e4387c6
7 changed files with 14 additions and 15 deletions

View File

@ -32,7 +32,7 @@ import { Settings } from "../../types/Settings";
import {
MapChangeEventHandler,
MapResetEventHandler,
MapTokenStateRemoveHandler,
TokenStateRemoveHandler,
NoteChangeEventHandler,
NoteRemoveEventHander,
TokenStateChangeEventHandler,
@ -46,7 +46,7 @@ type MapProps = {
mapState: MapState | null;
mapActions: MapActions;
onMapTokenStateChange: TokenStateChangeEventHandler;
onMapTokenStateRemove: MapTokenStateRemoveHandler;
onMapTokenStateRemove: TokenStateRemoveHandler;
onMapChange: MapChangeEventHandler;
onMapReset: MapResetEventHandler;
onMapDraw: (action: Action<DrawingState>) => void;

View File

@ -4,10 +4,10 @@ import { IconButton } from "theme-ui";
import SelectTokensIcon from "../../icons/SelectTokensIcon";
import SelectTokensModal from "../../modals/SelectTokensModal";
import { MapTokensStateCreateHandler } from "../../types/Events";
import { TokensStateCreateHandler } from "../../types/Events";
type SelectTokensButtonProps = {
onMapTokensStateCreate: MapTokensStateCreateHandler;
onMapTokensStateCreate: TokensStateCreateHandler;
};
function SelectTokensButton({

View File

@ -32,11 +32,11 @@ import {
} from "../../helpers/token";
import { findGroup } from "../../helpers/group";
import Vector2 from "../../helpers/Vector2";
import { MapTokensStateCreateHandler } from "../../types/Events";
import { TokensStateCreateHandler } from "../../types/Events";
import { Group } from "../../types/Group";
type TokenBarProps = {
onMapTokensStateCreate: MapTokensStateCreateHandler;
onMapTokensStateCreate: TokensStateCreateHandler;
};
function TokenBar({ onMapTokensStateCreate }: TokenBarProps) {

View File

@ -1,11 +1,11 @@
import Konva from "konva";
import DragOverlay from "../map/DragOverlay";
import { MapTokenStateRemoveHandler } from "../../types/Events";
import { TokenStateRemoveHandler } from "../../types/Events";
import { TokenState } from "../../types/TokenState";
type TokenDragOverlayProps = {
onTokenStateRemove: MapTokenStateRemoveHandler;
onTokenStateRemove: TokenStateRemoveHandler;
tokenState: TokenState;
tokenNode: Konva.Node;
dragging: boolean;

View File

@ -9,7 +9,7 @@ import {
} from "../types/Token";
import { TokenState } from "../types/TokenState";
import {
MapTokenStateRemoveHandler,
TokenStateRemoveHandler,
TokenStateChangeEventHandler,
} from "../types/Events";
import { useState } from "react";
@ -23,7 +23,7 @@ function useMapTokens(
map: Map | null,
mapState: MapState | null,
onTokenStateChange: TokenStateChangeEventHandler,
onTokenStateRemove: MapTokenStateRemoveHandler,
onTokenStateRemove: TokenStateRemoveHandler,
selectedToolId: MapToolId,
disabledTokens: Record<string, boolean>
) {

View File

@ -37,14 +37,14 @@ import { useMapStage } from "../contexts/MapStageContext";
import { TokenState } from "../types/TokenState";
import {
MapTokensStateCreateHandler,
TokensStateCreateHandler,
RequestCloseEventHandler,
} from "../types/Events";
type SelectTokensModalProps = {
isOpen: boolean;
onRequestClose: RequestCloseEventHandler;
onMapTokensStateCreate: MapTokensStateCreateHandler;
onMapTokensStateCreate: TokensStateCreateHandler;
};
function SelectTokensModal({

View File

@ -21,9 +21,8 @@ export type DiceSelectEventHandler = (dice: DefaultDice) => void;
export type RequestCloseEventHandler = () => void;
export type MapTokensStateCreateHandler = (states: TokenState[]) => void;
export type MapTokenStateRemoveHandler = (state: TokenState) => void;
export type TokensStateCreateHandler = (states: TokenState[]) => void;
export type TokenStateRemoveHandler = (state: TokenState) => void;
export type TokenStateChangeEventHandler = (
changes: Record<string, Partial<TokenState>>
) => void;