Event Handing
Event names
export type FloorPlanEvents =
| "click"
| "right-click"
| "double-click"
| "hover"
| "blur"
| "plan-right-click"
| "outside-click";Payload shape
export type FloorPlanEntityType = "SPACE" | "WALL_PERIMETER" | "ROOM" | "AREA";
export type Center = {
x: number; // absolute pixels in canvas coords
y: number;
relativeX?: number; // 0..1 within canvas
relativeY?: number; // 0..1 within canvas
};
export interface FloorPlanEntity<T extends Record<string, any> = {}> {
id: string;
type: FloorPlanEntityType; // "SPACE" | "ROOM" | "WALL_PERIMETER" | "AREA"
center?: Center;
properties?: T & { locationId: string; layerId: string };
}
export type SpaceMetadata = any;
export type RoomMetadata = any;
export type WallPerimeterMetadata = any;
export type FloorPlanEntityMetadata =
| SpaceMetadata
| RoomMetadata
| WallPerimeterMetadata;
interface FloorPlanEvent {
event: FloorPlanEvents;
id: string; // mirrors metadata.id
metadata: FloorPlanEntity<FloorPlanEntityMetadata>;
}Subscribing & unsubscribing
Vanilla JS example
Filtering & patterns
Security
Last updated
Was this helpful?