floor-editor-ts 1.3.7 → 1.3.9
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 +1358 -673
- package/dist/floor-editor.es.js.map +1 -1
- package/dist/src/lib/models/types.d.ts +14 -0
- package/dist/src/lib/packageDefaults.d.ts +7 -0
- package/dist/src/lib/stores/project.d.ts +10 -2
- package/dist/src/lib/utils/canvasRenderer.d.ts +7 -2
- package/dist/src/lib/utils/heatmapColorScale.d.ts +39 -0
- package/dist/src/lib/utils/hitTesting.d.ts +5 -1
- package/dist/src/lib/utils/zoneGeometry.d.ts +22 -0
- package/package.json +1 -1
|
@@ -128,6 +128,19 @@ export interface GuideLine {
|
|
|
128
128
|
orientation: 'horizontal' | 'vertical';
|
|
129
129
|
position: number;
|
|
130
130
|
}
|
|
131
|
+
/** Floor overlay zone (not tied to walls). Independent of heatmap. */
|
|
132
|
+
export type ZoneShape = 'rectangle' | 'triangle' | 'polygon';
|
|
133
|
+
export interface Zone {
|
|
134
|
+
id: string;
|
|
135
|
+
name: string;
|
|
136
|
+
shape: ZoneShape;
|
|
137
|
+
/** Closed polygon vertices (first point not repeated). */
|
|
138
|
+
points: Point[];
|
|
139
|
+
/** Stroke + label color (hex). */
|
|
140
|
+
color: string;
|
|
141
|
+
/** Soft fill alpha inside polygon. Default ~0.1 */
|
|
142
|
+
fillOpacity?: number;
|
|
143
|
+
}
|
|
131
144
|
export interface BackgroundImage {
|
|
132
145
|
dataUrl: string;
|
|
133
146
|
position: Point;
|
|
@@ -152,6 +165,7 @@ export interface Floor {
|
|
|
152
165
|
measurements: Measurement[];
|
|
153
166
|
annotations: Annotation[];
|
|
154
167
|
textAnnotations: TextAnnotation[];
|
|
168
|
+
zones?: Zone[];
|
|
155
169
|
groups: ElementGroup[];
|
|
156
170
|
}
|
|
157
171
|
export interface Project {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Floor, Project } from '../../lib/models/types';
|
|
2
|
+
import { HeatmapColorScale } from '../../lib/utils/heatmapColorScale';
|
|
3
|
+
export type { HeatmapColorLevel, HeatmapColorScale, } from '../../lib/utils/heatmapColorScale';
|
|
2
4
|
/** Camera from host app — used to assign floor camera furniture via select. */
|
|
3
5
|
export interface SiteCameraOption {
|
|
4
6
|
serial: string;
|
|
@@ -24,6 +26,11 @@ export interface FloorEditorConfig {
|
|
|
24
26
|
floorMaxHeight: number;
|
|
25
27
|
heatmapEnabled: boolean;
|
|
26
28
|
heatmapMatrix: number[][];
|
|
29
|
+
/**
|
|
30
|
+
* Floor heatmap color scale from host.
|
|
31
|
+
* `gradient` (default) or `levels` with host-defined N bands — see docs/heatmap-host-standard.md §8.
|
|
32
|
+
*/
|
|
33
|
+
heatmapColorScale?: HeatmapColorScale;
|
|
27
34
|
projectName?: string;
|
|
28
35
|
selectedCameraSerial?: string | null;
|
|
29
36
|
showCameraCones?: boolean;
|
|
@@ -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,11 @@ export declare function moveTextAnnotation(id: string, position: {
|
|
|
142
144
|
x: number;
|
|
143
145
|
y: number;
|
|
144
146
|
}): void;
|
|
147
|
+
export declare function addZone(shape: ZoneShape, points: Point[], name?: string, color?: string): string;
|
|
148
|
+
export declare function updateZone(id: string, updates: Partial<Pick<Zone, 'name' | 'color' | 'fillOpacity' | 'points' | 'shape'>>): void;
|
|
149
|
+
/** Live drag without undo snapshot (commit with updateZone / endUndoGroup). */
|
|
150
|
+
export declare function moveZonePoints(id: string, points: Point[]): void;
|
|
151
|
+
export declare function removeZone(id: string): void;
|
|
145
152
|
export declare const layerVisibility: import('svelte/store').Writable<{
|
|
146
153
|
walls: boolean;
|
|
147
154
|
doors: boolean;
|
|
@@ -152,6 +159,7 @@ export declare const layerVisibility: import('svelte/store').Writable<{
|
|
|
152
159
|
guides: boolean;
|
|
153
160
|
measurements: boolean;
|
|
154
161
|
annotations: boolean;
|
|
162
|
+
zones: boolean;
|
|
155
163
|
}>;
|
|
156
164
|
export declare function toggleFurnitureLock(id: string): void;
|
|
157
165
|
export declare function setFurnitureLocked(id: string, locked: boolean): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
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
|
+
import { HeatmapColorScale } from '../../../lib/utils/heatmapColorScale';
|
|
4
5
|
export declare function wallLength(w: Wall): number;
|
|
5
6
|
export declare function wallPointAt(w: Wall, t: number): Point;
|
|
6
7
|
export declare function wallTangentAt(w: Wall, t: number): Point;
|
|
@@ -33,6 +34,10 @@ export declare function drawColumn(cs: CanvasState, col: Column, selected: boole
|
|
|
33
34
|
export declare function drawGuides(cs: CanvasState, floor: Floor, selectedGuideId: string | null, RULER_SIZE: number): void;
|
|
34
35
|
export declare function drawPersistedMeasurements(cs: CanvasState, floor: Floor, selectedMeasurementId: string | null, dimSettings: ProjectSettings): void;
|
|
35
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;
|
|
36
41
|
export declare function drawAnnotation(cs: CanvasState, a: Annotation, selected: boolean, dimSettings: ProjectSettings): void;
|
|
37
42
|
export declare function drawAnnotations(cs: CanvasState, floor: Floor, selectedAnnotationId: string | null, dimSettings: ProjectSettings): void;
|
|
38
43
|
export declare function getRoomFill(room: Room, index: number): string;
|
|
@@ -49,4 +54,4 @@ export declare function drawMinimap(cs: CanvasState, minimapCanvas: HTMLCanvasEl
|
|
|
49
54
|
maxX: number;
|
|
50
55
|
maxY: number;
|
|
51
56
|
} | null): void;
|
|
52
|
-
export declare function drawFloorHeatmap(cs: CanvasState, floor: Floor, heatmapMatrix: number[][], detectedRooms: Room[]): void;
|
|
57
|
+
export declare function drawFloorHeatmap(cs: CanvasState, floor: Floor, heatmapMatrix: number[][], detectedRooms: Room[], colorScale?: HeatmapColorScale | null): void;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** Host-defined discrete heatmap band. */
|
|
2
|
+
export interface HeatmapColorLevel {
|
|
3
|
+
/** Inclusive lower bound for this band (see resolve rules). */
|
|
4
|
+
min: number;
|
|
5
|
+
/** Optional inclusive upper bound; if every level has max, use closed ranges. */
|
|
6
|
+
max?: number;
|
|
7
|
+
/** CSS color (hex / rgb / rgba). */
|
|
8
|
+
color: string;
|
|
9
|
+
/** Legend label — metadata for host; unused when drawing. */
|
|
10
|
+
label?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Floor heatmap color scale from host config.
|
|
14
|
+
* - `gradient`: value / max(matrix) → built-in continuous palette
|
|
15
|
+
* - `levels`: absolute thresholds + host colors (N bands, host-defined)
|
|
16
|
+
*/
|
|
17
|
+
export interface HeatmapColorScale {
|
|
18
|
+
mode: "gradient" | "levels";
|
|
19
|
+
levels?: HeatmapColorLevel[];
|
|
20
|
+
/** Cells with value <= hideBelow are not drawn. Default 0. */
|
|
21
|
+
hideBelow?: number;
|
|
22
|
+
}
|
|
23
|
+
export declare function normalizeHeatmapColorScale(value: unknown): HeatmapColorScale | undefined;
|
|
24
|
+
/** Fingerprint for heatmap offscreen cache invalidation. */
|
|
25
|
+
export declare function getHeatmapColorScaleKey(scale: HeatmapColorScale | null | undefined): string;
|
|
26
|
+
export declare function colorWithAlpha(color: string, alpha: number): string;
|
|
27
|
+
/**
|
|
28
|
+
* Resolve discrete band color for a cell value.
|
|
29
|
+
* @returns null → do not draw
|
|
30
|
+
*/
|
|
31
|
+
export declare function resolveHeatmapLevelColor(value: number, scale: HeatmapColorScale): {
|
|
32
|
+
color: string;
|
|
33
|
+
levelIndex: number;
|
|
34
|
+
levelCount: number;
|
|
35
|
+
} | null;
|
|
36
|
+
export declare function isLevelsColorScale(scale: HeatmapColorScale | null | undefined): scale is HeatmapColorScale & {
|
|
37
|
+
mode: "levels";
|
|
38
|
+
levels: HeatmapColorLevel[];
|
|
39
|
+
};
|
|
@@ -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,22 @@
|
|
|
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
|
+
export declare function rectPoints(x1: number, y1: number, x2: number, y2: number): Point[];
|
|
8
|
+
/** Isosceles triangle pointing up, centered at `c`. */
|
|
9
|
+
export declare function trianglePoints(c: Point, size?: number): Point[];
|
|
10
|
+
export declare function defaultRectAt(c: Point, size?: number): Point[];
|
|
11
|
+
export declare function zoneBounds(points: Point[]): {
|
|
12
|
+
minX: number;
|
|
13
|
+
minY: number;
|
|
14
|
+
maxX: number;
|
|
15
|
+
maxY: number;
|
|
16
|
+
} | null;
|
|
17
|
+
export declare function translatePoints(points: Point[], dx: number, dy: number): Point[];
|
|
18
|
+
/** Axis-aligned resize: keep opposite corner fixed when dragging corner index. */
|
|
19
|
+
export declare function resizeRectCorner(points: Point[], cornerIndex: number, to: Point): Point[];
|
|
20
|
+
export declare function isNearPoint(a: Point, b: Point, threshold: number): boolean;
|
|
21
|
+
export declare function ensureZoneDefaults(zone: Zone): Zone;
|
|
22
|
+
export declare function createZoneDraft(shape: ZoneShape, points: Point[], name: string, color: string): Omit<Zone, "id">;
|