TypeScript compilation fixes: - Added modifier keys (altKey, ctrlKey, shiftKey, metaKey) to PointerState interface - Updated all PointerState creations in canvas to include modifier keys - Added 'smudge' and 'dodge' cursor definitions to tool store Tool integration: - Added 'clone', 'smudge', 'dodge' to drawing tools array in canvas - Clone Stamp uses Alt+Click to set source point - Dodge/Burn uses Alt key to toggle between dodge (lighten) and burn (darken) modes - Smudge tool benefits from modifier key tracking for future enhancements All tools now properly receive keyboard modifier state for advanced interactions. Build verified successful with pnpm build. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
87 lines
1.7 KiB
TypeScript
87 lines
1.7 KiB
TypeScript
/**
|
|
* Canvas state interface
|
|
*/
|
|
export interface CanvasState {
|
|
/** Canvas width in pixels */
|
|
width: number;
|
|
/** Canvas height in pixels */
|
|
height: number;
|
|
/** Current zoom level (1 = 100%) */
|
|
zoom: number;
|
|
/** Pan offset X */
|
|
offsetX: number;
|
|
/** Pan offset Y */
|
|
offsetY: number;
|
|
/** Background color */
|
|
backgroundColor: string;
|
|
/** Show grid overlay */
|
|
showGrid: boolean;
|
|
/** Grid size in pixels */
|
|
gridSize: number;
|
|
/** Show rulers */
|
|
showRulers: boolean;
|
|
/** Snap to grid */
|
|
snapToGrid: boolean;
|
|
}
|
|
|
|
/**
|
|
* Canvas selection interface for selected regions (deprecated - use Selection from selection.ts)
|
|
*/
|
|
export interface CanvasSelection {
|
|
/** Is there an active selection */
|
|
active: boolean;
|
|
/** Selection bounds */
|
|
x: number;
|
|
y: number;
|
|
width: number;
|
|
height: number;
|
|
/** Selection path (for complex selections) */
|
|
path?: Path2D;
|
|
}
|
|
|
|
/**
|
|
* Mouse/pointer state
|
|
*/
|
|
export interface PointerState {
|
|
/** Is pointer currently down */
|
|
isDown: boolean;
|
|
/** Current X position (canvas coordinates) */
|
|
x: number;
|
|
/** Current Y position (canvas coordinates) */
|
|
y: number;
|
|
/** Previous X position */
|
|
prevX: number;
|
|
/** Previous Y position */
|
|
prevY: number;
|
|
/** Pressure (0-1, for stylus) */
|
|
pressure: number;
|
|
/** Alt key modifier */
|
|
altKey?: boolean;
|
|
/** Ctrl key modifier */
|
|
ctrlKey?: boolean;
|
|
/** Shift key modifier */
|
|
shiftKey?: boolean;
|
|
/** Meta key modifier */
|
|
metaKey?: boolean;
|
|
}
|
|
|
|
/**
|
|
* Viewport transformation
|
|
*/
|
|
export interface Viewport {
|
|
/** Scale factor */
|
|
scale: number;
|
|
/** Translation X */
|
|
translateX: number;
|
|
/** Translation Y */
|
|
translateY: number;
|
|
}
|
|
|
|
/**
|
|
* Canvas to screen coordinate conversion result
|
|
*/
|
|
export interface Point {
|
|
x: number;
|
|
y: number;
|
|
}
|