UNPKG

terra-draw

Version:

Frictionless map drawing across mapping provider

17 lines (16 loc) 1.08 kB
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; }