UNPKG

rlayers

Version:

React Components for OpenLayers

49 lines 2.1 kB
import { MapBrowserEvent } from 'ol'; import { default as Draw, DrawEvent } from 'ol/interaction/Draw'; import { StyleLike } from 'ol/style/Style'; import { default as RPointer } from './RPointer'; /** * @propsfor RDraw */ export interface RDrawProps { /** Type of the geometry */ type: 'Point' | 'LineString' | 'LinearRing' | 'Polygon' | 'MultiPoint' | 'MultiLineString' | 'MultiPolygon' | 'GeometryCollection' | 'Circle'; /** An optionnal condition for triggering the interaction * @default noModifierKeys */ condition?: (e: MapBrowserEvent<PointerEvent | KeyboardEvent | WheelEvent>) => boolean; /** An optional OpenLayers condition to allow the interaction to finish */ finishCondition?: (e: MapBrowserEvent<PointerEvent | KeyboardEvent | WheelEvent>) => boolean; /** An optional OpenLayers condition to activate freehand drawing * @default shiftKeyOnly */ freehandCondition?: (e: MapBrowserEvent<PointerEvent | KeyboardEvent | WheelEvent>) => boolean; /** * Style for rendering while drawing, supports only Openlayers styles. * Once the interaction is finished, the resulting feature will adopt * the style of its layer. */ style?: StyleLike; /** Do not trigger pointer events while the interaction is active */ stopClick?: boolean; /** Maximum number of points allowed per feature * @default Infinity */ maxPoints?: number; /** Minimum number of points allowed per feature * @default 2-3 */ minPoints?: number; /** Snap tolerance in pixels * @default 12 */ snapTolerance?: number; /** Called on draw start */ onDrawStart?: (this: RDraw, e: DrawEvent) => void; /** Called on draw end */ onDrawEnd?: (this: RDraw, e: DrawEvent) => void; /** Called on draw cancel */ onDrawAbort?: (this: RDraw, e: DrawEvent) => void; } /** Pointer interaction for drawing features */ export default class RDraw extends RPointer<RDrawProps> { protected static classProps: string[]; ol: Draw; createOL(props: RDrawProps): Draw; } //# sourceMappingURL=RDraw.d.ts.map