@deck.gl/mapbox 9.0.0-beta.2 → 9.0.0-beta.3

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.
Files changed (40) hide show
  1. package/dist/deck-utils.js +266 -0
  2. package/dist/dist.dev.js +778 -147
  3. package/dist/index.cjs +545 -0
  4. package/dist/index.cjs.map +7 -0
  5. package/dist/index.js +2 -0
  6. package/dist/mapbox-layer.js +42 -0
  7. package/dist/mapbox-overlay.js +222 -0
  8. package/dist/resolve-layers.js +74 -0
  9. package/dist.min.js +1 -2
  10. package/package.json +17 -8
  11. package/dist/es5/deck-utils.js +0 -300
  12. package/dist/es5/deck-utils.js.map +0 -1
  13. package/dist/es5/index.js +0 -24
  14. package/dist/es5/index.js.map +0 -1
  15. package/dist/es5/mapbox-layer.js +0 -80
  16. package/dist/es5/mapbox-layer.js.map +0 -1
  17. package/dist/es5/mapbox-overlay.js +0 -302
  18. package/dist/es5/mapbox-overlay.js.map +0 -1
  19. package/dist/es5/resolve-layers.js +0 -137
  20. package/dist/es5/resolve-layers.js.map +0 -1
  21. package/dist/esm/deck-utils.js +0 -263
  22. package/dist/esm/deck-utils.js.map +0 -1
  23. package/dist/esm/index.js +0 -3
  24. package/dist/esm/index.js.map +0 -1
  25. package/dist/esm/mapbox-layer.js +0 -60
  26. package/dist/esm/mapbox-layer.js.map +0 -1
  27. package/dist/esm/mapbox-overlay.js +0 -272
  28. package/dist/esm/mapbox-overlay.js.map +0 -1
  29. package/dist/esm/resolve-layers.js +0 -77
  30. package/dist/esm/resolve-layers.js.map +0 -1
  31. /package/{typed → dist}/deck-utils.d.ts +0 -0
  32. /package/{typed → dist}/deck-utils.d.ts.map +0 -0
  33. /package/{typed → dist}/index.d.ts +0 -0
  34. /package/{typed → dist}/index.d.ts.map +0 -0
  35. /package/{typed → dist}/mapbox-layer.d.ts +0 -0
  36. /package/{typed → dist}/mapbox-layer.d.ts.map +0 -0
  37. /package/{typed → dist}/mapbox-overlay.d.ts +0 -0
  38. /package/{typed → dist}/mapbox-overlay.d.ts.map +0 -0
  39. /package/{typed → dist}/resolve-layers.d.ts +0 -0
  40. /package/{typed → dist}/resolve-layers.d.ts.map +0 -0
