61 lines
1.1 KiB
TypeScript
61 lines
1.1 KiB
TypeScript
|
|
import type { PointerState } from './canvas';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Available tool types
|
||
|
|
*/
|
||
|
|
export type ToolType =
|
||
|
|
| 'select'
|
||
|
|
| 'move'
|
||
|
|
| 'pencil'
|
||
|
|
| 'brush'
|
||
|
|
| 'eraser'
|
||
|
|
| 'fill'
|
||
|
|
| 'eyedropper'
|
||
|
|
| 'text'
|
||
|
|
| 'shape'
|
||
|
|
| 'crop'
|
||
|
|
| 'clone'
|
||
|
|
| 'blur'
|
||
|
|
| 'sharpen';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Tool settings interface
|
||
|
|
*/
|
||
|
|
export interface ToolSettings {
|
||
|
|
/** Brush/pencil size */
|
||
|
|
size: number;
|
||
|
|
/** Opacity (0-1) */
|
||
|
|
opacity: number;
|
||
|
|
/** Hardness (0-1) */
|
||
|
|
hardness: number;
|
||
|
|
/** Color */
|
||
|
|
color: string;
|
||
|
|
/** Flow rate (0-1) */
|
||
|
|
flow: number;
|
||
|
|
/** Spacing between brush stamps */
|
||
|
|
spacing: number;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Tool state interface
|
||
|
|
*/
|
||
|
|
export interface ToolState {
|
||
|
|
/** Currently active tool */
|
||
|
|
activeTool: ToolType;
|
||
|
|
/** Tool-specific settings */
|
||
|
|
settings: ToolSettings;
|
||
|
|
/** Custom cursor */
|
||
|
|
cursor: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Tool event handlers
|
||
|
|
*/
|
||
|
|
export interface ToolHandlers {
|
||
|
|
onPointerDown?: (pointer: PointerState, ctx: CanvasRenderingContext2D) => void;
|
||
|
|
onPointerMove?: (pointer: PointerState, ctx: CanvasRenderingContext2D) => void;
|
||
|
|
onPointerUp?: (pointer: PointerState, ctx: CanvasRenderingContext2D) => void;
|
||
|
|
onActivate?: () => void;
|
||
|
|
onDeactivate?: () => void;
|
||
|
|
}
|