mirror of
https://github.com/visgl/react-map-gl.git
synced 2026-01-18 15:54:22 +00:00
Remap event types (#2207)
This commit is contained in:
parent
8ad14cafcf
commit
c15e571943
@ -38,6 +38,7 @@ import {
|
||||
} from './components/scale-control';
|
||||
import {useMap as _useMap} from './components/use-map';
|
||||
import type {MapRef as _MapRef} from './mapbox/create-ref';
|
||||
import type * as events from './types/events';
|
||||
|
||||
export function useMap() {
|
||||
return _useMap<MapboxMap>();
|
||||
@ -106,3 +107,22 @@ export default Map;
|
||||
export * from './types/public';
|
||||
export type {SourceProps} from './components/source';
|
||||
export type {LayerProps} from './components/layer';
|
||||
|
||||
// Events
|
||||
export type MapEvent = events.MapEvent<MapboxMap>;
|
||||
export type ErrorEvent = events.ErrorEvent<MapboxMap>;
|
||||
export type MapStyleDataEvent = events.MapStyleDataEvent<MapboxMap>;
|
||||
export type MapSourceDataEvent = events.MapSourceDataEvent<MapboxMap>;
|
||||
export type MapMouseEvent = events.MapMouseEvent<MapboxMap>;
|
||||
export type MapLayerMouseEvent = events.MapLayerMouseEvent<MapboxMap>;
|
||||
export type MapTouchEvent = events.MapTouchEvent<MapboxMap>;
|
||||
export type MapLayerTouchEvent = events.MapLayerTouchEvent<MapboxMap>;
|
||||
export type MapWheelEvent = events.MapWheelEvent<MapboxMap>;
|
||||
export type MapBoxZoomEvent = events.MapBoxZoomEvent<MapboxMap>;
|
||||
export type ViewStateChangeEvent = events.ViewStateChangeEvent<MapboxMap>;
|
||||
export type PopupEvent = events.PopupEvent<MapboxPopup>;
|
||||
export type MarkerEvent = events.MarkerEvent<MapboxMarker>;
|
||||
export type MarkerDragEvent = events.MarkerDragEvent<MapboxMarker>;
|
||||
export type GeolocateEvent = events.GeolocateEvent<MapboxGeolocateControl>;
|
||||
export type GeolocateResultEvent = events.GeolocateResultEvent<MapboxGeolocateControl>;
|
||||
export type GeolocateErrorEvent = events.GeolocateErrorEvent<MapboxGeolocateControl>;
|
||||
|
||||
@ -38,6 +38,7 @@ import {
|
||||
} from './components/scale-control';
|
||||
import {useMap as _useMap} from './components/use-map';
|
||||
import type {MapRef as _MapRef} from './mapbox/create-ref';
|
||||
import type * as events from './types/events';
|
||||
|
||||
export function useMap() {
|
||||
return _useMap<MaplibreMap>();
|
||||
@ -106,3 +107,22 @@ export default Map;
|
||||
export * from './types/public';
|
||||
export type {SourceProps} from './components/source';
|
||||
export type {LayerProps} from './components/layer';
|
||||
|
||||
// Events
|
||||
export type MapEvent = events.MapEvent<MaplibreMap>;
|
||||
export type ErrorEvent = events.ErrorEvent<MaplibreMap>;
|
||||
export type MapStyleDataEvent = events.MapStyleDataEvent<MaplibreMap>;
|
||||
export type MapSourceDataEvent = events.MapSourceDataEvent<MaplibreMap>;
|
||||
export type MapMouseEvent = events.MapMouseEvent<MaplibreMap>;
|
||||
export type MapLayerMouseEvent = events.MapLayerMouseEvent<MaplibreMap>;
|
||||
export type MapTouchEvent = events.MapTouchEvent<MaplibreMap>;
|
||||
export type MapLayerTouchEvent = events.MapLayerTouchEvent<MaplibreMap>;
|
||||
export type MapWheelEvent = events.MapWheelEvent<MaplibreMap>;
|
||||
export type MapBoxZoomEvent = events.MapBoxZoomEvent<MaplibreMap>;
|
||||
export type ViewStateChangeEvent = events.ViewStateChangeEvent<MaplibreMap>;
|
||||
export type PopupEvent = events.PopupEvent<MaplibrePopup>;
|
||||
export type MarkerEvent = events.MarkerEvent<MaplibreMarker>;
|
||||
export type MarkerDragEvent = events.MarkerDragEvent<MaplibreMarker>;
|
||||
export type GeolocateEvent = events.GeolocateEvent<MaplibreGeolocateControl>;
|
||||
export type GeolocateResultEvent = events.GeolocateResultEvent<MaplibreGeolocateControl>;
|
||||
export type GeolocateErrorEvent = events.GeolocateErrorEvent<MaplibreGeolocateControl>;
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
export type {IControl} from './lib';
|
||||
import type GeoJSON from 'geojson';
|
||||
import type {AnyLayer} from './style-spec';
|
||||
|
||||
/* Data types */
|
||||
export interface Point {
|
||||
@ -81,3 +82,10 @@ export type ControlPosition = 'top-right' | 'top-left' | 'bottom-right' | 'botto
|
||||
export interface ImmutableLike<T> {
|
||||
toJS: () => T;
|
||||
}
|
||||
|
||||
export type MapGeoJSONFeature = GeoJSON.Feature<GeoJSON.Geometry> & {
|
||||
layer: AnyLayer;
|
||||
source: string;
|
||||
sourceLayer: string;
|
||||
state: {[key: string]: any};
|
||||
};
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import type GeoJSON from 'geojson';
|
||||
import type {ViewState, Point, LngLat, LngLatBounds} from './common';
|
||||
import type {ViewState, Point, LngLat, LngLatBounds, MapGeoJSONFeature} from './common';
|
||||
import type {
|
||||
MapInstance,
|
||||
Evented,
|
||||
@ -7,14 +6,7 @@ import type {
|
||||
PopupInstance,
|
||||
GeolocateControlInstance
|
||||
} from './lib';
|
||||
import type {AnyLayer, AnySource} from './style-spec';
|
||||
|
||||
export type MapGeoJSONFeature = GeoJSON.Feature<GeoJSON.Geometry> & {
|
||||
layer: AnyLayer;
|
||||
source: string;
|
||||
sourceLayer: string;
|
||||
state: {[key: string]: any};
|
||||
};
|
||||
import type {AnySource} from './style-spec';
|
||||
|
||||
export interface MapEvent<SourceT extends Evented, OriginalEventT = undefined> {
|
||||
type: string;
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
export * from './public';
|
||||
export * from './events';
|
||||
|
||||
import type GeoJSON from 'geojson';
|
||||
import type {CustomSourceImplementation} from './lib';
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
export * from './common';
|
||||
export * from './events';
|
||||
export * from './style-spec';
|
||||
export * from './lib';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user