package/dist/index.cjs ADDED
@@ -0,0 +1,545 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // dist/index.js
21
+ var dist_exports = {};
22
+ __export(dist_exports, {
23
+ MapboxLayer: () => MapboxLayer,
24
+ MapboxOverlay: () => MapboxOverlay
25
+ });
26
+ module.exports = __toCommonJS(dist_exports);
27
+
28
+ // dist/deck-utils.js
29
+ var import_core = require("@deck.gl/core");
30
+ var import_web_mercator = require("@math.gl/web-mercator");
31
+ var import_constants = require("@luma.gl/constants");
32
+ var TILE_SIZE = 512;
33
+ var DEGREES_TO_RADIANS = Math.PI / 180;
34
+ function getDeckInstance({ map, gl, deck }) {
35
+ if (map.__deck) {
36
+ return map.__deck;
37
+ }
38
+ const customRender = deck == null ? void 0 : deck.props._customRender;
39
+ const onLoad = deck == null ? void 0 : deck.props.onLoad;
40
+ const deckProps = getInterleavedProps({
41
+ ...deck == null ? void 0 : deck.props,
42
+ _customRender: () => {
43
+ map.triggerRepaint();
44
+ customRender == null ? void 0 : customRender("");
45
+ }
46
+ });
47
+ let deckInstance;
48
+ if (!deck || deck.props.gl === gl) {
49
+ Object.assign(deckProps, {
50
+ gl,
51
+ width: null,
52
+ height: null,
53
+ touchAction: "unset",
54
+ viewState: getViewState(map)
55
+ });
56
+ if (deck == null ? void 0 : deck.isInitialized) {
57
+ watchMapMove(deck, map);
58
+ } else {
59
+ deckProps.onLoad = () => {
60
+ onLoad == null ? void 0 : onLoad();
61
+ watchMapMove(deckInstance, map);
62
+ };
63
+ }
64
+ }
65
+ if (deck) {
66
+ deckInstance = deck;
67
+ deck.setProps(deckProps);
68
+ deck.userData.isExternal = true;
69
+ } else {
70
+ deckInstance = new import_core.Deck(deckProps);
71
+ map.on("remove", () => {
72
+ removeDeckInstance(map);
73
+ });
74
+ }
75
+ deckInstance.userData.mapboxLayers = /* @__PURE__ */ new Set();
76
+ map.__deck = deckInstance;
77
+ map.on("render", () => {
78
+ if (deckInstance.isInitialized)
79
+ afterRender(deckInstance, map);
80
+ });
81
+ return deckInstance;
82
+ }
83
+ function watchMapMove(deck, map) {
84
+ const _handleMapMove = () => {
85
+ if (deck.isInitialized) {
86
+ onMapMove(deck, map);
87
+ } else {
88
+ map.off("move", _handleMapMove);
89
+ }
90
+ };
91
+ map.on("move", _handleMapMove);
92
+ }
93
+ function removeDeckInstance(map) {
94
+ var _a;
95
+ (_a = map.__deck) == null ? void 0 : _a.finalize();
96
+ map.__deck = null;
97
+ }
98
+ function getInterleavedProps(currProps) {
99
+ const nextProps = {
100
+ ...currProps,
101
+ parameters: {
102
+ depthMask: true,
103
+ depthTest: true,
104
+ blend: true,
105
+ blendFunc: [import_constants.GL.SRC_ALPHA, import_constants.GL.ONE_MINUS_SRC_ALPHA, import_constants.GL.ONE, import_constants.GL.ONE_MINUS_SRC_ALPHA],
106
+ polygonOffsetFill: true,
107
+ depthFunc: import_constants.GL.LEQUAL,
108
+ blendEquation: import_constants.GL.FUNC_ADD,
109
+ ...currProps.parameters
110
+ },
111
+ views: currProps.views || [new import_core.MapView({ id: "mapbox" })]
112
+ };
113
+ return nextProps;
114
+ }
115
+ function addLayer(deck, layer) {
116
+ deck.userData.mapboxLayers.add(layer);
117
+ updateLayers(deck);
118
+ }
119
+ function removeLayer(deck, layer) {
120
+ deck.userData.mapboxLayers.delete(layer);
121
+ updateLayers(deck);
122
+ }
123
+ function updateLayer(deck, layer) {
124
+ updateLayers(deck);
125
+ }
126
+ function drawLayer(deck, map, layer) {
127
+ let { currentViewport } = deck.userData;
128
+ let clearStack = false;
129
+ if (!currentViewport) {
130
+ currentViewport = getViewport(deck, map, true);
131
+ deck.userData.currentViewport = currentViewport;
132
+ clearStack = true;
133
+ }
134
+ if (!deck.isInitialized) {
135
+ return;
136
+ }
137
+ deck._drawLayers("mapbox-repaint", {
138
+ viewports: [currentViewport],
139
+ layerFilter: ({ layer: deckLayer }) => layer.id === deckLayer.id || deckLayer.props.operation.includes("terrain"),
140
+ clearStack,
141
+ clearCanvas: false
142
+ });
143
+ }
144
+ function getViewState(map) {
145
+ var _a;
146
+ const { lng, lat } = map.getCenter();
147
+ const viewState = {
148
+ longitude: (lng + 540) % 360 - 180,
149
+ latitude: lat,
150
+ zoom: map.getZoom(),
151
+ bearing: map.getBearing(),
152
+ pitch: map.getPitch(),
153
+ padding: map.getPadding(),
154
+ repeat: map.getRenderWorldCopies()
155
+ };
156
+ if ((_a = map.getTerrain) == null ? void 0 : _a.call(map)) {
157
+ centerCameraOnTerrain(map, viewState);
158
+ }
159
+ return viewState;
160
+ }
161
+ function centerCameraOnTerrain(map, viewState) {
162
+ if (map.getFreeCameraOptions) {
163
+ const { position } = map.getFreeCameraOptions();
164
+ if (!position || position.z === void 0) {
165
+ return;
166
+ }
167
+ const height = map.transform.height;
168
+ const { longitude, latitude, pitch } = viewState;
169
+ const cameraX = position.x * TILE_SIZE;
170
+ const cameraY = (1 - position.y) * TILE_SIZE;
171
+ const cameraZ = position.z * TILE_SIZE;
172
+ const center = (0, import_web_mercator.lngLatToWorld)([longitude, latitude]);
173
+ const dx = cameraX - center[0];
174
+ const dy = cameraY - center[1];
175
+ const cameraToCenterDistanceGround = Math.sqrt(dx * dx + dy * dy);
176
+ const pitchRadians = pitch * DEGREES_TO_RADIANS;
177
+ const altitudePixels = 1.5 * height;
178
+ const scale = pitchRadians < 1e-3 ? altitudePixels * Math.cos(pitchRadians) / cameraZ : altitudePixels * Math.sin(pitchRadians) / cameraToCenterDistanceGround;
179
+ viewState.zoom = Math.log2(scale);
180
+ const cameraZFromSurface = altitudePixels * Math.cos(pitchRadians) / scale;
181
+ const surfaceElevation = cameraZ - cameraZFromSurface;
182
+ viewState.position = [0, 0, surfaceElevation / (0, import_web_mercator.unitsPerMeter)(latitude)];
183
+ } else if (typeof map.transform.elevation === "number") {
184
+ viewState.position = [0, 0, map.transform.elevation];
185
+ }
186
+ }
187
+ function getViewport(deck, map, useMapboxProjection = true) {
188
+ return new import_core.WebMercatorViewport({
189
+ id: "mapbox",
190
+ x: 0,
191
+ y: 0,
192
+ width: deck.width,
193
+ height: deck.height,
194
+ ...getViewState(map),
195
+ nearZMultiplier: useMapboxProjection ? 0.02 : 0.1,
196
+ nearZ: map.transform._nearZ / map.transform.height,
197
+ farZ: map.transform._farZ / map.transform.height
198
+ });
199
+ }
200
+ function afterRender(deck, map) {
201
+ const { mapboxLayers, isExternal } = deck.userData;
202
+ if (isExternal) {
203
+ const mapboxLayerIds = Array.from(mapboxLayers, (layer) => layer.id);
204
+ const deckLayers = (0, import_core._flatten)(deck.props.layers, Boolean);
205
+ const hasNonMapboxLayers = deckLayers.some((layer) => layer && !mapboxLayerIds.includes(layer.id));
206
+ let viewports = deck.getViewports();
207
+ const mapboxViewportIdx = viewports.findIndex((vp) => vp.id === "mapbox");
208
+ const hasNonMapboxViews = viewports.length > 1 || mapboxViewportIdx < 0;
209
+ if (hasNonMapboxLayers || hasNonMapboxViews) {
210
+ if (mapboxViewportIdx >= 0) {
211
+ viewports = viewports.slice();
212
+ viewports[mapboxViewportIdx] = getViewport(deck, map, false);
213
+ }
214
+ deck._drawLayers("mapbox-repaint", {
215
+ viewports,
216
+ layerFilter: (params) => (!deck.props.layerFilter || deck.props.layerFilter(params)) && (params.viewport.id !== "mapbox" || !mapboxLayerIds.includes(params.layer.id)),
217
+ clearCanvas: false
218
+ });
219
+ }
220
+ }
221
+ deck.userData.currentViewport = null;
222
+ }
223
+ function onMapMove(deck, map) {
224
+ deck.setProps({
225
+ viewState: getViewState(map)
226
+ });
227
+ deck.needsRedraw({ clearRedrawFlags: true });
228
+ }
229
+ function updateLayers(deck) {
230
+ if (deck.userData.isExternal) {
231
+ return;
232
+ }
233
+ const layers = [];
234
+ deck.userData.mapboxLayers.forEach((deckLayer) => {
235
+ const LayerType = deckLayer.props.type;
236
+ const layer = new LayerType(deckLayer.props);
237
+ layers.push(layer);
238
+ });
239
+ deck.setProps({ layers });
240
+ }
241
+
242
+ // dist/mapbox-layer.js
243
+ var import_core2 = require("@deck.gl/core");
244
+ var MapboxLayer = class {
245
+ constructor(props) {
246
+ if (!props.id) {
247
+ throw new Error("Layer must have an unique id");
248
+ }
249
+ this.id = props.id;
250
+ this.type = "custom";
251
+ this.renderingMode = props.renderingMode || "3d";
252
+ this.map = null;
253
+ this.deck = null;
254
+ this.props = props;
255
+ }
256
+ onAdd(map, gl) {
257
+ if (gl instanceof WebGLRenderingContext) {
258
+ import_core2.log.warn("Use useWebGL2:true in mapboxgl.Map()")();
259
+ return;
260
+ }
261
+ this.map = map;
262
+ this.deck = getDeckInstance({ map, gl, deck: this.props.deck });
263
+ addLayer(this.deck, this);
264
+ }
265
+ onRemove() {
266
+ if (this.deck) {
267
+ removeLayer(this.deck, this);
268
+ }
269
+ }
270
+ setProps(props) {
271
+ Object.assign(this.props, props, { id: this.id });
272
+ if (this.deck) {
273
+ updateLayer(this.deck, this);
274
+ }
275
+ }
276
+ render() {
277
+ drawLayer(this.deck, this.map, this);
278
+ }
279
+ };
280
+
281
+ // dist/mapbox-overlay.js
282
+ var import_core4 = require("@deck.gl/core");
283
+
284
+ // dist/resolve-layers.js
285
+ var import_core3 = require("@deck.gl/core");
286
+ var UNDEFINED_BEFORE_ID = "__UNDEFINED__";
287
+ function resolveLayers(map, deck, oldLayers, newLayers) {
288
+ if (!map || !deck || !map.style || !map.style._loaded) {
289
+ return;
290
+ }
291
+ const layers = (0, import_core3._flatten)(newLayers, Boolean);
292
+ if (oldLayers !== newLayers) {
293
+ const prevLayers = (0, import_core3._flatten)(oldLayers, Boolean);
294
+ const prevLayerIds = new Set(prevLayers.map((l) => l.id));
295
+ for (const layer of layers) {
296
+ prevLayerIds.delete(layer.id);
297
+ }
298
+ for (const id of prevLayerIds) {
299
+ if (map.getLayer(id)) {
300
+ map.removeLayer(id);
301
+ }
302
+ }
303
+ }
304
+ for (const layer of layers) {
305
+ const mapboxLayer = map.getLayer(layer.id);
306
+ if (mapboxLayer) {
307
+ mapboxLayer.implementation.setProps(layer.props);
308
+ } else {
309
+ map.addLayer(
310
+ new MapboxLayer({ id: layer.id, deck }),
311
+ layer.props.beforeId
312
+ );
313
+ }
314
+ }
315
+ const mapLayers = map.style._order;
316
+ const layerGroups = {};
317
+ for (const layer of layers) {
318
+ let { beforeId } = layer.props;
319
+ if (!beforeId || !mapLayers.includes(beforeId)) {
320
+ beforeId = UNDEFINED_BEFORE_ID;
321
+ }
322
+ layerGroups[beforeId] = layerGroups[beforeId] || [];
323
+ layerGroups[beforeId].push(layer.id);
324
+ }
325
+ for (const beforeId in layerGroups) {
326
+ const layerGroup = layerGroups[beforeId];
327
+ let lastLayerIndex = beforeId === UNDEFINED_BEFORE_ID ? mapLayers.length : mapLayers.indexOf(beforeId);
328
+ let lastLayerId = beforeId === UNDEFINED_BEFORE_ID ? void 0 : beforeId;
329
+ for (let i = layerGroup.length - 1; i >= 0; i--) {
330
+ const layerId = layerGroup[i];
331
+ const layerIndex = mapLayers.indexOf(layerId);
332
+ if (layerIndex !== lastLayerIndex - 1) {
333
+ map.moveLayer(layerId, lastLayerId);
334
+ if (layerIndex > lastLayerIndex) {
335
+ lastLayerIndex++;
336
+ }
337
+ }
338
+ lastLayerIndex--;
339
+ lastLayerId = layerId;
340
+ }
341
+ }
342
+ }
343
+
344
+ // dist/mapbox-overlay.js
345
+ var MapboxOverlay = class {
346
+ constructor(props) {
347
+ this._handleStyleChange = () => {
348
+ resolveLayers(this._map, this._deck, this._props.layers, this._props.layers);
349
+ };
350
+ this._updateContainerSize = () => {
351
+ if (this._map && this._container) {
352
+ const { clientWidth, clientHeight } = this._map.getContainer();
353
+ Object.assign(this._container.style, {
354
+ width: `${clientWidth}px`,
355
+ height: `${clientHeight}px`
356
+ });
357
+ }
358
+ };
359
+ this._updateViewState = () => {
360
+ const deck = this._deck;
361
+ if (deck) {
362
+ deck.setProps({ viewState: getViewState(this._map) });
363
+ if (deck.isInitialized) {
364
+ deck.redraw();
365
+ }
366
+ }
367
+ };
368
+ this._handleMouseEvent = (event) => {
369
+ const deck = this._deck;
370
+ if (!deck || !deck.isInitialized) {
371
+ return;
372
+ }
373
+ const mockEvent = {
374
+ type: event.type,
375
+ offsetCenter: event.point,
376
+ srcEvent: event
377
+ };
378
+ const lastDown = this._lastMouseDownPoint;
379
+ if (!event.point && lastDown) {
380
+ mockEvent.deltaX = event.originalEvent.clientX - lastDown.clientX;
381
+ mockEvent.deltaY = event.originalEvent.clientY - lastDown.clientY;
382
+ mockEvent.offsetCenter = {
383
+ x: lastDown.x + mockEvent.deltaX,
384
+ y: lastDown.y + mockEvent.deltaY
385
+ };
386
+ }
387
+ switch (mockEvent.type) {
388
+ case "mousedown":
389
+ deck._onPointerDown(mockEvent);
390
+ this._lastMouseDownPoint = {
391
+ ...event.point,
392
+ clientX: event.originalEvent.clientX,
393
+ clientY: event.originalEvent.clientY
394
+ };
395
+ break;
396
+ case "dragstart":
397
+ mockEvent.type = "panstart";
398
+ deck._onEvent(mockEvent);
399
+ break;
400
+ case "drag":
401
+ mockEvent.type = "panmove";
402
+ deck._onEvent(mockEvent);
403
+ break;
404
+ case "dragend":
405
+ mockEvent.type = "panend";
406
+ deck._onEvent(mockEvent);
407
+ break;
408
+ case "click":
409
+ mockEvent.tapCount = 1;
410
+ deck._onEvent(mockEvent);
411
+ break;
412
+ case "dblclick":
413
+ mockEvent.type = "click";
414
+ mockEvent.tapCount = 2;
415
+ deck._onEvent(mockEvent);
416
+ break;
417
+ case "mousemove":
418
+ mockEvent.type = "pointermove";
419
+ deck._onPointerMove(mockEvent);
420
+ break;
421
+ case "mouseout":
422
+ mockEvent.type = "pointerleave";
423
+ deck._onPointerMove(mockEvent);
424
+ break;
425
+ default:
426
+ return;
427
+ }
428
+ };
429
+ const { interleaved = false, ...otherProps } = props;
430
+ this._interleaved = interleaved;
431
+ this._props = otherProps;
432
+ }
433
+ setProps(props) {
434
+ if (this._interleaved && props.layers) {
435
+ resolveLayers(this._map, this._deck, this._props.layers, props.layers);
436
+ }
437
+ Object.assign(this._props, props);
438
+ if (this._deck) {
439
+ this._deck.setProps(this._interleaved ? getInterleavedProps(this._props) : this._props);
440
+ }
441
+ }
442
+ onAdd(map) {
443
+ this._map = map;
444
+ return this._interleaved ? this._onAddInterleaved(map) : this._onAddOverlaid(map);
445
+ }
446
+ _onAddOverlaid(map) {
447
+ const container = document.createElement("div");
448
+ Object.assign(container.style, {
449
+ position: "absolute",
450
+ left: 0,
451
+ top: 0,
452
+ pointerEvents: "none"
453
+ });
454
+ this._container = container;
455
+ this._deck = new import_core4.Deck({
456
+ ...this._props,
457
+ parent: container,
458
+ viewState: getViewState(map)
459
+ });
460
+ map.on("resize", this._updateContainerSize);
461
+ map.on("render", this._updateViewState);
462
+ map.on("mousedown", this._handleMouseEvent);
463
+ map.on("dragstart", this._handleMouseEvent);
464
+ map.on("drag", this._handleMouseEvent);
465
+ map.on("dragend", this._handleMouseEvent);
466
+ map.on("mousemove", this._handleMouseEvent);
467
+ map.on("mouseout", this._handleMouseEvent);
468
+ map.on("click", this._handleMouseEvent);
469
+ map.on("dblclick", this._handleMouseEvent);
470
+ this._updateContainerSize();
471
+ return container;
472
+ }
473
+ _onAddInterleaved(map) {
474
+ this._deck = getDeckInstance({
475
+ map,
476
+ gl: map.painter.context.gl,
477
+ deck: new import_core4.Deck({
478
+ ...this._props,
479
+ gl: map.painter.context.gl
480
+ })
481
+ });
482
+ map.on("styledata", this._handleStyleChange);
483
+ resolveLayers(map, this._deck, [], this._props.layers);
484
+ return document.createElement("div");
485
+ }
486
+ onRemove() {
487
+ const map = this._map;
488
+ if (map) {
489
+ if (this._interleaved) {
490
+ this._onRemoveInterleaved(map);
491
+ } else {
492
+ this._onRemoveOverlaid(map);
493
+ }
494
+ }
495
+ this._deck = void 0;
496
+ this._map = void 0;
497
+ this._container = void 0;
498
+ }
499
+ _onRemoveOverlaid(map) {
500
+ var _a;
501
+ map.off("resize", this._updateContainerSize);
502
+ map.off("render", this._updateViewState);
503
+ map.off("mousedown", this._handleMouseEvent);
504
+ map.off("dragstart", this._handleMouseEvent);
505
+ map.off("drag", this._handleMouseEvent);
506
+ map.off("dragend", this._handleMouseEvent);
507
+ map.off("mousemove", this._handleMouseEvent);
508
+ map.off("mouseout", this._handleMouseEvent);
509
+ map.off("click", this._handleMouseEvent);
510
+ map.off("dblclick", this._handleMouseEvent);
511
+ (_a = this._deck) == null ? void 0 : _a.finalize();
512
+ }
513
+ _onRemoveInterleaved(map) {
514
+ map.off("styledata", this._handleStyleChange);
515
+ resolveLayers(map, this._deck, this._props.layers, []);
516
+ removeDeckInstance(map);
517
+ }
518
+ getDefaultPosition() {
519
+ return "top-left";
520
+ }
521
+ pickObject(params) {
522
+ (0, import_core4.assert)(this._deck);
523
+ return this._deck.pickObject(params);
524
+ }
525
+ pickMultipleObjects(params) {
526
+ (0, import_core4.assert)(this._deck);
527
+ return this._deck.pickMultipleObjects(params);
528
+ }
529
+ pickObjects(params) {
530
+ (0, import_core4.assert)(this._deck);
531
+ return this._deck.pickObjects(params);
532
+ }
533
+ finalize() {
534
+ if (this._map) {
535
+ this._map.removeControl(this);
536
+ }
537
+ }
538
+ getCanvas() {
539
+ if (!this._map) {
540
+ return null;
541
+ }
542
+ return this._interleaved ? this._map.getCanvas() : this._deck.getCanvas();
543
+ }
544
+ };
545
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["index.js", "deck-utils.js", "mapbox-layer.js", "mapbox-overlay.js", "resolve-layers.js"],
4
+ "sourcesContent": ["export { default as MapboxLayer } from \"./mapbox-layer.js\";\nexport { default as MapboxOverlay } from \"./mapbox-overlay.js\";\n", "import { Deck, WebMercatorViewport, MapView, _flatten as flatten } from '@deck.gl/core';\nimport { lngLatToWorld, unitsPerMeter } from '@math.gl/web-mercator';\nimport { GL } from '@luma.gl/constants';\n// Mercator constants\nconst TILE_SIZE = 512;\nconst DEGREES_TO_RADIANS = Math.PI / 180;\n// Create an interleaved deck instance.\nexport function getDeckInstance({ map, gl, deck }) {\n // Only create one deck instance per context\n if (map.__deck) {\n return map.__deck;\n }\n // Only initialize certain props once per context\n const customRender = deck?.props._customRender;\n const onLoad = deck?.props.onLoad;\n const deckProps = getInterleavedProps({\n ...deck?.props,\n _customRender: () => {\n map.triggerRepaint();\n // customRender may be subscribed by DeckGL React component to update child props\n // make sure it is still called\n // Hack - do not pass a redraw reason here to prevent the React component from clearing the context\n // Rerender will be triggered by MapboxLayer's render()\n customRender?.('');\n }\n });\n let deckInstance;\n if (!deck || deck.props.gl === gl) {\n // If deck isn't defined (Internal MapboxLayer use case),\n // or if deck is defined and is using the WebGLContext created by mapbox (MapboxOverlay and External MapboxLayer use case),\n // block deck from setting the canvas size, and use the map's viewState to drive deck.\n // Otherwise, we use deck's viewState to drive the map.\n Object.assign(deckProps, {\n gl,\n width: null,\n height: null,\n touchAction: 'unset',\n viewState: getViewState(map)\n });\n if (deck?.isInitialized) {\n watchMapMove(deck, map);\n }\n else {\n deckProps.onLoad = () => {\n onLoad?.();\n watchMapMove(deckInstance, map);\n };\n }\n }\n if (deck) {\n deckInstance = deck;\n deck.setProps(deckProps);\n deck.userData.isExternal = true;\n }\n else {\n deckInstance = new Deck(deckProps);\n map.on('remove', () => {\n removeDeckInstance(map);\n });\n }\n deckInstance.userData.mapboxLayers = new Set();\n // (deckInstance.userData as UserData).mapboxVersion = getMapboxVersion(map);\n map.__deck = deckInstance;\n map.on('render', () => {\n if (deckInstance.isInitialized)\n afterRender(deckInstance, map);\n });\n return deckInstance;\n}\nfunction watchMapMove(deck, map) {\n const _handleMapMove = () => {\n if (deck.isInitialized) {\n // call view state methods\n onMapMove(deck, map);\n }\n else {\n // deregister itself when deck is finalized\n map.off('move', _handleMapMove);\n }\n };\n map.on('move', _handleMapMove);\n}\nexport function removeDeckInstance(map) {\n map.__deck?.finalize();\n map.__deck = null;\n}\nexport function getInterleavedProps(currProps) {\n const nextProps = {\n ...currProps,\n // TODO: import these defaults from a single source of truth\n parameters: {\n depthMask: true,\n depthTest: true,\n blend: true,\n blendFunc: [GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA, GL.ONE, GL.ONE_MINUS_SRC_ALPHA],\n polygonOffsetFill: true,\n depthFunc: GL.LEQUAL,\n blendEquation: GL.FUNC_ADD,\n ...currProps.parameters\n },\n views: currProps.views || [new MapView({ id: 'mapbox' })]\n };\n return nextProps;\n}\nexport function addLayer(deck, layer) {\n deck.userData.mapboxLayers.add(layer);\n updateLayers(deck);\n}\nexport function removeLayer(deck, layer) {\n deck.userData.mapboxLayers.delete(layer);\n updateLayers(deck);\n}\nexport function updateLayer(deck, layer) {\n updateLayers(deck);\n}\nexport function drawLayer(deck, map, layer) {\n let { currentViewport } = deck.userData;\n let clearStack = false;\n if (!currentViewport) {\n // This is the first layer drawn in this render cycle.\n // Generate viewport from the current map state.\n currentViewport = getViewport(deck, map, true);\n deck.userData.currentViewport = currentViewport;\n clearStack = true;\n }\n if (!deck.isInitialized) {\n return;\n }\n deck._drawLayers('mapbox-repaint', {\n viewports: [currentViewport],\n layerFilter: ({ layer: deckLayer }) => layer.id === deckLayer.id || deckLayer.props.operation.includes('terrain'),\n clearStack,\n clearCanvas: false\n });\n}\nexport function getViewState(map) {\n const { lng, lat } = map.getCenter();\n const viewState = {\n // Longitude returned by getCenter can be outside of [-180, 180] when zooming near the anti meridian\n // https://github.com/visgl/deck.gl/issues/6894\n longitude: ((lng + 540) % 360) - 180,\n latitude: lat,\n zoom: map.getZoom(),\n bearing: map.getBearing(),\n pitch: map.getPitch(),\n padding: map.getPadding(),\n repeat: map.getRenderWorldCopies()\n };\n if (map.getTerrain?.()) {\n // When the base map has terrain, we need to target the camera at the terrain surface\n centerCameraOnTerrain(map, viewState);\n }\n return viewState;\n}\nfunction centerCameraOnTerrain(map, viewState) {\n if (map.getFreeCameraOptions) {\n // mapbox-gl v2\n const { position } = map.getFreeCameraOptions();\n if (!position || position.z === undefined) {\n return;\n }\n // @ts-ignore transform is not typed\n const height = map.transform.height;\n const { longitude, latitude, pitch } = viewState;\n // Convert mapbox mercator coordinate to deck common space\n const cameraX = position.x * TILE_SIZE;\n const cameraY = (1 - position.y) * TILE_SIZE;\n const cameraZ = position.z * TILE_SIZE;\n // Mapbox manipulates zoom in terrain mode, see discussion here: https://github.com/mapbox/mapbox-gl-js/issues/12040\n const center = lngLatToWorld([longitude, latitude]);\n const dx = cameraX - center[0];\n const dy = cameraY - center[1];\n const cameraToCenterDistanceGround = Math.sqrt(dx * dx + dy * dy);\n const pitchRadians = pitch * DEGREES_TO_RADIANS;\n const altitudePixels = 1.5 * height;\n const scale = pitchRadians < 0.001\n ? // Pitch angle too small to deduce the look at point, assume elevation is 0\n (altitudePixels * Math.cos(pitchRadians)) / cameraZ\n : (altitudePixels * Math.sin(pitchRadians)) / cameraToCenterDistanceGround;\n viewState.zoom = Math.log2(scale);\n const cameraZFromSurface = (altitudePixels * Math.cos(pitchRadians)) / scale;\n const surfaceElevation = cameraZ - cameraZFromSurface;\n viewState.position = [0, 0, surfaceElevation / unitsPerMeter(latitude)];\n }\n // @ts-ignore transform is not typed\n else if (typeof map.transform.elevation === 'number') {\n // maplibre-gl\n // @ts-ignore transform is not typed\n viewState.position = [0, 0, map.transform.elevation];\n }\n}\n// function getMapboxVersion(map: Map): {minor: number; major: number} {\n// // parse mapbox version string\n// let major = 0;\n// let minor = 0;\n// // @ts-ignore (2339) undefined property\n// const version: string = map.version;\n// if (version) {\n// [major, minor] = version.split('.').slice(0, 2).map(Number);\n// }\n// return {major, minor};\n// }\nfunction getViewport(deck, map, useMapboxProjection = true) {\n return new WebMercatorViewport({\n id: 'mapbox',\n x: 0,\n y: 0,\n width: deck.width,\n height: deck.height,\n ...getViewState(map),\n nearZMultiplier: useMapboxProjection\n ? // match mapbox-gl@>=1.3.0's projection matrix\n 0.02\n : // use deck.gl's own default\n 0.1,\n nearZ: map.transform._nearZ / map.transform.height,\n farZ: map.transform._farZ / map.transform.height\n });\n}\nfunction afterRender(deck, map) {\n const { mapboxLayers, isExternal } = deck.userData;\n if (isExternal) {\n // Draw non-Mapbox layers\n const mapboxLayerIds = Array.from(mapboxLayers, layer => layer.id);\n const deckLayers = flatten(deck.props.layers, Boolean);\n const hasNonMapboxLayers = deckLayers.some(layer => layer && !mapboxLayerIds.includes(layer.id));\n let viewports = deck.getViewports();\n const mapboxViewportIdx = viewports.findIndex(vp => vp.id === 'mapbox');\n const hasNonMapboxViews = viewports.length > 1 || mapboxViewportIdx < 0;\n if (hasNonMapboxLayers || hasNonMapboxViews) {\n if (mapboxViewportIdx >= 0) {\n viewports = viewports.slice();\n viewports[mapboxViewportIdx] = getViewport(deck, map, false);\n }\n deck._drawLayers('mapbox-repaint', {\n viewports,\n layerFilter: params => (!deck.props.layerFilter || deck.props.layerFilter(params)) &&\n (params.viewport.id !== 'mapbox' || !mapboxLayerIds.includes(params.layer.id)),\n clearCanvas: false\n });\n }\n }\n // End of render cycle, clear generated viewport\n deck.userData.currentViewport = null;\n}\nfunction onMapMove(deck, map) {\n deck.setProps({\n viewState: getViewState(map)\n });\n // Camera changed, will trigger a map repaint right after this\n // Clear any change flag triggered by setting viewState so that deck does not request\n // a second repaint\n deck.needsRedraw({ clearRedrawFlags: true });\n}\nfunction updateLayers(deck) {\n if (deck.userData.isExternal) {\n return;\n }\n const layers = [];\n deck.userData.mapboxLayers.forEach(deckLayer => {\n const LayerType = deckLayer.props.type;\n const layer = new LayerType(deckLayer.props);\n layers.push(layer);\n });\n deck.setProps({ layers });\n}\n", "import { getDeckInstance, addLayer, removeLayer, updateLayer, drawLayer } from \"./deck-utils.js\";\nimport { log } from '@deck.gl/core';\nexport default class MapboxLayer {\n /* eslint-disable no-this-before-super */\n constructor(props) {\n if (!props.id) {\n throw new Error('Layer must have an unique id');\n }\n this.id = props.id;\n this.type = 'custom';\n this.renderingMode = props.renderingMode || '3d';\n this.map = null;\n this.deck = null;\n this.props = props;\n }\n /* Mapbox custom layer methods */\n onAdd(map, gl) {\n if (gl instanceof WebGLRenderingContext) {\n log.warn('Use useWebGL2:true in mapboxgl.Map()')();\n return;\n }\n this.map = map;\n this.deck = getDeckInstance({ map, gl, deck: this.props.deck });\n addLayer(this.deck, this);\n }\n onRemove() {\n if (this.deck) {\n removeLayer(this.deck, this);\n }\n }\n setProps(props) {\n // id cannot be changed\n Object.assign(this.props, props, { id: this.id });\n // safe guard in case setProps is called before onAdd\n if (this.deck) {\n updateLayer(this.deck, this);\n }\n }\n render() {\n drawLayer(this.deck, this.map, this);\n }\n}\n", "import { Deck, assert } from '@deck.gl/core';\nimport { getViewState, getDeckInstance, removeDeckInstance, getInterleavedProps } from \"./deck-utils.js\";\nimport { resolveLayers } from \"./resolve-layers.js\";\n/**\n * Implements Mapbox [IControl](https://docs.mapbox.com/mapbox-gl-js/api/markers/#icontrol) interface\n * Renders deck.gl layers over the base map and automatically synchronizes with the map's camera\n */\nexport default class MapboxOverlay {\n constructor(props) {\n this._handleStyleChange = () => {\n resolveLayers(this._map, this._deck, this._props.layers, this._props.layers);\n };\n this._updateContainerSize = () => {\n if (this._map && this._container) {\n const { clientWidth, clientHeight } = this._map.getContainer();\n Object.assign(this._container.style, {\n width: `${clientWidth}px`,\n height: `${clientHeight}px`\n });\n }\n };\n this._updateViewState = () => {\n const deck = this._deck;\n if (deck) {\n // @ts-ignore (2345) map is always defined if deck is\n deck.setProps({ viewState: getViewState(this._map) });\n // Redraw immediately if view state has changed\n if (deck.isInitialized) {\n deck.redraw();\n }\n }\n };\n // eslint-disable-next-line complexity\n this._handleMouseEvent = (event) => {\n const deck = this._deck;\n if (!deck || !deck.isInitialized) {\n return;\n }\n const mockEvent = {\n type: event.type,\n offsetCenter: event.point,\n srcEvent: event\n };\n const lastDown = this._lastMouseDownPoint;\n if (!event.point && lastDown) {\n // drag* events do not contain a `point` field\n mockEvent.deltaX = event.originalEvent.clientX - lastDown.clientX;\n mockEvent.deltaY = event.originalEvent.clientY - lastDown.clientY;\n mockEvent.offsetCenter = {\n x: lastDown.x + mockEvent.deltaX,\n y: lastDown.y + mockEvent.deltaY\n };\n }\n switch (mockEvent.type) {\n case 'mousedown':\n deck._onPointerDown(mockEvent);\n this._lastMouseDownPoint = {\n ...event.point,\n clientX: event.originalEvent.clientX,\n clientY: event.originalEvent.clientY\n };\n break;\n case 'dragstart':\n mockEvent.type = 'panstart';\n deck._onEvent(mockEvent);\n break;\n case 'drag':\n mockEvent.type = 'panmove';\n deck._onEvent(mockEvent);\n break;\n case 'dragend':\n mockEvent.type = 'panend';\n deck._onEvent(mockEvent);\n break;\n case 'click':\n mockEvent.tapCount = 1;\n deck._onEvent(mockEvent);\n break;\n case 'dblclick':\n mockEvent.type = 'click';\n mockEvent.tapCount = 2;\n deck._onEvent(mockEvent);\n break;\n case 'mousemove':\n mockEvent.type = 'pointermove';\n deck._onPointerMove(mockEvent);\n break;\n case 'mouseout':\n mockEvent.type = 'pointerleave';\n deck._onPointerMove(mockEvent);\n break;\n default:\n return;\n }\n };\n const { interleaved = false, ...otherProps } = props;\n this._interleaved = interleaved;\n this._props = otherProps;\n }\n /** Update (partial) props of the underlying Deck instance. */\n setProps(props) {\n if (this._interleaved && props.layers) {\n resolveLayers(this._map, this._deck, this._props.layers, props.layers);\n }\n Object.assign(this._props, props);\n if (this._deck) {\n this._deck.setProps(this._interleaved ? getInterleavedProps(this._props) : this._props);\n }\n }\n /** Called when the control is added to a map */\n onAdd(map) {\n this._map = map;\n return this._interleaved ? this._onAddInterleaved(map) : this._onAddOverlaid(map);\n }\n _onAddOverlaid(map) {\n /* global document */\n const container = document.createElement('div');\n Object.assign(container.style, {\n position: 'absolute',\n left: 0,\n top: 0,\n pointerEvents: 'none'\n });\n this._container = container;\n this._deck = new Deck({\n ...this._props,\n parent: container,\n viewState: getViewState(map)\n });\n map.on('resize', this._updateContainerSize);\n map.on('render', this._updateViewState);\n map.on('mousedown', this._handleMouseEvent);\n map.on('dragstart', this._handleMouseEvent);\n map.on('drag', this._handleMouseEvent);\n map.on('dragend', this._handleMouseEvent);\n map.on('mousemove', this._handleMouseEvent);\n map.on('mouseout', this._handleMouseEvent);\n map.on('click', this._handleMouseEvent);\n map.on('dblclick', this._handleMouseEvent);\n this._updateContainerSize();\n return container;\n }\n _onAddInterleaved(map) {\n this._deck = getDeckInstance({\n map,\n // @ts-ignore non-public map property\n gl: map.painter.context.gl,\n deck: new Deck({\n ...this._props,\n // @ts-ignore non-public map property\n gl: map.painter.context.gl\n })\n });\n map.on('styledata', this._handleStyleChange);\n resolveLayers(map, this._deck, [], this._props.layers);\n return document.createElement('div');\n }\n /** Called when the control is removed from a map */\n onRemove() {\n const map = this._map;\n if (map) {\n if (this._interleaved) {\n this._onRemoveInterleaved(map);\n }\n else {\n this._onRemoveOverlaid(map);\n }\n }\n this._deck = undefined;\n this._map = undefined;\n this._container = undefined;\n }\n _onRemoveOverlaid(map) {\n map.off('resize', this._updateContainerSize);\n map.off('render', this._updateViewState);\n map.off('mousedown', this._handleMouseEvent);\n map.off('dragstart', this._handleMouseEvent);\n map.off('drag', this._handleMouseEvent);\n map.off('dragend', this._handleMouseEvent);\n map.off('mousemove', this._handleMouseEvent);\n map.off('mouseout', this._handleMouseEvent);\n map.off('click', this._handleMouseEvent);\n map.off('dblclick', this._handleMouseEvent);\n this._deck?.finalize();\n }\n _onRemoveInterleaved(map) {\n map.off('styledata', this._handleStyleChange);\n resolveLayers(map, this._deck, this._props.layers, []);\n removeDeckInstance(map);\n }\n getDefaultPosition() {\n return 'top-left';\n }\n /** Forwards the Deck.pickObject method */\n pickObject(params) {\n assert(this._deck);\n return this._deck.pickObject(params);\n }\n /** Forwards the Deck.pickMultipleObjects method */\n pickMultipleObjects(params) {\n assert(this._deck);\n return this._deck.pickMultipleObjects(params);\n }\n /** Forwards the Deck.pickObjects method */\n pickObjects(params) {\n assert(this._deck);\n return this._deck.pickObjects(params);\n }\n /** Remove from map and releases all resources */\n finalize() {\n if (this._map) {\n this._map.removeControl(this);\n }\n }\n /** If interleaved: true, returns base map's canvas, otherwise forwards the Deck.getCanvas method. */\n getCanvas() {\n if (!this._map) {\n return null;\n }\n return this._interleaved ? this._map.getCanvas() : this._deck.getCanvas();\n }\n}\n", "import { _flatten as flatten } from '@deck.gl/core';\nimport MapboxLayer from \"./mapbox-layer.js\";\nconst UNDEFINED_BEFORE_ID = '__UNDEFINED__';\n/** Insert Deck layers into the mapbox Map according to the user-defined order */\n// eslint-disable-next-line complexity, max-statements\nexport function resolveLayers(map, deck, oldLayers, newLayers) {\n // Wait until map style is loaded\n // @ts-ignore non-public map property\n if (!map || !deck || !map.style || !map.style._loaded) {\n return;\n }\n const layers = flatten(newLayers, Boolean);\n if (oldLayers !== newLayers) {\n // Step 1: remove layers that no longer exist\n const prevLayers = flatten(oldLayers, Boolean);\n const prevLayerIds = new Set(prevLayers.map(l => l.id));\n for (const layer of layers) {\n prevLayerIds.delete(layer.id);\n }\n for (const id of prevLayerIds) {\n if (map.getLayer(id)) {\n map.removeLayer(id);\n }\n }\n }\n // Step 2: add missing layers\n for (const layer of layers) {\n const mapboxLayer = map.getLayer(layer.id);\n if (mapboxLayer) {\n // @ts-expect-error not typed\n mapboxLayer.implementation.setProps(layer.props);\n }\n else {\n map.addLayer(new MapboxLayer({ id: layer.id, deck }), \n // @ts-expect-error beforeId is not defined in LayerProps\n layer.props.beforeId);\n }\n }\n // Step 3: check the order of layers\n // If beforeId is defined, the deck layer should always render before the mapbox layer [beforeId]\n // If beforeId is not defined, the deck layer should appear after all mapbox layers\n // When two deck layers share the same beforeId, they are rendered in the order that is passed into Deck props.layers\n // @ts-ignore non-public map property\n const mapLayers = map.style._order;\n // Group deck layers by beforeId\n const layerGroups = {};\n for (const layer of layers) {\n // @ts-expect-error beforeId is not defined in LayerProps\n let { beforeId } = layer.props;\n if (!beforeId || !mapLayers.includes(beforeId)) {\n beforeId = UNDEFINED_BEFORE_ID;\n }\n layerGroups[beforeId] = layerGroups[beforeId] || [];\n layerGroups[beforeId].push(layer.id);\n }\n for (const beforeId in layerGroups) {\n const layerGroup = layerGroups[beforeId];\n let lastLayerIndex = beforeId === UNDEFINED_BEFORE_ID ? mapLayers.length : mapLayers.indexOf(beforeId);\n let lastLayerId = beforeId === UNDEFINED_BEFORE_ID ? undefined : beforeId;\n for (let i = layerGroup.length - 1; i >= 0; i--) {\n const layerId = layerGroup[i];\n const layerIndex = mapLayers.indexOf(layerId);\n if (layerIndex !== lastLayerIndex - 1) {\n map.moveLayer(layerId, lastLayerId);\n if (layerIndex > lastLayerIndex) {\n // The last layer's index have changed\n lastLayerIndex++;\n }\n }\n lastLayerIndex--;\n lastLayerId = layerId;\n }\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAAwE;AACxE,0BAA6C;AAC7C,uBAAmB;AAEnB,IAAM,YAAY;AAClB,IAAM,qBAAqB,KAAK,KAAK;AAE9B,SAAS,gBAAgB,EAAE,KAAK,IAAI,KAAK,GAAG;AAE/C,MAAI,IAAI,QAAQ;AACZ,WAAO,IAAI;AAAA,EACf;AAEA,QAAM,eAAe,6BAAM,MAAM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AoB,MAAM;AAAA,EAChD;AAAA,EAEA,YAAY,QAAQ;AAChB,6BAAO,KAAK,KAAK;AACjB,WAAO,KAAK,MAAM,YAAY,MAAM;AAAA,EACxC;AAAA,EAEA,WAAW;AACP,QAAI,KAAK,MAAM;AACX,WAAK,KAAK,cAAc,IAAI;AAAA,IAChC;AAAA,EACJ;AAAA,EAEA,YAAY;AACR,QAAI,CAAC,KAAK,MAAM;AACZ,aAAO;AAAA,IACX;AACA,WAAO,KAAK,eAAe,KAAK,KAAK,UAAU,IAAI,KAAK,MAAM,UAAU;AAAA,EAC5E;AACJ;",
6
+ "names": ["flatten", "import_core", "import_core", "import_core", "flatten"]
7
+ }
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { default as MapboxLayer } from "./mapbox-layer.js";
2
+ export { default as MapboxOverlay } from "./mapbox-overlay.js";
@@ -0,0 +1,42 @@
1
+ import { getDeckInstance, addLayer, removeLayer, updateLayer, drawLayer } from "./deck-utils.js";
2
+ import { log } from '@deck.gl/core';
3
+ export default class MapboxLayer {
4
+ /* eslint-disable no-this-before-super */
5
+ constructor(props) {
6
+ if (!props.id) {
7
+ throw new Error('Layer must have an unique id');
8
+ }
9
+ this.id = props.id;
10
+ this.type = 'custom';
11
+ this.renderingMode = props.renderingMode || '3d';
12
+ this.map = null;
13
+ this.deck = null;
14
+ this.props = props;
15
+ }
16
+ /* Mapbox custom layer methods */
17
+ onAdd(map, gl) {
18
+ if (gl instanceof WebGLRenderingContext) {
19
+ log.warn('Use useWebGL2:true in mapboxgl.Map()')();
20
+ return;
21
+ }
22
+ this.map = map;
23
+ this.deck = getDeckInstance({ map, gl, deck: this.props.deck });
24
+ addLayer(this.deck, this);
25
+ }
26
+ onRemove() {
27
+ if (this.deck) {
28
+ removeLayer(this.deck, this);
29
+ }
30
+ }
31
+ setProps(props) {
32
+ // id cannot be changed
33
+ Object.assign(this.props, props, { id: this.id });
34
+ // safe guard in case setProps is called before onAdd
35
+ if (this.deck) {
36
+ updateLayer(this.deck, this);
37
+ }
38
+ }
39
+ render() {
40
+ drawLayer(this.deck, this.map, this);
41
+ }
42
+ }