@deck.gl/mapbox 9.1.0-beta.1 → 9.1.0
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.
- package/dist/deck-utils.d.ts +10 -8
- package/dist/deck-utils.d.ts.map +1 -1
- package/dist/deck-utils.js +68 -48
- package/dist/deck-utils.js.map +1 -0
- package/dist/dist.dev.js +77 -695
- package/dist/index.cjs +78 -45
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/mapbox-layer.d.ts +2 -2
- package/dist/mapbox-layer.d.ts.map +1 -1
- package/dist/mapbox-layer.js +3 -2
- package/dist/mapbox-layer.js.map +1 -0
- package/dist/mapbox-overlay.d.ts +1 -3
- package/dist/mapbox-overlay.d.ts.map +1 -1
- package/dist/mapbox-overlay.js +18 -6
- package/dist/mapbox-overlay.js.map +1 -0
- package/dist/resolve-layers.d.ts +1 -1
- package/dist/resolve-layers.d.ts.map +1 -1
- package/dist/resolve-layers.js +1 -0
- package/dist/resolve-layers.js.map +1 -0
- package/dist/types.d.ts +83 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist.min.js +1 -1
- package/package.json +5 -5
- package/src/deck-utils.ts +96 -58
- package/src/mapbox-layer.ts +3 -3
- package/src/mapbox-overlay.ts +35 -19
- package/src/resolve-layers.ts +1 -1
- package/src/types.ts +125 -0
package/dist/index.cjs
CHANGED
|
@@ -30,7 +30,6 @@ var import_core3 = require("@deck.gl/core");
|
|
|
30
30
|
// dist/deck-utils.js
|
|
31
31
|
var import_core = require("@deck.gl/core");
|
|
32
32
|
var import_web_mercator = require("@math.gl/web-mercator");
|
|
33
|
-
var import_constants = require("@luma.gl/constants");
|
|
34
33
|
var TILE_SIZE = 512;
|
|
35
34
|
var DEGREES_TO_RADIANS = Math.PI / 180;
|
|
36
35
|
function getDeckInstance({ map, gl, deck }) {
|
|
@@ -39,13 +38,15 @@ function getDeckInstance({ map, gl, deck }) {
|
|
|
39
38
|
}
|
|
40
39
|
const customRender = deck == null ? void 0 : deck.props._customRender;
|
|
41
40
|
const onLoad = deck == null ? void 0 : deck.props.onLoad;
|
|
42
|
-
const deckProps =
|
|
41
|
+
const deckProps = {
|
|
43
42
|
...deck == null ? void 0 : deck.props,
|
|
44
43
|
_customRender: () => {
|
|
45
44
|
map.triggerRepaint();
|
|
46
45
|
customRender == null ? void 0 : customRender("");
|
|
47
46
|
}
|
|
48
|
-
}
|
|
47
|
+
};
|
|
48
|
+
deckProps.parameters = { ...getDefaultParameters(map, true), ...deckProps.parameters };
|
|
49
|
+
deckProps.views || (deckProps.views = getDefaultView(map));
|
|
49
50
|
let deckInstance;
|
|
50
51
|
if (!deck || deck.props.gl === gl) {
|
|
51
52
|
Object.assign(deckProps, {
|
|
@@ -97,24 +98,23 @@ function removeDeckInstance(map) {
|
|
|
97
98
|
(_a = map.__deck) == null ? void 0 : _a.finalize();
|
|
98
99
|
map.__deck = null;
|
|
99
100
|
}
|
|
100
|
-
function
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
return nextProps;
|
|
101
|
+
function getDefaultParameters(map, interleaved) {
|
|
102
|
+
const result = interleaved ? {
|
|
103
|
+
depthWriteEnabled: true,
|
|
104
|
+
depthCompare: "less-equal",
|
|
105
|
+
depthBias: 0,
|
|
106
|
+
blend: true,
|
|
107
|
+
blendColorSrcFactor: "src-alpha",
|
|
108
|
+
blendColorDstFactor: "one-minus-src-alpha",
|
|
109
|
+
blendAlphaSrcFactor: "one",
|
|
110
|
+
blendAlphaDstFactor: "one-minus-src-alpha",
|
|
111
|
+
blendColorOperation: "add",
|
|
112
|
+
blendAlphaOperation: "add"
|
|
113
|
+
} : {};
|
|
114
|
+
if (getProjection(map) === "globe") {
|
|
115
|
+
result.cullMode = "back";
|
|
116
|
+
}
|
|
117
|
+
return result;
|
|
118
118
|
}
|
|
119
119
|
function addLayer(deck, layer) {
|
|
120
120
|
deck.userData.mapboxLayers.add(layer);
|
|
@@ -127,11 +127,11 @@ function removeLayer(deck, layer) {
|
|
|
127
127
|
function updateLayer(deck, layer) {
|
|
128
128
|
updateLayers(deck);
|
|
129
129
|
}
|
|
130
|
-
function drawLayer(deck, map, layer) {
|
|
130
|
+
function drawLayer(deck, map, layer, renderParameters) {
|
|
131
131
|
let { currentViewport } = deck.userData;
|
|
132
132
|
let clearStack = false;
|
|
133
133
|
if (!currentViewport) {
|
|
134
|
-
currentViewport = getViewport(deck, map,
|
|
134
|
+
currentViewport = getViewport(deck, map, renderParameters);
|
|
135
135
|
deck.userData.currentViewport = currentViewport;
|
|
136
136
|
clearStack = true;
|
|
137
137
|
}
|
|
@@ -145,6 +145,28 @@ function drawLayer(deck, map, layer) {
|
|
|
145
145
|
clearCanvas: false
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
|
+
function getProjection(map) {
|
|
149
|
+
var _a;
|
|
150
|
+
const projection = (_a = map.getProjection) == null ? void 0 : _a.call(map);
|
|
151
|
+
const type = (
|
|
152
|
+
// maplibre projection spec
|
|
153
|
+
(projection == null ? void 0 : projection.type) || // mapbox projection spec
|
|
154
|
+
(projection == null ? void 0 : projection.name)
|
|
155
|
+
);
|
|
156
|
+
if (type === "globe") {
|
|
157
|
+
return "globe";
|
|
158
|
+
}
|
|
159
|
+
if (type && type !== "mercator") {
|
|
160
|
+
throw new Error("Unsupported projection");
|
|
161
|
+
}
|
|
162
|
+
return "mercator";
|
|
163
|
+
}
|
|
164
|
+
function getDefaultView(map) {
|
|
165
|
+
if (getProjection(map) === "globe") {
|
|
166
|
+
return new import_core._GlobeView({ id: "mapbox" });
|
|
167
|
+
}
|
|
168
|
+
return new import_core.MapView({ id: "mapbox" });
|
|
169
|
+
}
|
|
148
170
|
function getViewState(map) {
|
|
149
171
|
var _a;
|
|
150
172
|
const { lng, lat } = map.getCenter();
|
|
@@ -193,23 +215,22 @@ function centerCameraOnTerrain(map, viewState) {
|
|
|
193
215
|
viewState.position = [0, 0, map.transform.elevation];
|
|
194
216
|
}
|
|
195
217
|
}
|
|
196
|
-
function getViewport(deck, map,
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
218
|
+
function getViewport(deck, map, renderParameters) {
|
|
219
|
+
const viewState = getViewState(map);
|
|
220
|
+
const view = getDefaultView(map);
|
|
221
|
+
if (renderParameters) {
|
|
222
|
+
view.props.nearZMultiplier = 0.2;
|
|
223
|
+
}
|
|
224
|
+
const nearZ = (renderParameters == null ? void 0 : renderParameters.nearZ) ?? map.transform._nearZ;
|
|
225
|
+
const farZ = (renderParameters == null ? void 0 : renderParameters.farZ) ?? map.transform._farZ;
|
|
226
|
+
if (Number.isFinite(nearZ)) {
|
|
227
|
+
viewState.nearZ = nearZ / map.transform.height;
|
|
228
|
+
viewState.farZ = farZ / map.transform.height;
|
|
229
|
+
}
|
|
230
|
+
return view.makeViewport({
|
|
201
231
|
width: deck.width,
|
|
202
232
|
height: deck.height,
|
|
203
|
-
|
|
204
|
-
nearZMultiplier: useMapboxProjection ? (
|
|
205
|
-
// match mapbox-gl@>=1.3.0's projection matrix
|
|
206
|
-
0.02
|
|
207
|
-
) : (
|
|
208
|
-
// use deck.gl's own default
|
|
209
|
-
0.1
|
|
210
|
-
),
|
|
211
|
-
nearZ: map.transform._nearZ / map.transform.height,
|
|
212
|
-
farZ: map.transform._farZ / map.transform.height
|
|
233
|
+
viewState
|
|
213
234
|
});
|
|
214
235
|
}
|
|
215
236
|
function afterRender(deck, map) {
|
|
@@ -224,7 +245,7 @@ function afterRender(deck, map) {
|
|
|
224
245
|
if (hasNonMapboxLayers || hasNonMapboxViews) {
|
|
225
246
|
if (mapboxViewportIdx >= 0) {
|
|
226
247
|
viewports = viewports.slice();
|
|
227
|
-
viewports[mapboxViewportIdx] = getViewport(deck, map
|
|
248
|
+
viewports[mapboxViewportIdx] = getViewport(deck, map);
|
|
228
249
|
}
|
|
229
250
|
deck._drawLayers("mapbox-repaint", {
|
|
230
251
|
viewports,
|
|
@@ -291,8 +312,8 @@ var MapboxLayer = class {
|
|
|
291
312
|
updateLayer(this.deck, this);
|
|
292
313
|
}
|
|
293
314
|
}
|
|
294
|
-
render() {
|
|
295
|
-
drawLayer(this.deck, this.map, this);
|
|
315
|
+
render(gl, renderParameters) {
|
|
316
|
+
drawLayer(this.deck, this.map, this, renderParameters);
|
|
296
317
|
}
|
|
297
318
|
};
|
|
298
319
|
|
|
@@ -374,8 +395,12 @@ var MapboxOverlay = class {
|
|
|
374
395
|
};
|
|
375
396
|
this._updateViewState = () => {
|
|
376
397
|
const deck = this._deck;
|
|
377
|
-
|
|
378
|
-
|
|
398
|
+
const map = this._map;
|
|
399
|
+
if (deck && map) {
|
|
400
|
+
deck.setProps({
|
|
401
|
+
views: this._props.views || getDefaultView(map),
|
|
402
|
+
viewState: getViewState(map)
|
|
403
|
+
});
|
|
379
404
|
if (deck.isInitialized) {
|
|
380
405
|
deck.redraw();
|
|
381
406
|
}
|
|
@@ -452,8 +477,14 @@ var MapboxOverlay = class {
|
|
|
452
477
|
resolveLayers(this._map, this._deck, this._props.layers, props.layers);
|
|
453
478
|
}
|
|
454
479
|
Object.assign(this._props, props);
|
|
455
|
-
if (this._deck) {
|
|
456
|
-
this._deck.setProps(
|
|
480
|
+
if (this._deck && this._map) {
|
|
481
|
+
this._deck.setProps({
|
|
482
|
+
...this._props,
|
|
483
|
+
parameters: {
|
|
484
|
+
...getDefaultParameters(this._map, this._interleaved),
|
|
485
|
+
...this._props.parameters
|
|
486
|
+
}
|
|
487
|
+
});
|
|
457
488
|
}
|
|
458
489
|
}
|
|
459
490
|
/** Called when the control is added to a map */
|
|
@@ -474,6 +505,8 @@ var MapboxOverlay = class {
|
|
|
474
505
|
this._deck = new import_core3.Deck({
|
|
475
506
|
...this._props,
|
|
476
507
|
parent: container,
|
|
508
|
+
parameters: { ...getDefaultParameters(map, false), ...this._props.parameters },
|
|
509
|
+
views: this._props.views || getDefaultView(map),
|
|
477
510
|
viewState: getViewState(map)
|
|
478
511
|
});
|
|
479
512
|
map.on("resize", this._updateContainerSize);
|
package/dist/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["index.
|
|
4
|
-
"sourcesContent": ["// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport { default as MapboxOverlay } from \"./mapbox-overlay.js\";\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { Deck, assert } from '@deck.gl/core';\nimport { getViewState, getDeckInstance, removeDeckInstance, getInterleavedProps } from \"./deck-utils.js\";\nimport { log } from '@deck.gl/core';\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 textAlign: 'initial',\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 // @ts-ignore non-public map property\n const gl = map.painter.context.gl;\n if (gl instanceof WebGLRenderingContext) {\n log.warn('Incompatible basemap library. See: https://deck.gl/docs/api-reference/mapbox/overview#compatibility')();\n }\n this._deck = getDeckInstance({\n map,\n gl,\n deck: new Deck({\n ...this._props,\n 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", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { 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: remove with withParametersWebGL\n parameters: {\n depthMask: true,\n depthTest: true,\n blend: true,\n blendFunc: [770, 771, 1, 771],\n polygonOffsetFill: true,\n depthFunc: 515,\n blendEquation: 32774,\n ...currProps.parameters\n },\n // @ts-ignore views prop is hidden by the types because it is not expected to work the same way as in standalone Deck, see documentation\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", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { _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 // Mapbox's map.getLayer() had a breaking change in v3.6.0, see https://github.com/visgl/deck.gl/issues/9086\n // @ts-expect-error not typed\n const layerInstance = mapboxLayer.implementation || mapboxLayer;\n layerInstance.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", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { getDeckInstance, addLayer, removeLayer, updateLayer, drawLayer } from \"./deck-utils.js\";\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 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 onAd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iB;AAC3C,QAAI,IAAI,YAAY,KAAK,iBAAiB;AAC1C,QAAI,IAAI,SAAS,KAAK,iBAAiB;AACvC,QAAI,IAAI,YAAY,KAAK,iBAAiB;AAC1C,eAAK,UAAL,mBAAY;AAAA,EAChB;AAAA,EACA,qBAAqB,KAAK;AACtB,QAAI,IAAI,aAAa,KAAK,kBAAkB;AAC5C,kBAAc,KAAK,KAAK,OAAO,KAAK,OAAO,QAAQ,CAAC,CAAC;AACrD,uBAAmB,GAAG;AAAA,EAC1B;AAAA,EACA,qBAAqB;AACjB,WAAO;AAAA,EACX;AAAA;AAAA,EAEA,WAAW,QAAQ;AACf,6BAAO,KAAK,KAAK;AACjB,WAAO,KAAK,MAAM,WAAW,MAAM;AAAA,EACvC;AAAA;AAAA,EAEA,oBAAoB,QAAQ;AACxB,6BAAO,KAAK,KAAK;AACjB,WAAO,KAAK,MAAM,oBAAoB,MAAM;AAAA,EAChD;AAAA;AAAA,EAEA,YAAY,QAAQ;AAChB,6BAAO,KAAK,KAAK;AACjB,WAAO,KAAK,MAAM,YAAY,MAAM;AAAA,EACxC;AAAA;AAAA,EAEA,WAAW;AACP,QAAI,KAAK,MAAM;AACX,WAAK,KAAK,cAAc,IAAI;AAAA,IAChC;AAAA,EACJ;AAAA;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": ["import_core", "flatten", "import_core", "import_core", "flatten"]
|
|
3
|
+
"sources": ["../src/index.ts", "../src/mapbox-overlay.ts", "../src/deck-utils.ts", "../src/resolve-layers.ts", "../src/mapbox-layer.ts"],
|
|
4
|
+
"sourcesContent": ["// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport {default as MapboxOverlay} from './mapbox-overlay';\n\nexport type {MapboxOverlayProps} from './mapbox-overlay';\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {Deck, assert} from '@deck.gl/core';\nimport {\n getViewState,\n getDefaultView,\n getDeckInstance,\n removeDeckInstance,\n getDefaultParameters\n} from './deck-utils';\n\nimport type {Map, IControl, MapMouseEvent, ControlPosition} from './types';\nimport type {MjolnirGestureEvent, MjolnirPointerEvent} from 'mjolnir.js';\nimport type {DeckProps} from '@deck.gl/core';\nimport {log} from '@deck.gl/core';\n\nimport {resolveLayers} from './resolve-layers';\n\nexport type MapboxOverlayProps = Omit<\n DeckProps,\n | 'width'\n | 'height'\n | 'gl'\n | 'parent'\n | 'canvas'\n | '_customRender'\n | 'viewState'\n | 'initialViewState'\n | 'controller'\n> & {\n interleaved?: boolean;\n};\n\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 implements IControl {\n private _props: MapboxOverlayProps;\n private _deck?: Deck<any>;\n private _map?: Map;\n private _container?: HTMLDivElement;\n private _interleaved: boolean;\n private _lastMouseDownPoint?: {x: number; y: number; clientX: number; clientY: number};\n\n constructor(props: MapboxOverlayProps) {\n const {interleaved = false, ...otherProps} = props;\n this._interleaved = interleaved;\n this._props = otherProps;\n }\n\n /** Update (partial) props of the underlying Deck instance. */\n setProps(props: MapboxOverlayProps): void {\n if (this._interleaved && props.layers) {\n resolveLayers(this._map, this._deck, this._props.layers, props.layers);\n }\n\n Object.assign(this._props, props);\n\n if (this._deck && this._map) {\n this._deck.setProps({\n ...this._props,\n parameters: {\n ...getDefaultParameters(this._map, this._interleaved),\n ...this._props.parameters\n }\n });\n }\n }\n\n /** Called when the control is added to a map */\n onAdd(map: Map): HTMLDivElement {\n this._map = map;\n return this._interleaved ? this._onAddInterleaved(map) : this._onAddOverlaid(map);\n }\n\n private _onAddOverlaid(map: Map): HTMLDivElement {\n /* global document */\n const container = document.createElement('div');\n Object.assign(container.style, {\n position: 'absolute',\n left: 0,\n top: 0,\n textAlign: 'initial',\n pointerEvents: 'none'\n });\n this._container = container;\n\n this._deck = new Deck<any>({\n ...this._props,\n parent: container,\n parameters: {...getDefaultParameters(map, false), ...this._props.parameters},\n views: this._props.views || getDefaultView(map),\n viewState: getViewState(map)\n });\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\n this._updateContainerSize();\n return container;\n }\n\n private _onAddInterleaved(map: Map): HTMLDivElement {\n // @ts-ignore non-public map property\n const gl = map.painter.context.gl;\n if (gl instanceof WebGLRenderingContext) {\n log.warn(\n 'Incompatible basemap library. See: https://deck.gl/docs/api-reference/mapbox/overview#compatibility'\n )();\n }\n this._deck = getDeckInstance({\n map,\n gl,\n deck: new Deck({\n ...this._props,\n gl\n })\n });\n\n map.on('styledata', this._handleStyleChange);\n resolveLayers(map, this._deck, [], this._props.layers);\n\n return document.createElement('div');\n }\n\n /** Called when the control is removed from a map */\n onRemove(): void {\n const map = this._map;\n\n if (map) {\n if (this._interleaved) {\n this._onRemoveInterleaved(map);\n } else {\n this._onRemoveOverlaid(map);\n }\n }\n\n this._deck = undefined;\n this._map = undefined;\n this._container = undefined;\n }\n\n private _onRemoveOverlaid(map: Map): void {\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\n private _onRemoveInterleaved(map: Map): void {\n map.off('styledata', this._handleStyleChange);\n resolveLayers(map, this._deck, this._props.layers, []);\n removeDeckInstance(map);\n }\n\n getDefaultPosition(): ControlPosition {\n return 'top-left';\n }\n\n /** Forwards the Deck.pickObject method */\n pickObject(params: Parameters<Deck['pickObject']>[0]): ReturnType<Deck['pickObject']> {\n assert(this._deck);\n return this._deck.pickObject(params);\n }\n\n /** Forwards the Deck.pickMultipleObjects method */\n pickMultipleObjects(\n params: Parameters<Deck['pickMultipleObjects']>[0]\n ): ReturnType<Deck['pickMultipleObjects']> {\n assert(this._deck);\n return this._deck.pickMultipleObjects(params);\n }\n\n /** Forwards the Deck.pickObjects method */\n pickObjects(params: Parameters<Deck['pickObjects']>[0]): ReturnType<Deck['pickObjects']> {\n assert(this._deck);\n return this._deck.pickObjects(params);\n }\n\n /** Remove from map and releases all resources */\n finalize() {\n if (this._map) {\n this._map.removeControl(this);\n }\n }\n\n /** If interleaved: true, returns base map's canvas, otherwise forwards the Deck.getCanvas method. */\n getCanvas(): HTMLCanvasElement | null {\n if (!this._map) {\n return null;\n }\n return this._interleaved ? this._map.getCanvas() : this._deck!.getCanvas();\n }\n\n private _handleStyleChange = () => {\n resolveLayers(this._map, this._deck, this._props.layers, this._props.layers);\n };\n\n private _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\n private _updateViewState = () => {\n const deck = this._deck;\n const map = this._map;\n if (deck && map) {\n deck.setProps({\n views: this._props.views || getDefaultView(map),\n viewState: getViewState(map)\n });\n // Redraw immediately if view state has changed\n if (deck.isInitialized) {\n deck.redraw();\n }\n }\n };\n\n // eslint-disable-next-line complexity\n private _handleMouseEvent = (event: MapMouseEvent) => {\n const deck = this._deck;\n if (!deck || !deck.isInitialized) {\n return;\n }\n\n const mockEvent: {\n type: string;\n deltaX?: number;\n deltaY?: number;\n offsetCenter: {x: number; y: number};\n srcEvent: MapMouseEvent;\n tapCount?: number;\n } = {\n type: event.type,\n offsetCenter: event.point,\n srcEvent: event\n };\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\n switch (mockEvent.type) {\n case 'mousedown':\n deck._onPointerDown(mockEvent as unknown as MjolnirPointerEvent);\n this._lastMouseDownPoint = {\n ...event.point,\n clientX: event.originalEvent.clientX,\n clientY: event.originalEvent.clientY\n };\n break;\n\n case 'dragstart':\n mockEvent.type = 'panstart';\n deck._onEvent(mockEvent as unknown as MjolnirGestureEvent);\n break;\n\n case 'drag':\n mockEvent.type = 'panmove';\n deck._onEvent(mockEvent as unknown as MjolnirGestureEvent);\n break;\n\n case 'dragend':\n mockEvent.type = 'panend';\n deck._onEvent(mockEvent as unknown as MjolnirGestureEvent);\n break;\n\n case 'click':\n mockEvent.tapCount = 1;\n deck._onEvent(mockEvent as unknown as MjolnirGestureEvent);\n break;\n\n case 'dblclick':\n mockEvent.type = 'click';\n mockEvent.tapCount = 2;\n deck._onEvent(mockEvent as unknown as MjolnirGestureEvent);\n break;\n\n case 'mousemove':\n mockEvent.type = 'pointermove';\n deck._onPointerMove(mockEvent as unknown as MjolnirPointerEvent);\n break;\n\n case 'mouseout':\n mockEvent.type = 'pointerleave';\n deck._onPointerMove(mockEvent as unknown as MjolnirPointerEvent);\n break;\n\n default:\n return;\n }\n };\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {Deck, MapView, _GlobeView as GlobeView, _flatten as flatten} from '@deck.gl/core';\nimport type {Viewport, MapViewState, Layer} from '@deck.gl/core';\nimport type {Parameters} from '@luma.gl/core';\nimport type MapboxLayer from './mapbox-layer';\nimport type {Map} from './types';\n\nimport {lngLatToWorld, unitsPerMeter} from '@math.gl/web-mercator';\n\ntype UserData = {\n isExternal: boolean;\n currentViewport?: Viewport | null;\n mapboxLayers: Set<MapboxLayer<any>>;\n // mapboxVersion: {minor: number; major: number};\n};\n\n// Mercator constants\nconst TILE_SIZE = 512;\nconst DEGREES_TO_RADIANS = Math.PI / 180;\n\n// Create an interleaved deck instance.\nexport function getDeckInstance({\n map,\n gl,\n deck\n}: {\n map: Map & {__deck?: Deck<any> | null};\n gl: WebGL2RenderingContext;\n deck?: Deck<any>;\n}): Deck<any> {\n // Only create one deck instance per context\n if (map.__deck) {\n return map.__deck;\n }\n\n // Only initialize certain props once per context\n const customRender = deck?.props._customRender;\n const onLoad = deck?.props.onLoad;\n\n const deckProps = {\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 deckProps.parameters = {...getDefaultParameters(map, true), ...deckProps.parameters};\n deckProps.views ||= getDefaultView(map);\n\n let deckInstance: Deck;\n\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 } else {\n deckProps.onLoad = () => {\n onLoad?.();\n watchMapMove(deckInstance, map);\n };\n }\n }\n\n if (deck) {\n deckInstance = deck;\n deck.setProps(deckProps);\n (deck.userData as UserData).isExternal = true;\n } else {\n deckInstance = new Deck(deckProps);\n map.on('remove', () => {\n removeDeckInstance(map);\n });\n }\n\n (deckInstance.userData as UserData).mapboxLayers = new Set();\n // (deckInstance.userData as UserData).mapboxVersion = getMapboxVersion(map);\n map.__deck = deckInstance;\n map.on('render', () => {\n if (deckInstance.isInitialized) afterRender(deckInstance, map);\n });\n\n return deckInstance;\n}\n\nfunction watchMapMove(deck: Deck, map: Map & {__deck?: Deck | null}) {\n const _handleMapMove = () => {\n if (deck.isInitialized) {\n // call view state methods\n onMapMove(deck, map);\n } else {\n // deregister itself when deck is finalized\n map.off('move', _handleMapMove);\n }\n };\n map.on('move', _handleMapMove);\n}\n\nexport function removeDeckInstance(map: Map & {__deck?: Deck | null}) {\n map.__deck?.finalize();\n map.__deck = null;\n}\n\nexport function getDefaultParameters(map: Map, interleaved: boolean): Parameters {\n const result: Parameters = interleaved\n ? {\n depthWriteEnabled: true,\n depthCompare: 'less-equal',\n depthBias: 0,\n blend: true,\n blendColorSrcFactor: 'src-alpha',\n blendColorDstFactor: 'one-minus-src-alpha',\n blendAlphaSrcFactor: 'one',\n blendAlphaDstFactor: 'one-minus-src-alpha',\n blendColorOperation: 'add',\n blendAlphaOperation: 'add'\n }\n : {};\n if (getProjection(map) === 'globe') {\n result.cullMode = 'back';\n }\n return result;\n}\n\nexport function addLayer(deck: Deck, layer: MapboxLayer<any>): void {\n (deck.userData as UserData).mapboxLayers.add(layer);\n updateLayers(deck);\n}\n\nexport function removeLayer(deck: Deck, layer: MapboxLayer<any>): void {\n (deck.userData as UserData).mapboxLayers.delete(layer);\n updateLayers(deck);\n}\n\nexport function updateLayer(deck: Deck, layer: MapboxLayer<any>): void {\n updateLayers(deck);\n}\n\nexport function drawLayer(\n deck: Deck,\n map: Map,\n layer: MapboxLayer<any>,\n renderParameters: any\n): void {\n let {currentViewport} = deck.userData as UserData;\n let clearStack: boolean = 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, renderParameters);\n (deck.userData as UserData).currentViewport = currentViewport;\n clearStack = true;\n }\n\n if (!deck.isInitialized) {\n return;\n }\n\n deck._drawLayers('mapbox-repaint', {\n viewports: [currentViewport],\n layerFilter: ({layer: deckLayer}) =>\n layer.id === deckLayer.id || deckLayer.props.operation.includes('terrain'),\n clearStack,\n clearCanvas: false\n });\n}\n\nfunction getProjection(map: Map): 'mercator' | 'globe' {\n const projection = map.getProjection?.();\n const type =\n // maplibre projection spec\n projection?.type ||\n // mapbox projection spec\n projection?.name;\n if (type === 'globe') {\n return 'globe';\n }\n if (type && type !== 'mercator') {\n throw new Error('Unsupported projection');\n }\n return 'mercator';\n}\n\nexport function getDefaultView(map: Map): GlobeView | MapView {\n if (getProjection(map) === 'globe') {\n return new GlobeView({id: 'mapbox'});\n }\n return new MapView({id: 'mapbox'});\n}\n\nexport function getViewState(map: Map): MapViewState & {\n repeat: boolean;\n padding: {\n left: number;\n right: number;\n top: number;\n bottom: number;\n };\n} {\n const {lng, lat} = map.getCenter();\n\n const viewState: MapViewState & {\n repeat: boolean;\n padding: {\n left: number;\n right: number;\n top: number;\n bottom: number;\n };\n } = {\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\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\n return viewState;\n}\n\nfunction centerCameraOnTerrain(map: Map, viewState: MapViewState) {\n if (map.getFreeCameraOptions) {\n // mapbox-gl v2\n const {position} = map.getFreeCameraOptions();\n if (!position || position.z === undefined) {\n return;\n }\n\n // @ts-ignore transform is not typed\n const height = map.transform.height;\n const {longitude, latitude, pitch} = viewState;\n\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\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\n const pitchRadians = pitch! * DEGREES_TO_RADIANS;\n const altitudePixels = 1.5 * height;\n const scale =\n 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\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\n// Since maplibre-gl@5\n// https://github.com/maplibre/maplibre-gl-js/blob/main/src/style/style_layer/custom_style_layer.ts\ntype MaplibreRenderParameters = {\n farZ: number;\n nearZ: number;\n fov: number;\n modelViewProjectionMatrix: number[];\n projectionMatrix: number[];\n};\n\nfunction getViewport(deck: Deck, map: Map, renderParameters?: unknown): Viewport {\n const viewState = getViewState(map);\n const view = getDefaultView(map);\n\n if (renderParameters) {\n // Called from MapboxLayer.render\n // Magic number, matches mapbox-gl@>=1.3.0's projection matrix\n view.props.nearZMultiplier = 0.2;\n }\n\n // Get the base map near/far plane\n // renderParameters is maplibre API but not mapbox\n // Transform is not an official API, properties could be undefined for older versions\n const nearZ = (renderParameters as MaplibreRenderParameters)?.nearZ ?? map.transform._nearZ;\n const farZ = (renderParameters as MaplibreRenderParameters)?.farZ ?? map.transform._farZ;\n if (Number.isFinite(nearZ)) {\n viewState.nearZ = nearZ / map.transform.height;\n viewState.farZ = farZ / map.transform.height;\n }\n // Otherwise fallback to default calculation using nearZMultiplier/farZMultiplier\n\n return view.makeViewport({\n width: deck.width,\n height: deck.height,\n viewState\n }) as Viewport;\n}\n\nfunction afterRender(deck: Deck, map: Map): void {\n const {mapboxLayers, isExternal} = deck.userData as UserData;\n\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) as Layer[];\n const hasNonMapboxLayers = deckLayers.some(\n layer => layer && !mapboxLayerIds.includes(layer.id)\n );\n let viewports = deck.getViewports();\n const mapboxViewportIdx = viewports.findIndex(vp => vp.id === 'mapbox');\n const hasNonMapboxViews = viewports.length > 1 || mapboxViewportIdx < 0;\n\n if (hasNonMapboxLayers || hasNonMapboxViews) {\n if (mapboxViewportIdx >= 0) {\n viewports = viewports.slice();\n viewports[mapboxViewportIdx] = getViewport(deck, map);\n }\n\n deck._drawLayers('mapbox-repaint', {\n viewports,\n layerFilter: params =>\n (!deck.props.layerFilter || deck.props.layerFilter(params)) &&\n (params.viewport.id !== 'mapbox' || !mapboxLayerIds.includes(params.layer.id)),\n clearCanvas: false\n });\n }\n }\n\n // End of render cycle, clear generated viewport\n (deck.userData as UserData).currentViewport = null;\n}\n\nfunction onMapMove(deck: Deck, map: Map): void {\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}\n\nfunction updateLayers(deck: Deck): void {\n if ((deck.userData as UserData).isExternal) {\n return;\n }\n\n const layers: Layer[] = [];\n (deck.userData as 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", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {_flatten as flatten} from '@deck.gl/core';\nimport MapboxLayer from './mapbox-layer';\n\nimport type {Deck, LayersList, Layer} from '@deck.gl/core';\nimport type {Map} from './types';\n\nconst UNDEFINED_BEFORE_ID = '__UNDEFINED__';\n\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(\n map?: Map,\n deck?: Deck,\n oldLayers?: LayersList,\n newLayers?: LayersList\n) {\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\n const layers = flatten(newLayers, Boolean) as Layer[];\n\n if (oldLayers !== newLayers) {\n // Step 1: remove layers that no longer exist\n const prevLayers = flatten(oldLayers, Boolean) as Layer[];\n const prevLayerIds = new Set<string>(prevLayers.map(l => l.id));\n\n for (const layer of layers) {\n prevLayerIds.delete(layer.id);\n }\n\n for (const id of prevLayerIds) {\n if (map.getLayer(id)) {\n map.removeLayer(id);\n }\n }\n }\n\n // Step 2: add missing layers\n for (const layer of layers) {\n const mapboxLayer = map.getLayer(layer.id) as MapboxLayer<Layer>;\n if (mapboxLayer) {\n // Mapbox's map.getLayer() had a breaking change in v3.6.0, see https://github.com/visgl/deck.gl/issues/9086\n // @ts-expect-error not typed\n const layerInstance = mapboxLayer.implementation || mapboxLayer;\n layerInstance.setProps(layer.props);\n } else {\n map.addLayer(\n new MapboxLayer({id: layer.id, deck}),\n // @ts-expect-error beforeId is not defined in LayerProps\n layer.props.beforeId\n );\n }\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: string[] = map.style._order;\n\n // Group deck layers by beforeId\n const layerGroups: Record<string, string[]> = {};\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\n for (const beforeId in layerGroups) {\n const layerGroup = layerGroups[beforeId];\n let lastLayerIndex =\n 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", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {getDeckInstance, addLayer, removeLayer, updateLayer, drawLayer} from './deck-utils';\nimport type {Map, CustomLayerInterface} from './types';\nimport type {Deck, Layer} from '@deck.gl/core';\n\nexport type MapboxLayerProps<LayerT extends Layer> = Partial<LayerT['props']> & {\n id: string;\n renderingMode?: '2d' | '3d';\n deck?: Deck;\n};\n\nexport default class MapboxLayer<LayerT extends Layer> implements CustomLayerInterface {\n id: string;\n type: 'custom';\n renderingMode: '2d' | '3d';\n map: Map | null;\n deck: Deck | null;\n props: MapboxLayerProps<LayerT>;\n\n /* eslint-disable no-this-before-super */\n constructor(props: MapboxLayerProps<LayerT>) {\n if (!props.id) {\n throw new Error('Layer must have an unique id');\n }\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\n /* Mapbox custom layer methods */\n\n onAdd(map: Map, gl: WebGL2RenderingContext): void {\n this.map = map;\n this.deck = getDeckInstance({map, gl, deck: this.props.deck});\n addLayer(this.deck, this);\n }\n\n onRemove(): void {\n if (this.deck) {\n removeLayer(this.deck, this);\n }\n }\n\n setProps(props: MapboxLayerProps<LayerT>) {\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\n render(gl, renderParameters) {\n drawLayer(this.deck!, this.map!, this, renderParameters);\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACIA,IAAAA,eAA2B;;;ACA3B,kBAA0E;AAM1E,0BAA2C;AAU3C,IAAM,YAAY;AAClB,IAAM,qBAAqB,KAAK,KAAK;AAG/B,SAAU,gBAAgB,EAC9B,KACA,IACA,KAAI,GAKL;AAEC,MAAI,IAAI,QAAQ;AACd,WAAO,IAAI;EACb;AAGA,QAAM,eAAe,6BAAM,MAAM;AACjC,QAAM,SAAS,6BAAM,MAAM;AAE3B,QAAM,YAAY;IAChB,GAAG,6BAAM;IACT,eAAe,MAAK;AAClB,UAAI,eAAc;AAKlB,mDAAe;IACjB;;AAEF,YAAU,aAAa,EAAC,GAAG,qBAAqB,KAAK,IAAI,GAAG,GAAG,UAAU,WAAU;AACnF,YAAU,UAAV,UAAU,QAAU,eAAe,GAAG;AAEtC,MAAI;AAEJ,MAAI,CAAC,QAAQ,KAAK,MAAM,OAAO,IAAI;AAKjC,WAAO,OAAO,WAAW;MACvB;MACA,OAAO;MACP,QAAQ;MACR,aAAa;MACb,WAAW,aAAa,GAAG;KAC5B;AACD,QAAI,6BAAM,eAAe;AACvB,mBAAa,MAAM,GAAG;IACxB,OAAO;AACL,gBAAU,SAAS,MAAK;AACtB;AACA,qBAAa,cAAc,GAAG;MAChC;IACF;EACF;AAEA,MAAI,MAAM;AACR,mBAAe;AACf,SAAK,SAAS,SAAS;AACtB,SAAK,SAAsB,aAAa;EAC3C,OAAO;AACL,mBAAe,IAAI,iBAAK,SAAS;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,SAAS,KAAK,iBAAiB;AACvC,QAAI,IAAI,YAAY,KAAK,iBAAiB;AAC1C,eAAK,UAAL,mBAAY;EACd;EAEQ,qBAAqB,KAAQ;AACnC,QAAI,IAAI,aAAa,KAAK,kBAAkB;AAC5C,kBAAc,KAAK,KAAK,OAAO,KAAK,OAAO,QAAQ,CAAA,CAAE;AACrD,uBAAmB,GAAG;EACxB;EAEA,qBAAkB;AAChB,WAAO;EACT;;EAGA,WAAW,QAAyC;AAClD,6BAAO,KAAK,KAAK;AACjB,WAAO,KAAK,MAAM,WAAW,MAAM;EACrC;;EAGA,oBACE,QAAkD;AAElD,6BAAO,KAAK,KAAK;AACjB,WAAO,KAAK,MAAM,oBAAoB,MAAM;EAC9C;;EAGA,YAAY,QAA0C;AACpD,6BAAO,KAAK,KAAK;AACjB,WAAO,KAAK,MAAM,YAAY,MAAM;EACtC;;EAGA,WAAQ;AACN,QAAI,KAAK,MAAM;AACb,WAAK,KAAK,cAAc,IAAI;IAC9B;EACF;;EAGA,YAAS;AACP,QAAI,CAAC,KAAK,MAAM;AACd,aAAO;IACT;AACA,WAAO,KAAK,eAAe,KAAK,KAAK,UAAS,IAAK,KAAK,MAAO,UAAS;EAC1E;;",
|
|
6
|
+
"names": ["import_core", "GlobeView", "flatten", "import_core", "import_core", "flatten"]
|
|
7
7
|
}
|
package/dist/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,4BAAyB"}
|
package/dist/mapbox-layer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Map, CustomLayerInterface } from
|
|
1
|
+
import type { Map, CustomLayerInterface } from "./types.js";
|
|
2
2
|
import type { Deck, Layer } from '@deck.gl/core';
|
|
3
3
|
export type MapboxLayerProps<LayerT extends Layer> = Partial<LayerT['props']> & {
|
|
4
4
|
id: string;
|
|
@@ -16,6 +16,6 @@ export default class MapboxLayer<LayerT extends Layer> implements CustomLayerInt
|
|
|
16
16
|
onAdd(map: Map, gl: WebGL2RenderingContext): void;
|
|
17
17
|
onRemove(): void;
|
|
18
18
|
setProps(props: MapboxLayerProps<LayerT>): void;
|
|
19
|
-
render(): void;
|
|
19
|
+
render(gl: any, renderParameters: any): void;
|
|
20
20
|
}
|
|
21
21
|
//# sourceMappingURL=mapbox-layer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapbox-layer.d.ts","sourceRoot":"","sources":["../src/mapbox-layer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,GAAG,EAAE,oBAAoB,EAAC,
|
|
1
|
+
{"version":3,"file":"mapbox-layer.d.ts","sourceRoot":"","sources":["../src/mapbox-layer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,GAAG,EAAE,oBAAoB,EAAC,mBAAgB;AACvD,OAAO,KAAK,EAAC,IAAI,EAAE,KAAK,EAAC,MAAM,eAAe,CAAC;AAE/C,MAAM,MAAM,gBAAgB,CAAC,MAAM,SAAS,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG;IAC9E,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAC5B,IAAI,CAAC,EAAE,IAAI,CAAC;CACb,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,sBAAsB,GAAG,IAAI;IAMjD,QAAQ,IAAI,IAAI;IAMhB,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC,MAAM,CAAC;IASxC,MAAM,CAAC,EAAE,KAAA,EAAE,gBAAgB,KAAA;CAG5B"}
|
package/dist/mapbox-layer.js
CHANGED
|
@@ -34,7 +34,8 @@ export default class MapboxLayer {
|
|
|
34
34
|
updateLayer(this.deck, this);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
render() {
|
|
38
|
-
drawLayer(this.deck, this.map, this);
|
|
37
|
+
render(gl, renderParameters) {
|
|
38
|
+
drawLayer(this.deck, this.map, this, renderParameters);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
+
//# sourceMappingURL=mapbox-layer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapbox-layer.js","sourceRoot":"","sources":["../src/mapbox-layer.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,eAAe,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAC,wBAAqB;AAU5F,MAAM,CAAC,OAAO,OAAO,WAAW;IAQ9B,yCAAyC;IACzC,YAAY,KAA+B;QACzC,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAClD,CAAC;QAED,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;QACrB,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,IAAI,IAAI,CAAC;QACjD,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;QAChB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,iCAAiC;IAEjC,KAAK,CAAC,GAAQ,EAAE,EAA0B;QACxC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC,EAAC,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EAAC,CAAC,CAAC;QAC9D,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED,QAAQ;QACN,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IAED,QAAQ,CAAC,KAA+B;QACtC,uBAAuB;QACvB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,EAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAC,CAAC,CAAC;QAChD,qDAAqD;QACrD,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IAED,MAAM,CAAC,EAAE,EAAE,gBAAgB;QACzB,SAAS,CAAC,IAAI,CAAC,IAAK,EAAE,IAAI,CAAC,GAAI,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC;IAC3D,CAAC;CACF"}
|
package/dist/mapbox-overlay.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Deck } from '@deck.gl/core';
|
|
2
|
-
import type { Map, IControl } from
|
|
2
|
+
import type { Map, IControl, ControlPosition } from "./types.js";
|
|
3
3
|
import type { DeckProps } from '@deck.gl/core';
|
|
4
4
|
export type MapboxOverlayProps = Omit<DeckProps, 'width' | 'height' | 'gl' | 'parent' | 'canvas' | '_customRender' | 'viewState' | 'initialViewState' | 'controller'> & {
|
|
5
5
|
interleaved?: boolean;
|
|
6
6
|
};
|
|
7
|
-
type ControlPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
8
7
|
/**
|
|
9
8
|
* Implements Mapbox [IControl](https://docs.mapbox.com/mapbox-gl-js/api/markers/#icontrol) interface
|
|
10
9
|
* Renders deck.gl layers over the base map and automatically synchronizes with the map's camera
|
|
@@ -43,5 +42,4 @@ export default class MapboxOverlay implements IControl {
|
|
|
43
42
|
private _updateViewState;
|
|
44
43
|
private _handleMouseEvent;
|
|
45
44
|
}
|
|
46
|
-
export {};
|
|
47
45
|
//# sourceMappingURL=mapbox-overlay.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapbox-overlay.d.ts","sourceRoot":"","sources":["../src/mapbox-overlay.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,IAAI,EAAS,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"mapbox-overlay.d.ts","sourceRoot":"","sources":["../src/mapbox-overlay.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,IAAI,EAAS,MAAM,eAAe,CAAC;AAS3C,OAAO,KAAK,EAAC,GAAG,EAAE,QAAQ,EAAiB,eAAe,EAAC,mBAAgB;AAE3E,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAK7C,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,SAAS,EACP,OAAO,GACP,QAAQ,GACR,IAAI,GACJ,QAAQ,GACR,QAAQ,GACR,eAAe,GACf,WAAW,GACX,kBAAkB,GAClB,YAAY,CACf,GAAG;IACF,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,aAAc,YAAW,QAAQ;IACpD,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,KAAK,CAA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 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
import { Deck, assert } from '@deck.gl/core';
|
|
5
|
-
import { getViewState, getDeckInstance, removeDeckInstance,
|
|
5
|
+
import { getViewState, getDefaultView, getDeckInstance, removeDeckInstance, getDefaultParameters } from "./deck-utils.js";
|
|
6
6
|
import { log } from '@deck.gl/core';
|
|
7
7
|
import { resolveLayers } from "./resolve-layers.js";
|
|
8
8
|
/**
|
|
@@ -25,9 +25,12 @@ export default class MapboxOverlay {
|
|
|
25
25
|
};
|
|
26
26
|
this._updateViewState = () => {
|
|
27
27
|
const deck = this._deck;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
deck.setProps({
|
|
28
|
+
const map = this._map;
|
|
29
|
+
if (deck && map) {
|
|
30
|
+
deck.setProps({
|
|
31
|
+
views: this._props.views || getDefaultView(map),
|
|
32
|
+
viewState: getViewState(map)
|
|
33
|
+
});
|
|
31
34
|
// Redraw immediately if view state has changed
|
|
32
35
|
if (deck.isInitialized) {
|
|
33
36
|
deck.redraw();
|
|
@@ -107,8 +110,14 @@ export default class MapboxOverlay {
|
|
|
107
110
|
resolveLayers(this._map, this._deck, this._props.layers, props.layers);
|
|
108
111
|
}
|
|
109
112
|
Object.assign(this._props, props);
|
|
110
|
-
if (this._deck) {
|
|
111
|
-
this._deck.setProps(
|
|
113
|
+
if (this._deck && this._map) {
|
|
114
|
+
this._deck.setProps({
|
|
115
|
+
...this._props,
|
|
116
|
+
parameters: {
|
|
117
|
+
...getDefaultParameters(this._map, this._interleaved),
|
|
118
|
+
...this._props.parameters
|
|
119
|
+
}
|
|
120
|
+
});
|
|
112
121
|
}
|
|
113
122
|
}
|
|
114
123
|
/** Called when the control is added to a map */
|
|
@@ -130,6 +139,8 @@ export default class MapboxOverlay {
|
|
|
130
139
|
this._deck = new Deck({
|
|
131
140
|
...this._props,
|
|
132
141
|
parent: container,
|
|
142
|
+
parameters: { ...getDefaultParameters(map, false), ...this._props.parameters },
|
|
143
|
+
views: this._props.views || getDefaultView(map),
|
|
133
144
|
viewState: getViewState(map)
|
|
134
145
|
});
|
|
135
146
|
map.on('resize', this._updateContainerSize);
|
|
@@ -228,3 +239,4 @@ export default class MapboxOverlay {
|
|
|
228
239
|
return this._interleaved ? this._map.getCanvas() : this._deck.getCanvas();
|
|
229
240
|
}
|
|
230
241
|
}
|
|
242
|
+
//# sourceMappingURL=mapbox-overlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapbox-overlay.js","sourceRoot":"","sources":["../src/mapbox-overlay.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,IAAI,EAAE,MAAM,EAAC,MAAM,eAAe,CAAC;AAC3C,OAAO,EACL,YAAY,EACZ,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACrB,wBAAqB;AAKtB,OAAO,EAAC,GAAG,EAAC,MAAM,eAAe,CAAC;AAElC,OAAO,EAAC,aAAa,EAAC,4BAAyB;AAiB/C;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,aAAa;IAQhC,YAAY,KAAyB;QAqK7B,uBAAkB,GAAG,GAAG,EAAE;YAChC,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC/E,CAAC,CAAC;QAEM,yBAAoB,GAAG,GAAG,EAAE;YAClC,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;gBACjC,MAAM,EAAC,WAAW,EAAE,YAAY,EAAC,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;gBAC7D,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE;oBACnC,KAAK,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AAI,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACvD,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;IAED,kBAAkB;QAChB,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,0CAA0C;IAC1C,UAAU,CAAC,MAAyC;QAClD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;IAED,mDAAmD;IACnD,mBAAmB,CACjB,MAAkD;QAElD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAChD,CAAC;IAED,2CAA2C;IAC3C,WAAW,CAAC,MAA0C;QACpD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAED,iDAAiD;IACjD,QAAQ;QACN,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IAED,qGAAqG;IACrG,SAAS;QACP,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACf,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAM,CAAC,SAAS,EAAE,CAAC;IAC7E,CAAC;CAgHF"}
|
package/dist/resolve-layers.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Deck, LayersList } from '@deck.gl/core';
|
|
2
|
-
import type { Map } from
|
|
2
|
+
import type { Map } from "./types.js";
|
|
3
3
|
/** Insert Deck layers into the mapbox Map according to the user-defined order */
|
|
4
4
|
export declare function resolveLayers(map?: Map, deck?: Deck, oldLayers?: LayersList, newLayers?: LayersList): void;
|
|
5
5
|
//# sourceMappingURL=resolve-layers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-layers.d.ts","sourceRoot":"","sources":["../src/resolve-layers.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAC,IAAI,EAAE,UAAU,EAAQ,MAAM,eAAe,CAAC;AAC3D,OAAO,KAAK,EAAC,GAAG,EAAC,
|
|
1
|
+
{"version":3,"file":"resolve-layers.d.ts","sourceRoot":"","sources":["../src/resolve-layers.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAC,IAAI,EAAE,UAAU,EAAQ,MAAM,eAAe,CAAC;AAC3D,OAAO,KAAK,EAAC,GAAG,EAAC,mBAAgB;AAIjC,iFAAiF;AAEjF,wBAAgB,aAAa,CAC3B,GAAG,CAAC,EAAE,GAAG,EACT,IAAI,CAAC,EAAE,IAAI,EACX,SAAS,CAAC,EAAE,UAAU,EACtB,SAAS,CAAC,EAAE,UAAU,QAiFvB"}
|
package/dist/resolve-layers.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-layers.js","sourceRoot":"","sources":["../src/resolve-layers.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,QAAQ,IAAI,OAAO,EAAC,MAAM,eAAe,CAAC;AAClD,OAAO,WAAW,0BAAuB;AAKzC,MAAM,mBAAmB,GAAG,eAAe,CAAC;AAE5C,iFAAiF;AACjF,sDAAsD;AACtD,MAAM,UAAU,aAAa,CAC3B,GAAS,EACT,IAAW,EACX,SAAsB,EACtB,SAAsB;IAEtB,iCAAiC;IACjC,qCAAqC;IACrC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,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