55 lines
964 B
TypeScript
55 lines
964 B
TypeScript
|
import { SubToolType, ToolType } from './types';
|
||
|
|
||
|
export type Vec2 = [number, number];
|
||
|
export interface LineSegment {
|
||
|
start?: Vec2;
|
||
|
end: Vec2;
|
||
|
}
|
||
|
|
||
|
export interface BezierSegment extends LineSegment {
|
||
|
startControl: Vec2;
|
||
|
endControl: Vec2;
|
||
|
}
|
||
|
|
||
|
export interface LayerObject {
|
||
|
name: string;
|
||
|
visible: boolean;
|
||
|
selected: boolean;
|
||
|
type: 'line' | 'room' | 'curve' | 'object';
|
||
|
}
|
||
|
|
||
|
export interface Line extends LayerObject {
|
||
|
segments: LineSegment[];
|
||
|
width: number;
|
||
|
color: string;
|
||
|
render?: Path2D;
|
||
|
lineCap?: CanvasLineCap;
|
||
|
closed?: boolean;
|
||
|
lineDash?: number[];
|
||
|
}
|
||
|
|
||
|
export interface Layer {
|
||
|
index: number;
|
||
|
contents: LayerObject[];
|
||
|
name: string;
|
||
|
color: string;
|
||
|
visible: boolean;
|
||
|
active: boolean;
|
||
|
}
|
||
|
|
||
|
export interface History<T> {
|
||
|
object: T;
|
||
|
property: keyof T;
|
||
|
value: unknown;
|
||
|
}
|
||
|
|
||
|
export interface UpdateEvent {
|
||
|
event: string;
|
||
|
object?: LayerObject;
|
||
|
}
|
||
|
|
||
|
export interface ToolEvent {
|
||
|
primary: ToolType;
|
||
|
secondary: SubToolType;
|
||
|
}
|