@deck.gl/mapbox 9.2.0-alpha.2 → 9.2.0-alpha.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.
- package/dist/deck-utils.d.ts.map +1 -1
- package/dist/deck-utils.js +8 -5
- package/dist/deck-utils.js.map +1 -1
- package/dist/dist.dev.js +7 -5
- package/dist/index.cjs +7 -5
- package/dist/index.cjs.map +2 -2
- package/dist.min.js +1 -1
- package/package.json +6 -4
- package/src/deck-utils.ts +10 -5
package/dist/deck-utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deck-utils.d.ts","sourceRoot":"","sources":["../src/deck-utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,IAAI,EAAE,OAAO,EAAE,UAAU,IAAI,SAAS,EAAsB,MAAM,eAAe,CAAC;AAC1F,OAAO,KAAK,EAAW,YAAY,EAAQ,MAAM,eAAe,CAAC;AACjE,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,WAAW,0BAAuB;AAC9C,OAAO,KAAK,EAAC,GAAG,EAAC,mBAAgB;
|
|
1
|
+
{"version":3,"file":"deck-utils.d.ts","sourceRoot":"","sources":["../src/deck-utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,IAAI,EAAE,OAAO,EAAE,UAAU,IAAI,SAAS,EAAsB,MAAM,eAAe,CAAC;AAC1F,OAAO,KAAK,EAAW,YAAY,EAAQ,MAAM,eAAe,CAAC;AACjE,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,WAAW,0BAAuB;AAC9C,OAAO,KAAK,EAAC,GAAG,EAAC,mBAAgB;AAkBjC,wBAAgB,eAAe,CAAC,EAC9B,GAAG,EACH,EAAE,EACF,IAAI,EACL,EAAE;IACD,GAAG,EAAE,GAAG,GAAG;QAAC,MAAM,CAAC,EAAE,IAAI,CAAC,G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
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
import { Deck, MapView, _GlobeView as GlobeView, _flatten as flatten } from '@deck.gl/core';
|
|
5
5
|
import { lngLatToWorld, unitsPerMeter } from '@math.gl/web-mercator';
|
|
6
|
+
const MAPBOX_VIEW_ID = 'mapbox';
|
|
6
7
|
// Mercator constants
|
|
7
8
|
const TILE_SIZE = 512;
|
|
8
9
|
const DEGREES_TO_RADIANS = Math.PI / 180;
|
|
@@ -157,9 +158,9 @@ function getProjection(map) {
|
|
|
157
158
|
}
|
|
158
159
|
export function getDefaultView(map) {
|
|
159
160
|
if (getProjection(map) === 'globe') {
|
|
160
|
-
return new GlobeView({ id:
|
|
161
|
+
return new GlobeView({ id: MAPBOX_VIEW_ID });
|
|
161
162
|
}
|
|
162
|
-
return new MapView({ id:
|
|
163
|
+
return new MapView({ id: MAPBOX_VIEW_ID });
|
|
163
164
|
}
|
|
164
165
|
export function getViewState(map) {
|
|
165
166
|
const { lng, lat } = map.getCenter();
|
|
@@ -219,7 +220,9 @@ function centerCameraOnTerrain(map, viewState) {
|
|
|
219
220
|
}
|
|
220
221
|
function getViewport(deck, map, renderParameters) {
|
|
221
222
|
const viewState = getViewState(map);
|
|
222
|
-
const
|
|
223
|
+
const { views } = deck.props;
|
|
224
|
+
const view = (views && flatten(views).find((v) => v.id === MAPBOX_VIEW_ID)) ||
|
|
225
|
+
getDefaultView(map);
|
|
223
226
|
if (renderParameters) {
|
|
224
227
|
// Called from MapboxLayer.render
|
|
225
228
|
// Magic number, matches mapbox-gl@>=1.3.0's projection matrix
|
|
@@ -249,7 +252,7 @@ function afterRender(deck, map) {
|
|
|
249
252
|
const deckLayers = flatten(deck.props.layers, Boolean);
|
|
250
253
|
const hasNonMapboxLayers = deckLayers.some(layer => layer && !mapboxLayerIds.includes(layer.id));
|
|
251
254
|
let viewports = deck.getViewports();
|
|
252
|
-
const mapboxViewportIdx = viewports.findIndex(vp => vp.id ===
|
|
255
|
+
const mapboxViewportIdx = viewports.findIndex(vp => vp.id === MAPBOX_VIEW_ID);
|
|
253
256
|
const hasNonMapboxViews = viewports.length > 1 || mapboxViewportIdx < 0;
|
|
254
257
|
if (hasNonMapboxLayers || hasNonMapboxViews) {
|
|
255
258
|
if (mapboxViewportIdx >= 0) {
|
|
@@ -259,7 +262,7 @@ function afterRender(deck, map) {
|
|
|
259
262
|
deck._drawLayers('mapbox-repaint', {
|
|
260
263
|
viewports,
|
|
261
264
|
layerFilter: params => (!deck.props.layerFilter || deck.props.layerFilter(params)) &&
|
|
262
|
-
(params.viewport.id !==
|
|
265
|
+
(params.viewport.id !== MAPBOX_VIEW_ID || !mapboxLayerIds.includes(params.layer.id)),
|
|
263
266
|
clearCanvas: false
|
|
264
267
|
});
|
|
265
268
|
}
|
package/dist/deck-utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deck-utils.js","sourceRoot":"","sources":["../src/deck-utils.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,IAAI,EAAE,OAAO,EAAE,UAAU,IAAI,SAAS,EAAE,QAAQ,IAAI,OAAO,EAAC,MAAM,eAAe,CAAC;AAM1F,OAAO,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"deck-utils.js","sourceRoot":"","sources":["../src/deck-utils.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,IAAI,EAAE,OAAO,EAAE,UAAU,IAAI,SAAS,EAAE,QAAQ,IAAI,OAAO,EAAC,MAAM,eAAe,CAAC;AAM1F,OAAO,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,uBAAuB,CAAC;AAEnE,MAAM,cAAc,GAAG,QAAQ,CAAC;AAShC,qBAAqB;AACrB,MAAM,SAAS,GAAG,GAAG,CAAC;AACtB,MAAM,kBAAkB,GAAG,IAAI,CAAC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IAAI,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC,CAAC,CAAC;IACH,IAAI,CAAC,QAAQ,CAAC,EAAC,MAAM,EAAC,CAAC,CAAC;AAC1B,CAAC"}
|
package/dist/dist.dev.js
CHANGED
|
@@ -101,6 +101,7 @@ var __exports__ = (() => {
|
|
|
101
101
|
var DEGREES_TO_RADIANS2 = Math.PI / 180;
|
|
102
102
|
|
|
103
103
|
// src/deck-utils.ts
|
|
104
|
+
var MAPBOX_VIEW_ID = "mapbox";
|
|
104
105
|
var TILE_SIZE2 = 512;
|
|
105
106
|
var DEGREES_TO_RADIANS3 = Math.PI / 180;
|
|
106
107
|
function getDeckInstance({
|
|
@@ -236,9 +237,9 @@ var __exports__ = (() => {
|
|
|
236
237
|
}
|
|
237
238
|
function getDefaultView(map) {
|
|
238
239
|
if (getProjection(map) === "globe") {
|
|
239
|
-
return new import_core2._GlobeView({ id:
|
|
240
|
+
return new import_core2._GlobeView({ id: MAPBOX_VIEW_ID });
|
|
240
241
|
}
|
|
241
|
-
return new import_core2.MapView({ id:
|
|
242
|
+
return new import_core2.MapView({ id: MAPBOX_VIEW_ID });
|
|
242
243
|
}
|
|
243
244
|
function getViewState(map) {
|
|
244
245
|
const { lng, lat } = map.getCenter();
|
|
@@ -289,7 +290,8 @@ var __exports__ = (() => {
|
|
|
289
290
|
}
|
|
290
291
|
function getViewport(deck, map, renderParameters) {
|
|
291
292
|
const viewState = getViewState(map);
|
|
292
|
-
const
|
|
293
|
+
const { views } = deck.props;
|
|
294
|
+
const view = views && (0, import_core2._flatten)(views).find((v) => v.id === MAPBOX_VIEW_ID) || getDefaultView(map);
|
|
293
295
|
if (renderParameters) {
|
|
294
296
|
view.props.nearZMultiplier = 0.2;
|
|
295
297
|
}
|
|
@@ -314,7 +316,7 @@ var __exports__ = (() => {
|
|
|
314
316
|
(layer) => layer && !mapboxLayerIds.includes(layer.id)
|
|
315
317
|
);
|
|
316
318
|
let viewports = deck.getViewports();
|
|
317
|
-
const mapboxViewportIdx = viewports.findIndex((vp) => vp.id ===
|
|
319
|
+
const mapboxViewportIdx = viewports.findIndex((vp) => vp.id === MAPBOX_VIEW_ID);
|
|
318
320
|
const hasNonMapboxViews = viewports.length > 1 || mapboxViewportIdx < 0;
|
|
319
321
|
if (hasNonMapboxLayers || hasNonMapboxViews) {
|
|
320
322
|
if (mapboxViewportIdx >= 0) {
|
|
@@ -323,7 +325,7 @@ var __exports__ = (() => {
|
|
|
323
325
|
}
|
|
324
326
|
deck._drawLayers("mapbox-repaint", {
|
|
325
327
|
viewports,
|
|
326
|
-
layerFilter: (params) => (!deck.props.layerFilter || deck.props.layerFilter(params)) && (params.viewport.id !==
|
|
328
|
+
layerFilter: (params) => (!deck.props.layerFilter || deck.props.layerFilter(params)) && (params.viewport.id !== MAPBOX_VIEW_ID || !mapboxLayerIds.includes(params.layer.id)),
|
|
327
329
|
clearCanvas: false
|
|
328
330
|
});
|
|
329
331
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -30,6 +30,7 @@ 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 MAPBOX_VIEW_ID = "mapbox";
|
|
33
34
|
var TILE_SIZE = 512;
|
|
34
35
|
var DEGREES_TO_RADIANS = Math.PI / 180;
|
|
35
36
|
function getDeckInstance({ map, gl, deck }) {
|
|
@@ -163,9 +164,9 @@ function getProjection(map) {
|
|
|
163
164
|
}
|
|
164
165
|
function getDefaultView(map) {
|
|
165
166
|
if (getProjection(map) === "globe") {
|
|
166
|
-
return new import_core._GlobeView({ id:
|
|
167
|
+
return new import_core._GlobeView({ id: MAPBOX_VIEW_ID });
|
|
167
168
|
}
|
|
168
|
-
return new import_core.MapView({ id:
|
|
169
|
+
return new import_core.MapView({ id: MAPBOX_VIEW_ID });
|
|
169
170
|
}
|
|
170
171
|
function getViewState(map) {
|
|
171
172
|
var _a;
|
|
@@ -217,7 +218,8 @@ function centerCameraOnTerrain(map, viewState) {
|
|
|
217
218
|
}
|
|
218
219
|
function getViewport(deck, map, renderParameters) {
|
|
219
220
|
const viewState = getViewState(map);
|
|
220
|
-
const
|
|
221
|
+
const { views } = deck.props;
|
|
222
|
+
const view = views && (0, import_core._flatten)(views).find((v) => v.id === MAPBOX_VIEW_ID) || getDefaultView(map);
|
|
221
223
|
if (renderParameters) {
|
|
222
224
|
view.props.nearZMultiplier = 0.2;
|
|
223
225
|
}
|
|
@@ -240,7 +242,7 @@ function afterRender(deck, map) {
|
|
|
240
242
|
const deckLayers = (0, import_core._flatten)(deck.props.layers, Boolean);
|
|
241
243
|
const hasNonMapboxLayers = deckLayers.some((layer) => layer && !mapboxLayerIds.includes(layer.id));
|
|
242
244
|
let viewports = deck.getViewports();
|
|
243
|
-
const mapboxViewportIdx = viewports.findIndex((vp) => vp.id ===
|
|
245
|
+
const mapboxViewportIdx = viewports.findIndex((vp) => vp.id === MAPBOX_VIEW_ID);
|
|
244
246
|
const hasNonMapboxViews = viewports.length > 1 || mapboxViewportIdx < 0;
|
|
245
247
|
if (hasNonMapboxLayers || hasNonMapboxViews) {
|
|
246
248
|
if (mapboxViewportIdx >= 0) {
|
|
@@ -249,7 +251,7 @@ function afterRender(deck, map) {
|
|
|
249
251
|
}
|
|
250
252
|
deck._drawLayers("mapbox-repaint", {
|
|
251
253
|
viewports,
|
|
252
|
-
layerFilter: (params) => (!deck.props.layerFilter || deck.props.layerFilter(params)) && (params.viewport.id !==
|
|
254
|
+
layerFilter: (params) => (!deck.props.layerFilter || deck.props.layerFilter(params)) && (params.viewport.id !== MAPBOX_VIEW_ID || !mapboxLayerIds.includes(params.layer.id)),
|
|
253
255
|
clearCanvas: false
|
|
254
256
|
});
|
|
255
257
|
}
|
package/dist/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
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 // The local Map type is for internal typecheck only. It does not necesarily satisefy mapbox/maplibre types at runtime.\n // Do not restrict the argument type here to avoid type conflict.\n /** Called when the control is added to a map */\n onAdd(map: unknown): HTMLDivElement {\n this._map = map as Map;\n return this._interleaved ? this._onAddInterleaved(map as Map) : this._onAddOverlaid(map as 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: params =>\n (!deck.props.layerFilter || deck.props.layerFilter(params)) &&\n (layer.id === params.layer.id || params.layer.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({\n id: layer.id,\n deck,\n // @ts-expect-error slot is not defined in LayerProps\n slot: layer.props.slot\n }),\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 /* Mapbox v3 Standard style */\n slot?: 'bottom' | 'middle' | 'top';\n};\n\nexport default class MapboxLayer<LayerT extends Layer> implements CustomLayerInterface {\n id: string;\n type: 'custom';\n renderingMode: '2d' | '3d';\n /* Mapbox v3 Standard style */\n slot?: 'bottom' | 'middle' | 'top';\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.slot = props.slot;\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,qBAA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M;AACd,aAAO;IACT;AACA,WAAO,KAAK,eAAe,KAAK,KAAK,UAAS,IAAK,KAAK,MAAO,UAAS;EAC1E;;",
|
|
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 // The local Map type is for internal typecheck only. It does not necesarily satisefy mapbox/maplibre types at runtime.\n // Do not restrict the argument type here to avoid type conflict.\n /** Called when the control is added to a map */\n onAdd(map: unknown): HTMLDivElement {\n this._map = map as Map;\n return this._interleaved ? this._onAddInterleaved(map as Map) : this._onAddOverlaid(map as 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\nconst MAPBOX_VIEW_ID = 'mapbox';\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: params =>\n (!deck.props.layerFilter || deck.props.layerFilter(params)) &&\n (layer.id === params.layer.id || params.layer.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_VIEW_ID});\n }\n return new MapView({id: MAPBOX_VIEW_ID});\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 {views} = deck.props;\n const view =\n (views && flatten(views).find((v: {id: string}) => v.id === MAPBOX_VIEW_ID)) ||\n 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_VIEW_ID);\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_VIEW_ID || !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({\n id: layer.id,\n deck,\n // @ts-expect-error slot is not defined in LayerProps\n slot: layer.props.slot\n }),\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 /* Mapbox v3 Standard style */\n slot?: 'bottom' | 'middle' | 'top';\n};\n\nexport default class MapboxLayer<LayerT extends Layer> implements CustomLayerInterface {\n id: string;\n type: 'custom';\n renderingMode: '2d' | '3d';\n /* Mapbox v3 Standard style */\n slot?: 'bottom' | 'middle' | 'top';\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.slot = props.slot;\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;AAE3C,IAAM,iBAAiB;AAUvB,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,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,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
6
|
"names": ["import_core", "GlobeView", "flatten", "import_core", "import_core", "flatten"]
|
|
7
7
|
}
|
package/dist.min.js
CHANGED
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
5
5
|
else if (typeof exports === 'object') exports['deck'] = factory();
|
|
6
6
|
else root['deck'] = factory();})(globalThis, function () {
|
|
7
|
-
"use strict";var __exports__=(()=>{var it=Object.create;var S=Object.defineProperty;var st=Object.getOwnPropertyDescriptor;var at=Object.getOwnPropertyNames;var ct=Object.getPrototypeOf,lt=Object.prototype.hasOwnProperty;var ut=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),pt=(e,t)=>{for(var o in t)S(e,o,{get:t[o],enumerable:!0})},j=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of at(t))!lt.call(e,r)&&r!==o&&S(e,r,{get:()=>t[r],enumerable:!(n=st(t,r))||n.enumerable});return e},d=(e,t,o)=>(j(e,t,"default"),o&&j(o,t,"default")),b=(e,t,o)=>(o=e!=null?it(ct(e)):{},j(t||!e||!e.__esModule?S(o,"default",{value:e,enumerable:!0}):o,e)),dt=e=>j(S({},"__esModule",{value:!0}),e);var f=ut((Ot,Y)=>{Y.exports=globalThis.deck});var E={};pt(E,{MapboxOverlay:()=>P});var p={},B=b(f(),1);d(p,b(f(),1));if(!B.Layer)throw new Error("@deck.gl/core is not found");d(E,p);var M=b(f(),1);var h=b(f(),1);function I(e,t){if(!e)throw new Error(t||"@math.gl/web-mercator: assertion failed.")}var m=Math.PI,Mt=m/4,R=m/180,Nt=180/m,z=512,gt=4003e4;function v(e){let[t,o]=e;I(Number.isFinite(t)),I(Number.isFinite(o)&&o>=-90&&o<=90,"invalid latitude");let n=t*R,r=o*R,a=z*(n+m)/(2*m),i=z*(m+Math.log(Math.tan(Mt+r*.5)))/(2*m);return[a,i]}function V(e){let t=Math.cos(e*R);return z/gt/t}var qt=Math.PI/180;var A=512,jt=Math.PI/180;function C({map:e,gl:t,deck:o}){if(e.__deck)return e.__deck;let n=o?.props._customRender,r=o?.props.onLoad,a={...o?.props,_customRender:()=>{e.triggerRepaint(),n?.("")}};a.parameters={...F(e,!0),...a.parameters},a.views||=w(e);let i;return(!o||o.props.gl===t)&&(Object.assign(a,{gl:t,width:null,height:null,touchAction:"unset",viewState:x(e)}),o?.isInitialized?q(o,e):a.onLoad=()=>{r?.(),q(i,e)}),o?(i=o,o.setProps(a),o.userData.isExternal=!0):(i=new h.Deck(a),e.on("remove",()=>{Z(e)})),i.userData.mapboxLayers=new Set,e.__deck=i,e.on("render",()=>{i.isInitialized&&It(i,e)}),i}function q(e,t){let o=()=>{e.isInitialized?Ct(e,t):t.off("move",o)};t.on("move",o)}function Z(e){e.__deck?.finalize(),e.__deck=null}function F(e,t){let o=t?{depthWriteEnabled:!0,depthCompare:"less-equal",depthBias:0,blend:!0,blendColorSrcFactor:"src-alpha",blendColorDstFactor:"one-minus-src-alpha",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one-minus-src-alpha",blendColorOperation:"add",blendAlphaOperation:"add"}:{};return tt(e)==="globe"&&(o.cullMode="back"),o}function $(e,t){e.userData.mapboxLayers.add(t),N(e)}function J(e,t){e.userData.mapboxLayers.delete(t),N(e)}function K(e,t){N(e)}function Q(e,t,o,n){let{currentViewport:r}=e.userData,a=!1;r||(r=et(e,t,n),e.userData.currentViewport=r,a=!0),e.isInitialized&&e._drawLayers("mapbox-repaint",{viewports:[r],layerFilter:i=>(!e.props.layerFilter||e.props.layerFilter(i))&&(o.id===i.layer.id||i.layer.props.operation.includes("terrain")),clearStack:a,clearCanvas:!1})}function tt(e){let t=e.getProjection?.(),o=t?.type||t?.name;if(o==="globe")return"globe";if(o&&o!=="mercator")throw new Error("Unsupported projection");return"mercator"}function w(e){return tt(e)==="globe"?new h._GlobeView({id:"mapbox"}):new h.MapView({id:"mapbox"})}function x(e){let{lng:t,lat:o}=e.getCenter(),n={longitude:(t+540)%360-180,latitude:o,zoom:e.getZoom(),bearing:e.getBearing(),pitch:e.getPitch(),padding:e.getPadding(),repeat:e.getRenderWorldCopies()};return e.getTerrain?.()&&St(e,n),n}function St(e,t){if(e.getFreeCameraOptions){let{position:o}=e.getFreeCameraOptions();if(!o||o.z===void 0)return;let n=e.transform.height,{longitude:r,latitude:a,pitch:i}=t,s=o.x*A,c=(1-o.y)*A,l=o.z*A,u=v([r,a]),g=s-u[0],y=c-u[1],k=Math.sqrt(g*g+y*y),T=i*jt,O=1.5*n,G=T<.001?O*Math.cos(T)/l:O*Math.sin(T)/k;t.zoom=Math.log2(G);let nt=O*Math.cos(T)/G,rt=l-nt;t.position=[0,0,rt/V(a)]}else typeof e.transform.elevation=="number"&&(t.position=[0,0,e.transform.elevation])}function et(e,t,o){let n=x(t),r=w(t);o&&(r.props.nearZMultiplier=.2);let a=o?.nearZ??t.transform._nearZ,i=o?.farZ??t.transform._farZ;return Number.isFinite(a)&&(n.nearZ=a/t.transform.height,n.farZ=i/t.transform.height),r.makeViewport({width:e.width,height:e.height,viewState:n})}function It(e,t){let{mapboxLayers:o,isExternal:n}=e.userData;if(n){let r=Array.from(o,u=>u.id),i=(0,h._flatten)(e.props.layers,Boolean).some(u=>u&&!r.includes(u.id)),s=e.getViewports(),c=s.findIndex(u=>u.id==="mapbox"),l=s.length>1||c<0;(i||l)&&(c>=0&&(s=s.slice(),s[c]=et(e,t)),e._drawLayers("mapbox-repaint",{viewports:s,layerFilter:u=>(!e.props.layerFilter||e.props.layerFilter(u))&&(u.viewport.id!=="mapbox"||!r.includes(u.layer.id)),clearCanvas:!1}))}e.userData.currentViewport=null}function Ct(e,t){e.setProps({viewState:x(t)}),e.needsRedraw({clearRedrawFlags:!0})}function N(e){if(e.userData.isExternal)return;let t=[];e.userData.mapboxLayers.forEach(o=>{let n=o.props.type,r=new n(o.props);t.push(r)}),e.setProps({layers:t})}var ot=b(f(),1);var X=b(f(),1);var L=class{constructor(t){if(!t.id)throw new Error("Layer must have an unique id");this.id=t.id,this.type="custom",this.renderingMode=t.renderingMode||"3d",this.slot=t.slot,this.map=null,this.deck=null,this.props=t}onAdd(t,o){this.map=t,this.deck=C({map:t,gl:o,deck:this.props.deck}),$(this.deck,this)}onRemove(){this.deck&&J(this.deck,this)}setProps(t){Object.assign(this.props,t,{id:this.id}),this.deck&&K(this.deck,this)}render(t,o){Q(this.deck,this.map,this,o)}};var U="__UNDEFINED__";function D(e,t,o,n){if(!e||!t||!e.style||!e.style._loaded)return;let r=(0,X._flatten)(n,Boolean);if(o!==n){let s=(0,X._flatten)(o,Boolean),c=new Set(s.map(l=>l.id));for(let l of r)c.delete(l.id);for(let l of c)e.getLayer(l)&&e.removeLayer(l)}for(let s of r){let c=e.getLayer(s.id);c?(c.implementation||c).setProps(s.props):e.addLayer(new L({id:s.id,deck:t,slot:s.props.slot}),s.props.beforeId)}let a=e.style._order,i={};for(let s of r){let{beforeId:c}=s.props;(!c||!a.includes(c))&&(c=U),i[c]=i[c]||[],i[c].push(s.id)}for(let s in i){let c=i[s],l=s===U?a.length:a.indexOf(s),u=s===U?void 0:s;for(let g=c.length-1;g>=0;g--){let y=c[g],k=a.indexOf(y);k!==l-1&&(e.moveLayer(y,u),k>l&&l++),l--,u=y}}}var P=class{constructor(t){this._handleStyleChange=()=>{D(this._map,this._deck,this._props.layers,this._props.layers)};this._updateContainerSize=()=>{if(this._map&&this._container){let{clientWidth:t,clientHeight:o}=this._map.getContainer();Object.assign(this._container.style,{width:`${t}px`,height:`${o}px`})}};this._updateViewState=()=>{let t=this._deck,o=this._map;t&&o&&(t.setProps({views:this._props.views||w(o),viewState:x(o)}),t.isInitialized&&t.redraw())};this._handleMouseEvent=t=>{let o=this._deck;if(!o||!o.isInitialized)return;let n={type:t.type,offsetCenter:t.point,srcEvent:t},r=this._lastMouseDownPoint;switch(!t.point&&r&&(n.deltaX=t.originalEvent.clientX-r.clientX,n.deltaY=t.originalEvent.clientY-r.clientY,n.offsetCenter={x:r.x+n.deltaX,y:r.y+n.deltaY}),n.type){case"mousedown":o._onPointerDown(n),this._lastMouseDownPoint={...t.point,clientX:t.originalEvent.clientX,clientY:t.originalEvent.clientY};break;case"dragstart":n.type="panstart",o._onEvent(n);break;case"drag":n.type="panmove",o._onEvent(n);break;case"dragend":n.type="panend",o._onEvent(n);break;case"click":n.tapCount=1,o._onEvent(n);break;case"dblclick":n.type="click",n.tapCount=2,o._onEvent(n);break;case"mousemove":n.type="pointermove",o._onPointerMove(n);break;case"mouseout":n.type="pointerleave",o._onPointerMove(n);break;default:return}};let{interleaved:o=!1,...n}=t;this._interleaved=o,this._props=n}setProps(t){this._interleaved&&t.layers&&D(this._map,this._deck,this._props.layers,t.layers),Object.assign(this._props,t),this._deck&&this._map&&this._deck.setProps({...this._props,parameters:{...F(this._map,this._interleaved),...this._props.parameters}})}onAdd(t){return this._map=t,this._interleaved?this._onAddInterleaved(t):this._onAddOverlaid(t)}_onAddOverlaid(t){let o=document.createElement("div");return Object.assign(o.style,{position:"absolute",left:0,top:0,textAlign:"initial",pointerEvents:"none"}),this._container=o,this._deck=new M.Deck({...this._props,parent:o,parameters:{...F(t,!1),...this._props.parameters},views:this._props.views||w(t),viewState:x(t)}),t.on("resize",this._updateContainerSize),t.on("render",this._updateViewState),t.on("mousedown",this._handleMouseEvent),t.on("dragstart",this._handleMouseEvent),t.on("drag",this._handleMouseEvent),t.on("dragend",this._handleMouseEvent),t.on("mousemove",this._handleMouseEvent),t.on("mouseout",this._handleMouseEvent),t.on("click",this._handleMouseEvent),t.on("dblclick",this._handleMouseEvent),this._updateContainerSize(),o}_onAddInterleaved(t){let o=t.painter.context.gl;return o instanceof WebGLRenderingContext&&ot.log.warn("Incompatible basemap library. See: https://deck.gl/docs/api-reference/mapbox/overview#compatibility")(),this._deck=C({map:t,gl:o,deck:new M.Deck({...this._props,gl:o})}),t.on("styledata",this._handleStyleChange),D(t,this._deck,[],this._props.layers),document.createElement("div")}onRemove(){let t=this._map;t&&(this._interleaved?this._onRemoveInterleaved(t):this._onRemoveOverlaid(t)),this._deck=void 0,this._map=void 0,this._container=void 0}_onRemoveOverlaid(t){t.off("resize",this._updateContainerSize),t.off("render",this._updateViewState),t.off("mousedown",this._handleMouseEvent),t.off("dragstart",this._handleMouseEvent),t.off("drag",this._handleMouseEvent),t.off("dragend",this._handleMouseEvent),t.off("mousemove",this._handleMouseEvent),t.off("mouseout",this._handleMouseEvent),t.off("click",this._handleMouseEvent),t.off("dblclick",this._handleMouseEvent),this._deck?.finalize()}_onRemoveInterleaved(t){t.off("styledata",this._handleStyleChange),D(t,this._deck,this._props.layers,[]),Z(t)}getDefaultPosition(){return"top-left"}pickObject(t){return(0,M.assert)(this._deck),this._deck.pickObject(t)}pickMultipleObjects(t){return(0,M.assert)(this._deck),this._deck.pickMultipleObjects(t)}pickObjects(t){return(0,M.assert)(this._deck),this._deck.pickObjects(t)}finalize(){this._map&&this._map.removeControl(this)}getCanvas(){return this._map?this._interleaved?this._map.getCanvas():this._deck.getCanvas():null}};return dt(E);})();
|
|
7
|
+
"use strict";var __exports__=(()=>{var st=Object.create;var S=Object.defineProperty;var at=Object.getOwnPropertyDescriptor;var ct=Object.getOwnPropertyNames;var lt=Object.getPrototypeOf,ut=Object.prototype.hasOwnProperty;var pt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),dt=(e,t)=>{for(var o in t)S(e,o,{get:t[o],enumerable:!0})},j=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ct(t))!ut.call(e,r)&&r!==o&&S(e,r,{get:()=>t[r],enumerable:!(n=at(t,r))||n.enumerable});return e},h=(e,t,o)=>(j(e,t,"default"),o&&j(o,t,"default")),b=(e,t,o)=>(o=e!=null?st(lt(e)):{},j(t||!e||!e.__esModule?S(o,"default",{value:e,enumerable:!0}):o,e)),ht=e=>j(S({},"__esModule",{value:!0}),e);var f=pt((Rt,Y)=>{Y.exports=globalThis.deck});var k={};dt(k,{MapboxOverlay:()=>E});var p={},W=b(f(),1);h(p,b(f(),1));if(!W.Layer)throw new Error("@deck.gl/core is not found");h(k,p);var M=b(f(),1);var d=b(f(),1);function C(e,t){if(!e)throw new Error(t||"@math.gl/web-mercator: assertion failed.")}var m=Math.PI,gt=m/4,z=m/180,Ut=180/m,V=512,yt=4003e4;function v(e){let[t,o]=e;C(Number.isFinite(t)),C(Number.isFinite(o)&&o>=-90&&o<=90,"invalid latitude");let n=t*z,r=o*z,a=V*(n+m)/(2*m),i=V*(m+Math.log(Math.tan(gt+r*.5)))/(2*m);return[a,i]}function A(e){let t=Math.cos(e*z);return V/yt/t}var $t=Math.PI/180;var w="mapbox",Z=512,jt=Math.PI/180;function F({map:e,gl:t,deck:o}){if(e.__deck)return e.__deck;let n=o?.props._customRender,r=o?.props.onLoad,a={...o?.props,_customRender:()=>{e.triggerRepaint(),n?.("")}};a.parameters={...O(e,!0),...a.parameters},a.views||=L(e);let i;return(!o||o.props.gl===t)&&(Object.assign(a,{gl:t,width:null,height:null,touchAction:"unset",viewState:_(e)}),o?.isInitialized?$(o,e):a.onLoad=()=>{r?.(),$(i,e)}),o?(i=o,o.setProps(a),o.userData.isExternal=!0):(i=new d.Deck(a),e.on("remove",()=>{N(e)})),i.userData.mapboxLayers=new Set,e.__deck=i,e.on("render",()=>{i.isInitialized&&Ct(i,e)}),i}function $(e,t){let o=()=>{e.isInitialized?Ft(e,t):t.off("move",o)};t.on("move",o)}function N(e){e.__deck?.finalize(),e.__deck=null}function O(e,t){let o=t?{depthWriteEnabled:!0,depthCompare:"less-equal",depthBias:0,blend:!0,blendColorSrcFactor:"src-alpha",blendColorDstFactor:"one-minus-src-alpha",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one-minus-src-alpha",blendColorOperation:"add",blendAlphaOperation:"add"}:{};return et(e)==="globe"&&(o.cullMode="back"),o}function J(e,t){e.userData.mapboxLayers.add(t),U(e)}function K(e,t){e.userData.mapboxLayers.delete(t),U(e)}function Q(e,t){U(e)}function tt(e,t,o,n){let{currentViewport:r}=e.userData,a=!1;r||(r=ot(e,t,n),e.userData.currentViewport=r,a=!0),e.isInitialized&&e._drawLayers("mapbox-repaint",{viewports:[r],layerFilter:i=>(!e.props.layerFilter||e.props.layerFilter(i))&&(o.id===i.layer.id||i.layer.props.operation.includes("terrain")),clearStack:a,clearCanvas:!1})}function et(e){let t=e.getProjection?.(),o=t?.type||t?.name;if(o==="globe")return"globe";if(o&&o!=="mercator")throw new Error("Unsupported projection");return"mercator"}function L(e){return et(e)==="globe"?new d._GlobeView({id:w}):new d.MapView({id:w})}function _(e){let{lng:t,lat:o}=e.getCenter(),n={longitude:(t+540)%360-180,latitude:o,zoom:e.getZoom(),bearing:e.getBearing(),pitch:e.getPitch(),padding:e.getPadding(),repeat:e.getRenderWorldCopies()};return e.getTerrain?.()&&St(e,n),n}function St(e,t){if(e.getFreeCameraOptions){let{position:o}=e.getFreeCameraOptions();if(!o||o.z===void 0)return;let n=e.transform.height,{longitude:r,latitude:a,pitch:i}=t,s=o.x*Z,c=(1-o.y)*Z,l=o.z*Z,u=v([r,a]),g=s-u[0],y=c-u[1],T=Math.sqrt(g*g+y*y),I=i*jt,R=1.5*n,B=I<.001?R*Math.cos(I)/l:R*Math.sin(I)/T;t.zoom=Math.log2(B);let rt=R*Math.cos(I)/B,it=l-rt;t.position=[0,0,it/A(a)]}else typeof e.transform.elevation=="number"&&(t.position=[0,0,e.transform.elevation])}function ot(e,t,o){let n=_(t),{views:r}=e.props,a=r&&(0,d._flatten)(r).find(c=>c.id===w)||L(t);o&&(a.props.nearZMultiplier=.2);let i=o?.nearZ??t.transform._nearZ,s=o?.farZ??t.transform._farZ;return Number.isFinite(i)&&(n.nearZ=i/t.transform.height,n.farZ=s/t.transform.height),a.makeViewport({width:e.width,height:e.height,viewState:n})}function Ct(e,t){let{mapboxLayers:o,isExternal:n}=e.userData;if(n){let r=Array.from(o,u=>u.id),i=(0,d._flatten)(e.props.layers,Boolean).some(u=>u&&!r.includes(u.id)),s=e.getViewports(),c=s.findIndex(u=>u.id===w),l=s.length>1||c<0;(i||l)&&(c>=0&&(s=s.slice(),s[c]=ot(e,t)),e._drawLayers("mapbox-repaint",{viewports:s,layerFilter:u=>(!e.props.layerFilter||e.props.layerFilter(u))&&(u.viewport.id!==w||!r.includes(u.layer.id)),clearCanvas:!1}))}e.userData.currentViewport=null}function Ft(e,t){e.setProps({viewState:_(t)}),e.needsRedraw({clearRedrawFlags:!0})}function U(e){if(e.userData.isExternal)return;let t=[];e.userData.mapboxLayers.forEach(o=>{let n=o.props.type,r=new n(o.props);t.push(r)}),e.setProps({layers:t})}var nt=b(f(),1);var G=b(f(),1);var D=class{constructor(t){if(!t.id)throw new Error("Layer must have an unique id");this.id=t.id,this.type="custom",this.renderingMode=t.renderingMode||"3d",this.slot=t.slot,this.map=null,this.deck=null,this.props=t}onAdd(t,o){this.map=t,this.deck=F({map:t,gl:o,deck:this.props.deck}),J(this.deck,this)}onRemove(){this.deck&&K(this.deck,this)}setProps(t){Object.assign(this.props,t,{id:this.id}),this.deck&&Q(this.deck,this)}render(t,o){tt(this.deck,this.map,this,o)}};var X="__UNDEFINED__";function P(e,t,o,n){if(!e||!t||!e.style||!e.style._loaded)return;let r=(0,G._flatten)(n,Boolean);if(o!==n){let s=(0,G._flatten)(o,Boolean),c=new Set(s.map(l=>l.id));for(let l of r)c.delete(l.id);for(let l of c)e.getLayer(l)&&e.removeLayer(l)}for(let s of r){let c=e.getLayer(s.id);c?(c.implementation||c).setProps(s.props):e.addLayer(new D({id:s.id,deck:t,slot:s.props.slot}),s.props.beforeId)}let a=e.style._order,i={};for(let s of r){let{beforeId:c}=s.props;(!c||!a.includes(c))&&(c=X),i[c]=i[c]||[],i[c].push(s.id)}for(let s in i){let c=i[s],l=s===X?a.length:a.indexOf(s),u=s===X?void 0:s;for(let g=c.length-1;g>=0;g--){let y=c[g],T=a.indexOf(y);T!==l-1&&(e.moveLayer(y,u),T>l&&l++),l--,u=y}}}var E=class{constructor(t){this._handleStyleChange=()=>{P(this._map,this._deck,this._props.layers,this._props.layers)};this._updateContainerSize=()=>{if(this._map&&this._container){let{clientWidth:t,clientHeight:o}=this._map.getContainer();Object.assign(this._container.style,{width:`${t}px`,height:`${o}px`})}};this._updateViewState=()=>{let t=this._deck,o=this._map;t&&o&&(t.setProps({views:this._props.views||L(o),viewState:_(o)}),t.isInitialized&&t.redraw())};this._handleMouseEvent=t=>{let o=this._deck;if(!o||!o.isInitialized)return;let n={type:t.type,offsetCenter:t.point,srcEvent:t},r=this._lastMouseDownPoint;switch(!t.point&&r&&(n.deltaX=t.originalEvent.clientX-r.clientX,n.deltaY=t.originalEvent.clientY-r.clientY,n.offsetCenter={x:r.x+n.deltaX,y:r.y+n.deltaY}),n.type){case"mousedown":o._onPointerDown(n),this._lastMouseDownPoint={...t.point,clientX:t.originalEvent.clientX,clientY:t.originalEvent.clientY};break;case"dragstart":n.type="panstart",o._onEvent(n);break;case"drag":n.type="panmove",o._onEvent(n);break;case"dragend":n.type="panend",o._onEvent(n);break;case"click":n.tapCount=1,o._onEvent(n);break;case"dblclick":n.type="click",n.tapCount=2,o._onEvent(n);break;case"mousemove":n.type="pointermove",o._onPointerMove(n);break;case"mouseout":n.type="pointerleave",o._onPointerMove(n);break;default:return}};let{interleaved:o=!1,...n}=t;this._interleaved=o,this._props=n}setProps(t){this._interleaved&&t.layers&&P(this._map,this._deck,this._props.layers,t.layers),Object.assign(this._props,t),this._deck&&this._map&&this._deck.setProps({...this._props,parameters:{...O(this._map,this._interleaved),...this._props.parameters}})}onAdd(t){return this._map=t,this._interleaved?this._onAddInterleaved(t):this._onAddOverlaid(t)}_onAddOverlaid(t){let o=document.createElement("div");return Object.assign(o.style,{position:"absolute",left:0,top:0,textAlign:"initial",pointerEvents:"none"}),this._container=o,this._deck=new M.Deck({...this._props,parent:o,parameters:{...O(t,!1),...this._props.parameters},views:this._props.views||L(t),viewState:_(t)}),t.on("resize",this._updateContainerSize),t.on("render",this._updateViewState),t.on("mousedown",this._handleMouseEvent),t.on("dragstart",this._handleMouseEvent),t.on("drag",this._handleMouseEvent),t.on("dragend",this._handleMouseEvent),t.on("mousemove",this._handleMouseEvent),t.on("mouseout",this._handleMouseEvent),t.on("click",this._handleMouseEvent),t.on("dblclick",this._handleMouseEvent),this._updateContainerSize(),o}_onAddInterleaved(t){let o=t.painter.context.gl;return o instanceof WebGLRenderingContext&&nt.log.warn("Incompatible basemap library. See: https://deck.gl/docs/api-reference/mapbox/overview#compatibility")(),this._deck=F({map:t,gl:o,deck:new M.Deck({...this._props,gl:o})}),t.on("styledata",this._handleStyleChange),P(t,this._deck,[],this._props.layers),document.createElement("div")}onRemove(){let t=this._map;t&&(this._interleaved?this._onRemoveInterleaved(t):this._onRemoveOverlaid(t)),this._deck=void 0,this._map=void 0,this._container=void 0}_onRemoveOverlaid(t){t.off("resize",this._updateContainerSize),t.off("render",this._updateViewState),t.off("mousedown",this._handleMouseEvent),t.off("dragstart",this._handleMouseEvent),t.off("drag",this._handleMouseEvent),t.off("dragend",this._handleMouseEvent),t.off("mousemove",this._handleMouseEvent),t.off("mouseout",this._handleMouseEvent),t.off("click",this._handleMouseEvent),t.off("dblclick",this._handleMouseEvent),this._deck?.finalize()}_onRemoveInterleaved(t){t.off("styledata",this._handleStyleChange),P(t,this._deck,this._props.layers,[]),N(t)}getDefaultPosition(){return"top-left"}pickObject(t){return(0,M.assert)(this._deck),this._deck.pickObject(t)}pickMultipleObjects(t){return(0,M.assert)(this._deck),this._deck.pickMultipleObjects(t)}pickObjects(t){return(0,M.assert)(this._deck),this._deck.pickObjects(t)}finalize(){this._map&&this._map.removeControl(this)}getCanvas(){return this._map?this._interleaved?this._map.getCanvas():this._deck.getCanvas():null}};return ht(k);})();
|
|
8
8
|
return __exports__;
|
|
9
9
|
});
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Use deck.gl layers as custom mapbox-gl-js layers",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"version": "9.2.0-alpha.
|
|
6
|
+
"version": "9.2.0-alpha.3",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -38,12 +38,14 @@
|
|
|
38
38
|
"prepublishOnly": "npm run build-bundle && npm run build-bundle -- --env=dev"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@luma.gl/constants": "^9.
|
|
41
|
+
"@luma.gl/constants": "^9.2.0-alpha.5",
|
|
42
42
|
"@math.gl/web-mercator": "^4.1.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@deck.gl/core": "^9.1.0",
|
|
46
|
-
"@luma.gl/
|
|
46
|
+
"@luma.gl/constants": "^9.2.0-alpha.5",
|
|
47
|
+
"@luma.gl/core": "^9.2.0-alpha.5",
|
|
48
|
+
"@math.gl/web-mercator": "^4.1.0"
|
|
47
49
|
},
|
|
48
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "f34ff252c38397cd37d7d443e16ba906fda7d3c9"
|
|
49
51
|
}
|
package/src/deck-utils.ts
CHANGED
|
@@ -10,6 +10,8 @@ import type {Map} from './types';
|
|
|
10
10
|
|
|
11
11
|
import {lngLatToWorld, unitsPerMeter} from '@math.gl/web-mercator';
|
|
12
12
|
|
|
13
|
+
const MAPBOX_VIEW_ID = 'mapbox';
|
|
14
|
+
|
|
13
15
|
type UserData = {
|
|
14
16
|
isExternal: boolean;
|
|
15
17
|
currentViewport?: Viewport | null;
|
|
@@ -200,9 +202,9 @@ function getProjection(map: Map): 'mercator' | 'globe' {
|
|
|
200
202
|
|
|
201
203
|
export function getDefaultView(map: Map): GlobeView | MapView {
|
|
202
204
|
if (getProjection(map) === 'globe') {
|
|
203
|
-
return new GlobeView({id:
|
|
205
|
+
return new GlobeView({id: MAPBOX_VIEW_ID});
|
|
204
206
|
}
|
|
205
|
-
return new MapView({id:
|
|
207
|
+
return new MapView({id: MAPBOX_VIEW_ID});
|
|
206
208
|
}
|
|
207
209
|
|
|
208
210
|
export function getViewState(map: Map): MapViewState & {
|
|
@@ -300,7 +302,10 @@ type MaplibreRenderParameters = {
|
|
|
300
302
|
|
|
301
303
|
function getViewport(deck: Deck, map: Map, renderParameters?: unknown): Viewport {
|
|
302
304
|
const viewState = getViewState(map);
|
|
303
|
-
const
|
|
305
|
+
const {views} = deck.props;
|
|
306
|
+
const view =
|
|
307
|
+
(views && flatten(views).find((v: {id: string}) => v.id === MAPBOX_VIEW_ID)) ||
|
|
308
|
+
getDefaultView(map);
|
|
304
309
|
|
|
305
310
|
if (renderParameters) {
|
|
306
311
|
// Called from MapboxLayer.render
|
|
@@ -337,7 +342,7 @@ function afterRender(deck: Deck, map: Map): void {
|
|
|
337
342
|
layer => layer && !mapboxLayerIds.includes(layer.id)
|
|
338
343
|
);
|
|
339
344
|
let viewports = deck.getViewports();
|
|
340
|
-
const mapboxViewportIdx = viewports.findIndex(vp => vp.id ===
|
|
345
|
+
const mapboxViewportIdx = viewports.findIndex(vp => vp.id === MAPBOX_VIEW_ID);
|
|
341
346
|
const hasNonMapboxViews = viewports.length > 1 || mapboxViewportIdx < 0;
|
|
342
347
|
|
|
343
348
|
if (hasNonMapboxLayers || hasNonMapboxViews) {
|
|
@@ -350,7 +355,7 @@ function afterRender(deck: Deck, map: Map): void {
|
|
|
350
355
|
viewports,
|
|
351
356
|
layerFilter: params =>
|
|
352
357
|
(!deck.props.layerFilter || deck.props.layerFilter(params)) &&
|
|
353
|
-
(params.viewport.id !==
|
|
358
|
+
(params.viewport.id !== MAPBOX_VIEW_ID || !mapboxLayerIds.includes(params.layer.id)),
|
|
354
359
|
clearCanvas: false
|
|
355
360
|
});
|
|
356
361
|
}
|