79 lines
1.5 KiB
TypeScript
79 lines
1.5 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;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Selection interface for selected regions
|
||
|
|
*/
|
||
|
|
export interface Selection {
|
||
|
|
/** 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;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 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;
|
||
|
|
}
|