feat: more tests, refactored

This commit is contained in:
2026-05-24 21:05:21 +07:00
parent e7dd9420e7
commit c1f12c7201
33 changed files with 1403 additions and 334 deletions
-26
View File
@@ -14,29 +14,3 @@ export type ToolActionController = {
};
export type EditorToolController = ToolModeController | ToolActionController;
type CreateEditorToolControllersOptions = {
onAddTextLayer: () => void;
onImportImage: () => void;
labels: {
pointer: string;
pan: string;
face: string;
fill: string;
brush: string;
text: string;
image: string;
};
};
export function createEditorToolControllers(options: CreateEditorToolControllersOptions): EditorToolController[] {
return [
{ kind: "mode", id: "pointer", label: options.labels.pointer },
{ kind: "mode", id: "hand", label: options.labels.pan },
{ kind: "mode", id: "face", label: options.labels.face },
{ kind: "mode", id: "fill", label: options.labels.fill },
{ kind: "mode", id: "brush", label: options.labels.brush },
{ kind: "action", id: "add-text", label: options.labels.text, run: options.onAddTextLayer },
{ kind: "action", id: "import-image", label: options.labels.image, run: options.onImportImage },
];
}