Inital commit
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import { FaArrowsUpDownLeftRight, FaExpand } from "react-icons/fa6";
|
||||
import type { DefinedTool } from "./interfaces";
|
||||
import type { JSX } from "react";
|
||||
import { FaMousePointer } from "react-icons/fa";
|
||||
|
||||
export const TOOLS: DefinedTool<any>[] = [];
|
||||
|
||||
export function defineTool<T = any, K extends string = string>(
|
||||
key: K,
|
||||
name: string,
|
||||
icon: () => JSX.Element,
|
||||
defaultSettings: () => T = () => null,
|
||||
): DefinedTool<T, K> {
|
||||
const tool: DefinedTool<T, K> = {
|
||||
key,
|
||||
name,
|
||||
icon,
|
||||
defaultSettings,
|
||||
};
|
||||
TOOLS.push(tool);
|
||||
return tool;
|
||||
}
|
||||
|
||||
export const TOOL_SELECT = defineTool<null>("select", "Select", () => <FaMousePointer />);
|
||||
export const TOOL_CANVAS_MOVE = defineTool<null>("move", "move-canvas", () => <FaArrowsUpDownLeftRight />);
|
||||
export const TOOL_OBJECT_MOVE = defineTool<null>("move-object", "Move object", () => <FaExpand />);
|
||||
Reference in New Issue
Block a user