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

56 lines
971 B
TypeScript
Raw Normal View History

2023-01-17 18:32:15 +00:00
import { LayerObjectType, SubToolType, ToolType } from './types';
2023-01-16 19:37:39 +00:00
export type Vec2 = [number, number];
export interface LineSegment {
start?: Vec2;
end: Vec2;
}
export interface BezierSegment extends LineSegment {
startControl: Vec2;
endControl: Vec2;
}
export interface LayerObject {
2023-01-17 18:32:15 +00:00
id: number;
2023-01-16 19:37:39 +00:00
name: string;
visible: boolean;
selected: boolean;
2023-01-17 18:32:15 +00:00
type: LayerObjectType;
2023-01-16 19:37:39 +00:00
}
export interface Line extends LayerObject {
segments: LineSegment[];
width: number;
color: string;
render?: Path2D;
lineCap?: CanvasLineCap;
closed?: boolean;
lineDash?: number[];
}
export interface Layer {
2023-01-17 18:32:15 +00:00
id: number;
2023-01-16 19:37:39 +00:00
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;
}