homemanager-fe/src/modules/house-planner/interfaces.ts

55 lines
964 B
TypeScript
Raw Normal View History

2023-01-16 19:37:39 +00:00
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;
}