chessground12
Version:
Extended lishuuro.org Chess UI
58 lines (57 loc) • 1.47 kB
TypeScript
import type { State } from './state';
import { Role, Color, Key, NumberPair, MouchEvent } from './types';
export interface DrawShape {
orig: Key;
dest?: Key;
brush?: string;
modifiers?: DrawModifiers;
piece?: DrawShapePiece;
customSvg?: string;
}
export interface DrawShapePiece {
role: Role;
color: Color;
promoted?: boolean;
scale?: number;
}
export interface DrawBrush {
key: string;
color: string;
opacity: number;
lineWidth: number;
}
export interface DrawBrushes {
[name: string]: DrawBrush;
}
export interface DrawModifiers {
lineWidth?: number;
}
export interface Drawable {
enabled: boolean;
visible: boolean;
defaultSnapToValidMove: boolean;
eraseOnClick: boolean;
onChange?: (shapes: DrawShape[]) => void;
shapes: DrawShape[];
autoShapes: DrawShape[];
current?: DrawCurrent;
brushes: DrawBrushes;
pieces: {
baseUrl: string;
};
prevSvgHash: string;
}
export interface DrawCurrent {
orig: Key;
dest?: Key;
mouseSq?: Key;
pos: NumberPair;
brush: string;
snapToValidMove: boolean;
}
export declare function start(state: State, e: MouchEvent): void;
export declare function processDraw(state: State): void;
export declare function move(state: State, e: MouchEvent): void;
export declare function end(state: State): void;
export declare function cancel(state: State): void;
export declare function clear(state: State): void;