@bdh-gis/mapbox-gl-locate
v1.5.0
Published
Locate for mapbox controls
Downloads
23
Readme
🏷️ @bdh-gis/mapbox-gl-locate
定位
npm i @bdh-gis/mapbox-gl-locate
import Locate from '@bdh-gis/mapbox-gl-locate';
import '@bdh-gis/mapbox-gl-locate/src/index.css';
map.addControl(new Locate({
lon: 126.566551,
lat: 45.777201,
}));
Options
export type AnyEvent =
| 'CONTROL_BUTTON_CLICK'
| 'CREATE_BUTTONS'
| 'CREATE_PANEL'
| 'PANEL_CLOSE'
| 'LON_CHANGE'
| 'LAT_CHANGE'
| 'SET_CURRENT_LOCATION'
| 'LOCATE';
export type Panel = {
header?: HTMLDivElement;
headerTitle?: HTMLDivElement;
headerClose?: HTMLDivElement;
body?: HTMLDivElement;
bodyEditRows?: {
row: HTMLDivElement;
rowLabel: HTMLDivElement;
rowInput: HTMLInputElement;
}[];
bodyButtonsRow?: HTMLDivElement;
bodyButtons?: HTMLDivElement[];
lon?: string | number;
lat?: string | number;
};
export type Options = {
lon?: string | number;
lat?: string | number;
isCreateButtons?: boolean;
isCreatePanel?: boolean;
buttons?: Utils.ButtonOptions[];
panelContainer?: HTMLDivElement;
panel?: {
header: Utils.PanelOptions;
body: {
editRows: Utils.EditRow[];
buttonsRow: Utils.RowButton[];
};
};
onEvents?: (event: AnyEvent, data?: any) => void;
};