@deck.gl/mapbox 8.8.0-alpha.3 → 8.8.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,22 +1,38 @@
1
- import {Deck, WebMercatorViewport, MapView} from '@deck.gl/core';
2
-
3
- export function getDeckInstance({map, gl, deck}) {
1
+ import {Deck, WebMercatorViewport, MapView, _flatten as flatten} from '@deck.gl/core';
2
+ import type {DeckProps, MapViewState, Layer} from '@deck.gl/core';
3
+ import type MapboxLayer from './mapbox-layer';
4
+ import type {Map} from 'mapbox-gl';
5
+
6
+ type UserData = {
7
+ isExternal: boolean;
8
+ currentViewport?: WebMercatorViewport | null;
9
+ mapboxLayers: Set<MapboxLayer<any>>;
10
+ mapboxVersion: {minor: number; major: number};
11
+ };
12
+
13
+ export function getDeckInstance({
14
+ map,
15
+ gl,
16
+ deck
17
+ }: {
18
+ map: Map & {__deck?: Deck | null};
19
+ gl: WebGLRenderingContext;
20
+ deck?: Deck;
21
+ }): Deck {
4
22
  // Only create one deck instance per context
5
23
  if (map.__deck) {
6
24
  return map.__deck;
7
25
  }
8
26
 
9
- const customRender = deck && deck.props._customRender;
27
+ const customRender = deck?.props._customRender;
10
28
 
11
- const deckProps = {
29
+ const deckProps: DeckProps = {
12
30
  useDevicePixels: true,
13
- _customRender: () => {
31
+ _customRender: (reason: string) => {
14
32
  map.triggerRepaint();
15
- if (customRender) {
16
- // customRender may be subscribed by DeckGL React component to update child props
17
- // make sure it is still called
18
- customRender();
19
- }
33
+ // customRender may be subscribed by DeckGL React component to update child props
34
+ // make sure it is still called
35
+ customRender?.(reason);
20
36
  },
21
37
  // TODO: import these defaults from a single source of truth
22
38
  parameters: {
@@ -28,10 +44,6 @@ export function getDeckInstance({map, gl, deck}) {
28
44
  depthFunc: gl.LEQUAL,
29
45
  blendEquation: gl.FUNC_ADD
30
46
  },
31
- userData: {
32
- isExternal: false,
33
- mapboxLayers: new Set()
34
- },
35
47
  views: (deck && deck.props.views) || [new MapView({id: 'mapbox'})]
36
48
  };
37
49
 
@@ -40,58 +52,62 @@ export function getDeckInstance({map, gl, deck}) {
40
52
  // block deck from setting the canvas size
41
53
  Object.assign(deckProps, {
42
54
  gl,
43
- width: false,
44
- height: false,
55
+ width: null,
56
+ height: null,
45
57
  touchAction: 'unset',
46
58
  viewState: getViewState(map)
47
59
  });
48
60
  // If using the WebGLContext created by deck (React use case), we use deck's viewState to drive the map.
49
61
  // Otherwise (pure JS use case), we use the map's viewState to drive deck.
50
- map.on('move', () => onMapMove(deck, map));
62
+ map.on('move', () => onMapMove(deck!, map));
51
63
  }
52
64
 
53
65
  if (deck) {
54
66
  deck.setProps(deckProps);
55
- deck.props.userData.isExternal = true;
67
+ (deck.userData as UserData).isExternal = true;
56
68
  } else {
57
69
  deck = new Deck(deckProps);
58
70
  map.on('remove', () => {
59
- deck.finalize();
71
+ deck!.finalize();
60
72
  map.__deck = null;
61
73
  });
62
74
  }
63
75
 
64
- deck.props.userData.mapboxVersion = getMapboxVersion(map);
76
+ (deck.userData as UserData).mapboxLayers = new Set();
77
+ (deck.userData as UserData).mapboxVersion = getMapboxVersion(map);
65
78
  map.__deck = deck;
66
79
  map.on('render', () => {
80
+ // @ts-expect-error (2445) protected property
67
81
  if (deck.layerManager) afterRender(deck, map);
68
82
  });
69
83
 
70
84
  return deck;
71
85
  }
72
86
 
73
- export function addLayer(deck, layer) {
74
- deck.props.userData.mapboxLayers.add(layer);
87
+ export function addLayer(deck: Deck, layer: MapboxLayer<any>): void {
88
+ (deck.userData as UserData).mapboxLayers.add(layer);
75
89
  updateLayers(deck);
76
90
  }
77
91
 
78
- export function removeLayer(deck, layer) {
79
- deck.props.userData.mapboxLayers.delete(layer);
92
+ export function removeLayer(deck: Deck, layer: MapboxLayer<any>): void {
93
+ (deck.userData as UserData).mapboxLayers.delete(layer);
80
94
  updateLayers(deck);
81
95
  }
82
96
 
83
- export function updateLayer(deck, layer) {
97
+ export function updateLayer(deck: Deck, layer: MapboxLayer<any>): void {
84
98
  updateLayers(deck);
85
99
  }
86
100
 
87
- export function drawLayer(deck, map, layer) {
88
- let {currentViewport} = deck.props.userData;
101
+ export function drawLayer(deck: Deck, map: Map, layer: MapboxLayer<any>): void {
102
+ let {currentViewport} = deck.userData as UserData;
89
103
  if (!currentViewport) {
90
104
  // This is the first layer drawn in this render cycle.
91
105
  // Generate viewport from the current map state.
92
106
  currentViewport = getViewport(deck, map, true);
93
- deck.props.userData.currentViewport = currentViewport;
107
+ (deck.userData as UserData).currentViewport = currentViewport;
94
108
  }
109
+
110
+ // @ts-expect-error (2445) protected property
95
111
  if (!deck.layerManager) {
96
112
  return;
97
113
  }
@@ -103,10 +119,12 @@ export function drawLayer(deck, map, layer) {
103
119
  });
104
120
  }
105
121
 
106
- export function getViewState(map) {
122
+ export function getViewState(map: Map): MapViewState & {repeat: boolean} {
107
123
  const {lng, lat} = map.getCenter();
108
124
  return {
109
- longitude: lng,
125
+ // Longitude returned by getCenter can be outside of [-180, 180] when zooming near the anti meridian
126
+ // https://github.com/visgl/deck.gl/issues/6894
127
+ longitude: ((lng + 540) % 360) - 180,
110
128
  latitude: lat,
111
129
  zoom: map.getZoom(),
112
130
  bearing: map.getBearing(),
@@ -115,18 +133,20 @@ export function getViewState(map) {
115
133
  };
116
134
  }
117
135
 
118
- function getMapboxVersion(map) {
136
+ function getMapboxVersion(map: Map): {minor: number; major: number} {
119
137
  // parse mapbox version string
120
138
  let major = 0;
121
139
  let minor = 0;
122
- if (map.version) {
123
- [major, minor] = map.version.split('.').slice(0, 2).map(Number);
140
+ // @ts-ignore (2339) undefined property
141
+ const version: string = map.version;
142
+ if (version) {
143
+ [major, minor] = version.split('.').slice(0, 2).map(Number);
124
144
  }
125
145
  return {major, minor};
126
146
  }
127
147
 
128
- function getViewport(deck, map, useMapboxProjection = true) {
129
- const {mapboxVersion} = deck.props.userData;
148
+ function getViewport(deck: Deck, map: Map, useMapboxProjection = true): WebMercatorViewport {
149
+ const {mapboxVersion} = deck.userData as UserData;
130
150
 
131
151
  return new WebMercatorViewport(
132
152
  Object.assign(
@@ -156,13 +176,16 @@ function getViewport(deck, map, useMapboxProjection = true) {
156
176
  );
157
177
  }
158
178
 
159
- function afterRender(deck, map) {
160
- const {mapboxLayers, isExternal} = deck.props.userData;
179
+ function afterRender(deck: Deck, map: Map): void {
180
+ const {mapboxLayers, isExternal} = deck.userData as UserData;
161
181
 
162
182
  if (isExternal) {
163
183
  // Draw non-Mapbox layers
164
184
  const mapboxLayerIds = Array.from(mapboxLayers, layer => layer.id);
165
- const hasNonMapboxLayers = deck.props.layers.some(layer => !mapboxLayerIds.includes(layer.id));
185
+ const deckLayers = flatten(deck.props.layers, Boolean) as Layer[];
186
+ const hasNonMapboxLayers = deckLayers.some(
187
+ layer => layer && !mapboxLayerIds.includes(layer.id)
188
+ );
166
189
  let viewports = deck.getViewports();
167
190
  const mapboxViewportIdx = viewports.findIndex(vp => vp.id === 'mapbox');
168
191
  const hasNonMapboxViews = viewports.length > 1 || mapboxViewportIdx < 0;
@@ -184,10 +207,10 @@ function afterRender(deck, map) {
184
207
  }
185
208
 
186
209
  // End of render cycle, clear generated viewport
187
- deck.props.userData.currentViewport = null;
210
+ (deck.userData as UserData).currentViewport = null;
188
211
  }
189
212
 
190
- function onMapMove(deck, map) {
213
+ function onMapMove(deck: Deck, map: Map): void {
191
214
  deck.setProps({
192
215
  viewState: getViewState(map)
193
216
  });
@@ -197,14 +220,14 @@ function onMapMove(deck, map) {
197
220
  deck.needsRedraw({clearRedrawFlags: true});
198
221
  }
199
222
 
200
- function updateLayers(deck) {
201
- if (deck.props.userData.isExternal) {
223
+ function updateLayers(deck: Deck): void {
224
+ if ((deck.userData as UserData).isExternal) {
202
225
  return;
203
226
  }
204
227
 
205
- const layers = [];
228
+ const layers: Layer[] = [];
206
229
  let layerIndex = 0;
207
- deck.props.userData.mapboxLayers.forEach(deckLayer => {
230
+ (deck.userData as UserData).mapboxLayers.forEach(deckLayer => {
208
231
  const LayerType = deckLayer.props.type;
209
232
  const layer = new LayerType(deckLayer.props, {_offset: layerIndex++});
210
233
  layers.push(layer);
@@ -1,8 +1,21 @@
1
1
  import {getDeckInstance, addLayer, removeLayer, updateLayer, drawLayer} from './deck-utils';
2
+ import type {Map, CustomLayerInterface} from 'mapbox-gl';
3
+ import type {Deck, Layer} from '@deck.gl/core';
4
+
5
+ export type MapboxLayerProps<LayerT extends Layer> = Partial<LayerT['props']> & {
6
+ id: string;
7
+ };
8
+
9
+ export default class MapboxLayer<LayerT extends Layer> implements CustomLayerInterface {
10
+ id: string;
11
+ type: 'custom';
12
+ renderingMode: '2d' | '3d';
13
+ map: Map | null;
14
+ deck: Deck | null;
15
+ props: MapboxLayerProps<LayerT>;
2
16
 
3
- export default class MapboxLayer {
4
17
  /* eslint-disable no-this-before-super */
5
- constructor(props) {
18
+ constructor(props: MapboxLayerProps<LayerT>) {
6
19
  if (!props.id) {
7
20
  throw new Error('Layer must have an unique id');
8
21
  }
@@ -17,17 +30,19 @@ export default class MapboxLayer {
17
30
 
18
31
  /* Mapbox custom layer methods */
19
32
 
20
- onAdd(map, gl) {
33
+ onAdd(map: Map, gl: WebGLRenderingContext): void {
21
34
  this.map = map;
22
35
  this.deck = getDeckInstance({map, gl, deck: this.props.deck});
23
36
  addLayer(this.deck, this);
24
37
  }
25
38
 
26
- onRemove() {
27
- removeLayer(this.deck, this);
39
+ onRemove(): void {
40
+ if (this.deck) {
41
+ removeLayer(this.deck, this);
42
+ }
28
43
  }
29
44
 
30
- setProps(props) {
45
+ setProps(props: MapboxLayerProps<LayerT>) {
31
46
  // id cannot be changed
32
47
  Object.assign(this.props, props, {id: this.id});
33
48
  // safe guard in case setProps is called before onAdd
@@ -36,7 +51,7 @@ export default class MapboxLayer {
36
51
  }
37
52
  }
38
53
 
39
- render(gl, matrix) {
40
- drawLayer(this.deck, this.map, this);
54
+ render() {
55
+ drawLayer(this.deck!, this.map!, this);
41
56
  }
42
57
  }
@@ -1,24 +1,26 @@
1
- import {Deck} from '@deck.gl/core';
1
+ import {Deck, assert} from '@deck.gl/core';
2
2
  import {getViewState} from './deck-utils';
3
3
 
4
4
  import type {Map, IControl, MapMouseEvent} from 'mapbox-gl';
5
+ import type {MjolnirGestureEvent, MjolnirPointerEvent} from 'mjolnir.js';
6
+ import type {DeckProps} from '@deck.gl/core';
5
7
 
6
8
  /**
7
9
  * Implements Mapbox [IControl](https://docs.mapbox.com/mapbox-gl-js/api/markers/#icontrol) interface
8
10
  * Renders deck.gl layers over the base map and automatically synchronizes with the map's camera
9
11
  */
10
12
  export default class MapboxOverlay implements IControl {
11
- private _props: any;
12
- private _deck: Deck;
13
+ private _props: DeckProps;
14
+ private _deck?: Deck;
13
15
  private _map?: Map;
14
16
  private _container?: HTMLDivElement;
15
17
 
16
- constructor(props) {
18
+ constructor(props: DeckProps) {
17
19
  this._props = {...props};
18
20
  }
19
21
 
20
22
  /** Update (partial) props of the underlying Deck instance. */
21
- setProps(props: any): void {
23
+ setProps(props: DeckProps): void {
22
24
  Object.assign(this._props, props);
23
25
 
24
26
  if ('viewState' in this._props) {
@@ -31,7 +33,7 @@ export default class MapboxOverlay implements IControl {
31
33
  }
32
34
 
33
35
  /** Called when the control is added to a map */
34
- onAdd(map: Map) {
36
+ onAdd(map: Map): HTMLDivElement {
35
37
  this._map = map;
36
38
 
37
39
  /* global document */
@@ -62,7 +64,7 @@ export default class MapboxOverlay implements IControl {
62
64
  }
63
65
 
64
66
  /** Called when the control is removed from a map */
65
- onRemove() {
67
+ onRemove(): void {
66
68
  const map = this._map;
67
69
 
68
70
  if (map) {
@@ -75,6 +77,7 @@ export default class MapboxOverlay implements IControl {
75
77
  }
76
78
 
77
79
  this._deck?.finalize();
80
+ this._deck = undefined;
78
81
  this._map = undefined;
79
82
  this._container = undefined;
80
83
  }
@@ -84,18 +87,23 @@ export default class MapboxOverlay implements IControl {
84
87
  }
85
88
 
86
89
  /** Forwards the Deck.pickObject method */
87
- pickObject(params) {
88
- return this._deck && this._deck.pickObject(params);
90
+ pickObject(params: Parameters<Deck['pickObject']>[0]): ReturnType<Deck['pickObject']> {
91
+ assert(this._deck);
92
+ return this._deck.pickObject(params);
89
93
  }
90
94
 
91
95
  /** Forwards the Deck.pickMultipleObjects method */
92
- pickMultipleObjects(params) {
93
- return this._deck && this._deck.pickMultipleObjects(params);
96
+ pickMultipleObjects(
97
+ params: Parameters<Deck['pickMultipleObjects']>[0]
98
+ ): ReturnType<Deck['pickMultipleObjects']> {
99
+ assert(this._deck);
100
+ return this._deck.pickMultipleObjects(params);
94
101
  }
95
102
 
96
103
  /** Forwards the Deck.pickObjects method */
97
- pickObjects(params) {
98
- return this._deck && this._deck.pickObjects(params);
104
+ pickObjects(params: Parameters<Deck['pickObjects']>[0]): ReturnType<Deck['pickObjects']> {
105
+ assert(this._deck);
106
+ return this._deck.pickObjects(params);
99
107
  }
100
108
 
101
109
  /** Remove from map and releases all resources */
@@ -105,7 +113,7 @@ export default class MapboxOverlay implements IControl {
105
113
  }
106
114
  }
107
115
 
108
- _updateContainerSize = () => {
116
+ private _updateContainerSize = () => {
109
117
  if (this._map && this._container) {
110
118
  const {clientWidth, clientHeight} = this._map.getContainer();
111
119
  Object.assign(this._container.style, {
@@ -115,16 +123,17 @@ export default class MapboxOverlay implements IControl {
115
123
  }
116
124
  };
117
125
 
118
- _updateViewState = () => {
126
+ private _updateViewState = () => {
119
127
  const deck = this._deck;
120
128
  if (deck) {
129
+ // @ts-ignore (2345) map is always defined if deck is
121
130
  deck.setProps({viewState: getViewState(this._map)});
122
131
  // Redraw immediately if view state has changed
123
- deck.redraw(false);
132
+ deck.redraw();
124
133
  }
125
134
  };
126
135
 
127
- _handleMouseEvent = (event: MapMouseEvent) => {
136
+ private _handleMouseEvent = (event: MapMouseEvent) => {
128
137
  const deck = this._deck;
129
138
  if (!deck) {
130
139
  return;
@@ -143,29 +152,26 @@ export default class MapboxOverlay implements IControl {
143
152
 
144
153
  switch (event.type) {
145
154
  case 'click':
146
- // Hack: because we do not listen to pointer down, perform picking now
147
- deck._lastPointerDownInfo = deck.pickObject({
148
- ...mockEvent.offsetCenter,
149
- radius: deck.props.pickingRadius
150
- });
151
155
  mockEvent.tapCount = 1;
152
- deck._onEvent(mockEvent);
156
+ // Hack: because we do not listen to pointer down, perform picking now
157
+ deck._onPointerDown(mockEvent as MjolnirGestureEvent);
158
+ deck._onEvent(mockEvent as MjolnirGestureEvent);
153
159
  break;
154
160
 
155
161
  case 'dblclick':
156
162
  mockEvent.type = 'click';
157
163
  mockEvent.tapCount = 2;
158
- deck._onEvent(mockEvent);
164
+ deck._onEvent(mockEvent as MjolnirGestureEvent);
159
165
  break;
160
166
 
161
167
  case 'mousemove':
162
168
  mockEvent.type = 'pointermove';
163
- deck._onPointerMove(mockEvent);
169
+ deck._onPointerMove(mockEvent as MjolnirPointerEvent);
164
170
  break;
165
171
 
166
172
  case 'mouseout':
167
173
  mockEvent.type = 'pointerleave';
168
- deck._onPointerMove(mockEvent);
174
+ deck._onPointerMove(mockEvent as MjolnirPointerEvent);
169
175
  break;
170
176
 
171
177
  default:
@@ -0,0 +1,19 @@
1
+ import { Deck } from '@deck.gl/core/typed';
2
+ import type { MapViewState } from '@deck.gl/core/typed';
3
+ import type MapboxLayer from './mapbox-layer';
4
+ import type { Map } from 'mapbox-gl';
5
+ export declare function getDeckInstance({ map, gl, deck }: {
6
+ map: Map & {
7
+ __deck?: Deck | null;
8
+ };
9
+ gl: WebGLRenderingContext;
10
+ deck?: Deck;
11
+ }): Deck;
12
+ export declare function addLayer(deck: Deck, layer: MapboxLayer<any>): void;
13
+ export declare function removeLayer(deck: Deck, layer: MapboxLayer<any>): void;
14
+ export declare function updateLayer(deck: Deck, layer: MapboxLayer<any>): void;
15
+ export declare function drawLayer(deck: Deck, map: Map, layer: MapboxLayer<any>): void;
16
+ export declare function getViewState(map: Map): MapViewState & {
17
+ repeat: boolean;
18
+ };
19
+ //# sourceMappingURL=deck-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deck-utils.d.ts","sourceRoot":"","sources":["../src/deck-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAoD,MAAM,eAAe,CAAC;AACtF,OAAO,KAAK,EAAY,YAAY,EAAQ,MAAM,eAAe,CAAC;AAClE,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,WAAW,CAAC;AASnC,wBAAgB,eAAe,CAAC,EAC9B,GAAG,EACH,EAAE,EACF,IAAI,EACL,EAAE;IACD,GAAG,EAAE,GAAG,GAAG;QAAC,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;KAAC,CAAC;IAClC,EAAE,EAAE,qBAAqB,CAAC;IAC1B,IAAI,CAAC,EAAE,IAAI,CAAC;CACb,GAAG,IAAI,CAgEP;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,CAAC,GAAG,CAAC,GAAG,IAAI,CAGlE;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,CAAC,GAAG,CAAC,GAAG,IAAI,CAGrE;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,CAAC,GAAG,CAAC,GAAG,IAAI,CAErE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,CAAC,GAAG,CAAC,GAAG,IAAI,CAmB7E;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,YAAY,GAAG;IAAC,MAAM,EAAE,OAAO,CAAA;CAAC,CAYvE"}
@@ -0,0 +1,3 @@
1
+ export { default as MapboxLayer } from './mapbox-layer';
2
+ export { default as MapboxOverlay } from './mapbox-overlay';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { Map, CustomLayerInterface } from 'mapbox-gl';
2
+ import type { Deck, Layer } from '@deck.gl/core/typed';
3
+ export declare type MapboxLayerProps<LayerT extends Layer> = Partial<LayerT['props']> & {
4
+ id: string;
5
+ };
6
+ export default class MapboxLayer<LayerT extends Layer> implements CustomLayerInterface {
7
+ id: string;
8
+ type: 'custom';
9
+ renderingMode: '2d' | '3d';
10
+ map: Map | null;
11
+ deck: Deck | null;
12
+ props: MapboxLayerProps<LayerT>;
13
+ constructor(props: MapboxLayerProps<LayerT>);
14
+ onAdd(map: Map, gl: WebGLRenderingContext): void;
15
+ onRemove(): void;
16
+ setProps(props: MapboxLayerProps<LayerT>): void;
17
+ render(): void;
18
+ }
19
+ //# sourceMappingURL=mapbox-layer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapbox-layer.d.ts","sourceRoot":"","sources":["../src/mapbox-layer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,GAAG,EAAE,oBAAoB,EAAC,MAAM,WAAW,CAAC;AACzD,OAAO,KAAK,EAAC,IAAI,EAAE,KAAK,EAAC,MAAM,eAAe,CAAC;AAE/C,oBAAY,gBAAgB,CAAC,MAAM,SAAS,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG;IAC9E,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,WAAW,CAAC,MAAM,SAAS,KAAK,CAAE,YAAW,oBAAoB;IACpF,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;IACf,aAAa,EAAE,IAAI,GAAG,IAAI,CAAC;IAC3B,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC;IAChB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,KAAK,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;gBAGpB,KAAK,EAAE,gBAAgB,CAAC,MAAM,CAAC;IAe3C,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,qBAAqB,GAAG,IAAI;IAMhD,QAAQ,IAAI,IAAI;IAMhB,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC,MAAM,CAAC;IASxC,MAAM;CAGP"}
@@ -0,0 +1,33 @@
1
+ import { Deck } from '@deck.gl/core/typed';
2
+ import type { Map, IControl } from 'mapbox-gl';
3
+ import type { DeckProps } from '@deck.gl/core/typed';
4
+ /**
5
+ * Implements Mapbox [IControl](https://docs.mapbox.com/mapbox-gl-js/api/markers/#icontrol) interface
6
+ * Renders deck.gl layers over the base map and automatically synchronizes with the map's camera
7
+ */
8
+ export default class MapboxOverlay implements IControl {
9
+ private _props;
10
+ private _deck?;
11
+ private _map?;
12
+ private _container?;
13
+ constructor(props: DeckProps);
14
+ /** Update (partial) props of the underlying Deck instance. */
15
+ setProps(props: DeckProps): void;
16
+ /** Called when the control is added to a map */
17
+ onAdd(map: Map): HTMLDivElement;
18
+ /** Called when the control is removed from a map */
19
+ onRemove(): void;
20
+ getDefaultPosition(): string;
21
+ /** Forwards the Deck.pickObject method */
22
+ pickObject(params: Parameters<Deck['pickObject']>[0]): ReturnType<Deck['pickObject']>;
23
+ /** Forwards the Deck.pickMultipleObjects method */
24
+ pickMultipleObjects(params: Parameters<Deck['pickMultipleObjects']>[0]): ReturnType<Deck['pickMultipleObjects']>;
25
+ /** Forwards the Deck.pickObjects method */
26
+ pickObjects(params: Parameters<Deck['pickObjects']>[0]): ReturnType<Deck['pickObjects']>;
27
+ /** Remove from map and releases all resources */
28
+ finalize(): void;
29
+ private _updateContainerSize;
30
+ private _updateViewState;
31
+ private _handleMouseEvent;
32
+ }
33
+ //# sourceMappingURL=mapbox-overlay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapbox-overlay.d.ts","sourceRoot":"","sources":["../src/mapbox-overlay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAS,MAAM,eAAe,CAAC;AAG3C,OAAO,KAAK,EAAC,GAAG,EAAE,QAAQ,EAAgB,MAAM,WAAW,CAAC;AAE5D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAE7C;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,aAAc,YAAW,QAAQ;IACpD,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,KAAK,CAAC,CAAO;IACrB,OAAO,CAAC,IAAI,CAAC,CAAM;IACnB,OAAO,CAAC,UAAU,CAAC,CAAiB;gBAExB,KAAK,EAAE,SAAS;IAI5B,8DAA8D;IAC9D,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAYhC,gDAAgD;IAChD,KAAK,CAAC,GAAG,EAAE,GAAG,GAAG,cAAc;IA8B/B,oDAAoD;IACpD,QAAQ,IAAI,IAAI;IAkBhB,kBAAkB;IAIlB,0CAA0C;IAC1C,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAKrF,mDAAmD;IACnD,mBAAmB,CACjB,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,GACjD,UAAU,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IAK1C,2CAA2C;IAC3C,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAKxF,iDAAiD;IACjD,QAAQ;IAMR,OAAO,CAAC,oBAAoB,CAQ1B;IAEF,OAAO,CAAC,gBAAgB,CAQtB;IAEF,OAAO,CAAC,iBAAiB,CA4CvB;CACH"}
@@ -0,0 +1,6 @@
1
+ {
2
+ "internal": true,
3
+ "main": "../dist/es5/index.js",
4
+ "module": "../dist/esm/index.js",
5
+ "types": "index.d.ts"
6
+ }