83 lines
3.2 KiB
TypeScript
83 lines
3.2 KiB
TypeScript
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 {};
|