the editable site (validation-lab)
This commit is contained in:
commit
3ac81d5a52
13454 files changed
+2227005
No files matched your search
+75
@@ -0,0 +1,75 @@
|
||||
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor } from "../../common";
|
||||
import { TerraDrawBaseDrawMode, BaseModeOptions, CustomStyling, ModeUpdateOptions } from "../base.mode";
|
||||
import { GeoJSONStoreFeatures, StoreValidation } from "../../store/store";
|
||||
import { BehaviorConfig } from "../base.behavior";
|
||||
type TerraDrawPolygonModeKeyEvents = {
|
||||
cancel?: KeyboardEvent["key"] | null;
|
||||
finish?: KeyboardEvent["key"] | null;
|
||||
};
|
||||
type PolygonStyling = {
|
||||
fillColor: HexColorStyling;
|
||||
fillOpacity: NumericStyling;
|
||||
outlineColor: HexColorStyling;
|
||||
outlineOpacity: NumericStyling;
|
||||
outlineWidth: NumericStyling;
|
||||
coordinatePointWidth: NumericStyling;
|
||||
coordinatePointColor: HexColorStyling;
|
||||
coordinatePointOpacity: NumericStyling;
|
||||
coordinatePointOutlineWidth: NumericStyling;
|
||||
coordinatePointOutlineColor: HexColorStyling;
|
||||
coordinatePointOutlineOpacity: NumericStyling;
|
||||
};
|
||||
interface Cursors {
|
||||
start?: Cursor;
|
||||
close?: Cursor;
|
||||
}
|
||||
interface TerraDrawAngledRectangleModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
||||
pointerDistance?: number;
|
||||
keyEvents?: TerraDrawPolygonModeKeyEvents | null;
|
||||
cursors?: Cursors;
|
||||
showCoordinatePoints?: boolean;
|
||||
}
|
||||
export declare class TerraDrawAngledRectangleMode extends TerraDrawBaseDrawMode<PolygonStyling> {
|
||||
mode: string;
|
||||
private currentCoordinate;
|
||||
private currentId;
|
||||
private keyEvents;
|
||||
private cursors;
|
||||
private mouseMove;
|
||||
private showCoordinatePoints;
|
||||
private mutateFeature;
|
||||
private readFeature;
|
||||
private coordinatePoints;
|
||||
constructor(options?: TerraDrawAngledRectangleModeOptions<PolygonStyling>);
|
||||
updateOptions(options?: ModeUpdateOptions<TerraDrawAngledRectangleModeOptions<PolygonStyling>>): void;
|
||||
private close;
|
||||
/** @internal */
|
||||
start(): void;
|
||||
/** @internal */
|
||||
stop(): void;
|
||||
/** @internal */
|
||||
onMouseMove(event: TerraDrawMouseEvent): void;
|
||||
private getUpdateForSecondCoordinate;
|
||||
private getNewSecondAndThirdCoordinates;
|
||||
/** @internal */
|
||||
onClick(event: TerraDrawMouseEvent): void;
|
||||
/** @internal */
|
||||
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
||||
/** @internal */
|
||||
onKeyDown(): void;
|
||||
/** @internal */
|
||||
onDragStart(): void;
|
||||
/** @internal */
|
||||
onDrag(): void;
|
||||
/** @internal */
|
||||
onDragEnd(): void;
|
||||
/** @internal */
|
||||
cleanUp(): void;
|
||||
/** @internal */
|
||||
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
||||
validateFeature(feature: unknown): StoreValidation;
|
||||
afterFeatureUpdated(feature: GeoJSONStoreFeatures): void;
|
||||
afterFeatureAdded(feature: GeoJSONStoreFeatures): void;
|
||||
registerBehaviors(config: BehaviorConfig): void;
|
||||
}
|
||||
export {};
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
import { Project, Projection, TerraDrawGeoJSONStore, Unproject } from "../common";
|
||||
export type BehaviorConfig = {
|
||||
store: TerraDrawGeoJSONStore;
|
||||
mode: string;
|
||||
project: Project;
|
||||
unproject: Unproject;
|
||||
pointerDistance: number;
|
||||
coordinatePrecision: number;
|
||||
projection: Projection;
|
||||
undoRedoMaxStackSize?: number;
|
||||
};
|
||||
export declare class TerraDrawModeBehavior {
|
||||
protected store: TerraDrawGeoJSONStore;
|
||||
protected mode: string;
|
||||
protected project: Project;
|
||||
protected unproject: Unproject;
|
||||
protected pointerDistance: number;
|
||||
protected coordinatePrecision: number;
|
||||
protected projection: Projection;
|
||||
protected undoRedoMaxStackSize?: number;
|
||||
constructor({ store, mode, project, unproject, pointerDistance, coordinatePrecision, projection, undoRedoMaxStackSize, }: BehaviorConfig);
|
||||
}
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
|
||||
import { TerraDrawOnChangeContext, HexColor, OnFinishContext, Projection, TerraDrawAdapterStyling, TerraDrawGeoJSONStore, TerraDrawKeyboardEvent, TerraDrawModeRegisterConfig, TerraDrawModeState, TerraDrawMouseEvent, Validation, HexColorStyling, NumericStyling, UrlStyling, DashArrayStyling, MarkerAnchorStyling } from "../common";
|
||||
import { FeatureId, GeoJSONStoreFeatures, StoreChangeHandler } from "../store/store";
|
||||
export type CustomStyling = Record<string, string | number | HexColorStyling | NumericStyling | UrlStyling | DashArrayStyling | MarkerAnchorStyling>;
|
||||
export declare enum ModeTypes {
|
||||
Drawing = "drawing",
|
||||
Select = "select",
|
||||
Static = "static",
|
||||
Render = "render"
|
||||
}
|
||||
export declare const DefaultPointerEvents: {
|
||||
readonly rightClick: true;
|
||||
readonly contextMenu: false;
|
||||
readonly leftClick: true;
|
||||
readonly onDragStart: true;
|
||||
readonly onDrag: true;
|
||||
readonly onDragEnd: true;
|
||||
};
|
||||
type AllowPointerEvent = boolean | ((event: TerraDrawMouseEvent) => boolean);
|
||||
export type ModeUpdateOptions<Mode> = Omit<Mode, "modeName">;
|
||||
export interface PointerEvents {
|
||||
leftClick: AllowPointerEvent;
|
||||
rightClick: AllowPointerEvent;
|
||||
contextMenu: AllowPointerEvent;
|
||||
onDragStart: AllowPointerEvent;
|
||||
onDrag: AllowPointerEvent;
|
||||
onDragEnd: AllowPointerEvent;
|
||||
}
|
||||
export type BaseModeOptions<Styling extends CustomStyling> = {
|
||||
modeName?: string;
|
||||
styles?: Partial<Styling>;
|
||||
pointerDistance?: number;
|
||||
validation?: Validation;
|
||||
projection?: Projection;
|
||||
pointerEvents?: PointerEvents;
|
||||
};
|
||||
export declare abstract class TerraDrawBaseDrawMode<Styling extends CustomStyling> {
|
||||
protected _state: TerraDrawModeState;
|
||||
get state(): TerraDrawModeState;
|
||||
set state(_: TerraDrawModeState);
|
||||
protected _styles: Partial<Styling>;
|
||||
get styles(): Partial<Styling>;
|
||||
set styles(styling: Partial<Styling>);
|
||||
protected pointerEvents: PointerEvents;
|
||||
protected behaviors: TerraDrawModeBehavior[];
|
||||
protected validate: Validation | undefined;
|
||||
protected pointerDistance: number;
|
||||
protected coordinatePrecision: number;
|
||||
protected undoRedoMaxStackSize?: number;
|
||||
protected onStyleChange: StoreChangeHandler<TerraDrawOnChangeContext | undefined>;
|
||||
protected store: TerraDrawGeoJSONStore;
|
||||
protected projection: Projection;
|
||||
protected setDoubleClickToZoom: TerraDrawModeRegisterConfig["setDoubleClickToZoom"];
|
||||
protected unproject: TerraDrawModeRegisterConfig["unproject"];
|
||||
protected project: TerraDrawModeRegisterConfig["project"];
|
||||
protected setCursor: TerraDrawModeRegisterConfig["setCursor"];
|
||||
protected registerBehaviors(_behaviorConfig: BehaviorConfig): void;
|
||||
private isInitialUpdate;
|
||||
constructor(options?: BaseModeOptions<Styling>, willCallUpdateOptionsInParentClass?: boolean);
|
||||
updateOptions(options?: BaseModeOptions<Styling>): void;
|
||||
protected allowPointerEvent(pointerEvent: AllowPointerEvent, event: TerraDrawMouseEvent): boolean;
|
||||
type: ModeTypes;
|
||||
mode: string;
|
||||
protected setDrawing(): void;
|
||||
protected setStarted(): void;
|
||||
protected setStopped(): void;
|
||||
register(config: TerraDrawModeRegisterConfig): void;
|
||||
validateFeature(feature: unknown): ReturnType<Validation>;
|
||||
afterFeatureAdded(_feature: GeoJSONStoreFeatures): void;
|
||||
afterFeatureUpdated(_feature: GeoJSONStoreFeatures): void;
|
||||
private performFeatureValidation;
|
||||
protected validateModeFeature(feature: unknown, modeValidationFn: (feature: GeoJSONStoreFeatures) => ReturnType<Validation>): ReturnType<Validation>;
|
||||
abstract start(): void;
|
||||
abstract stop(): void;
|
||||
abstract cleanUp(): void;
|
||||
abstract styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
||||
onFinish(_finishedId: FeatureId, _context: OnFinishContext): void;
|
||||
onDeselect(_deselectedId: FeatureId): void;
|
||||
onSelect(_selectedId: FeatureId): void;
|
||||
onKeyDown(_event: TerraDrawKeyboardEvent): void;
|
||||
onKeyUp(_event: TerraDrawKeyboardEvent): void;
|
||||
undo(): void;
|
||||
clearHistory(): void;
|
||||
undoSize(): number;
|
||||
redoSize(): number;
|
||||
redo(): void;
|
||||
onMouseMove(_event: TerraDrawMouseEvent): void;
|
||||
onClick(_event: TerraDrawMouseEvent): void;
|
||||
onDragStart(_event: TerraDrawMouseEvent, _setMapDraggability: (enabled: boolean) => void): void;
|
||||
onDrag(_event: TerraDrawMouseEvent, _setMapDraggability: (enabled: boolean) => void): void;
|
||||
onDragEnd(_event: TerraDrawMouseEvent, _setMapDraggability: (enabled: boolean) => void): void;
|
||||
protected getHexColorStylingValue(value: HexColor | ((feature: GeoJSONStoreFeatures) => HexColor | undefined) | undefined, defaultValue: HexColor, feature: GeoJSONStoreFeatures): HexColor;
|
||||
protected getNumericStylingValue(value: number | ((feature: GeoJSONStoreFeatures) => number | undefined) | undefined, defaultValue: number, feature: GeoJSONStoreFeatures): number;
|
||||
protected getUrlStylingValue(value: UrlStyling | undefined, defaultValue: string, feature: GeoJSONStoreFeatures): string;
|
||||
protected getMarkerAnchorStylingValue(value: MarkerAnchorStyling | undefined, defaultValue: NonNullable<TerraDrawAdapterStyling["markerAnchor"]>, feature: GeoJSONStoreFeatures): NonNullable<TerraDrawAdapterStyling["markerAnchor"]>;
|
||||
protected getDashArrayStylingValue(value: [number, number] | ((feature: GeoJSONStoreFeatures) => [number, number] | undefined) | undefined, defaultValue: [number, number] | undefined, feature: GeoJSONStoreFeatures): [number, number] | undefined;
|
||||
private getStylingValue;
|
||||
}
|
||||
export declare abstract class TerraDrawBaseSelectMode<Styling extends CustomStyling> extends TerraDrawBaseDrawMode<Styling> {
|
||||
type: ModeTypes;
|
||||
abstract selectFeature(featureId: FeatureId): void;
|
||||
abstract deselectFeature(featureId: FeatureId): void;
|
||||
}
|
||||
export {};
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor, Projection, DrawInteractions, OneDimensionalSnapping } from "../../common";
|
||||
import { GeoJSONStoreFeatures, StoreValidation } from "../../store/store";
|
||||
import { BaseModeOptions, CustomStyling, ModeUpdateOptions, TerraDrawBaseDrawMode } from "../base.mode";
|
||||
import { BehaviorConfig } from "../base.behavior";
|
||||
type TerraDrawCircleModeKeyEvents = {
|
||||
cancel: KeyboardEvent["key"] | null;
|
||||
finish: KeyboardEvent["key"] | null;
|
||||
};
|
||||
type CirclePolygonStyling = {
|
||||
fillColor: HexColorStyling;
|
||||
fillOpacity: NumericStyling;
|
||||
outlineColor: HexColorStyling;
|
||||
outlineWidth: NumericStyling;
|
||||
outlineOpacity: NumericStyling;
|
||||
coordinatePointWidth: NumericStyling;
|
||||
coordinatePointColor: HexColorStyling;
|
||||
coordinatePointOpacity: NumericStyling;
|
||||
coordinatePointOutlineWidth: NumericStyling;
|
||||
coordinatePointOutlineColor: HexColorStyling;
|
||||
coordinatePointOutlineOpacity: NumericStyling;
|
||||
snappingPointColor: HexColorStyling;
|
||||
snappingPointWidth: NumericStyling;
|
||||
snappingPointOpacity: NumericStyling;
|
||||
snappingPointOutlineColor: HexColorStyling;
|
||||
snappingPointOutlineWidth: NumericStyling;
|
||||
snappingPointOutlineOpacity: NumericStyling;
|
||||
};
|
||||
interface Cursors {
|
||||
start?: Cursor;
|
||||
}
|
||||
interface TerraDrawCircleModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
||||
keyEvents?: TerraDrawCircleModeKeyEvents | null;
|
||||
cursors?: Cursors;
|
||||
startingRadiusKilometers?: number;
|
||||
projection?: Projection;
|
||||
drawInteraction?: DrawInteractions;
|
||||
segments?: number;
|
||||
showCoordinatePoints?: boolean;
|
||||
snapping?: OneDimensionalSnapping;
|
||||
}
|
||||
export declare class TerraDrawCircleMode extends TerraDrawBaseDrawMode<CirclePolygonStyling> {
|
||||
mode: string;
|
||||
private center;
|
||||
private endPosition;
|
||||
private segments;
|
||||
private currentCircleId;
|
||||
private keyEvents;
|
||||
private cursors;
|
||||
private startingRadiusKilometers;
|
||||
private cursorMovedAfterInitialCursorDown;
|
||||
private drawInteraction;
|
||||
private drawType;
|
||||
private cancelled;
|
||||
private minimumSegments;
|
||||
private showCoordinatePoints;
|
||||
private snapping;
|
||||
private snappedPointId;
|
||||
private readFeature;
|
||||
private coordinatePoints;
|
||||
private mutateFeature;
|
||||
private pixelDistance;
|
||||
private clickBoundingBox;
|
||||
private coordinateSnapping;
|
||||
private lineSnapping;
|
||||
private featureSnapping;
|
||||
/**
|
||||
* Create a new circle mode instance
|
||||
* @param options - Options to customize the behavior of the circle mode
|
||||
* @param options.keyEvents - Key events to cancel or finish the mode
|
||||
* @param options.cursors - Cursors to use for the mode
|
||||
* @param options.styles - Custom styling for the circle
|
||||
* @param options.pointerDistance - Distance in pixels to consider a pointer close to a vertex
|
||||
* @param options.startingRadiusKilometers - The starting radius of the circle in kilometers
|
||||
* @param options.projection - The map projection being used
|
||||
* @param options.showCoordinatePoints - Render a point at each circle vertex
|
||||
* @param options.drawInteraction - The type of draw interaction to use
|
||||
* @param options.snapping - Snapping options applied to the circle center coordinate
|
||||
*
|
||||
*/
|
||||
constructor(options?: TerraDrawCircleModeOptions<CirclePolygonStyling>);
|
||||
updateOptions(options?: ModeUpdateOptions<TerraDrawCircleModeOptions<CirclePolygonStyling>>): void;
|
||||
private close;
|
||||
private beginDrawing;
|
||||
private dragDrawAllowed;
|
||||
private moveDrawAllowed;
|
||||
/** @internal */
|
||||
start(): void;
|
||||
/** @internal */
|
||||
stop(): void;
|
||||
/** @internal */
|
||||
onClick(event: TerraDrawMouseEvent): void;
|
||||
/** @internal */
|
||||
onMouseMove(event: TerraDrawMouseEvent): void;
|
||||
private updateSnappedCoordinate;
|
||||
private deleteSnappedPoint;
|
||||
private getSnappedCoordinate;
|
||||
/** @internal */
|
||||
onKeyDown(): void;
|
||||
/** @internal */
|
||||
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
||||
/** @internal */
|
||||
onDragStart(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
||||
/** @internal */
|
||||
onDrag(event: TerraDrawMouseEvent, _setMapDraggability: (enabled: boolean) => void): void;
|
||||
/** @internal */
|
||||
onDragEnd(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
||||
/** @internal */
|
||||
cleanUp(): void;
|
||||
/** @internal */
|
||||
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
||||
validateFeature(feature: unknown): StoreValidation;
|
||||
private updateCircle;
|
||||
afterFeatureUpdated(feature: GeoJSONStoreFeatures): void;
|
||||
afterFeatureAdded(feature: GeoJSONStoreFeatures): void;
|
||||
registerBehaviors(config: BehaviorConfig): void;
|
||||
}
|
||||
export {};
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
|
||||
import { TerraDrawMouseEvent } from "../common";
|
||||
export declare class ClickBoundingBoxBehavior extends TerraDrawModeBehavior {
|
||||
constructor(config: BehaviorConfig);
|
||||
create(event: TerraDrawMouseEvent): import("geojson").Feature<import("geojson").Polygon, import("geojson").GeoJsonProperties>;
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
import { Position } from "geojson";
|
||||
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
|
||||
import { TerraDrawMouseEvent } from "../common";
|
||||
import { PixelDistanceBehavior } from "./pixel-distance.behavior";
|
||||
import { MutateFeatureBehavior } from "./mutate-feature.behavior";
|
||||
import { FeatureId } from "../extend";
|
||||
import { ReadFeatureBehavior } from "./read-feature.behavior";
|
||||
export declare class ClosingPointsBehavior extends TerraDrawModeBehavior {
|
||||
readonly config: BehaviorConfig;
|
||||
private readonly pixelDistance;
|
||||
private readonly mutateFeatureBehavior;
|
||||
private readonly readFeatureBehavior;
|
||||
constructor(config: BehaviorConfig, pixelDistance: PixelDistanceBehavior, mutateFeatureBehavior: MutateFeatureBehavior, readFeatureBehavior: ReadFeatureBehavior);
|
||||
private _startEndPoints;
|
||||
get ids(): FeatureId[];
|
||||
set ids(_: FeatureId[]);
|
||||
create(selectedCoords: Position[] | Position[][]): void;
|
||||
delete(): void;
|
||||
updateOne(index: number, updatedCoordinate: Position): void;
|
||||
update(updatedCoordinates: Position[] | Position[][]): void;
|
||||
isLineStringClosingPoint(event: TerraDrawMouseEvent): {
|
||||
isClosing: boolean;
|
||||
};
|
||||
isPolygonClosingPoints(event: TerraDrawMouseEvent): {
|
||||
isClosing: boolean;
|
||||
isPreviousClosing: boolean;
|
||||
};
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
|
||||
import { Snappable, TerraDrawMouseEvent } from "../common";
|
||||
import { Feature, Position } from "geojson";
|
||||
import { ClickBoundingBoxBehavior } from "./click-bounding-box.behavior";
|
||||
import { FeatureId } from "../store/store";
|
||||
import { PixelDistanceBehavior } from "./pixel-distance.behavior";
|
||||
export declare class CoordinateSnappingBehavior extends TerraDrawModeBehavior {
|
||||
readonly config: BehaviorConfig;
|
||||
private readonly pixelDistance;
|
||||
private readonly clickBoundingBox;
|
||||
constructor(config: BehaviorConfig, pixelDistance: PixelDistanceBehavior, clickBoundingBox: ClickBoundingBoxBehavior);
|
||||
/** Returns the nearest snappable coordinate - on first click there is no currentId so no need to provide */
|
||||
getSnappableCoordinateFirstClick(event: TerraDrawMouseEvent): Position | undefined;
|
||||
getSnappableCoordinate(event: TerraDrawMouseEvent, currentFeatureId: FeatureId): Position | undefined;
|
||||
getSnappable(event: TerraDrawMouseEvent, filter?: (feature: Feature) => boolean): Snappable;
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { LineString, Polygon, Position } from "geojson";
|
||||
import { SnapToDegree, TerraDrawMouseEvent } from "../common";
|
||||
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
|
||||
export declare class DegreeSnappingBehavior extends TerraDrawModeBehavior {
|
||||
readonly config: BehaviorConfig;
|
||||
constructor(config: BehaviorConfig);
|
||||
private EPSILON;
|
||||
private DEFAULT_DEGREE;
|
||||
getSnappableCoordinate(event: TerraDrawMouseEvent, geometry: LineString | Polygon, currentCoordinate: number, options?: SnapToDegree): Position | undefined;
|
||||
private getDegree;
|
||||
private offsets;
|
||||
private snapOnWebMercator;
|
||||
private snapOnGlobe;
|
||||
private projectedCandidates;
|
||||
private getClosingCandidate;
|
||||
private closingDegrees;
|
||||
private hasAngle;
|
||||
private angle;
|
||||
private toLocalPoint;
|
||||
private fromLocalPoint;
|
||||
private closestPoint;
|
||||
private distance;
|
||||
private pixelDistance;
|
||||
private angleDifference;
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
import { Cursor, DrawInteractions, HexColorStyling, NumericStyling, OneDimensionalSnapping, Projection, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, TerraDrawMouseEvent } from "../../common";
|
||||
import { GeoJSONStoreFeatures, StoreValidation } from "../../store/store";
|
||||
import { BehaviorConfig } from "../base.behavior";
|
||||
import { BaseModeOptions, CustomStyling, ModeUpdateOptions, TerraDrawBaseDrawMode } from "../base.mode";
|
||||
type TerraDrawEllipseModeKeyEvents = {
|
||||
cancel: KeyboardEvent["key"] | null;
|
||||
finish: KeyboardEvent["key"] | null;
|
||||
};
|
||||
type EllipsePolygonStyling = {
|
||||
fillColor: HexColorStyling;
|
||||
fillOpacity: NumericStyling;
|
||||
outlineColor: HexColorStyling;
|
||||
outlineWidth: NumericStyling;
|
||||
outlineOpacity: NumericStyling;
|
||||
coordinatePointWidth: NumericStyling;
|
||||
coordinatePointColor: HexColorStyling;
|
||||
coordinatePointOpacity: NumericStyling;
|
||||
coordinatePointOutlineWidth: NumericStyling;
|
||||
coordinatePointOutlineColor: HexColorStyling;
|
||||
coordinatePointOutlineOpacity: NumericStyling;
|
||||
snappingPointColor: HexColorStyling;
|
||||
snappingPointWidth: NumericStyling;
|
||||
snappingPointOpacity: NumericStyling;
|
||||
snappingPointOutlineColor: HexColorStyling;
|
||||
snappingPointOutlineWidth: NumericStyling;
|
||||
snappingPointOutlineOpacity: NumericStyling;
|
||||
};
|
||||
interface Cursors {
|
||||
start?: Cursor;
|
||||
}
|
||||
interface TerraDrawEllipseModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
||||
keyEvents?: TerraDrawEllipseModeKeyEvents | null;
|
||||
cursors?: Cursors;
|
||||
startingRadiusKilometers?: number;
|
||||
projection?: Projection;
|
||||
drawInteraction?: DrawInteractions;
|
||||
segments?: number;
|
||||
showCoordinatePoints?: boolean;
|
||||
/** Snapping options applied to the ellipse center coordinate. */
|
||||
snapping?: OneDimensionalSnapping;
|
||||
}
|
||||
export declare class TerraDrawEllipseMode extends TerraDrawBaseDrawMode<EllipsePolygonStyling> {
|
||||
mode: string;
|
||||
private center;
|
||||
private endPosition;
|
||||
private segments;
|
||||
private currentEllipseId;
|
||||
private keyEvents;
|
||||
private cursors;
|
||||
private startingRadiusKilometers;
|
||||
private cursorMovedAfterInitialCursorDown;
|
||||
private drawInteraction;
|
||||
private drawType;
|
||||
private minimumSegments;
|
||||
private showCoordinatePoints;
|
||||
private cancelled;
|
||||
private snapping;
|
||||
private snappedPointId;
|
||||
private readFeature;
|
||||
private coordinatePoints;
|
||||
private mutateFeature;
|
||||
private pixelDistance;
|
||||
private clickBoundingBox;
|
||||
private coordinateSnapping;
|
||||
private lineSnapping;
|
||||
private featureSnapping;
|
||||
constructor(options?: TerraDrawEllipseModeOptions<EllipsePolygonStyling>);
|
||||
updateOptions(options?: ModeUpdateOptions<TerraDrawEllipseModeOptions<EllipsePolygonStyling>>): void;
|
||||
private close;
|
||||
private beginDrawing;
|
||||
private dragDrawAllowed;
|
||||
private moveDrawAllowed;
|
||||
/** @internal */
|
||||
start(): void;
|
||||
/** @internal */
|
||||
stop(): void;
|
||||
/** @internal */
|
||||
onClick(event: TerraDrawMouseEvent): void;
|
||||
/** @internal */
|
||||
onMouseMove(event: TerraDrawMouseEvent): void;
|
||||
private updateSnappedCoordinate;
|
||||
private deleteSnappedPoint;
|
||||
private getSnappedCoordinate;
|
||||
/** @internal */
|
||||
onKeyDown(): void;
|
||||
/** @internal */
|
||||
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
||||
/** @internal */
|
||||
onDragStart(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
||||
/** @internal */
|
||||
onDrag(event: TerraDrawMouseEvent, _setMapDraggability: (enabled: boolean) => void): void;
|
||||
/** @internal */
|
||||
onDragEnd(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
||||
/** @internal */
|
||||
cleanUp(): void;
|
||||
/** @internal */
|
||||
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
||||
validateFeature(feature: unknown): StoreValidation;
|
||||
private updateEllipse;
|
||||
afterFeatureUpdated(feature: GeoJSONStoreFeatures): void;
|
||||
afterFeatureAdded(feature: GeoJSONStoreFeatures): void;
|
||||
registerBehaviors(config: BehaviorConfig): void;
|
||||
}
|
||||
export {};
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
import { Snappable, TerraDrawMouseEvent } from "../common";
|
||||
import { Feature } from "geojson";
|
||||
import { FeatureId } from "../store/store";
|
||||
import { CoordinateSnappingBehavior } from "./coordinate-snapping.behavior";
|
||||
import { LineSnappingBehavior } from "./line-snapping.behavior";
|
||||
export declare class FeatureSnappingBehavior {
|
||||
private readonly coordinateSnapping;
|
||||
private readonly lineSnapping;
|
||||
constructor(coordinateSnapping: CoordinateSnappingBehavior, lineSnapping: LineSnappingBehavior);
|
||||
getSnappable(event: TerraDrawMouseEvent, currentFeatureId?: FeatureId, filter?: (feature: Feature) => boolean, options?: {
|
||||
toLine?: boolean;
|
||||
toCoordinate?: boolean;
|
||||
}): Snappable;
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
Generated
Vendored
+88
@@ -0,0 +1,88 @@
|
||||
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor, DashArrayStyling, DrawInteractions } from "../../common";
|
||||
import { BaseModeOptions, CustomStyling, ModeUpdateOptions, TerraDrawBaseDrawMode } from "../base.mode";
|
||||
import { GeoJSONStoreFeatures, StoreValidation } from "../../store/store";
|
||||
import { BehaviorConfig } from "../base.behavior";
|
||||
type TerraDrawFreehandLineStringModeKeyEvents = {
|
||||
cancel: KeyboardEvent["key"] | null;
|
||||
finish: KeyboardEvent["key"] | null;
|
||||
};
|
||||
type FreehandLineStringStyling = {
|
||||
lineStringWidth: NumericStyling;
|
||||
lineStringColor: HexColorStyling;
|
||||
lineStringOpacity: NumericStyling;
|
||||
lineStringDash: DashArrayStyling;
|
||||
coordinatePointWidth: NumericStyling;
|
||||
coordinatePointColor: HexColorStyling;
|
||||
coordinatePointOpacity: NumericStyling;
|
||||
coordinatePointOutlineWidth: NumericStyling;
|
||||
coordinatePointOutlineColor: HexColorStyling;
|
||||
coordinatePointOutlineOpacity: NumericStyling;
|
||||
closingPointColor: HexColorStyling;
|
||||
closingPointOpacity: NumericStyling;
|
||||
closingPointWidth: NumericStyling;
|
||||
closingPointOutlineColor: HexColorStyling;
|
||||
closingPointOutlineWidth: NumericStyling;
|
||||
closingPointOutlineOpacity: NumericStyling;
|
||||
};
|
||||
interface Cursors {
|
||||
start?: Cursor;
|
||||
close?: Cursor;
|
||||
}
|
||||
interface TerraDrawFreehandLineStringModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
||||
minDistance?: number;
|
||||
keyEvents?: TerraDrawFreehandLineStringModeKeyEvents | null;
|
||||
cursors?: Cursors;
|
||||
drawInteraction?: DrawInteractions;
|
||||
showCoordinatePoints?: boolean;
|
||||
}
|
||||
export declare class TerraDrawFreehandLineStringMode extends TerraDrawBaseDrawMode<FreehandLineStringStyling> {
|
||||
mode: string;
|
||||
private canClose;
|
||||
private showCoordinatePoints;
|
||||
private currentId;
|
||||
private minDistance;
|
||||
private keyEvents;
|
||||
private cursors;
|
||||
private preventNewFeature;
|
||||
private drawInteraction;
|
||||
private drawType;
|
||||
private coordinatePoints;
|
||||
private mutateFeature;
|
||||
private readFeature;
|
||||
private pixelDistance;
|
||||
private closingPoints;
|
||||
constructor(options?: TerraDrawFreehandLineStringModeOptions<FreehandLineStringStyling>);
|
||||
updateOptions(options?: ModeUpdateOptions<TerraDrawFreehandLineStringModeOptions<FreehandLineStringStyling>>): void;
|
||||
private moveDrawAllowed;
|
||||
private dragDrawAllowed;
|
||||
private close;
|
||||
/** @internal */
|
||||
start(): void;
|
||||
/** @internal */
|
||||
stop(): void;
|
||||
private addCoordinate;
|
||||
private beginDrawing;
|
||||
/** @internal */
|
||||
onMouseMove(event: TerraDrawMouseEvent): void;
|
||||
/** @internal */
|
||||
onClick(event: TerraDrawMouseEvent): void;
|
||||
/** @internal */
|
||||
onKeyDown(): void;
|
||||
/** @internal */
|
||||
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
||||
/** @internal */
|
||||
onDragStart(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
||||
/** @internal */
|
||||
onDrag(event: TerraDrawMouseEvent, _setMapDraggability: (enabled: boolean) => void): void;
|
||||
/** @internal */
|
||||
onDragEnd(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
||||
/** @internal */
|
||||
cleanUp(): void;
|
||||
/** @internal */
|
||||
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
||||
validateFeature(feature: unknown): StoreValidation;
|
||||
afterFeatureUpdated(feature: GeoJSONStoreFeatures): void;
|
||||
afterFeatureAdded(feature: GeoJSONStoreFeatures): void;
|
||||
registerBehaviors(config: BehaviorConfig): void;
|
||||
}
|
||||
export {};
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor, DrawInteractions } from "../../common";
|
||||
import { BaseModeOptions, CustomStyling, ModeUpdateOptions, TerraDrawBaseDrawMode } from "../base.mode";
|
||||
import { GeoJSONStoreFeatures, StoreValidation } from "../../store/store";
|
||||
import { BehaviorConfig } from "../base.behavior";
|
||||
type TerraDrawFreehandModeKeyEvents = {
|
||||
cancel: KeyboardEvent["key"] | null;
|
||||
finish: KeyboardEvent["key"] | null;
|
||||
};
|
||||
type FreehandPolygonStyling = {
|
||||
fillColor: HexColorStyling;
|
||||
fillOpacity: NumericStyling;
|
||||
outlineColor: HexColorStyling;
|
||||
outlineOpacity: NumericStyling;
|
||||
outlineWidth: NumericStyling;
|
||||
coordinatePointWidth: NumericStyling;
|
||||
coordinatePointColor: HexColorStyling;
|
||||
coordinatePointOpacity: NumericStyling;
|
||||
coordinatePointOutlineWidth: NumericStyling;
|
||||
coordinatePointOutlineColor: HexColorStyling;
|
||||
coordinatePointOutlineOpacity: NumericStyling;
|
||||
closingPointColor: HexColorStyling;
|
||||
closingPointOpacity: NumericStyling;
|
||||
closingPointWidth: NumericStyling;
|
||||
closingPointOutlineColor: HexColorStyling;
|
||||
closingPointOutlineOpacity: NumericStyling;
|
||||
closingPointOutlineWidth: NumericStyling;
|
||||
};
|
||||
interface Cursors {
|
||||
start?: Cursor;
|
||||
close?: Cursor;
|
||||
}
|
||||
interface TerraDrawFreehandModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
||||
minDistance?: number;
|
||||
smoothing?: number;
|
||||
preventPointsNearClose?: boolean;
|
||||
autoClose?: boolean;
|
||||
autoCloseTimeout?: number;
|
||||
keyEvents?: TerraDrawFreehandModeKeyEvents | null;
|
||||
cursors?: Cursors;
|
||||
drawInteraction?: DrawInteractions;
|
||||
showCoordinatePoints?: boolean;
|
||||
}
|
||||
export declare class TerraDrawFreehandMode extends TerraDrawBaseDrawMode<FreehandPolygonStyling> {
|
||||
mode: string;
|
||||
private canClose;
|
||||
private currentId;
|
||||
private closingPointId;
|
||||
private minDistance;
|
||||
private keyEvents;
|
||||
private cursors;
|
||||
private preventPointsNearClose;
|
||||
private autoClose;
|
||||
private autoCloseTimeout;
|
||||
private hasLeftStartingPoint;
|
||||
private preventNewFeature;
|
||||
private drawInteraction;
|
||||
private drawType;
|
||||
private smoothing;
|
||||
private showCoordinatePoints;
|
||||
private coordinatePoints;
|
||||
private mutateFeature;
|
||||
private readFeature;
|
||||
constructor(options?: TerraDrawFreehandModeOptions<FreehandPolygonStyling>);
|
||||
updateOptions(options?: ModeUpdateOptions<TerraDrawFreehandModeOptions<FreehandPolygonStyling>>): void;
|
||||
private moveDrawAllowed;
|
||||
private dragDrawAllowed;
|
||||
private beginDrawing;
|
||||
private addCoordinate;
|
||||
/**
|
||||
* Uses a simple linear interpolation to smooth the coordinates. The smoothing factor determines how
|
||||
* much influence the previous coordinate has on the new coordinate. A smoothing factor of 0 means
|
||||
* no smoothing (the target coordinate is used as is), while a smoothing factor close to 1 means a
|
||||
* lot of smoothing (the new coordinate will be very close to the previous coordinate).
|
||||
* The default value is 0, which means no smoothing.
|
||||
* @param previousCoordinate
|
||||
* @param targetCoordinate
|
||||
* @returns
|
||||
*/
|
||||
private getSmoothedCoordinate;
|
||||
private close;
|
||||
/** @internal */
|
||||
start(): void;
|
||||
/** @internal */
|
||||
stop(): void;
|
||||
/** @internal */
|
||||
onMouseMove(event: TerraDrawMouseEvent): void;
|
||||
/** @internal */
|
||||
onClick(event: TerraDrawMouseEvent): void;
|
||||
/** @internal */
|
||||
onKeyDown(): void;
|
||||
/** @internal */
|
||||
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
||||
/** @internal */
|
||||
onDragStart(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
||||
/** @internal */
|
||||
onDrag(event: TerraDrawMouseEvent, _setMapDraggability: (enabled: boolean) => void): void;
|
||||
/** @internal */
|
||||
onDragEnd(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
||||
/** @internal */
|
||||
cleanUp(): void;
|
||||
/** @internal */
|
||||
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
||||
validateFeature(feature: unknown): StoreValidation;
|
||||
afterFeatureUpdated(feature: GeoJSONStoreFeatures): void;
|
||||
afterFeatureAdded(feature: GeoJSONStoreFeatures): void;
|
||||
registerBehaviors(config: BehaviorConfig): void;
|
||||
}
|
||||
export {};
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
|
||||
import { Position } from "geojson";
|
||||
export declare class InsertCoordinatesBehavior extends TerraDrawModeBehavior {
|
||||
readonly config: BehaviorConfig;
|
||||
constructor(config: BehaviorConfig);
|
||||
generateInsertionCoordinates(coordinateOne: Position, coordinateTwo: Position, segmentLength: number): Position[];
|
||||
generateInsertionGeodesicCoordinates(coordinateOne: Position, coordinateTwo: Position, segmentLength: number): Position[];
|
||||
private limitCoordinates;
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
|
||||
import { Snappable, TerraDrawMouseEvent } from "../common";
|
||||
import { Feature } from "geojson";
|
||||
import { ClickBoundingBoxBehavior } from "./click-bounding-box.behavior";
|
||||
import { FeatureId } from "../store/store";
|
||||
import { PixelDistanceBehavior } from "./pixel-distance.behavior";
|
||||
export declare class LineSnappingBehavior extends TerraDrawModeBehavior {
|
||||
readonly config: BehaviorConfig;
|
||||
private readonly pixelDistance;
|
||||
private readonly clickBoundingBox;
|
||||
constructor(config: BehaviorConfig, pixelDistance: PixelDistanceBehavior, clickBoundingBox: ClickBoundingBoxBehavior);
|
||||
/** Returns the nearest snappable coordinate - on first click there is no currentId so no need to provide */
|
||||
getSnappableCoordinateFirstClick: (event: TerraDrawMouseEvent) => number[] | undefined;
|
||||
getSnappableCoordinate: (event: TerraDrawMouseEvent, currentFeatureId: FeatureId) => number[] | undefined;
|
||||
getSnappable: (event: TerraDrawMouseEvent, filter?: (feature: Feature) => boolean) => Snappable;
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor, Snapping, DashArrayStyling } from "../../common";
|
||||
import { BaseModeOptions, CustomStyling, ModeUpdateOptions, TerraDrawBaseDrawMode } from "../base.mode";
|
||||
import { BehaviorConfig } from "../base.behavior";
|
||||
import { GeoJSONStoreFeatures, StoreValidation } from "../../store/store";
|
||||
type TerraDrawLineStringModeKeyEvents = {
|
||||
cancel: KeyboardEvent["key"] | null;
|
||||
finish: KeyboardEvent["key"] | null;
|
||||
};
|
||||
type LineStringStyling = {
|
||||
lineStringWidth: NumericStyling;
|
||||
lineStringColor: HexColorStyling;
|
||||
lineStringOpacity: NumericStyling;
|
||||
closingPointColor: HexColorStyling;
|
||||
closingPointWidth: NumericStyling;
|
||||
closingPointOpacity: NumericStyling;
|
||||
closingPointOutlineColor: HexColorStyling;
|
||||
closingPointOutlineWidth: NumericStyling;
|
||||
closingPointOutlineOpacity: NumericStyling;
|
||||
snappingPointColor: HexColorStyling;
|
||||
snappingPointWidth: NumericStyling;
|
||||
snappingPointOpacity: NumericStyling;
|
||||
snappingPointOutlineColor: HexColorStyling;
|
||||
snappingPointOutlineWidth: NumericStyling;
|
||||
snappingPointOutlineOpacity: NumericStyling;
|
||||
coordinatePointColor: HexColorStyling;
|
||||
coordinatePointOpacity: NumericStyling;
|
||||
coordinatePointWidth: NumericStyling;
|
||||
coordinatePointOutlineColor: HexColorStyling;
|
||||
coordinatePointOutlineWidth: NumericStyling;
|
||||
coordinatePointOutlineOpacity: NumericStyling;
|
||||
lineStringDash: DashArrayStyling;
|
||||
};
|
||||
interface Cursors {
|
||||
start?: Cursor;
|
||||
close?: Cursor;
|
||||
dragStart?: Cursor;
|
||||
dragEnd?: Cursor;
|
||||
}
|
||||
interface InertCoordinates {
|
||||
strategy: "amount";
|
||||
value: number;
|
||||
}
|
||||
interface TerraDrawLineStringModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
||||
snapping?: Snapping;
|
||||
pointerDistance?: number;
|
||||
keyEvents?: TerraDrawLineStringModeKeyEvents | null;
|
||||
cursors?: Cursors;
|
||||
insertCoordinates?: InertCoordinates;
|
||||
editable?: boolean;
|
||||
showCoordinatePoints?: boolean;
|
||||
finishOnNthCoordinate?: number;
|
||||
}
|
||||
export declare class TerraDrawLineStringMode extends TerraDrawBaseDrawMode<LineStringStyling> {
|
||||
mode: string;
|
||||
private currentCoordinate;
|
||||
private currentId;
|
||||
private keyEvents;
|
||||
private snapping;
|
||||
private cursors;
|
||||
private mouseMove;
|
||||
private insertCoordinates;
|
||||
private lastCommittedCoordinates;
|
||||
private snappedPointId;
|
||||
private lastMouseMoveEvent;
|
||||
private showCoordinatePoints;
|
||||
private finishOnNthCoordinate;
|
||||
private editable;
|
||||
private editedFeatureId;
|
||||
private editedFeatureCoordinateIndex;
|
||||
private editedSnapType;
|
||||
private editedInsertIndex;
|
||||
private editedPointId;
|
||||
private coordinateSnapping;
|
||||
private insertPoint;
|
||||
private lineSnapping;
|
||||
private featureSnapping;
|
||||
private degreeSnapping;
|
||||
private pixelDistance;
|
||||
private clickBoundingBox;
|
||||
private mutateFeature;
|
||||
private readFeature;
|
||||
private closingPoints;
|
||||
private coordinatePoints;
|
||||
private undoRedo;
|
||||
constructor(options?: TerraDrawLineStringModeOptions<LineStringStyling>);
|
||||
updateOptions(options?: ModeUpdateOptions<TerraDrawLineStringModeOptions<LineStringStyling>>): void;
|
||||
private shouldFinishOnCommit;
|
||||
private updateSnappedCoordinate;
|
||||
private close;
|
||||
private generateInsertCoordinates;
|
||||
private createLine;
|
||||
private firstUpdateToLine;
|
||||
private updateToLine;
|
||||
undoSize(): number;
|
||||
clearHistory(): void;
|
||||
private pushHistorySnapshot;
|
||||
private updateSnappedGuidancePointFromLastMouseMove;
|
||||
private syncClosingPoints;
|
||||
undo(): void;
|
||||
redoSize(): number;
|
||||
redo(): void;
|
||||
/** @internal */
|
||||
registerBehaviors(config: BehaviorConfig): void;
|
||||
/** @internal */
|
||||
start(): void;
|
||||
/** @internal */
|
||||
stop(): void;
|
||||
/** @internal */
|
||||
onMouseMove(event: TerraDrawMouseEvent): void;
|
||||
private getInsertCoordinates;
|
||||
private onRightClick;
|
||||
private onLeftClick;
|
||||
/** @internal */
|
||||
onClick(event: TerraDrawMouseEvent): void;
|
||||
/** @internal */
|
||||
onKeyDown(): void;
|
||||
/** @internal */
|
||||
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
||||
/** @internal */
|
||||
onDragStart(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
||||
/** @internal */
|
||||
onDrag(event: TerraDrawMouseEvent, _setMapDraggability: (enabled: boolean) => void): void;
|
||||
/** @internal */
|
||||
onDragEnd(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
||||
/** @internal */
|
||||
cleanUp(): void;
|
||||
/** @internal */
|
||||
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
||||
validateFeature(feature: unknown): StoreValidation;
|
||||
private lineStringFilter;
|
||||
private snapCoordinate;
|
||||
afterFeatureUpdated(feature: GeoJSONStoreFeatures): void;
|
||||
afterFeatureAdded(feature: GeoJSONStoreFeatures): void;
|
||||
}
|
||||
export {};
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, NumericStyling, HexColorStyling, Cursor, UrlStyling, MarkerAnchorStyling, OneDimensionalSnapping } from "../../common";
|
||||
import { GeoJSONStoreFeatures, StoreValidation } from "../../store/store";
|
||||
import { BaseModeOptions, CustomStyling, ModeUpdateOptions, TerraDrawBaseDrawMode } from "../base.mode";
|
||||
import { BehaviorConfig } from "../base.behavior";
|
||||
type MarkerModeStyling = {
|
||||
/** Marker must be a PNG or JPG */
|
||||
markerUrl: UrlStyling;
|
||||
markerHeight: NumericStyling;
|
||||
markerWidth: NumericStyling;
|
||||
markerAnchor: MarkerAnchorStyling;
|
||||
snappingPointColor: HexColorStyling;
|
||||
snappingPointWidth: NumericStyling;
|
||||
snappingPointOpacity: NumericStyling;
|
||||
snappingPointOutlineColor: HexColorStyling;
|
||||
snappingPointOutlineWidth: NumericStyling;
|
||||
snappingPointOutlineOpacity: NumericStyling;
|
||||
};
|
||||
interface Cursors {
|
||||
create?: Cursor;
|
||||
dragStart?: Cursor;
|
||||
dragEnd?: Cursor;
|
||||
}
|
||||
interface TerraDrawMarkerModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
||||
snapping?: OneDimensionalSnapping;
|
||||
cursors?: Cursors;
|
||||
editable?: boolean;
|
||||
}
|
||||
export declare class TerraDrawMarkerMode extends TerraDrawBaseDrawMode<MarkerModeStyling> {
|
||||
mode: "marker";
|
||||
private cursors;
|
||||
private editable;
|
||||
private snapping;
|
||||
private editedFeatureId;
|
||||
private snappedPointId;
|
||||
private pixelDistance;
|
||||
private clickBoundingBox;
|
||||
private pointSearch;
|
||||
private mutateFeature;
|
||||
private coordinateSnapping;
|
||||
private lineSnapping;
|
||||
private featureSnapping;
|
||||
constructor(options?: TerraDrawMarkerModeOptions<MarkerModeStyling>);
|
||||
updateOptions(options?: ModeUpdateOptions<TerraDrawMarkerModeOptions<MarkerModeStyling>>): void;
|
||||
/** @internal */
|
||||
start(): void;
|
||||
/** @internal */
|
||||
stop(): void;
|
||||
/** @internal */
|
||||
onClick(event: TerraDrawMouseEvent): void;
|
||||
/** @internal */
|
||||
onMouseMove(event?: TerraDrawMouseEvent): void;
|
||||
/** @internal */
|
||||
onKeyDown(): void;
|
||||
/** @internal */
|
||||
onKeyUp(): void;
|
||||
/** @internal */
|
||||
cleanUp(): void;
|
||||
onDragStart(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
||||
/** @internal */
|
||||
onDrag(event: TerraDrawMouseEvent, _setMapDraggability: (enabled: boolean) => void): void;
|
||||
/** @internal */
|
||||
onDragEnd(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
||||
registerBehaviors(config: BehaviorConfig): void;
|
||||
/** @internal */
|
||||
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
||||
validateFeature(feature: unknown): StoreValidation;
|
||||
private onLeftClick;
|
||||
private snapCoordinate;
|
||||
private updateSnappedCoordinate;
|
||||
private deleteSnappedPoint;
|
||||
private getSnappedCoordinate;
|
||||
private onRightClick;
|
||||
afterFeatureUpdated(feature: GeoJSONStoreFeatures): void;
|
||||
}
|
||||
export {};
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
|
||||
import { FeatureId } from "../extend";
|
||||
import { GeoJSONStoreFeatures, GeoJSONStoreGeometries, JSONObject, JSON } from "../store/store";
|
||||
import { Polygon, Position, LineString, Point } from "geojson";
|
||||
import { Actions, GuidancePointProperties, UpdateTypes, Validation } from "../common";
|
||||
type MutateFeatureBehaviorOptions = {
|
||||
validate: Validation | undefined;
|
||||
};
|
||||
export declare const Mutations: {
|
||||
readonly InsertBefore: "insert-before";
|
||||
readonly InsertAfter: "insert-after";
|
||||
readonly Update: "update";
|
||||
readonly Delete: "delete";
|
||||
readonly Replace: "replace";
|
||||
};
|
||||
type InsertBeforeMutation = {
|
||||
type: typeof Mutations.InsertBefore;
|
||||
index: number;
|
||||
coordinate: Position;
|
||||
};
|
||||
type InsertAfterMutation = {
|
||||
type: typeof Mutations.InsertAfter;
|
||||
index: number;
|
||||
coordinate: Position;
|
||||
};
|
||||
type UpdateMutation = {
|
||||
type: typeof Mutations.Update;
|
||||
index: number;
|
||||
coordinate: Position;
|
||||
};
|
||||
type DeleteMutation = {
|
||||
type: typeof Mutations.Delete;
|
||||
index: number;
|
||||
};
|
||||
export type ReplaceMutation<ReplacedGeometry extends GeoJSONStoreGeometries> = {
|
||||
type: typeof Mutations.Replace;
|
||||
coordinates: ReplacedGeometry["coordinates"];
|
||||
};
|
||||
export type CoordinateMutation = InsertBeforeMutation | InsertAfterMutation | UpdateMutation | DeleteMutation;
|
||||
type ValidProperties = Record<string, JSON | undefined>;
|
||||
type FinishContext = {
|
||||
updateType: UpdateTypes.Finish;
|
||||
action: Actions;
|
||||
};
|
||||
type MutateContext = FinishContext | {
|
||||
updateType: UpdateTypes.Commit | UpdateTypes.Provisional;
|
||||
};
|
||||
export type UpdateGeometry<G extends GeoJSONStoreGeometries> = {
|
||||
featureId: FeatureId;
|
||||
coordinateMutations?: ReplaceMutation<G> | CoordinateMutation[];
|
||||
propertyMutations?: ValidProperties;
|
||||
context: MutateContext;
|
||||
};
|
||||
export declare class MutateFeatureBehavior extends TerraDrawModeBehavior {
|
||||
constructor(config: BehaviorConfig, options: MutateFeatureBehaviorOptions);
|
||||
private options;
|
||||
createPoint({ coordinates, properties, context, }: {
|
||||
coordinates: Position;
|
||||
properties: JSONObject;
|
||||
context?: FinishContext;
|
||||
}): (GeoJSONStoreFeatures<{
|
||||
type: "Point";
|
||||
coordinates: Position;
|
||||
}> & {
|
||||
id: FeatureId;
|
||||
}) | undefined;
|
||||
createLineString({ coordinates, properties, }: {
|
||||
coordinates: LineString["coordinates"];
|
||||
properties: JSONObject;
|
||||
}): GeoJSONStoreFeatures<{
|
||||
type: "LineString";
|
||||
coordinates: Position[];
|
||||
}> & {
|
||||
id: FeatureId;
|
||||
};
|
||||
createPolygon({ coordinates, properties, }: {
|
||||
coordinates: Polygon["coordinates"][0];
|
||||
properties: JSONObject;
|
||||
}): GeoJSONStoreFeatures<Polygon> & {
|
||||
id: FeatureId;
|
||||
};
|
||||
createPolygon({ coordinates, properties, context, }: {
|
||||
coordinates: Polygon["coordinates"][0];
|
||||
properties: JSONObject;
|
||||
context: FinishContext;
|
||||
}): (GeoJSONStoreFeatures<Polygon> & {
|
||||
id: FeatureId;
|
||||
}) | undefined;
|
||||
createGuidancePoint({ coordinate, type, }: {
|
||||
coordinate: Position;
|
||||
type: GuidancePointProperties;
|
||||
}): FeatureId;
|
||||
createGuidancePoints({ coordinates, type, additionalProperties, }: {
|
||||
coordinates: Position[];
|
||||
type: GuidancePointProperties;
|
||||
additionalProperties?: (index: number) => JSONObject;
|
||||
}): FeatureId[];
|
||||
updatePoint({ featureId, coordinateMutations, propertyMutations, context, }: UpdateGeometry<Point>): GeoJSONStoreFeatures<Point> | null;
|
||||
updatePolygon({ featureId, coordinateMutations, context, propertyMutations, }: UpdateGeometry<Polygon>): GeoJSONStoreFeatures<Polygon> | null;
|
||||
updateLineString({ featureId, coordinateMutations, context, propertyMutations, }: UpdateGeometry<LineString>): GeoJSONStoreFeatures<LineString> | null;
|
||||
deleteFeatureIfPresent(featureId: FeatureId | undefined): void;
|
||||
deleteFeaturesIfPresent(featureIds: FeatureId[]): void;
|
||||
setDeselected(featureIds: FeatureId[]): void;
|
||||
setSelected(featureId: FeatureId): void;
|
||||
updateGuidancePoints(guidancePoints: {
|
||||
featureId: FeatureId;
|
||||
coordinate: Position;
|
||||
}[]): void;
|
||||
private handleCreateFeature;
|
||||
private handleMutateFeature;
|
||||
private mutateFeature;
|
||||
private applyCoordinateMutations;
|
||||
private isReplaceMutation;
|
||||
private createFeatureWithGeometry;
|
||||
private validateGeometryWithUpdateType;
|
||||
private buildFeatureWithGeometry;
|
||||
private createFeatures;
|
||||
private updateFeatureGeometries;
|
||||
private updateFeatureProperties;
|
||||
}
|
||||
export {};
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
|
||||
import { TerraDrawMouseEvent } from "../common";
|
||||
import { Position } from "geojson";
|
||||
export declare class PixelDistanceBehavior extends TerraDrawModeBehavior {
|
||||
constructor(config: BehaviorConfig);
|
||||
measure(clickEvent: TerraDrawMouseEvent, secondCoordinate: Position): number;
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
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 PointSearchBehavior extends TerraDrawModeBehavior {
|
||||
private readonly pixelDistance;
|
||||
private readonly clickBoundingBox;
|
||||
constructor(config: BehaviorConfig, pixelDistance: PixelDistanceBehavior, clickBoundingBox: ClickBoundingBoxBehavior);
|
||||
getNearestPointFeature(event: TerraDrawMouseEvent): GeoJSONStoreFeatures | undefined;
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, NumericStyling, HexColorStyling, Cursor, OneDimensionalSnapping } from "../../common";
|
||||
import { GeoJSONStoreFeatures, StoreValidation } from "../../store/store";
|
||||
import { BaseModeOptions, CustomStyling, ModeUpdateOptions, TerraDrawBaseDrawMode } from "../base.mode";
|
||||
import { BehaviorConfig } from "../base.behavior";
|
||||
type PointModeStyling = {
|
||||
pointWidth: NumericStyling;
|
||||
pointColor: HexColorStyling;
|
||||
pointOpacity: NumericStyling;
|
||||
pointOutlineColor: HexColorStyling;
|
||||
pointOutlineOpacity: NumericStyling;
|
||||
pointOutlineWidth: NumericStyling;
|
||||
snappingPointColor: HexColorStyling;
|
||||
snappingPointWidth: NumericStyling;
|
||||
snappingPointOpacity: NumericStyling;
|
||||
snappingPointOutlineColor: HexColorStyling;
|
||||
snappingPointOutlineWidth: NumericStyling;
|
||||
snappingPointOutlineOpacity: NumericStyling;
|
||||
editedPointColor: HexColorStyling;
|
||||
editedPointWidth: NumericStyling;
|
||||
editedPointOutlineColor: HexColorStyling;
|
||||
editedPointOutlineWidth: NumericStyling;
|
||||
};
|
||||
interface Cursors {
|
||||
create?: Cursor;
|
||||
dragStart?: Cursor;
|
||||
dragEnd?: Cursor;
|
||||
}
|
||||
interface TerraDrawPointModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
||||
snapping?: OneDimensionalSnapping;
|
||||
cursors?: Cursors;
|
||||
editable?: boolean;
|
||||
}
|
||||
export declare class TerraDrawPointMode extends TerraDrawBaseDrawMode<PointModeStyling> {
|
||||
mode: string;
|
||||
private cursors;
|
||||
private editable;
|
||||
private snapping;
|
||||
private editedFeatureId;
|
||||
private snappedPointId;
|
||||
private pixelDistance;
|
||||
private clickBoundingBox;
|
||||
private pointSearch;
|
||||
private mutateFeature;
|
||||
private coordinateSnapping;
|
||||
private lineSnapping;
|
||||
private featureSnapping;
|
||||
constructor(options?: TerraDrawPointModeOptions<PointModeStyling>);
|
||||
updateOptions(options?: ModeUpdateOptions<TerraDrawPointModeOptions<PointModeStyling>>): void;
|
||||
/** @internal */
|
||||
start(): void;
|
||||
/** @internal */
|
||||
stop(): void;
|
||||
/** @internal */
|
||||
onClick(event: TerraDrawMouseEvent): void;
|
||||
/** @internal */
|
||||
onMouseMove(event?: TerraDrawMouseEvent): void;
|
||||
/** @internal */
|
||||
onKeyDown(): void;
|
||||
/** @internal */
|
||||
onKeyUp(): void;
|
||||
/** @internal */
|
||||
cleanUp(): void;
|
||||
onDragStart(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
||||
/** @internal */
|
||||
onDrag(event: TerraDrawMouseEvent, _setMapDraggability: (enabled: boolean) => void): void;
|
||||
/** @internal */
|
||||
onDragEnd(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
||||
registerBehaviors(config: BehaviorConfig): void;
|
||||
/** @internal */
|
||||
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
||||
validateFeature(feature: unknown): StoreValidation;
|
||||
private onLeftClick;
|
||||
private snapCoordinate;
|
||||
private updateSnappedCoordinate;
|
||||
private deleteSnappedPoint;
|
||||
private getSnappedCoordinate;
|
||||
private onRightClick;
|
||||
afterFeatureUpdated(feature: GeoJSONStoreFeatures): void;
|
||||
}
|
||||
export {};
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor, Snapping } from "../../common";
|
||||
import { TerraDrawBaseDrawMode, BaseModeOptions, CustomStyling, PointerEvents, ModeUpdateOptions } from "../base.mode";
|
||||
import { BehaviorConfig } from "../base.behavior";
|
||||
import { GeoJSONStoreFeatures, StoreValidation } from "../../store/store";
|
||||
type TerraDrawPolygonModeKeyEvents = {
|
||||
cancel?: KeyboardEvent["key"] | null;
|
||||
finish?: KeyboardEvent["key"] | null;
|
||||
};
|
||||
type PolygonStyling = {
|
||||
fillColor: HexColorStyling;
|
||||
fillOpacity: NumericStyling;
|
||||
outlineColor: HexColorStyling;
|
||||
outlineOpacity: NumericStyling;
|
||||
outlineWidth: NumericStyling;
|
||||
closingPointWidth: NumericStyling;
|
||||
closingPointColor: HexColorStyling;
|
||||
closingPointOpacity: NumericStyling;
|
||||
closingPointOutlineWidth: NumericStyling;
|
||||
closingPointOutlineColor: HexColorStyling;
|
||||
closingPointOutlineOpacity: NumericStyling;
|
||||
snappingPointWidth: NumericStyling;
|
||||
snappingPointColor: HexColorStyling;
|
||||
snappingPointOpacity: NumericStyling;
|
||||
snappingPointOutlineWidth: NumericStyling;
|
||||
snappingPointOutlineColor: HexColorStyling;
|
||||
snappingPointOutlineOpacity: NumericStyling;
|
||||
editedPointWidth: NumericStyling;
|
||||
editedPointColor: HexColorStyling;
|
||||
editedPointOpacity: NumericStyling;
|
||||
editedPointOutlineWidth: NumericStyling;
|
||||
editedPointOutlineColor: HexColorStyling;
|
||||
editedPointOutlineOpacity: NumericStyling;
|
||||
coordinatePointWidth: NumericStyling;
|
||||
coordinatePointColor: HexColorStyling;
|
||||
coordinatePointOpacity: NumericStyling;
|
||||
coordinatePointOutlineWidth: NumericStyling;
|
||||
coordinatePointOutlineColor: HexColorStyling;
|
||||
coordinatePointOutlineOpacity: NumericStyling;
|
||||
};
|
||||
interface Cursors {
|
||||
start?: Cursor;
|
||||
close?: Cursor;
|
||||
dragStart?: Cursor;
|
||||
dragEnd?: Cursor;
|
||||
}
|
||||
interface TerraDrawPolygonModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
||||
snapping?: Snapping;
|
||||
pointerDistance?: number;
|
||||
keyEvents?: TerraDrawPolygonModeKeyEvents | null;
|
||||
pointerEvents?: PointerEvents;
|
||||
cursors?: Cursors;
|
||||
editable?: boolean;
|
||||
showCoordinatePoints?: boolean;
|
||||
}
|
||||
export declare class TerraDrawPolygonMode extends TerraDrawBaseDrawMode<PolygonStyling> {
|
||||
mode: string;
|
||||
private currentCoordinate;
|
||||
private currentId;
|
||||
private keyEvents;
|
||||
private cursors;
|
||||
private mouseMove;
|
||||
private showCoordinatePoints;
|
||||
private lastMouseMoveEvent;
|
||||
private snapping;
|
||||
private snappedPointId;
|
||||
private editable;
|
||||
private editedFeatureId;
|
||||
private editedFeatureCoordinateIndex;
|
||||
private editedSnapType;
|
||||
private editedInsertIndex;
|
||||
private editedPointId;
|
||||
private coordinatePoints;
|
||||
private lineSnapping;
|
||||
private coordinateSnapping;
|
||||
private featureSnapping;
|
||||
private degreeSnapping;
|
||||
private pixelDistance;
|
||||
private closingPoints;
|
||||
private clickBoundingBox;
|
||||
private mutateFeature;
|
||||
private readFeature;
|
||||
private undoRedo;
|
||||
constructor(options?: TerraDrawPolygonModeOptions<PolygonStyling>);
|
||||
updateOptions(options?: ModeUpdateOptions<TerraDrawPolygonModeOptions<PolygonStyling>>): void;
|
||||
private close;
|
||||
/** @internal */
|
||||
registerBehaviors(config: BehaviorConfig): void;
|
||||
/** @internal */
|
||||
start(): void;
|
||||
/** @internal */
|
||||
stop(): void;
|
||||
private updateSnappedCoordinate;
|
||||
undoSize(): number;
|
||||
clearHistory(): void;
|
||||
private pushHistorySnapshot;
|
||||
private updateSnappedGuidancePointFromLastMouseMove;
|
||||
private syncClosingPoints;
|
||||
undo(): void;
|
||||
redoSize(): number;
|
||||
redo(): void;
|
||||
/** @internal */
|
||||
onMouseMove(event: TerraDrawMouseEvent): void;
|
||||
private snapCoordinate;
|
||||
private polygonFilter;
|
||||
private onRightClick;
|
||||
private onLeftClick;
|
||||
/** @internal */
|
||||
onClick(event: TerraDrawMouseEvent): void;
|
||||
/** @internal */
|
||||
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
||||
/** @internal */
|
||||
onKeyDown(): void;
|
||||
onDragStart(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
||||
/** @internal */
|
||||
onDrag(event: TerraDrawMouseEvent, _setMapDraggability: (enabled: boolean) => void): void;
|
||||
/** @internal */
|
||||
onDragEnd(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
||||
/** @internal */
|
||||
cleanUp(): void;
|
||||
/** @internal */
|
||||
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
||||
afterFeatureAdded(feature: GeoJSONStoreFeatures): void;
|
||||
afterFeatureUpdated(feature: GeoJSONStoreFeatures): void;
|
||||
validateFeature(feature: unknown): StoreValidation;
|
||||
}
|
||||
export {};
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
import { TerraDrawAdapterStyling, TerraDrawKeyboardEvent, TerraDrawMouseEvent, HexColorStyling, NumericStyling, Cursor, Snapping, DashArrayStyling } from "../../common";
|
||||
import { BaseModeOptions, CustomStyling, ModeUpdateOptions, TerraDrawBaseDrawMode } from "../base.mode";
|
||||
import { BehaviorConfig } from "../base.behavior";
|
||||
import { GeoJSONStoreFeatures, StoreValidation } from "../../store/store";
|
||||
type TerraDrawPolyLineModeKeyEvents = {
|
||||
cancel: KeyboardEvent["key"] | null;
|
||||
finish: KeyboardEvent["key"] | null;
|
||||
};
|
||||
type PolyLineStyling = {
|
||||
lineStringWidth: NumericStyling;
|
||||
lineStringColor: HexColorStyling;
|
||||
lineStringOpacity: NumericStyling;
|
||||
lineStringDash: DashArrayStyling;
|
||||
polygonFillColor: HexColorStyling;
|
||||
polygonFillOpacity: NumericStyling;
|
||||
polygonOutlineColor: HexColorStyling;
|
||||
polygonOutlineWidth: NumericStyling;
|
||||
polygonOutlineOpacity: NumericStyling;
|
||||
closingPointColor: HexColorStyling;
|
||||
closingPointWidth: NumericStyling;
|
||||
closingPointOpacity: NumericStyling;
|
||||
closingPointOutlineColor: HexColorStyling;
|
||||
closingPointOutlineWidth: NumericStyling;
|
||||
closingPointOutlineOpacity: NumericStyling;
|
||||
snappingPointColor: HexColorStyling;
|
||||
snappingPointWidth: NumericStyling;
|
||||
snappingPointOpacity: NumericStyling;
|
||||
snappingPointOutlineColor: HexColorStyling;
|
||||
snappingPointOutlineWidth: NumericStyling;
|
||||
snappingPointOutlineOpacity: NumericStyling;
|
||||
coordinatePointColor: HexColorStyling;
|
||||
coordinatePointWidth: NumericStyling;
|
||||
coordinatePointOpacity: NumericStyling;
|
||||
coordinatePointOutlineColor: HexColorStyling;
|
||||
coordinatePointOutlineWidth: NumericStyling;
|
||||
coordinatePointOutlineOpacity: NumericStyling;
|
||||
};
|
||||
interface Cursors {
|
||||
start?: Cursor;
|
||||
close?: Cursor;
|
||||
}
|
||||
interface TerraDrawPolyLineModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
||||
snapping?: Snapping;
|
||||
keyEvents?: TerraDrawPolyLineModeKeyEvents | null;
|
||||
cursors?: Cursors;
|
||||
showCoordinatePoints?: boolean;
|
||||
}
|
||||
export declare class TerraDrawPolyLineMode extends TerraDrawBaseDrawMode<PolyLineStyling> {
|
||||
mode: string;
|
||||
private currentCoordinate;
|
||||
private currentId;
|
||||
private keyEvents;
|
||||
private cursors;
|
||||
private mouseMove;
|
||||
private snapping;
|
||||
private snappedPointId;
|
||||
private showCoordinatePoints;
|
||||
private mutateFeature;
|
||||
private readFeature;
|
||||
private pixelDistance;
|
||||
private closingPoints;
|
||||
private clickBoundingBox;
|
||||
private lineSnapping;
|
||||
private coordinateSnapping;
|
||||
private featureSnapping;
|
||||
private degreeSnapping;
|
||||
private coordinatePoints;
|
||||
constructor(options?: TerraDrawPolyLineModeOptions<PolyLineStyling>);
|
||||
updateOptions(options?: ModeUpdateOptions<TerraDrawPolyLineModeOptions<PolyLineStyling>>): void;
|
||||
/** @internal */
|
||||
registerBehaviors(config: BehaviorConfig): void;
|
||||
/** @internal */
|
||||
start(): void;
|
||||
/** @internal */
|
||||
stop(): void;
|
||||
private finishLine;
|
||||
private toPolygonLikeCoordinates;
|
||||
private closeAsPolygon;
|
||||
/** @internal */
|
||||
onMouseMove(event: TerraDrawMouseEvent): void;
|
||||
private onLeftClick;
|
||||
/** @internal */
|
||||
onClick(event: TerraDrawMouseEvent): void;
|
||||
/** @internal */
|
||||
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
||||
/** @internal */
|
||||
onKeyDown(): void;
|
||||
/** @internal */
|
||||
onDragStart(): void;
|
||||
/** @internal */
|
||||
onDrag(): void;
|
||||
/** @internal */
|
||||
onDragEnd(): void;
|
||||
/** @internal */
|
||||
cleanUp(): void;
|
||||
private updateSnappedCoordinate;
|
||||
private snapCoordinate;
|
||||
/** @internal */
|
||||
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
||||
afterFeatureAdded(feature: GeoJSONStoreFeatures): void;
|
||||
afterFeatureUpdated(feature: GeoJSONStoreFeatures): void;
|
||||
validateFeature(feature: unknown): StoreValidation;
|
||||
}
|
||||
export {};
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
|
||||
import { FeatureId } from "../extend";
|
||||
import { GeoJSONStoreGeometries, JSONObject } from "../store/store";
|
||||
import { Position, Point } from "geojson";
|
||||
export declare class ReadFeatureBehavior extends TerraDrawModeBehavior {
|
||||
constructor(config: BehaviorConfig);
|
||||
getGeometryType(featureId: FeatureId): "Polygon" | "LineString" | "Point";
|
||||
coordinateAtIndexIsIdentical({ featureId, newCoordinate, index, }: {
|
||||
featureId: FeatureId;
|
||||
newCoordinate: Position;
|
||||
index: number;
|
||||
}): boolean;
|
||||
getGeometry<G extends GeoJSONStoreGeometries>(featureId: FeatureId): G;
|
||||
getCoordinates<G extends Exclude<GeoJSONStoreGeometries, Point>>(featureId: FeatureId): Position[];
|
||||
getCoordinate<G extends Exclude<GeoJSONStoreGeometries, Point>>(featureId: FeatureId, index: number): Position;
|
||||
getProperties(featureId: FeatureId): {
|
||||
[x: string]: import("../store/store").JSON;
|
||||
};
|
||||
hasFeature(featureId: FeatureId): boolean;
|
||||
getAllFeatureIdsWhere(equals: (properties: JSONObject) => boolean): FeatureId[];
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor, DrawInteractions } from "../../common";
|
||||
import { GeoJSONStoreFeatures, StoreValidation } from "../../store/store";
|
||||
import { BaseModeOptions, CustomStyling, ModeUpdateOptions, TerraDrawBaseDrawMode } from "../base.mode";
|
||||
import { BehaviorConfig } from "../base.behavior";
|
||||
type TerraDrawRectangleModeKeyEvents = {
|
||||
cancel: KeyboardEvent["key"] | null;
|
||||
finish: KeyboardEvent["key"] | null;
|
||||
};
|
||||
type RectanglePolygonStyling = {
|
||||
fillColor: HexColorStyling;
|
||||
fillOpacity: NumericStyling;
|
||||
outlineColor: HexColorStyling;
|
||||
outlineOpacity: NumericStyling;
|
||||
outlineWidth: NumericStyling;
|
||||
coordinatePointWidth: NumericStyling;
|
||||
coordinatePointColor: HexColorStyling;
|
||||
coordinatePointOpacity: NumericStyling;
|
||||
coordinatePointOutlineWidth: NumericStyling;
|
||||
coordinatePointOutlineColor: HexColorStyling;
|
||||
coordinatePointOutlineOpacity: NumericStyling;
|
||||
};
|
||||
interface Cursors {
|
||||
start?: Cursor;
|
||||
}
|
||||
interface TerraDrawRectangleModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
||||
keyEvents?: TerraDrawRectangleModeKeyEvents | null;
|
||||
cursors?: Cursors;
|
||||
drawInteraction?: DrawInteractions;
|
||||
showCoordinatePoints?: boolean;
|
||||
}
|
||||
export declare class TerraDrawRectangleMode extends TerraDrawBaseDrawMode<RectanglePolygonStyling> {
|
||||
mode: string;
|
||||
private startPosition;
|
||||
private endPosition;
|
||||
private currentRectangleId;
|
||||
private keyEvents;
|
||||
private cursors;
|
||||
private drawInteraction;
|
||||
private drawType;
|
||||
private showCoordinatePoints;
|
||||
private mutateFeature;
|
||||
private readFeature;
|
||||
private coordinatePoints;
|
||||
constructor(options?: TerraDrawRectangleModeOptions<RectanglePolygonStyling>);
|
||||
updateOptions(options?: ModeUpdateOptions<TerraDrawRectangleModeOptions<RectanglePolygonStyling>>): void;
|
||||
private updateRectangle;
|
||||
private close;
|
||||
private beginDrawing;
|
||||
/** TODO: Probably should be private? */
|
||||
/** @internal */
|
||||
moveDrawAllowed(): boolean;
|
||||
/** TODO: Probably should be private? */
|
||||
/** @internal */
|
||||
dragDrawAllowed(): boolean;
|
||||
/** @internal */
|
||||
start(): void;
|
||||
/** @internal */
|
||||
stop(): void;
|
||||
/** @internal */
|
||||
onClick(event: TerraDrawMouseEvent): void;
|
||||
/** @internal */
|
||||
onMouseMove(event: TerraDrawMouseEvent): void;
|
||||
/** @internal */
|
||||
onKeyDown(): void;
|
||||
/** @internal */
|
||||
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
||||
/** @internal */
|
||||
onDragStart(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
||||
/** @internal */
|
||||
onDrag(event: TerraDrawMouseEvent, _setMapDraggability: (enabled: boolean) => void): void;
|
||||
/** @internal */
|
||||
onDragEnd(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
||||
/** @internal */
|
||||
cleanUp(): void;
|
||||
/** @internal */
|
||||
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
||||
validateFeature(feature: unknown): StoreValidation;
|
||||
afterFeatureUpdated(feature: GeoJSONStoreFeatures): void;
|
||||
afterFeatureAdded(feature: GeoJSONStoreFeatures): void;
|
||||
registerBehaviors(config: BehaviorConfig): void;
|
||||
}
|
||||
export {};
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
import { HexColorStyling, NumericStyling, TerraDrawAdapterStyling } from "../../common";
|
||||
import { BaseModeOptions, CustomStyling, ModeTypes, ModeUpdateOptions, TerraDrawBaseDrawMode } from "../base.mode";
|
||||
import { BehaviorConfig } from "../base.behavior";
|
||||
import { GeoJSONStoreFeatures } from "../../terra-draw";
|
||||
import { StoreValidation } from "../../store/store";
|
||||
type RenderModeStyling = {
|
||||
pointColor: HexColorStyling;
|
||||
pointWidth: NumericStyling;
|
||||
pointOpacity: NumericStyling;
|
||||
pointOutlineColor: HexColorStyling;
|
||||
pointOutlineOpacity: NumericStyling;
|
||||
pointOutlineWidth: NumericStyling;
|
||||
polygonFillColor: HexColorStyling;
|
||||
polygonFillOpacity: NumericStyling;
|
||||
polygonOutlineColor: HexColorStyling;
|
||||
polygonOutlineWidth: NumericStyling;
|
||||
lineStringWidth: NumericStyling;
|
||||
lineStringColor: HexColorStyling;
|
||||
lineStringOpacity: NumericStyling;
|
||||
zIndex: NumericStyling;
|
||||
};
|
||||
interface TerraDrawRenderModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
||||
styles: Partial<T>;
|
||||
}
|
||||
export declare class TerraDrawRenderMode extends TerraDrawBaseDrawMode<RenderModeStyling> {
|
||||
type: ModeTypes;
|
||||
mode: string;
|
||||
constructor(options: TerraDrawRenderModeOptions<RenderModeStyling>);
|
||||
updateOptions(options?: ModeUpdateOptions<TerraDrawRenderModeOptions<RenderModeStyling>>): void;
|
||||
/** @internal */
|
||||
registerBehaviors(behaviorConfig: BehaviorConfig): void;
|
||||
/** @internal */
|
||||
start(): void;
|
||||
/** @internal */
|
||||
stop(): void;
|
||||
/** @internal */
|
||||
onKeyUp(): void;
|
||||
/** @internal */
|
||||
onKeyDown(): void;
|
||||
/** @internal */
|
||||
onClick(): void;
|
||||
/** @internal */
|
||||
onDragStart(): void;
|
||||
/** @internal */
|
||||
onDrag(): void;
|
||||
/** @internal */
|
||||
onDragEnd(): void;
|
||||
/** @internal */
|
||||
onMouseMove(): void;
|
||||
/** @internal */
|
||||
cleanUp(): void;
|
||||
/** @internal */
|
||||
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
||||
validateFeature(feature: unknown): StoreValidation;
|
||||
}
|
||||
export {};
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor, OneDimensionalSnapping } from "../../common";
|
||||
import { TerraDrawBaseDrawMode, BaseModeOptions, CustomStyling, ModeUpdateOptions } from "../base.mode";
|
||||
import { GeoJSONStoreFeatures, StoreValidation } from "../../store/store";
|
||||
import { BehaviorConfig } from "../base.behavior";
|
||||
type TerraDrawSectorModeKeyEvents = {
|
||||
cancel?: KeyboardEvent["key"] | null;
|
||||
finish?: KeyboardEvent["key"] | null;
|
||||
};
|
||||
type SectorPolygonStyling = {
|
||||
snappingPointColor: HexColorStyling;
|
||||
snappingPointWidth: NumericStyling;
|
||||
snappingPointOpacity: NumericStyling;
|
||||
snappingPointOutlineColor: HexColorStyling;
|
||||
snappingPointOutlineWidth: NumericStyling;
|
||||
snappingPointOutlineOpacity: NumericStyling;
|
||||
fillColor: HexColorStyling;
|
||||
outlineColor: HexColorStyling;
|
||||
outlineWidth: NumericStyling;
|
||||
outlineOpacity: NumericStyling;
|
||||
fillOpacity: NumericStyling;
|
||||
coordinatePointWidth: NumericStyling;
|
||||
coordinatePointColor: HexColorStyling;
|
||||
coordinatePointOpacity: NumericStyling;
|
||||
coordinatePointOutlineWidth: NumericStyling;
|
||||
coordinatePointOutlineColor: HexColorStyling;
|
||||
coordinatePointOutlineOpacity: NumericStyling;
|
||||
};
|
||||
interface Cursors {
|
||||
start?: Cursor;
|
||||
close?: Cursor;
|
||||
}
|
||||
interface TerraDrawSectorModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
||||
/** Snap the center and initial radius endpoint only. */
|
||||
snapping?: OneDimensionalSnapping;
|
||||
arcPoints?: number;
|
||||
pointerDistance?: number;
|
||||
keyEvents?: TerraDrawSectorModeKeyEvents | null;
|
||||
cursors?: Cursors;
|
||||
showCoordinatePoints?: boolean;
|
||||
/** Allow reversing the arc by crossing back over its starting radius. Defaults to false. */
|
||||
allowDirectionChange?: boolean;
|
||||
}
|
||||
export declare class TerraDrawSectorMode extends TerraDrawBaseDrawMode<SectorPolygonStyling> {
|
||||
mode: string;
|
||||
private snapping;
|
||||
private snappedPointId;
|
||||
private currentCoordinate;
|
||||
private currentId;
|
||||
private keyEvents;
|
||||
private direction;
|
||||
private arcPoints;
|
||||
private cursors;
|
||||
private mouseMove;
|
||||
private showCoordinatePoints;
|
||||
private allowDirectionChange;
|
||||
private previousEndBearing;
|
||||
private coordinateSnapping;
|
||||
private featureSnapping;
|
||||
private readFeature;
|
||||
private mutateFeature;
|
||||
private coordinatePoints;
|
||||
constructor(options?: TerraDrawSectorModeOptions<SectorPolygonStyling>);
|
||||
updateOptions(options?: ModeUpdateOptions<TerraDrawSectorModeOptions<SectorPolygonStyling>>): void;
|
||||
private updateSnappedCoordinate;
|
||||
private deleteSnappedPoint;
|
||||
private getSnappedCoordinate;
|
||||
private close;
|
||||
private getSectorCoordinates;
|
||||
/** @internal */
|
||||
start(): void;
|
||||
/** @internal */
|
||||
stop(): void;
|
||||
/** @internal */
|
||||
onMouseMove(event: TerraDrawMouseEvent): void;
|
||||
/** @internal */
|
||||
onClick(event: TerraDrawMouseEvent): void;
|
||||
/** @internal */
|
||||
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
||||
/** @internal */
|
||||
onKeyDown(): void;
|
||||
/** @internal */
|
||||
onDragStart(): void;
|
||||
/** @internal */
|
||||
onDrag(): void;
|
||||
/** @internal */
|
||||
onDragEnd(): void;
|
||||
/** @internal */
|
||||
cleanUp(): void;
|
||||
/** @internal */
|
||||
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
||||
validateFeature(feature: unknown): StoreValidation;
|
||||
afterFeatureUpdated(feature: GeoJSONStoreFeatures): void;
|
||||
registerBehaviors(config: BehaviorConfig): void;
|
||||
}
|
||||
export {};
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
Generated
Vendored
+27
@@ -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;
|
||||
}
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
Generated
Vendored
+71
@@ -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;
|
||||
}
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
Generated
Vendored
+37
@@ -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;
|
||||
}
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+26
@@ -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;
|
||||
}
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
Generated
Vendored
+14
@@ -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;
|
||||
};
|
||||
}
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+36
@@ -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;
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+23
@@ -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;
|
||||
}
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+11
@@ -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;
|
||||
}
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
Generated
Vendored
+27
@@ -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;
|
||||
}
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+153
@@ -0,0 +1,153 @@
|
||||
import { TerraDrawMouseEvent, TerraDrawKeyboardEvent, TerraDrawAdapterStyling, HexColorStyling, NumericStyling, Cursor, Validation, Snapping, UrlStyling, DashArrayStyling, MarkerAnchorStyling } from "../../common";
|
||||
import { BaseModeOptions, CustomStyling, ModeUpdateOptions, TerraDrawBaseSelectMode } from "../base.mode";
|
||||
import { BehaviorConfig } from "../base.behavior";
|
||||
import { FeatureId, GeoJSONStoreFeatures } from "../../store/store";
|
||||
import { ResizeOptions } from "./behaviors/drag-coordinate-resize.behavior";
|
||||
type TerraDrawSelectModeKeyEvents = {
|
||||
deselect: KeyboardEvent["key"] | null;
|
||||
delete: KeyboardEvent["key"] | null;
|
||||
rotate: KeyboardEvent["key"][] | null;
|
||||
scale: KeyboardEvent["key"][] | null;
|
||||
};
|
||||
type ModeFlags = {
|
||||
feature?: {
|
||||
validation?: Validation;
|
||||
draggable?: boolean;
|
||||
rotateable?: boolean;
|
||||
scaleable?: boolean;
|
||||
selfIntersectable?: boolean;
|
||||
coordinates?: {
|
||||
snappable?: boolean | Snapping;
|
||||
midpoints?: boolean | {
|
||||
draggable?: boolean;
|
||||
};
|
||||
draggable?: boolean;
|
||||
resizable?: ResizeOptions;
|
||||
deletable?: boolean;
|
||||
};
|
||||
};
|
||||
};
|
||||
type SelectionStyling = {
|
||||
selectedPointColor: HexColorStyling;
|
||||
selectedPointWidth: NumericStyling;
|
||||
selectedPointOpacity: NumericStyling;
|
||||
selectedPointOutlineColor: HexColorStyling;
|
||||
selectedPointOutlineWidth: NumericStyling;
|
||||
selectedPointOutlineOpacity: NumericStyling;
|
||||
selectedMarkerUrl: UrlStyling;
|
||||
selectedMarkerHeight: NumericStyling;
|
||||
selectedMarkerWidth: NumericStyling;
|
||||
selectedMarkerAnchor: MarkerAnchorStyling;
|
||||
selectedLineStringColor: HexColorStyling;
|
||||
selectedLineStringWidth: NumericStyling;
|
||||
selectedLineStringOpacity: NumericStyling;
|
||||
selectedLineStringDash: DashArrayStyling;
|
||||
selectedPolygonColor: HexColorStyling;
|
||||
selectedPolygonFillOpacity: NumericStyling;
|
||||
selectedPolygonOutlineColor: HexColorStyling;
|
||||
selectedPolygonOutlineOpacity: NumericStyling;
|
||||
selectedPolygonOutlineWidth: NumericStyling;
|
||||
selectionPointWidth: NumericStyling;
|
||||
selectionPointColor: HexColorStyling;
|
||||
selectionPointOpacity: NumericStyling;
|
||||
selectionPointOutlineColor: HexColorStyling;
|
||||
selectionPointOutlineWidth: NumericStyling;
|
||||
selectionPointOutlineOpacity: NumericStyling;
|
||||
midPointColor: HexColorStyling;
|
||||
midPointOutlineColor: HexColorStyling;
|
||||
midPointOpacity: NumericStyling;
|
||||
midPointWidth: NumericStyling;
|
||||
midPointOutlineWidth: NumericStyling;
|
||||
midPointOutlineOpacity: NumericStyling;
|
||||
};
|
||||
interface Cursors {
|
||||
pointerOver?: Cursor;
|
||||
pointerOverFeature?: Cursor;
|
||||
pointerOverCoordinate?: Cursor;
|
||||
pointerOverResizeHandle?: Cursor;
|
||||
dragStart?: Cursor;
|
||||
dragEnd?: Cursor;
|
||||
insertMidpoint?: Cursor;
|
||||
}
|
||||
interface TerraDrawSelectModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
||||
pointerDistance?: number;
|
||||
flags?: {
|
||||
[mode: string]: ModeFlags;
|
||||
};
|
||||
keyEvents?: TerraDrawSelectModeKeyEvents | null;
|
||||
dragEventThrottle?: number;
|
||||
cursors?: Cursors;
|
||||
allowManualDeselection?: boolean;
|
||||
allowManualSelection?: boolean;
|
||||
}
|
||||
export declare class TerraDrawSelectMode extends TerraDrawBaseSelectMode<SelectionStyling> {
|
||||
mode: string;
|
||||
private allowManualDeselection;
|
||||
private allowManualSelection;
|
||||
private dragEventThrottle;
|
||||
private dragEventCount;
|
||||
private selected;
|
||||
private flags;
|
||||
private keyEvents;
|
||||
private cursors;
|
||||
private validations;
|
||||
private dragTarget;
|
||||
private selectionPoints;
|
||||
private midPoints;
|
||||
private coordinateSnap;
|
||||
private featuresAtMouseEvent;
|
||||
private pixelDistance;
|
||||
private clickBoundingBox;
|
||||
private dragFeature;
|
||||
private dragCoordinate;
|
||||
private rotateFeature;
|
||||
private scaleFeature;
|
||||
private dragCoordinateResizeFeature;
|
||||
private coordinatePoints;
|
||||
private lineSnap;
|
||||
private mutateFeature;
|
||||
private readFeature;
|
||||
private getPointerOverFeatureCursor;
|
||||
private getPointerOverCoordinateCursor;
|
||||
private getPointerOverResizeHandleCursor;
|
||||
constructor(options?: TerraDrawSelectModeOptions<SelectionStyling>);
|
||||
updateOptions(options?: ModeUpdateOptions<TerraDrawSelectModeOptions<SelectionStyling>>): void;
|
||||
selectFeature(featureId: FeatureId): void;
|
||||
setSelecting(): void;
|
||||
registerBehaviors(config: BehaviorConfig): void;
|
||||
deselectFeature(id: FeatureId): void;
|
||||
private deselect;
|
||||
private deleteSelected;
|
||||
private clearDragTargetAndCursor;
|
||||
private getSelectedFlags;
|
||||
private onRightClick;
|
||||
private select;
|
||||
private onLeftClick;
|
||||
/** @internal */
|
||||
start(): void;
|
||||
/** @internal */
|
||||
stop(): void;
|
||||
/** @internal */
|
||||
onClick(event: TerraDrawMouseEvent): void;
|
||||
private canScale;
|
||||
private canRotate;
|
||||
private preventDefaultKeyEvent;
|
||||
/** @internal */
|
||||
onKeyDown(event: TerraDrawKeyboardEvent): void;
|
||||
/** @internal */
|
||||
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
||||
/** @internal */
|
||||
cleanUp(): void;
|
||||
/** @internal */
|
||||
onDragStart(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
||||
/** @internal */
|
||||
onDrag(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
||||
/** @internal */
|
||||
onDragEnd(event: TerraDrawMouseEvent, setMapDraggability: (enabled: boolean) => void): void;
|
||||
/** @internal */
|
||||
onMouseMove(event: TerraDrawMouseEvent): void;
|
||||
/** @internal */
|
||||
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
||||
afterFeatureUpdated(feature: GeoJSONStoreFeatures): void;
|
||||
}
|
||||
export {};
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
import { TerraDrawMouseEvent, TerraDrawAdapterStyling, TerraDrawKeyboardEvent, HexColorStyling, NumericStyling, Cursor } from "../../common";
|
||||
import { TerraDrawBaseDrawMode, BaseModeOptions, CustomStyling, ModeUpdateOptions } from "../base.mode";
|
||||
import { GeoJSONStoreFeatures, StoreValidation } from "../../store/store";
|
||||
import { BehaviorConfig } from "../base.behavior";
|
||||
type TerraDrawSensorModeKeyEvents = {
|
||||
cancel?: KeyboardEvent["key"] | null;
|
||||
finish?: KeyboardEvent["key"] | null;
|
||||
};
|
||||
type SensorPolygonStyling = {
|
||||
centerPointColor: HexColorStyling;
|
||||
centerPointWidth: NumericStyling;
|
||||
centerPointOpacity: NumericStyling;
|
||||
centerPointOutlineColor: HexColorStyling;
|
||||
centerPointOutlineWidth: NumericStyling;
|
||||
centerPointOutlineOpacity: NumericStyling;
|
||||
outlineColor: HexColorStyling;
|
||||
outlineWidth: NumericStyling;
|
||||
outlineOpacity: NumericStyling;
|
||||
fillColor: HexColorStyling;
|
||||
fillOpacity: NumericStyling;
|
||||
coordinatePointWidth: NumericStyling;
|
||||
coordinatePointColor: HexColorStyling;
|
||||
coordinatePointOpacity: NumericStyling;
|
||||
coordinatePointOutlineWidth: NumericStyling;
|
||||
coordinatePointOutlineColor: HexColorStyling;
|
||||
coordinatePointOutlineOpacity: NumericStyling;
|
||||
};
|
||||
interface Cursors {
|
||||
start?: Cursor;
|
||||
close?: Cursor;
|
||||
}
|
||||
interface TerraDrawSensorModeOptions<T extends CustomStyling> extends BaseModeOptions<T> {
|
||||
arcPoints?: number;
|
||||
pointerDistance?: number;
|
||||
keyEvents?: TerraDrawSensorModeKeyEvents | null;
|
||||
cursors?: Cursors;
|
||||
showCoordinatePoints?: boolean;
|
||||
/** Allow reversing the arc by crossing back over its starting radius. Defaults to false. */
|
||||
allowDirectionChange?: boolean;
|
||||
}
|
||||
export declare class TerraDrawSensorMode extends TerraDrawBaseDrawMode<SensorPolygonStyling> {
|
||||
mode: string;
|
||||
private currentCoordinate;
|
||||
private currentId;
|
||||
private currentInitialArcId;
|
||||
private currentStartingPointId;
|
||||
private keyEvents;
|
||||
private direction;
|
||||
private arcPoints;
|
||||
private cursors;
|
||||
private mouseMove;
|
||||
private showCoordinatePoints;
|
||||
private allowDirectionChange;
|
||||
private previousEndBearing;
|
||||
private readFeature;
|
||||
private mutateFeature;
|
||||
private coordinatePoints;
|
||||
constructor(options?: TerraDrawSensorModeOptions<SensorPolygonStyling>);
|
||||
updateOptions(options?: ModeUpdateOptions<TerraDrawSensorModeOptions<SensorPolygonStyling>>): void;
|
||||
/** @internal */
|
||||
start(): void;
|
||||
/** @internal */
|
||||
stop(): void;
|
||||
/** @internal */
|
||||
onMouseMove(event: TerraDrawMouseEvent): void;
|
||||
/** @internal */
|
||||
onClick(event: TerraDrawMouseEvent): void;
|
||||
/** @internal */
|
||||
onKeyUp(event: TerraDrawKeyboardEvent): void;
|
||||
/** @internal */
|
||||
onKeyDown(): void;
|
||||
/** @internal */
|
||||
onDragStart(): void;
|
||||
/** @internal */
|
||||
onDrag(): void;
|
||||
/** @internal */
|
||||
onDragEnd(): void;
|
||||
/** @internal */
|
||||
cleanUp(): void;
|
||||
/** @internal */
|
||||
styleFeature(feature: GeoJSONStoreFeatures): TerraDrawAdapterStyling;
|
||||
validateFeature(feature: unknown): StoreValidation;
|
||||
afterFeatureUpdated(feature: GeoJSONStoreFeatures): void;
|
||||
registerBehaviors(config: BehaviorConfig): void;
|
||||
private updateInitialArcCoordinatePoints;
|
||||
private deleteInitialArc;
|
||||
private close;
|
||||
private getUpdatedPolygonCoordinates;
|
||||
private getUpdatedLineStringCoordinates;
|
||||
private getDeltaBearing;
|
||||
private notInSector;
|
||||
}
|
||||
export {};
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
import { TerraDrawAdapterStyling } from "../../common";
|
||||
import { ModeTypes, TerraDrawBaseDrawMode } from "../base.mode";
|
||||
type StaticModeStylingExt<T extends TerraDrawAdapterStyling> = {};
|
||||
type StaticModeStyling = StaticModeStylingExt<TerraDrawAdapterStyling>;
|
||||
export declare class TerraDrawStaticMode extends TerraDrawBaseDrawMode<StaticModeStyling> {
|
||||
type: ModeTypes;
|
||||
mode: "static";
|
||||
start(): void;
|
||||
stop(): void;
|
||||
onKeyUp(): void;
|
||||
onKeyDown(): void;
|
||||
onClick(): void;
|
||||
onDragStart(): void;
|
||||
onDrag(): void;
|
||||
onDragEnd(): void;
|
||||
onMouseMove(): void;
|
||||
cleanUp(): void;
|
||||
styleFeature(): {
|
||||
pointColor: import("../../common").HexColor;
|
||||
pointWidth: number;
|
||||
pointOpacity?: number;
|
||||
pointOutlineColor: import("../../common").HexColor;
|
||||
pointOutlineOpacity?: number;
|
||||
pointOutlineWidth: number;
|
||||
polygonFillColor: import("../../common").HexColor;
|
||||
polygonFillOpacity: number;
|
||||
polygonOutlineColor: import("../../common").HexColor;
|
||||
polygonOutlineOpacity?: number;
|
||||
polygonOutlineWidth: number;
|
||||
lineStringWidth: number;
|
||||
lineStringColor: import("../../common").HexColor;
|
||||
lineStringOpacity?: number;
|
||||
lineStringDash?: import("../../common").DashArrayStyling;
|
||||
zIndex: number;
|
||||
markerUrl?: string;
|
||||
markerHeight?: number;
|
||||
markerWidth?: number;
|
||||
markerAnchor?: "center" | "top" | "bottom" | "left" | "right" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
||||
};
|
||||
}
|
||||
export {};
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
type UndoRedoHistoryEntry<Coordinates> = {
|
||||
featureCoordinates: Coordinates;
|
||||
currentCoordinate: number;
|
||||
};
|
||||
type UndoStepResult<Coordinates> = {
|
||||
undoneEntry: UndoRedoHistoryEntry<Coordinates>;
|
||||
previousEntry: UndoRedoHistoryEntry<Coordinates> | undefined;
|
||||
};
|
||||
type UndoRedoBehaviorOptions = {
|
||||
maxStackSize?: number;
|
||||
};
|
||||
export declare class UndoRedoBehavior<Coordinates> {
|
||||
private undoHistory;
|
||||
private redoHistory;
|
||||
private cloneCoordinatesFunction;
|
||||
private maxStackSize;
|
||||
constructor(options?: UndoRedoBehaviorOptions);
|
||||
setMaxStackSize(maxStackSize: number): void;
|
||||
private trimHistoryToMax;
|
||||
private pushUndoEntry;
|
||||
private pushRedoEntry;
|
||||
private cloneRecursively;
|
||||
cloneCoordinates(coordinates: Coordinates): Coordinates;
|
||||
private cloneEntry;
|
||||
clear(): void;
|
||||
undoSize(): number;
|
||||
redoSize(): number;
|
||||
recordSnapshot(entry: UndoRedoHistoryEntry<Coordinates>): void;
|
||||
beginUndo(): UndoStepResult<Coordinates> | undefined;
|
||||
takeRedo(): UndoRedoHistoryEntry<Coordinates> | undefined;
|
||||
commitRedo(entry: UndoRedoHistoryEntry<Coordinates>): void;
|
||||
}
|
||||
export {};
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
Reference in new issue
Block a user