terra-draw
Version:
Frictionless map drawing across mapping provider
22 lines (21 loc) • 1.24 kB
TypeScript
import { BehaviorConfig, TerraDrawModeBehavior } from "./base.behavior";
import { 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): {
coordinate: undefined | Position;
minDist: number;
featureId: undefined | FeatureId;
featureCoordinateIndex: undefined | number;
};
}