Skip to content

Commit

Permalink
feat: editor token button
Browse files Browse the repository at this point in the history
  • Loading branch information
micahg committed Aug 31, 2024
1 parent f7e4908 commit c7991d8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 21 deletions.
20 changes: 18 additions & 2 deletions packages/mui/src/components/ContentEditor/ContentEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
Visibility,
Edit,
EditOff,
Face,
} from "@mui/icons-material";
import { GameMasterAction } from "../GameMasterActionComponent/GameMasterActionComponent";
import {
Expand Down Expand Up @@ -56,7 +57,7 @@ interface ContentEditorProps {
}

const SELECT_ACTIONS = ["select"] as const;
const BRUSH_ACTIONS = ["paint", "erase"] as const;
const BRUSH_ACTIONS = ["paint", "erase", "token"] as const;
type BrushAction = (typeof BRUSH_ACTIONS)[number];
type SelectAction = (typeof SELECT_ACTIONS)[number];
type RecordingAction = "move" | SelectAction | BrushAction;
Expand Down Expand Up @@ -381,6 +382,20 @@ const ContentEditor = ({
disabled: () => internalState.rec || internalState.act === "select",
callback: () => sm.transition("rotateClock"),
},
{
icon: Face,
tooltip: "Token",
hidden: () => internalState.rec && internalState.act === "token",
disabled: () => internalState.rec && internalState.act !== "token",
callback: () => prepareRecording("token"),
},
{
icon: Face,
tooltip: "Finish Token",
hidden: () => !(internalState.rec && internalState.act === "token"),
disabled: () => false,
callback: () => sm.transition("wait"),
},
{
icon: EditOff,
tooltip: "Erase",
Expand Down Expand Up @@ -521,7 +536,8 @@ const ContentEditor = ({
updateSelected(true);
} else if (
internalState.act === "erase" ||
internalState.act === "paint"
internalState.act === "paint" ||
internalState.act === "token"
) {
worker.postMessage({ cmd: `end_${internalState.act}` });
sm.transition("record");
Expand Down
19 changes: 0 additions & 19 deletions packages/mui/test/statemachine.test.ts

This file was deleted.

0 comments on commit c7991d8

Please sign in to comment.