the editable site (validation-lab)

This commit is contained in:
kpgarrod committed 2026-11-21 08:03:55 +01:00
commit 3ac81d5a52
13454 files changed
+2227005

No files matched your search

@@ -0,0 +1,27 @@
import { Position } from "geojson";
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
import { FeatureId } from "../../../store/store";
import { ReadFeatureBehavior } from "../../read-feature.behavior";
import { MutateFeatureBehavior } from "../../mutate-feature.behavior";
export declare class CoordinatePointBehavior extends TerraDrawModeBehavior {
private readonly readFeature;
private readonly mutateFeature;
constructor(config: BehaviorConfig, readFeature: ReadFeatureBehavior, mutateFeature: MutateFeatureBehavior);
setEnabled(enabled: boolean): void;
createOrUpdate({ featureId, featureCoordinates, }: {
featureId: FeatureId;
featureCoordinates: Position[] | Position[][];
}): void;
deletePointsByFeatureIds(features: FeatureId[]): void;
updateOneAtIndex(featureId: FeatureId, index: number, updatedCoordinate: Position): void;
updateAllInPlace({ featureId, featureCoordinates, }: {
featureId: FeatureId;
featureCoordinates: Position[] | Position[][];
}): void;
private createPoints;
private syncCurrentlyDrawing;
private setFeatureCoordinatePoints;
private deleteCoordinatePoints;
private deleteIfPresent;
private deleteOrphanedPoints;
}
@@ -0,0 +1 @@
export {};
@@ -0,0 +1,71 @@
import { TerraDrawMouseEvent } from "../../../common";
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
import { PixelDistanceBehavior } from "../../pixel-distance.behavior";
import { MidPointBehavior } from "./midpoint.behavior";
import { SelectionPointBehavior } from "./selection-point.behavior";
import { FeatureId } from "../../../store/store";
import { CoordinatePointBehavior } from "./coordinate-point.behavior";
import { ReadFeatureBehavior } from "../../read-feature.behavior";
import { MutateFeatureBehavior } from "../../mutate-feature.behavior";
export type ResizeOptions = "center" | "opposite" | "center-fixed" | "opposite-fixed";
export declare class DragCoordinateResizeBehavior extends TerraDrawModeBehavior {
readonly config: BehaviorConfig;
private readonly pixelDistance;
private readonly selectionPoints;
private readonly midPoints;
private readonly coordinatePoints;
private readonly readFeature;
private readonly mutateFeature;
constructor(config: BehaviorConfig, pixelDistance: PixelDistanceBehavior, selectionPoints: SelectionPointBehavior, midPoints: MidPointBehavior, coordinatePoints: CoordinatePointBehavior, readFeature: ReadFeatureBehavior, mutateFeature: MutateFeatureBehavior);
private minimumScale;
private draggedCoordinate;
private centerOrigin;
private oppositeOrigin;
private oppositeClosestBBoxIndex;
private boundingBoxMaps;
private getClosestCoordinate;
private isValidDragWebMercator;
private getSelectedFeatureDataWebMercator;
private centerWebMercatorDrag;
private centerFixedWebMercatorDrag;
private scaleFixedWebMercator;
private oppositeFixedWebMercatorDrag;
private oppositeWebMercatorDrag;
private scaleWebMercator;
private getFeature;
private getNormalisedCoordinates;
private validateScale;
private performWebMercatorScale;
private getBBoxWebMercator;
private getIndexesWebMercator;
/**
* @returns - true if the feature is being dragged (resized), false otherwise
*/
isDragging(): boolean;
/**
* Starts the resizing of the feature
* @param id - feature id of the feature that is being dragged
* @param index - index of the coordinate that is being dragged
* @returns - void
*/
startDragging(id: FeatureId, index: number): void;
/**
* Stops the resizing of the feature
* @returns - void *
*/
stopDragging(): void;
/**
* Returns the index of the coordinate that is going to be dragged
* @param event - cursor event
* @param selectedId - feature id of the feature that is selected
* @returns - the index to be dragged
*/
getDraggableIndex(event: TerraDrawMouseEvent, selectedId: FeatureId): number;
/**
* Resizes the feature based on the cursor event
* @param event - cursor event
* @param resizeOption - the resize option, either "center" or "opposite"
* @returns - true is resize was successful, false otherwise
*/
drag(event: TerraDrawMouseEvent, resizeOption: ResizeOptions): boolean;
}
@@ -0,0 +1 @@
export {};
@@ -0,0 +1,37 @@
import { Snapping, TerraDrawMouseEvent } from "../../../common";
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
import { PixelDistanceBehavior } from "../../pixel-distance.behavior";
import { MidPointBehavior } from "./midpoint.behavior";
import { SelectionPointBehavior } from "./selection-point.behavior";
import { FeatureId } from "../../../store/store";
import { CoordinatePointBehavior } from "./coordinate-point.behavior";
import { CoordinateSnappingBehavior } from "../../coordinate-snapping.behavior";
import { LineSnappingBehavior } from "../../line-snapping.behavior";
import { ReadFeatureBehavior } from "../../read-feature.behavior";
import { MutateFeatureBehavior } from "../../mutate-feature.behavior";
export declare class DragCoordinateBehavior extends TerraDrawModeBehavior {
readonly config: BehaviorConfig;
private readonly pixelDistance;
private readonly selectionPoints;
private readonly midPoints;
private readonly coordinatePoints;
private readonly coordinateSnapping;
private readonly lineSnapping;
private readonly readFeature;
private readonly mutateFeature;
private readonly featureSnapping;
constructor(config: BehaviorConfig, pixelDistance: PixelDistanceBehavior, selectionPoints: SelectionPointBehavior, midPoints: MidPointBehavior, coordinatePoints: CoordinatePointBehavior, coordinateSnapping: CoordinateSnappingBehavior, lineSnapping: LineSnappingBehavior, readFeature: ReadFeatureBehavior, mutateFeature: MutateFeatureBehavior);
private draggedCoordinate;
private getClosestCoordinate;
getDraggable(event: TerraDrawMouseEvent, selectedId: FeatureId): {
dist: number;
index: number;
isFirstOrLastPolygonCoord: boolean;
};
getDraggableIndex(event: TerraDrawMouseEvent, selectedId: FeatureId): number;
private snapCoordinate;
drag(event: TerraDrawMouseEvent, allowSelfIntersection: boolean, snapping: Snapping): boolean;
isDragging(): boolean;
startDragging(id: FeatureId, index: number): void;
stopDragging(): void;
}
@@ -0,0 +1 @@
export {};
@@ -0,0 +1,26 @@
import { TerraDrawMouseEvent } from "../../../common";
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
import { FeatureAtPointerEventBehavior } from "./feature-at-pointer-event.behavior";
import { SelectionPointBehavior } from "./selection-point.behavior";
import { MidPointBehavior } from "./midpoint.behavior";
import { FeatureId } from "../../../store/store";
import { CoordinatePointBehavior } from "./coordinate-point.behavior";
import { ReadFeatureBehavior } from "../../read-feature.behavior";
import { MutateFeatureBehavior } from "../../mutate-feature.behavior";
export declare class DragFeatureBehavior extends TerraDrawModeBehavior {
readonly config: BehaviorConfig;
private readonly featuresAtCursorEvent;
private readonly selectionPoints;
private readonly midPoints;
private readonly coordinatePoints;
private readonly readFeature;
private readonly mutateFeature;
constructor(config: BehaviorConfig, featuresAtCursorEvent: FeatureAtPointerEventBehavior, selectionPoints: SelectionPointBehavior, midPoints: MidPointBehavior, coordinatePoints: CoordinatePointBehavior, readFeature: ReadFeatureBehavior, mutateFeature: MutateFeatureBehavior);
private draggedFeatureId;
private dragPosition;
startDragging(event: TerraDrawMouseEvent, id: FeatureId): void;
stopDragging(): void;
isDragging(): boolean;
canDrag(event: TerraDrawMouseEvent, selectedId: FeatureId): boolean;
drag(event: TerraDrawMouseEvent): false | undefined;
}
@@ -0,0 +1 @@
export {};
@@ -0,0 +1,14 @@
import { TerraDrawMouseEvent } from "../../../common";
import { GeoJSONStoreFeatures } from "../../../store/store";
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
import { ClickBoundingBoxBehavior } from "../../click-bounding-box.behavior";
import { PixelDistanceBehavior } from "../../pixel-distance.behavior";
export declare class FeatureAtPointerEventBehavior extends TerraDrawModeBehavior {
readonly config: BehaviorConfig;
private readonly createClickBoundingBox;
private readonly pixelDistance;
constructor(config: BehaviorConfig, createClickBoundingBox: ClickBoundingBoxBehavior, pixelDistance: PixelDistanceBehavior);
find(event: TerraDrawMouseEvent, hasSelection: boolean): {
clickedFeature: GeoJSONStoreFeatures | undefined;
};
}
@@ -0,0 +1 @@
export {};
@@ -0,0 +1,36 @@
import { Position } from "geojson";
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
import { SelectionPointBehavior } from "./selection-point.behavior";
import { TerraDrawMouseEvent } from "../../../common";
import { FeatureId } from "../../../store/store";
import { CoordinatePointBehavior } from "./coordinate-point.behavior";
import { MutateFeatureBehavior } from "../../mutate-feature.behavior";
import { ReadFeatureBehavior } from "../../read-feature.behavior";
import { PixelDistanceBehavior } from "../../pixel-distance.behavior";
export declare class MidPointBehavior extends TerraDrawModeBehavior {
readonly config: BehaviorConfig;
private readonly selectionPointBehavior;
private readonly coordinatePointBehavior;
private readonly mutateFeature;
private readonly readFeature;
private readonly pixelDistance;
constructor(config: BehaviorConfig, selectionPointBehavior: SelectionPointBehavior, coordinatePointBehavior: CoordinatePointBehavior, mutateFeature: MutateFeatureBehavior, readFeature: ReadFeatureBehavior, pixelDistance: PixelDistanceBehavior);
private _midPoints;
private getMidpointConfig;
get ids(): FeatureId[];
set ids(_: FeatureId[]);
getNearestMidPoint(event: TerraDrawMouseEvent): undefined;
insert({ featureId, midPointId, }: {
featureId: FeatureId;
midPointId: FeatureId;
}): void;
create({ featureCoordinates, featureId, }: {
featureCoordinates: Position[] | Position[][];
featureId: FeatureId;
}): void;
delete(): void;
updateAllInPlace({ featureCoordinates, }: {
featureCoordinates: Position[] | Position[][];
}): undefined;
updateOneAtIndex(index: number, featureCoordinates: Position[] | Position[][]): undefined;
}
@@ -0,0 +1 @@
export {};
@@ -0,0 +1,23 @@
import { TerraDrawMouseEvent } from "../../../common";
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
import { SelectionPointBehavior } from "./selection-point.behavior";
import { MidPointBehavior } from "./midpoint.behavior";
import { FeatureId } from "../../../store/store";
import { CoordinatePointBehavior } from "./coordinate-point.behavior";
import { ReadFeatureBehavior } from "../../read-feature.behavior";
import { MutateFeatureBehavior } from "../../mutate-feature.behavior";
export declare class RotateFeatureBehavior extends TerraDrawModeBehavior {
readonly config: BehaviorConfig;
private readonly selectionPoints;
private readonly midPoints;
private readonly coordinatePoints;
private readonly readFeature;
private readonly mutateFeature;
constructor(config: BehaviorConfig, selectionPoints: SelectionPointBehavior, midPoints: MidPointBehavior, coordinatePoints: CoordinatePointBehavior, readFeature: ReadFeatureBehavior, mutateFeature: MutateFeatureBehavior);
private lastBearing;
private selectedGeometry;
private selectedGeometryCentroid;
private selectedGeometryWebMercatorCentroid;
reset(): void;
rotate(event: TerraDrawMouseEvent, selectedId: FeatureId): false | undefined;
}
@@ -0,0 +1 @@
export {};
@@ -0,0 +1,11 @@
import { TerraDrawMouseEvent } from "../../../common";
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
import { FeatureId } from "../../../store/store";
import { DragCoordinateResizeBehavior } from "./drag-coordinate-resize.behavior";
export declare class ScaleFeatureBehavior extends TerraDrawModeBehavior {
readonly config: BehaviorConfig;
private readonly dragCoordinateResizeBehavior;
constructor(config: BehaviorConfig, dragCoordinateResizeBehavior: DragCoordinateResizeBehavior);
scale(event: TerraDrawMouseEvent, featureId: FeatureId): void;
reset(): void;
}
@@ -0,0 +1 @@
export {};
@@ -0,0 +1,27 @@
import { Position } from "geojson";
import { BehaviorConfig, TerraDrawModeBehavior } from "../../base.behavior";
import { FeatureId } from "../../../store/store";
import { SELECT_PROPERTIES } from "../../../common";
import { MutateFeatureBehavior } from "../../mutate-feature.behavior";
export type SelectionPointProperties = {
mode: string;
index: number;
[SELECT_PROPERTIES.SELECTION_POINT_FEATURE_ID]: string;
[SELECT_PROPERTIES.SELECTION_POINT]: true;
};
export declare class SelectionPointBehavior extends TerraDrawModeBehavior {
constructor(config: BehaviorConfig, mutateFeatureBehavior: MutateFeatureBehavior);
private mutateFeature;
private _selectionPoints;
get ids(): FeatureId[];
set ids(_: FeatureId[]);
create({ featureId, featureCoordinates, }: {
featureId: FeatureId;
featureCoordinates: Position[] | Position[][];
}): void;
delete(): void;
updateAllInPlace({ featureCoordinates, }: {
featureCoordinates: Position[] | Position[][];
}): void;
updateOneAtIndex(index: number, updatedCoordinate: Position): void;
}
@@ -0,0 +1 @@
export {};