floor-editor-ts 1.3.8 → 1.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/floor-editor.es.js +1403 -729
- package/dist/floor-editor.es.js.map +1 -1
- package/dist/src/lib/models/types.d.ts +17 -0
- package/dist/src/lib/stores/project.d.ts +22 -2
- package/dist/src/lib/utils/canvasRenderer.d.ts +5 -1
- package/dist/src/lib/utils/hitTesting.d.ts +5 -1
- package/dist/src/lib/utils/zoneGeometry.d.ts +31 -0
- package/package.json +1 -1
|
@@ -128,6 +128,22 @@ export interface GuideLine {
|
|
|
128
128
|
orientation: 'horizontal' | 'vertical';
|
|
129
129
|
position: number;
|
|
130
130
|
}
|
|
131
|
+
/** Floor overlay area (not tied to walls). Independent of heatmap. 1 area ↔ 1 camera. */
|
|
132
|
+
export type ZoneShape = 'rectangle' | 'triangle' | 'polygon';
|
|
133
|
+
export interface Zone {
|
|
134
|
+
id: string;
|
|
135
|
+
/** Display name — normally from assignedCameras[].area */
|
|
136
|
+
name: string;
|
|
137
|
+
shape: ZoneShape;
|
|
138
|
+
/** Closed polygon vertices (first point not repeated). */
|
|
139
|
+
points: Point[];
|
|
140
|
+
/** Stroke + label color — normally from assignedCameras[].areaColor */
|
|
141
|
+
color: string;
|
|
142
|
+
/** Soft fill alpha inside polygon. Default ~0.1 */
|
|
143
|
+
fillOpacity?: number;
|
|
144
|
+
/** Linked camera serial (assignedCameras item). */
|
|
145
|
+
cameraSerial?: string;
|
|
146
|
+
}
|
|
131
147
|
export interface BackgroundImage {
|
|
132
148
|
dataUrl: string;
|
|
133
149
|
position: Point;
|
|
@@ -152,6 +168,7 @@ export interface Floor {
|
|
|
152
168
|
measurements: Measurement[];
|
|
153
169
|
annotations: Annotation[];
|
|
154
170
|
textAnnotations: TextAnnotation[];
|
|
171
|
+
zones?: Zone[];
|
|
155
172
|
groups: ElementGroup[];
|
|
156
173
|
}
|
|
157
174
|
export interface Project {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { Project, Floor, Wall, Door, Window as Win, FurnitureItem, Point, Stair, Column, BackgroundImage, ElementGroup } from '../../../lib/models/types';
|
|
1
|
+
import { Project, Floor, Wall, Door, Window as Win, FurnitureItem, Point, Stair, Column, BackgroundImage, ElementGroup, Zone, ZoneShape } from '../../../lib/models/types';
|
|
2
2
|
export declare function createDefaultFloor(level?: number): Floor;
|
|
3
3
|
export declare function createDefaultProject(name?: string): Project;
|
|
4
4
|
export declare const currentProject: import('svelte/store').Writable<Project | null>;
|
|
5
5
|
export declare const activeFloor: import('svelte/store').Readable<Floor | null>;
|
|
6
|
-
export type Tool = 'select' | 'wall' | 'door' | 'window' | 'furniture' | 'text';
|
|
6
|
+
export type Tool = 'select' | 'wall' | 'door' | 'window' | 'furniture' | 'text' | 'annotate' | 'measure' | 'zone';
|
|
7
7
|
export declare const selectedTool: import('svelte/store').Writable<Tool>;
|
|
8
|
+
/** Subtype when selectedTool === 'zone' */
|
|
9
|
+
export declare const placingZoneShape: import('svelte/store').Writable<ZoneShape>;
|
|
8
10
|
export declare const snapEnabled: import('svelte/store').Writable<boolean>;
|
|
9
11
|
/** When true, left-click drag pans the canvas instead of selecting */
|
|
10
12
|
export declare const panMode: import('svelte/store').Writable<boolean>;
|
|
@@ -142,6 +144,23 @@ export declare function moveTextAnnotation(id: string, position: {
|
|
|
142
144
|
x: number;
|
|
143
145
|
y: number;
|
|
144
146
|
}): void;
|
|
147
|
+
export type AddZoneOptions = {
|
|
148
|
+
name?: string;
|
|
149
|
+
color?: string;
|
|
150
|
+
cameraSerial?: string;
|
|
151
|
+
fillOpacity?: number;
|
|
152
|
+
};
|
|
153
|
+
export declare function addZone(shape: ZoneShape, points: Point[], nameOrOpts?: string | AddZoneOptions, colorArg?: string): string;
|
|
154
|
+
/**
|
|
155
|
+
* Create area for a camera, or replace geometry if that camera already has an area.
|
|
156
|
+
*/
|
|
157
|
+
export declare function upsertCameraZone(shape: ZoneShape, points: Point[], opts: AddZoneOptions & {
|
|
158
|
+
cameraSerial: string;
|
|
159
|
+
}): string;
|
|
160
|
+
export declare function updateZone(id: string, updates: Partial<Pick<Zone, 'name' | 'color' | 'fillOpacity' | 'points' | 'shape' | 'cameraSerial'>>): void;
|
|
161
|
+
/** Live drag without undo snapshot (commit with updateZone / endUndoGroup). */
|
|
162
|
+
export declare function moveZonePoints(id: string, points: Point[]): void;
|
|
163
|
+
export declare function removeZone(id: string): void;
|
|
145
164
|
export declare const layerVisibility: import('svelte/store').Writable<{
|
|
146
165
|
walls: boolean;
|
|
147
166
|
doors: boolean;
|
|
@@ -152,6 +171,7 @@ export declare const layerVisibility: import('svelte/store').Writable<{
|
|
|
152
171
|
guides: boolean;
|
|
153
172
|
measurements: boolean;
|
|
154
173
|
annotations: boolean;
|
|
174
|
+
zones: boolean;
|
|
155
175
|
}>;
|
|
156
176
|
export declare function toggleFurnitureLock(id: string): void;
|
|
157
177
|
export declare function setFurnitureLocked(id: string, locked: boolean): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Point, Wall, Door, Window as Win, FurnitureItem, Stair, Column, Floor, Annotation, Room } from '../../../lib/models/types';
|
|
1
|
+
import { Point, Wall, Door, Window as Win, FurnitureItem, Stair, Column, Floor, Annotation, Zone, Room } from '../../../lib/models/types';
|
|
2
2
|
import { CanvasState } from '../../../lib/utils/canvasInteraction';
|
|
3
3
|
import { ProjectSettings } from '../../../lib/stores/settings';
|
|
4
4
|
import { HeatmapColorScale } from '../../../lib/utils/heatmapColorScale';
|
|
@@ -34,6 +34,10 @@ export declare function drawColumn(cs: CanvasState, col: Column, selected: boole
|
|
|
34
34
|
export declare function drawGuides(cs: CanvasState, floor: Floor, selectedGuideId: string | null, RULER_SIZE: number): void;
|
|
35
35
|
export declare function drawPersistedMeasurements(cs: CanvasState, floor: Floor, selectedMeasurementId: string | null, dimSettings: ProjectSettings): void;
|
|
36
36
|
export declare function drawTextAnnotations(cs: CanvasState, floor: Floor, selectedTextAnnotationId: string | null, currentSelectedId: string | null): void;
|
|
37
|
+
export declare function drawZoneShape(cs: CanvasState, zone: Zone, selected: boolean): void;
|
|
38
|
+
export declare function drawZones(cs: CanvasState, floor: Floor, selectedZoneId: string | null): void;
|
|
39
|
+
/** Preview while drawing polygon / dragging rect. */
|
|
40
|
+
export declare function drawZoneDraft(cs: CanvasState, points: Point[], color: string, closed: boolean, cursor?: Point | null): void;
|
|
37
41
|
export declare function drawAnnotation(cs: CanvasState, a: Annotation, selected: boolean, dimSettings: ProjectSettings): void;
|
|
38
42
|
export declare function drawAnnotations(cs: CanvasState, floor: Floor, selectedAnnotationId: string | null, dimSettings: ProjectSettings): void;
|
|
39
43
|
export declare function getRoomFill(room: Room, index: number): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Point, Wall, Door, Window as Win, FurnitureItem, Stair, Column, Floor, Room } from '../../../lib/models/types';
|
|
1
|
+
import { Point, Wall, Door, Window as Win, FurnitureItem, Stair, Column, Floor, Zone, Room } from '../../../lib/models/types';
|
|
2
2
|
import { HandleType } from '../../../lib/utils/canvasInteraction';
|
|
3
3
|
export declare function pointInPolygon(p: Point, poly: Point[]): boolean;
|
|
4
4
|
export declare function pointToSegmentDist(p: Point, a: Point, b: Point): number;
|
|
@@ -14,3 +14,7 @@ export declare function findRoomAt(p: Point, rooms: Room[], walls: Wall[]): Room
|
|
|
14
14
|
export declare function hitTestMeasurement(wp: Point, floor: Floor, zoom: number): string | null;
|
|
15
15
|
export declare function hitTestAnnotation(wp: Point, floor: Floor, zoom: number): string | null;
|
|
16
16
|
export declare function hitTestTextAnnotation(wp: Point, floor: Floor, ctx: CanvasRenderingContext2D, zoom: number): string | null;
|
|
17
|
+
/** Hit zone vertex; returns index or -1. */
|
|
18
|
+
export declare function findZoneVertexAt(wp: Point, zone: Zone, zoom: number): number;
|
|
19
|
+
/** Top-most zone under point (fill or near edge). */
|
|
20
|
+
export declare function findZoneAt(wp: Point, zones: Zone[] | undefined, zoom: number): Zone | null;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Point, Zone, ZoneShape } from '../../../lib/models/types';
|
|
2
|
+
export declare const ZONE_COLOR_PALETTE: readonly ["#F97316", "#22C55E", "#3B82F6", "#EF4444", "#A855F7", "#EAB308"];
|
|
3
|
+
export declare const DEFAULT_ZONE_FILL_OPACITY = 0.1;
|
|
4
|
+
/** Default rect half-size in world units (cm). */
|
|
5
|
+
export declare const DEFAULT_ZONE_SIZE = 200;
|
|
6
|
+
export declare function nextZoneColor(existingCount: number): string;
|
|
7
|
+
/** Resolve area label + color from host assigned camera fields. */
|
|
8
|
+
export declare function resolveCameraAreaStyle(source: {
|
|
9
|
+
area?: unknown;
|
|
10
|
+
areaColor?: unknown;
|
|
11
|
+
props?: Record<string, string>;
|
|
12
|
+
} | null | undefined, fallbackIndex?: number): {
|
|
13
|
+
name: string;
|
|
14
|
+
color: string;
|
|
15
|
+
};
|
|
16
|
+
export declare function rectPoints(x1: number, y1: number, x2: number, y2: number): Point[];
|
|
17
|
+
/** Isosceles triangle pointing up, centered at `c`. */
|
|
18
|
+
export declare function trianglePoints(c: Point, size?: number): Point[];
|
|
19
|
+
export declare function defaultRectAt(c: Point, size?: number): Point[];
|
|
20
|
+
export declare function zoneBounds(points: Point[]): {
|
|
21
|
+
minX: number;
|
|
22
|
+
minY: number;
|
|
23
|
+
maxX: number;
|
|
24
|
+
maxY: number;
|
|
25
|
+
} | null;
|
|
26
|
+
export declare function translatePoints(points: Point[], dx: number, dy: number): Point[];
|
|
27
|
+
/** Axis-aligned resize: keep opposite corner fixed when dragging corner index. */
|
|
28
|
+
export declare function resizeRectCorner(points: Point[], cornerIndex: number, to: Point): Point[];
|
|
29
|
+
export declare function isNearPoint(a: Point, b: Point, threshold: number): boolean;
|
|
30
|
+
export declare function ensureZoneDefaults(zone: Zone): Zone;
|
|
31
|
+
export declare function createZoneDraft(shape: ZoneShape, points: Point[], name: string, color: string): Omit<Zone, "id">;
|