vue-maplibre-gl
Version:
Vue 3 plugin for maplibre-gl
49 lines (48 loc) • 1.37 kB
TypeScript
import { FitBoundsOptions } from '../../types.ts';
import { Feature, Polygon, Position } from 'geojson';
import { LayerSpecification, LngLat } from 'maplibre-gl';
export declare enum DrawMode {
POLYGON = "POLYGON",
CIRCLE = "CIRCLE",
CIRCLE_STATIC = "CIRCLE_STATIC"
}
export interface DrawPluginOptions {
mode?: DrawMode;
styles?: DrawStyle[];
onUpdate?: OnUpdateHandler;
autoZoom?: boolean;
fitBoundsOptions?: FitBoundsOptions;
minArea?: {
size?: number;
color?: string;
label?: string;
};
pointerPrecision?: PointerPrecisionOption;
waitForSetup?: boolean;
circleMode?: {
creationSize: number;
};
}
export interface PointerPrecisionOption {
mouse: number;
touch: number;
}
type WithoutSource<T> = T extends any ? Omit<T, 'source'> : never;
export type DrawStyle = WithoutSource<LayerSpecification>;
export interface DrawFeatureProperties {
center?: Position;
radius?: number;
area?: number;
tooSmall?: boolean;
minSizeLabel?: string;
hasHelperVertex?: boolean;
meta: 'polygon' | 'circle' | 'vertex' | 'midpoint';
}
export interface DrawModeSnapshot {
polygon: Position[];
point?: Position;
start: LngLat;
}
export type DrawModel = Feature<Polygon, DrawFeatureProperties>;
export type OnUpdateHandler = (m: DrawModel) => void;
export {};