@deck.gl/mapbox 9.2.11 → 9.3.0-alpha.2
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 +13 -1
- package/dist/deck-utils.js.map +1 -1
- package/dist/dist.dev.js +12 -1
- package/dist/index.cjs +12 -1
- package/dist/index.cjs.map +2 -2
- package/dist.min.js +1 -1
- package/package.json +5 -5
- package/src/deck-utils.ts +16 -3
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,gBAAgB,gCAA6B;AACzD,OAAO,KAAK,EAAoB,GAAG,EAAC,mBAAgB;AAepD,wBAAgB,eAAe,CAAC,EAC9B,GAAG,EACH,IAAI,EACL,EAAE;IACD,GAAG,EAAE,GAAG,GAAG;QAAC,MAAM,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;KAAC,CAAC;IACvC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;CACjB,GAAG,IAAI,CAAC,GAAG,CAAC,CAgDZ;AAeD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,GAAG,GAAG;IAAC,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;CAAC,QAGnE;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,OAAO,GAAG,UAAU,CAmB/E;AAED,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EAAE,gBAAgB,EACvB,gBAAgB,EAAE,GAAG,GACpB,IAAI,CAmCN;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,UAAU,GAAG,OAAO,CAc5D;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,SAAS,GAAG,OAAO,CAK5D;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,YAAY,GAAG;IACrD,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH,CA6BA"}
|
package/dist/deck-utils.js
CHANGED
|
@@ -103,6 +103,9 @@ export function drawLayer(deck, map, layer, renderParameters) {
|
|
|
103
103
|
deck.userData.currentViewport = currentViewport;
|
|
104
104
|
clearStack = true;
|
|
105
105
|
}
|
|
106
|
+
if (!currentViewport) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
106
109
|
deck._drawLayers('mapbox-repaint', {
|
|
107
110
|
viewports: [currentViewport],
|
|
108
111
|
layerFilter: params => (!deck.props.layerFilter || deck.props.layerFilter(params)) &&
|
|
@@ -124,6 +127,9 @@ export function drawLayerGroup(deck, map, group, renderParameters) {
|
|
|
124
127
|
deck.userData.currentViewport = currentViewport;
|
|
125
128
|
clearStack = true;
|
|
126
129
|
}
|
|
130
|
+
if (!currentViewport) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
127
133
|
deck._drawLayers('mapbox-repaint', {
|
|
128
134
|
viewports: [currentViewport],
|
|
129
135
|
layerFilter: params => {
|
|
@@ -252,7 +258,13 @@ function afterRender(deck, map) {
|
|
|
252
258
|
if (hasNonMapboxLayers || hasNonMapboxViews) {
|
|
253
259
|
if (mapboxViewportIdx >= 0) {
|
|
254
260
|
viewports = viewports.slice();
|
|
255
|
-
|
|
261
|
+
const mapboxViewport = getViewport(deck, map);
|
|
262
|
+
if (mapboxViewport) {
|
|
263
|
+
viewports[mapboxViewportIdx] = mapboxViewport;
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
viewports.splice(mapboxViewportIdx, 1);
|
|
267
|
+
}
|
|
256
268
|
}
|
|
257
269
|
deck._drawLayers('mapbox-repaint', {
|
|
258
270
|
viewports,
|
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,EAAO,OAAO,EAAE,UAAU,IAAI,SAAS,EAAE,QAAQ,IAAI,OAAO,EAAC,MAAM,eAAe,CAAC;AAO1F,OAAO,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,uBAAuB,CAAC;AAEnE,MAAM,cAAc,GAAG,QAAQ,CAAC;AAMhC,qBAAqB;AACrB,MAAM,SAAS,GAAG,GAAG,CAAC;AACtB,MAAM,kBAAkB,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;AAEzC,uCAAuC;AACvC,MAAM,UAAU,eAAe,CAAC,EAC9B,GAAG,EACH,IAAI,EAIL;IACC,4CAA4C;IAC5C,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;QACf,OAAO,GAAG,CAAC,MAAM,CAAC;IACpB,CAAC;IAED,iDAAiD;IACjD,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;IAC9C,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAEjC,MAAM,SAAS,GAAG;QAChB,GAAG,IAAI,CAAC,KAAK;QACb,aAAa,EAAE,GAAG,EAAE;YAClB,GAAG,CAAC,cAAc,EAAE,CAAC;YACrB,iFAAiF;YACjF,+BAA+B;YAC/B,mGAAmG;YACnG,uDAAuD;YACvD,YAAY,EAA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E;YACjC,SAAS;YACT,WAAW,EAAE,MAAM,CAAC,EAAE,CACpB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;gBAC3D,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,KAAK,cAAc,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAC3E,WAAW,EAAE,KAAK;SACnB,CAAC,CAAC;IACL,CAAC;IAED,gDAAgD;IAC/C,IAAI,CAAC,QAAqB,CAAC,eAAe,GAAG,IAAI,CAAC;AACrD,CAAC;AAED,SAAS,SAAS,CAAC,IAAU,EAAE,GAAQ;IACrC,IAAI,CAAC,QAAQ,CAAC;QACZ,SAAS,EAAE,YAAY,CAAC,GAAG,CAAC;KAC7B,CAAC,CAAC;IACH,8DAA8D;IAC9D,qFAAqF;IACrF,mBAAmB;IACnB,IAAI,CAAC,WAAW,CAAC,EAAC,gBAAgB,EAAE,IAAI,EAAC,CAAC,CAAC;AAC7C,CAAC"}
|
package/dist/dist.dev.js
CHANGED
|
@@ -186,6 +186,9 @@ var __exports__ = (() => {
|
|
|
186
186
|
deck.userData.currentViewport = currentViewport;
|
|
187
187
|
clearStack = true;
|
|
188
188
|
}
|
|
189
|
+
if (!currentViewport) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
189
192
|
deck._drawLayers("mapbox-repaint", {
|
|
190
193
|
viewports: [currentViewport],
|
|
191
194
|
layerFilter: (params) => (!deck.props.layerFilter || deck.props.layerFilter(params)) && (layer.id === params.layer.id || params.layer.props.operation.includes("terrain")),
|
|
@@ -204,6 +207,9 @@ var __exports__ = (() => {
|
|
|
204
207
|
deck.userData.currentViewport = currentViewport;
|
|
205
208
|
clearStack = true;
|
|
206
209
|
}
|
|
210
|
+
if (!currentViewport) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
207
213
|
deck._drawLayers("mapbox-repaint", {
|
|
208
214
|
viewports: [currentViewport],
|
|
209
215
|
layerFilter: (params) => {
|
|
@@ -315,7 +321,12 @@ var __exports__ = (() => {
|
|
|
315
321
|
if (hasNonMapboxLayers || hasNonMapboxViews) {
|
|
316
322
|
if (mapboxViewportIdx >= 0) {
|
|
317
323
|
viewports = viewports.slice();
|
|
318
|
-
|
|
324
|
+
const mapboxViewport = getViewport(deck, map);
|
|
325
|
+
if (mapboxViewport) {
|
|
326
|
+
viewports[mapboxViewportIdx] = mapboxViewport;
|
|
327
|
+
} else {
|
|
328
|
+
viewports.splice(mapboxViewportIdx, 1);
|
|
329
|
+
}
|
|
319
330
|
}
|
|
320
331
|
deck._drawLayers("mapbox-repaint", {
|
|
321
332
|
viewports,
|
package/dist/index.cjs
CHANGED
|
@@ -113,6 +113,9 @@ function drawLayer(deck, map, layer, renderParameters) {
|
|
|
113
113
|
deck.userData.currentViewport = currentViewport;
|
|
114
114
|
clearStack = true;
|
|
115
115
|
}
|
|
116
|
+
if (!currentViewport) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
116
119
|
deck._drawLayers("mapbox-repaint", {
|
|
117
120
|
viewports: [currentViewport],
|
|
118
121
|
layerFilter: (params) => (!deck.props.layerFilter || deck.props.layerFilter(params)) && (layer.id === params.layer.id || params.layer.props.operation.includes("terrain")),
|
|
@@ -131,6 +134,9 @@ function drawLayerGroup(deck, map, group, renderParameters) {
|
|
|
131
134
|
deck.userData.currentViewport = currentViewport;
|
|
132
135
|
clearStack = true;
|
|
133
136
|
}
|
|
137
|
+
if (!currentViewport) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
134
140
|
deck._drawLayers("mapbox-repaint", {
|
|
135
141
|
viewports: [currentViewport],
|
|
136
142
|
layerFilter: (params) => {
|
|
@@ -244,7 +250,12 @@ function afterRender(deck, map) {
|
|
|
244
250
|
if (hasNonMapboxLayers || hasNonMapboxViews) {
|
|
245
251
|
if (mapboxViewportIdx >= 0) {
|
|
246
252
|
viewports = viewports.slice();
|
|
247
|
-
|
|
253
|
+
const mapboxViewport = getViewport(deck, map);
|
|
254
|
+
if (mapboxViewport) {
|
|
255
|
+
viewports[mapboxViewportIdx] = mapboxViewport;
|
|
256
|
+
} else {
|
|
257
|
+
viewports.splice(mapboxViewportIdx, 1);
|
|
258
|
+
}
|
|
248
259
|
}
|
|
249
260
|
deck._drawLayers("mapbox-repaint", {
|
|
250
261
|
viewports,
|
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", "../src/resolve-layer-groups.ts", "../src/mapbox-layer-group.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, log} from '@deck.gl/core';\nimport {\n getViewState,\n getDefaultView,\n getDeckInstance,\n removeDeckInstance,\n getDefaultParameters,\n getProjection\n} from './deck-utils';\n\nimport type {Map, IControl, MapMouseEvent, ControlPosition} from './types';\nimport type {MjolnirGestureEvent, MjolnirPointerEvent} from 'mjolnir.js';\nimport type {DeckProps, LayersList} from '@deck.gl/core';\n\nimport {resolveLayers} from './resolve-layers';\nimport {resolveLayerGroups} from './resolve-layer-groups';\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 /**\n * deck.gl layers are inserted into mapbox-gl's layer stack, and share the same WebGL2RenderingContext as the base map.\n */\n interleaved?: boolean;\n\n /**\n * (experimental) render deck.gl layers in batches grouped by `beforeId` or `slot` to enable cross-layer extension handling.\n * @default false\n */\n _renderLayersInGroups?: 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 _renderLayersInGroups: boolean;\n private _lastMouseDownPoint?: {x: number; y: number; clientX: number; clientY: number};\n\n constructor(props: MapboxOverlayProps) {\n const {interleaved = false} = props;\n this._interleaved = interleaved;\n this._renderLayersInGroups = props._renderLayersInGroups || false;\n this._props = this.filterProps(props);\n }\n\n /** Filter out props to pass to Deck **/\n filterProps(props: MapboxOverlayProps): MapboxOverlayProps {\n const {interleaved = false, useDevicePixels, ...deckProps} = props;\n if (!interleaved && useDevicePixels !== undefined) {\n // useDevicePixels cannot be used in interleaved mode\n (deckProps as MapboxOverlayProps).useDevicePixels = useDevicePixels;\n }\n return deckProps;\n }\n\n /** Update (partial) props of the underlying Deck instance. */\n setProps(props: MapboxOverlayProps): void {\n if (this._interleaved && props.layers) {\n this._resolveLayers(this._map, this._deck, this._props.layers, props.layers);\n }\n\n Object.assign(this._props, this.filterProps(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: WebGL2RenderingContext = 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 deck: new Deck({\n ...this._props,\n gl,\n parameters: {...getDefaultParameters(map, true), ...this._props.parameters}\n })\n });\n\n map.on('styledata', this._handleStyleChange);\n this._resolveLayers(map, this._deck, [], this._props.layers);\n\n return document.createElement('div');\n }\n\n private _resolveLayers(\n map: Map | undefined,\n deck: Deck | undefined,\n prevLayers: LayersList | undefined,\n newLayers: LayersList | undefined\n ): void {\n if (this._renderLayersInGroups) {\n resolveLayerGroups(map, prevLayers, newLayers);\n } else {\n resolveLayers(map, deck, prevLayers, newLayers);\n }\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 this._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 this._resolveLayers(this._map, this._deck, this._props.layers, this._props.layers);\n if (!this._map) return;\n\n // getProjection() returns undefined before style is loaded\n const projection = getProjection(this._map);\n if (projection && !this._props.views) {\n this._deck?.setProps({views: getDefaultView(this._map)});\n }\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 MapboxLayerGroup from './mapbox-layer-group';\nimport type {LayerOverlayProps, Map} from './types';\n\nimport {lngLatToWorld, unitsPerMeter} from '@math.gl/web-mercator';\n\nconst MAPBOX_VIEW_ID = 'mapbox';\n\ntype UserData = {\n currentViewport?: Viewport | null;\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 deck\n}: {\n map: Map & {__deck?: Deck<any> | null};\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.views ||= getDefaultView(map);\n\n // deck is using the WebGLContext created by mapbox,\n // block deck from setting the canvas size, and use the map's viewState to drive deck.\n Object.assign(deckProps, {\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(deck, map);\n };\n }\n\n deck.setProps(deckProps);\n\n map.__deck = deck;\n map.on('render', () => {\n if (deck.isInitialized) afterRender(deck, map);\n });\n\n return deck;\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 drawLayer(\n deck: Deck,\n map: Map,\n layer: MapboxLayer<any>,\n renderParameters: any\n): void {\n if (!deck.isInitialized) {\n return;\n }\n\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 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\nexport function drawLayerGroup(\n deck: Deck,\n map: Map,\n group: MapboxLayerGroup,\n renderParameters: any\n): void {\n if (!deck.isInitialized) {\n return;\n }\n\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 deck._drawLayers('mapbox-repaint', {\n viewports: [currentViewport],\n layerFilter: params => {\n if (deck.props.layerFilter && !deck.props.layerFilter(params)) {\n return false;\n }\n\n const layer = params.layer as Layer<LayerOverlayProps>;\n if (layer.props.beforeId === group.beforeId && layer.props.slot === group.slot) {\n return true;\n }\n return false;\n },\n clearStack,\n clearCanvas: false\n });\n}\n\nexport function 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 // View is always MapView or GlobeView in this context\n const view = (deck.getView(MAPBOX_VIEW_ID) || getDefaultView(map)) as MapView | GlobeView;\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 // Draw non-Mapbox layers (layers that don't have a corresponding MapboxLayer on the map)\n const deckLayers = flatten(deck.props.layers, Boolean) as Layer[];\n const hasNonMapboxLayers = deckLayers.some(layer => layer && !map.getLayer(layer.id));\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 || !map.getLayer(params.layer.id)),\n clearCanvas: false\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", "// 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 // @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 {drawLayer} from './deck-utils';\nimport type {Map, CustomLayerInterface} from './types';\nimport type {Deck, Layer} from '@deck.gl/core';\n\ntype MapWithDeck = Map & {__deck: Deck};\n\nexport type MapboxLayerProps<LayerT extends Layer> = Partial<LayerT['props']> & {\n id: string;\n renderingMode?: '2d' | '3d';\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: MapWithDeck | 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.props = props;\n }\n\n /* Mapbox custom layer methods */\n\n onAdd(map: MapWithDeck, gl: WebGL2RenderingContext): void {\n this.map = map;\n }\n\n onRemove(): void {\n this.map = null;\n }\n\n setProps(props: MapboxLayerProps<LayerT>) {\n // id cannot be changed\n Object.assign(this.props, props, {id: this.id});\n }\n\n render(gl, renderParameters) {\n if (!this.map) return;\n\n drawLayer(this.map.__deck, this.map, this, renderParameters);\n }\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {_flatten as flatten} from '@deck.gl/core';\n\nimport type {Layer, LayersList} from '@deck.gl/core';\nimport type {Map, LayerOverlayProps} from './types';\nimport MapboxLayerGroup from './mapbox-layer-group';\n\nconst UNDEFINED_BEFORE_ID = '__UNDEFINED__';\n\nfunction getLayerGroupId(layer: Layer<LayerOverlayProps>): string {\n if (layer.props.beforeId) {\n return `deck-layer-group-before:${layer.props.beforeId}`;\n } else if (layer.props.slot) {\n return `deck-layer-group-slot:${layer.props.slot}`;\n }\n return 'deck-layer-group-last';\n}\n\n/** Group Deck layers into buckets (by beforeId or slot) and insert them\n * into the mapbox Map according to the user-defined order\n **/\n// eslint-disable-next-line complexity, max-statements\nexport function resolveLayerGroups(map?: Map, oldLayers?: LayersList, newLayers?: LayersList) {\n // Wait until map style is loaded\n // @ts-ignore non-public map property\n if (!map || !map.style || !map.style._loaded) {\n return;\n }\n\n const layers = flatten(newLayers, Boolean) as Layer<LayerOverlayProps>[];\n\n if (oldLayers !== newLayers) {\n // Step 1: remove \"group\" layers that no longer exist\n const prevLayers = flatten(oldLayers, Boolean) as Layer<LayerOverlayProps>[];\n const prevLayerGroupIds = new Set<string>(prevLayers.map(l => getLayerGroupId(l)));\n const newLayerGroupIds = new Set<string>(layers.map(l => getLayerGroupId(l)));\n\n for (const groupId of prevLayerGroupIds) {\n if (!newLayerGroupIds.has(groupId)) {\n if (map.getLayer(groupId)) {\n map.removeLayer(groupId);\n }\n }\n }\n }\n\n // Step 2: add missing \"group\" layers\n const layerGroups: Record<string, MapboxLayerGroup> = {};\n for (const layer of layers) {\n const groupId = getLayerGroupId(layer);\n const mapboxGroup = map.getLayer(groupId) as MapboxLayerGroup;\n if (mapboxGroup) {\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 groupInstance = mapboxGroup.implementation || mapboxGroup;\n layerGroups[groupId] = groupInstance;\n } else {\n const newGroup = new MapboxLayerGroup({\n id: groupId,\n slot: layer.props.slot,\n beforeId: layer.props.beforeId\n });\n layerGroups[groupId] = newGroup;\n map.addLayer(newGroup, layer.props.beforeId);\n }\n }\n\n // Step 3: check the order of layers\n // If beforeId move \"group\" layers to proper position in the mapbox layer order\n // @ts-ignore non-public map property\n const mapLayers: string[] = map.style._order;\n\n for (const [groupId, group] of Object.entries(layerGroups)) {\n const beforeId = group.beforeId || UNDEFINED_BEFORE_ID;\n\n const expectedGroupIndex =\n beforeId === UNDEFINED_BEFORE_ID ? mapLayers.length : mapLayers.indexOf(beforeId);\n\n const currentGropupIndex = mapLayers.indexOf(groupId);\n if (currentGropupIndex !== expectedGroupIndex - 1) {\n const moveBeforeId = beforeId === UNDEFINED_BEFORE_ID ? undefined : beforeId;\n map.moveLayer(groupId, moveBeforeId);\n }\n }\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {drawLayerGroup} from './deck-utils';\nimport type {Map, CustomLayerInterface} from './types';\nimport {assert, type Deck} from '@deck.gl/core';\n\ntype MapWithDeck = Map & {__deck: Deck};\n\nexport type MapboxLayerGroupProps = {\n id: string;\n renderingMode?: '2d' | '3d';\n /* Mapbox v3 Standard style */\n slot?: 'bottom' | 'middle' | 'top';\n beforeId?: string;\n};\n\nexport default class MapboxLayerGroup implements CustomLayerInterface {\n id: string;\n type: 'custom';\n renderingMode: '2d' | '3d';\n /* Mapbox v3 Standard style */\n slot?: 'bottom' | 'middle' | 'top';\n beforeId?: string;\n map: MapWithDeck | null;\n\n /* eslint-disable no-this-before-super */\n constructor(props: MapboxLayerGroupProps) {\n assert(props.id, 'id is required');\n\n this.id = props.id;\n this.type = 'custom';\n this.renderingMode = props.renderingMode || '3d';\n this.slot = props.slot;\n this.beforeId = props.beforeId;\n this.map = null;\n }\n\n /* Mapbox custom layer methods */\n\n onAdd(map: MapWithDeck, gl: WebGL2RenderingContext): void {\n this.map = map;\n }\n\n render(gl, renderParameters) {\n if (!this.map) return;\n\n drawLayerGroup(this.map.__deck, this.map, this, renderParameters);\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACIA,IAAAA,eAAgC;;;ACAhC,kBAA0E;AAO1E,0BAA2C;AAE3C,IAAM,iBAAiB;AAOvB,IAAM,YAAY;AAClB,IAAM,qBAAqB,KAAK,KAAK;AAG/B,SAAU,gBAAgB,EAC9B,KACA,KAAI,GAIL;AAEC,MAAI,IAAI,QAAQ;AACd,WAAO,IAAI;EACb;AAGA,QAAM,eAAe,KAAK,MAAM;AAChC,QAAM,SAAS,KAAK,MAAM;AAE1B,QAAM,YAAY;IAChB,GAAG,KAAK;IACR,eAAe,MAAK;AAClB,UAAI,eAAc;AAKlB,mDAAe;IACjB;;AAEF,YAAU,UAAV,UAAU,QAAU,eAAe,GAAG;AAItC,SAAO,OAAO,WAAW;IACvB,OAAO;IACP,QAAQ;IACR,aAAa;IACb,WAAW,aAAa,GAAG;GAC5B;AACD,MAAI,KAAK,eAAe;AACtB,iBAAa,MAAM,GAAG;EACxB,OAAO;AACL,cAAU,SAAS,MAAK;AACtB;AACA,mBAAa,MAAM,GAAG;IACxB;EACF;AAEA,OAAK,SAAS,SAAS;AAEvB,MAAI,SAAS;AACb,MAAI,GAAG,UAAU,MAAK;AACpB,QAAI,KAAK;AAAe,kBAAY,MAAM,GAAG;EAC/C,CAAC;AAED,SAAO;AACT;AAEA,SAAS,aAAa,MA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AAO,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;;",
|
|
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, log} from '@deck.gl/core';\nimport {\n getViewState,\n getDefaultView,\n getDeckInstance,\n removeDeckInstance,\n getDefaultParameters,\n getProjection\n} from './deck-utils';\n\nimport type {Map, IControl, MapMouseEvent, ControlPosition} from './types';\nimport type {MjolnirGestureEvent, MjolnirPointerEvent} from 'mjolnir.js';\nimport type {DeckProps, LayersList} from '@deck.gl/core';\n\nimport {resolveLayers} from './resolve-layers';\nimport {resolveLayerGroups} from './resolve-layer-groups';\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 /**\n * deck.gl layers are inserted into mapbox-gl's layer stack, and share the same WebGL2RenderingContext as the base map.\n */\n interleaved?: boolean;\n\n /**\n * (experimental) render deck.gl layers in batches grouped by `beforeId` or `slot` to enable cross-layer extension handling.\n * @default false\n */\n _renderLayersInGroups?: 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 _renderLayersInGroups: boolean;\n private _lastMouseDownPoint?: {x: number; y: number; clientX: number; clientY: number};\n\n constructor(props: MapboxOverlayProps) {\n const {interleaved = false} = props;\n this._interleaved = interleaved;\n this._renderLayersInGroups = props._renderLayersInGroups || false;\n this._props = this.filterProps(props);\n }\n\n /** Filter out props to pass to Deck **/\n filterProps(props: MapboxOverlayProps): MapboxOverlayProps {\n const {interleaved = false, useDevicePixels, ...deckProps} = props;\n if (!interleaved && useDevicePixels !== undefined) {\n // useDevicePixels cannot be used in interleaved mode\n (deckProps as MapboxOverlayProps).useDevicePixels = useDevicePixels;\n }\n return deckProps;\n }\n\n /** Update (partial) props of the underlying Deck instance. */\n setProps(props: MapboxOverlayProps): void {\n if (this._interleaved && props.layers) {\n this._resolveLayers(this._map, this._deck, this._props.layers, props.layers);\n }\n\n Object.assign(this._props, this.filterProps(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: WebGL2RenderingContext = 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 deck: new Deck({\n ...this._props,\n gl,\n parameters: {...getDefaultParameters(map, true), ...this._props.parameters}\n })\n });\n\n map.on('styledata', this._handleStyleChange);\n this._resolveLayers(map, this._deck, [], this._props.layers);\n\n return document.createElement('div');\n }\n\n private _resolveLayers(\n map: Map | undefined,\n deck: Deck | undefined,\n prevLayers: LayersList | undefined,\n newLayers: LayersList | undefined\n ): void {\n if (this._renderLayersInGroups) {\n resolveLayerGroups(map, prevLayers, newLayers);\n } else {\n resolveLayers(map, deck, prevLayers, newLayers);\n }\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 this._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 this._resolveLayers(this._map, this._deck, this._props.layers, this._props.layers);\n if (!this._map) return;\n\n // getProjection() returns undefined before style is loaded\n const projection = getProjection(this._map);\n if (projection && !this._props.views) {\n this._deck?.setProps({views: getDefaultView(this._map)});\n }\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 MapboxLayerGroup from './mapbox-layer-group';\nimport type {LayerOverlayProps, Map} from './types';\n\nimport {lngLatToWorld, unitsPerMeter} from '@math.gl/web-mercator';\n\nconst MAPBOX_VIEW_ID = 'mapbox';\n\ntype UserData = {\n currentViewport?: Viewport | null;\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 deck\n}: {\n map: Map & {__deck?: Deck<any> | null};\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.views ||= getDefaultView(map);\n\n // deck is using the WebGLContext created by mapbox,\n // block deck from setting the canvas size, and use the map's viewState to drive deck.\n Object.assign(deckProps, {\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(deck, map);\n };\n }\n\n deck.setProps(deckProps);\n\n map.__deck = deck;\n map.on('render', () => {\n if (deck.isInitialized) afterRender(deck, map);\n });\n\n return deck;\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 drawLayer(\n deck: Deck,\n map: Map,\n layer: MapboxLayer<any>,\n renderParameters: any\n): void {\n if (!deck.isInitialized) {\n return;\n }\n\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 (!currentViewport) {\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\nexport function drawLayerGroup(\n deck: Deck,\n map: Map,\n group: MapboxLayerGroup,\n renderParameters: any\n): void {\n if (!deck.isInitialized) {\n return;\n }\n\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 (!currentViewport) {\n return;\n }\n\n deck._drawLayers('mapbox-repaint', {\n viewports: [currentViewport],\n layerFilter: params => {\n if (deck.props.layerFilter && !deck.props.layerFilter(params)) {\n return false;\n }\n\n const layer = params.layer as Layer<LayerOverlayProps>;\n if (layer.props.beforeId === group.beforeId && layer.props.slot === group.slot) {\n return true;\n }\n return false;\n },\n clearStack,\n clearCanvas: false\n });\n}\n\nexport function 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 | null {\n const viewState = getViewState(map);\n // View is always MapView or GlobeView in this context\n const view = (deck.getView(MAPBOX_VIEW_ID) || getDefaultView(map)) as MapView | GlobeView;\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 });\n}\n\nfunction afterRender(deck: Deck, map: Map): void {\n // Draw non-Mapbox layers (layers that don't have a corresponding MapboxLayer on the map)\n const deckLayers = flatten(deck.props.layers, Boolean) as Layer[];\n const hasNonMapboxLayers = deckLayers.some(layer => layer && !map.getLayer(layer.id));\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 const mapboxViewport = getViewport(deck, map);\n if (mapboxViewport) {\n viewports[mapboxViewportIdx] = mapboxViewport;\n } else {\n viewports.splice(mapboxViewportIdx, 1);\n }\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 || !map.getLayer(params.layer.id)),\n clearCanvas: false\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", "// 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 // @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 {drawLayer} from './deck-utils';\nimport type {Map, CustomLayerInterface} from './types';\nimport type {Deck, Layer} from '@deck.gl/core';\n\ntype MapWithDeck = Map & {__deck: Deck};\n\nexport type MapboxLayerProps<LayerT extends Layer> = Partial<LayerT['props']> & {\n id: string;\n renderingMode?: '2d' | '3d';\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: MapWithDeck | 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.props = props;\n }\n\n /* Mapbox custom layer methods */\n\n onAdd(map: MapWithDeck, gl: WebGL2RenderingContext): void {\n this.map = map;\n }\n\n onRemove(): void {\n this.map = null;\n }\n\n setProps(props: MapboxLayerProps<LayerT>) {\n // id cannot be changed\n Object.assign(this.props, props, {id: this.id});\n }\n\n render(gl, renderParameters) {\n if (!this.map) return;\n\n drawLayer(this.map.__deck, this.map, this, renderParameters);\n }\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {_flatten as flatten} from '@deck.gl/core';\n\nimport type {Layer, LayersList} from '@deck.gl/core';\nimport type {Map, LayerOverlayProps} from './types';\nimport MapboxLayerGroup from './mapbox-layer-group';\n\nconst UNDEFINED_BEFORE_ID = '__UNDEFINED__';\n\nfunction getLayerGroupId(layer: Layer<LayerOverlayProps>): string {\n if (layer.props.beforeId) {\n return `deck-layer-group-before:${layer.props.beforeId}`;\n } else if (layer.props.slot) {\n return `deck-layer-group-slot:${layer.props.slot}`;\n }\n return 'deck-layer-group-last';\n}\n\n/** Group Deck layers into buckets (by beforeId or slot) and insert them\n * into the mapbox Map according to the user-defined order\n **/\n// eslint-disable-next-line complexity, max-statements\nexport function resolveLayerGroups(map?: Map, oldLayers?: LayersList, newLayers?: LayersList) {\n // Wait until map style is loaded\n // @ts-ignore non-public map property\n if (!map || !map.style || !map.style._loaded) {\n return;\n }\n\n const layers = flatten(newLayers, Boolean) as Layer<LayerOverlayProps>[];\n\n if (oldLayers !== newLayers) {\n // Step 1: remove \"group\" layers that no longer exist\n const prevLayers = flatten(oldLayers, Boolean) as Layer<LayerOverlayProps>[];\n const prevLayerGroupIds = new Set<string>(prevLayers.map(l => getLayerGroupId(l)));\n const newLayerGroupIds = new Set<string>(layers.map(l => getLayerGroupId(l)));\n\n for (const groupId of prevLayerGroupIds) {\n if (!newLayerGroupIds.has(groupId)) {\n if (map.getLayer(groupId)) {\n map.removeLayer(groupId);\n }\n }\n }\n }\n\n // Step 2: add missing \"group\" layers\n const layerGroups: Record<string, MapboxLayerGroup> = {};\n for (const layer of layers) {\n const groupId = getLayerGroupId(layer);\n const mapboxGroup = map.getLayer(groupId) as MapboxLayerGroup;\n if (mapboxGroup) {\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 groupInstance = mapboxGroup.implementation || mapboxGroup;\n layerGroups[groupId] = groupInstance;\n } else {\n const newGroup = new MapboxLayerGroup({\n id: groupId,\n slot: layer.props.slot,\n beforeId: layer.props.beforeId\n });\n layerGroups[groupId] = newGroup;\n map.addLayer(newGroup, layer.props.beforeId);\n }\n }\n\n // Step 3: check the order of layers\n // If beforeId move \"group\" layers to proper position in the mapbox layer order\n // @ts-ignore non-public map property\n const mapLayers: string[] = map.style._order;\n\n for (const [groupId, group] of Object.entries(layerGroups)) {\n const beforeId = group.beforeId || UNDEFINED_BEFORE_ID;\n\n const expectedGroupIndex =\n beforeId === UNDEFINED_BEFORE_ID ? mapLayers.length : mapLayers.indexOf(beforeId);\n\n const currentGropupIndex = mapLayers.indexOf(groupId);\n if (currentGropupIndex !== expectedGroupIndex - 1) {\n const moveBeforeId = beforeId === UNDEFINED_BEFORE_ID ? undefined : beforeId;\n map.moveLayer(groupId, moveBeforeId);\n }\n }\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {drawLayerGroup} from './deck-utils';\nimport type {Map, CustomLayerInterface} from './types';\nimport {assert, type Deck} from '@deck.gl/core';\n\ntype MapWithDeck = Map & {__deck: Deck};\n\nexport type MapboxLayerGroupProps = {\n id: string;\n renderingMode?: '2d' | '3d';\n /* Mapbox v3 Standard style */\n slot?: 'bottom' | 'middle' | 'top';\n beforeId?: string;\n};\n\nexport default class MapboxLayerGroup implements CustomLayerInterface {\n id: string;\n type: 'custom';\n renderingMode: '2d' | '3d';\n /* Mapbox v3 Standard style */\n slot?: 'bottom' | 'middle' | 'top';\n beforeId?: string;\n map: MapWithDeck | null;\n\n /* eslint-disable no-this-before-super */\n constructor(props: MapboxLayerGroupProps) {\n assert(props.id, 'id is required');\n\n this.id = props.id;\n this.type = 'custom';\n this.renderingMode = props.renderingMode || '3d';\n this.slot = props.slot;\n this.beforeId = props.beforeId;\n this.map = null;\n }\n\n /* Mapbox custom layer methods */\n\n onAdd(map: MapWithDeck, gl: WebGL2RenderingContext): void {\n this.map = map;\n }\n\n render(gl, renderParameters) {\n if (!this.map) return;\n\n drawLayerGroup(this.map.__deck, this.map, this, renderParameters);\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACIA,IAAAA,eAAgC;;;ACAhC,kBAA0E;AAO1E,0BAA2C;AAE3C,IAAM,iBAAiB;AAOvB,IAAM,YAAY;AAClB,IAAM,qBAAqB,KAAK,KAAK;AAG/B,SAAU,gBAAgB,EAC9B,KACA,KAAI,GAIL;AAEC,MAAI,IAAI,QAAQ;AACd,WAAO,IAAI;EACb;AAGA,QAAM,eAAe,KAAK,MAAM;AAChC,QAAM,SAAS,KAAK,MAAM;AAE1B,QAAM,YAAY;IAChB,GAAG,KAAK;IACR,eAAe,MAAK;AAClB,UAAI,eAAc;AAKlB,mDAAe;IACjB;;AAEF,YAAU,UAAV,UAAU,QAAU,eAAe,GAAG;AAItC,SAAO,OAAO,WAAW;IACvB,OAAO;IACP,QAAQ;IACR,aAAa;IACb,WAAW,aAAa,GAAG;GAC5B;AACD,MAAI,KAAK,eAAe;AACtB,iBAAa,MAAM,GAAG;EACxB,OAAO;AACL,cAAU,SAAS,MAAK;AACtB;AACA,mBAAa,MAAM,GAAG;IACxB;EACF;AAEA,OAAK,SAAS,SAAS;AAEvB,MAAI,SAAS;AACb,MAAI,GAAG,UAAU,MAAK;AACpB,QAAI,KAAK;AAAe,k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L,mBAAY;EACd;EAEQ,qBAAqB,KAAQ;AACnC,QAAI,IAAI,aAAa,KAAK,kBAAkB;AAC5C,SAAK,eAAe,KAAK,KAAK,OAAO,KAAK,OAAO,QAAQ,CAAA,CAAE;AAC3D,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
6
|
"names": ["import_core", "GlobeView", "flatten", "import_core", "flatten", "import_core", "import_core", "UNDEFINED_BEFORE_ID", "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 ce=Object.create;var S=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var pe=Object.getOwnPropertyNames;var ue=Object.getPrototypeOf,de=Object.prototype.hasOwnProperty;var he=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),fe=(t,e)=>{for(var o in e)S(t,o,{get:e[o],enumerable:!0})},j=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of pe(e))!de.call(t,n)&&n!==o&&S(t,n,{get:()=>e[n],enumerable:!(r=le(e,n))||r.enumerable});return t},h=(t,e,o)=>(j(t,e,"default"),o&&j(o,e,"default")),m=(t,e,o)=>(o=t!=null?ce(ue(t)):{},j(e||!t||!t.__esModule?S(o,"default",{value:t,enumerable:!0}):o,t)),me=t=>j(S({},"__esModule",{value:!0}),t);var f=he((Ge,q)=>{q.exports=globalThis.deck});var k={};fe(k,{MapboxOverlay:()=>E});var p={},H=m(f(),1);h(p,m(f(),1));if(!H.Layer)throw new Error("@deck.gl/core is not found");h(k,p);var u=m(f(),1);var b=m(f(),1);function O(t,e){if(!t)throw new Error(e||"@math.gl/web-mercator: assertion failed.")}var g=Math.PI,ve=g/4,V=g/180,We=180/g,G=512,be=4003e4;function v(t){let[e,o]=t;O(Number.isFinite(e)),O(Number.isFinite(o)&&o>=-90&&o<=90,"invalid latitude");let r=e*V,n=o*V,l=G*(r+g)/(2*g),s=G*(g+Math.log(Math.tan(ve+n*.5)))/(2*g);return[l,s]}function z(t){let e=Math.cos(t*V);return G/be/e}var Ke=Math.PI/180;var w="mapbox",N=512,Oe=Math.PI/180;function Q({map:t,deck:e}){if(t.__deck)return t.__deck;let o=e.props._customRender,r=e.props.onLoad,n={...e.props,_customRender:()=>{t.triggerRepaint(),o?.("")}};return n.views||=_(t),Object.assign(n,{width:null,height:null,touchAction:"unset",viewState:x(t)}),e.isInitialized?K(e,t):n.onLoad=()=>{r?.(),K(e,t)},e.setProps(n),t.__deck=e,t.on("render",()=>{e.isInitialized&&Fe(e,t)}),e}function K(t,e){let o=()=>{t.isInitialized?Re(t,e):e.off("move",o)};e.on("move",o)}function ee(t){t.__deck?.finalize(),t.__deck=null}function C(t,e){let o=e?{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 F(t)==="globe"&&(o.cullMode="back"),o}function te(t,e,o,r){if(!t.isInitialized)return;let{currentViewport:n}=t.userData,l=!1;n||(n=A(t,e,r),t.userData.currentViewport=n,l=!0),t._drawLayers("mapbox-repaint",{viewports:[n],layerFilter:s=>(!t.props.layerFilter||t.props.layerFilter(s))&&(o.id===s.layer.id||s.layer.props.operation.includes("terrain")),clearStack:l,clearCanvas:!1})}function oe(t,e,o,r){if(!t.isInitialized)return;let{currentViewport:n}=t.userData,l=!1;n||(n=A(t,e,r),t.userData.currentViewport=n,l=!0),t._drawLayers("mapbox-repaint",{viewports:[n],layerFilter:s=>{if(t.props.layerFilter&&!t.props.layerFilter(s))return!1;let i=s.layer;return i.props.beforeId===o.beforeId&&i.props.slot===o.slot},clearStack:l,clearCanvas:!1})}function F(t){let e=t.getProjection?.(),o=e?.type||e?.name;if(o==="globe")return"globe";if(o&&o!=="mercator")throw new Error("Unsupported projection");return"mercator"}function _(t){return F(t)==="globe"?new b._GlobeView({id:w}):new b.MapView({id:w})}function x(t){let{lng:e,lat:o}=t.getCenter(),r={longitude:(e+540)%360-180,latitude:o,zoom:t.getZoom(),bearing:t.getBearing(),pitch:t.getPitch(),padding:t.getPadding(),repeat:t.getRenderWorldCopies()};return t.getTerrain?.()&&Ce(t,r),r}function Ce(t,e){if(t.getFreeCameraOptions){let{position:o}=t.getFreeCameraOptions();if(!o||o.z===void 0)return;let r=t.transform.height,{longitude:n,latitude:l,pitch:s}=e,i=o.x*N,c=(1-o.y)*N,a=o.z*N,y=v([n,l]),d=i-y[0],M=c-y[1],I=Math.sqrt(d*d+M*M),T=s*Oe,R=1.5*r,Y=T<.001?R*Math.cos(T)/a:R*Math.sin(T)/I;e.zoom=Math.log2(Y);let se=R*Math.cos(T)/Y,ae=a-se;e.position=[0,0,ae/z(l)]}else typeof t.transform.elevation=="number"&&(e.position=[0,0,t.transform.elevation])}function A(t,e,o){let r=x(e),n=t.getView(w)||_(e);o&&(n.props.nearZMultiplier=.2);let l=o?.nearZ??e.transform._nearZ,s=o?.farZ??e.transform._farZ;return Number.isFinite(l)&&(r.nearZ=l/e.transform.height,r.farZ=s/e.transform.height),n.makeViewport({width:t.width,height:t.height,viewState:r})}function Fe(t,e){let r=(0,b._flatten)(t.props.layers,Boolean).some(i=>i&&!e.getLayer(i.id)),n=t.getViewports(),l=n.findIndex(i=>i.id===w),s=n.length>1||l<0;(r||s)&&(l>=0&&(n=n.slice(),n[l]=A(t,e)),t._drawLayers("mapbox-repaint",{viewports:n,layerFilter:i=>(!t.props.layerFilter||t.props.layerFilter(i))&&(i.viewport.id!==w||!e.getLayer(i.layer.id)),clearCanvas:!1})),t.userData.currentViewport=null}function Re(t,e){t.setProps({viewState:x(e)}),t.needsRedraw({clearRedrawFlags:!0})}var U=m(f(),1);var P=class{constructor(e){if(!e.id)throw new Error("Layer must have an unique id");this.id=e.id,this.type="custom",this.renderingMode=e.renderingMode||"3d",this.slot=e.slot,this.map=null,this.props=e}onAdd(e,o){this.map=e}onRemove(){this.map=null}setProps(e){Object.assign(this.props,e,{id:this.id})}render(e,o){this.map&&te(this.map.__deck,this.map,this,o)}};var Z="__UNDEFINED__";function re(t,e,o,r){if(!t||!e||!t.style||!t.style._loaded)return;let n=(0,U._flatten)(r,Boolean);if(o!==r){let i=(0,U._flatten)(o,Boolean),c=new Set(i.map(a=>a.id));for(let a of n)c.delete(a.id);for(let a of c)t.getLayer(a)&&t.removeLayer(a)}for(let i of n){let c=t.getLayer(i.id);c?(c.implementation||c).setProps(i.props):t.addLayer(new P({id:i.id,slot:i.props.slot}),i.props.beforeId)}let l=t.style._order,s={};for(let i of n){let{beforeId:c}=i.props;(!c||!l.includes(c))&&(c=Z),s[c]=s[c]||[],s[c].push(i.id)}for(let i in s){let c=s[i],a=i===Z?l.length:l.indexOf(i),y=i===Z?void 0:i;for(let d=c.length-1;d>=0;d--){let M=c[d],I=l.indexOf(M);I!==a-1&&(t.moveLayer(M,y),I>a&&a++),a--,y=M}}}var X=m(f(),1);var ne=m(f(),1),D=class{constructor(e){(0,ne.assert)(e.id,"id is required"),this.id=e.id,this.type="custom",this.renderingMode=e.renderingMode||"3d",this.slot=e.slot,this.beforeId=e.beforeId,this.map=null}onAdd(e,o){this.map=e}render(e,o){this.map&&oe(this.map.__deck,this.map,this,o)}};var W="__UNDEFINED__";function B(t){return t.props.beforeId?`deck-layer-group-before:${t.props.beforeId}`:t.props.slot?`deck-layer-group-slot:${t.props.slot}`:"deck-layer-group-last"}function ie(t,e,o){if(!t||!t.style||!t.style._loaded)return;let r=(0,X._flatten)(o,Boolean);if(e!==o){let s=(0,X._flatten)(e,Boolean),i=new Set(s.map(a=>B(a))),c=new Set(r.map(a=>B(a)));for(let a of i)c.has(a)||t.getLayer(a)&&t.removeLayer(a)}let n={};for(let s of r){let i=B(s),c=t.getLayer(i);if(c){let a=c.implementation||c;n[i]=a}else{let a=new D({id:i,slot:s.props.slot,beforeId:s.props.beforeId});n[i]=a,t.addLayer(a,s.props.beforeId)}}let l=t.style._order;for(let[s,i]of Object.entries(n)){let c=i.beforeId||W,a=c===W?l.length:l.indexOf(c);if(l.indexOf(s)!==a-1){let d=c===W?void 0:c;t.moveLayer(s,d)}}}var E=class{constructor(e){this._handleStyleChange=()=>{if(this._resolveLayers(this._map,this._deck,this._props.layers,this._props.layers),!this._map)return;F(this._map)&&!this._props.views&&this._deck?.setProps({views:_(this._map)})};this._updateContainerSize=()=>{if(this._map&&this._container){let{clientWidth:e,clientHeight:o}=this._map.getContainer();Object.assign(this._container.style,{width:`${e}px`,height:`${o}px`})}};this._updateViewState=()=>{let e=this._deck,o=this._map;e&&o&&(e.setProps({views:this._props.views||_(o),viewState:x(o)}),e.isInitialized&&e.redraw())};this._handleMouseEvent=e=>{let o=this._deck;if(!o||!o.isInitialized)return;let r={type:e.type,offsetCenter:e.point,srcEvent:e},n=this._lastMouseDownPoint;switch(!e.point&&n&&(r.deltaX=e.originalEvent.clientX-n.clientX,r.deltaY=e.originalEvent.clientY-n.clientY,r.offsetCenter={x:n.x+r.deltaX,y:n.y+r.deltaY}),r.type){case"mousedown":o._onPointerDown(r),this._lastMouseDownPoint={...e.point,clientX:e.originalEvent.clientX,clientY:e.originalEvent.clientY};break;case"dragstart":r.type="panstart",o._onEvent(r);break;case"drag":r.type="panmove",o._onEvent(r);break;case"dragend":r.type="panend",o._onEvent(r);break;case"click":r.tapCount=1,o._onEvent(r);break;case"dblclick":r.type="click",r.tapCount=2,o._onEvent(r);break;case"mousemove":r.type="pointermove",o._onPointerMove(r);break;case"mouseout":r.type="pointerleave",o._onPointerMove(r);break;default:return}};let{interleaved:o=!1}=e;this._interleaved=o,this._renderLayersInGroups=e._renderLayersInGroups||!1,this._props=this.filterProps(e)}filterProps(e){let{interleaved:o=!1,useDevicePixels:r,...n}=e;return!o&&r!==void 0&&(n.useDevicePixels=r),n}setProps(e){this._interleaved&&e.layers&&this._resolveLayers(this._map,this._deck,this._props.layers,e.layers),Object.assign(this._props,this.filterProps(e)),this._deck&&this._map&&this._deck.setProps({...this._props,parameters:{...C(this._map,this._interleaved),...this._props.parameters}})}onAdd(e){return this._map=e,this._interleaved?this._onAddInterleaved(e):this._onAddOverlaid(e)}_onAddOverlaid(e){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 u.Deck({...this._props,parent:o,parameters:{...C(e,!1),...this._props.parameters},views:this._props.views||_(e),viewState:x(e)}),e.on("resize",this._updateContainerSize),e.on("render",this._updateViewState),e.on("mousedown",this._handleMouseEvent),e.on("dragstart",this._handleMouseEvent),e.on("drag",this._handleMouseEvent),e.on("dragend",this._handleMouseEvent),e.on("mousemove",this._handleMouseEvent),e.on("mouseout",this._handleMouseEvent),e.on("click",this._handleMouseEvent),e.on("dblclick",this._handleMouseEvent),this._updateContainerSize(),o}_onAddInterleaved(e){let o=e.painter.context.gl;return o instanceof WebGLRenderingContext&&u.log.warn("Incompatible basemap library. See: https://deck.gl/docs/api-reference/mapbox/overview#compatibility")(),this._deck=Q({map:e,deck:new u.Deck({...this._props,gl:o,parameters:{...C(e,!0),...this._props.parameters}})}),e.on("styledata",this._handleStyleChange),this._resolveLayers(e,this._deck,[],this._props.layers),document.createElement("div")}_resolveLayers(e,o,r,n){this._renderLayersInGroups?ie(e,r,n):re(e,o,r,n)}onRemove(){let e=this._map;e&&(this._interleaved?this._onRemoveInterleaved(e):this._onRemoveOverlaid(e)),this._deck=void 0,this._map=void 0,this._container=void 0}_onRemoveOverlaid(e){e.off("resize",this._updateContainerSize),e.off("render",this._updateViewState),e.off("mousedown",this._handleMouseEvent),e.off("dragstart",this._handleMouseEvent),e.off("drag",this._handleMouseEvent),e.off("dragend",this._handleMouseEvent),e.off("mousemove",this._handleMouseEvent),e.off("mouseout",this._handleMouseEvent),e.off("click",this._handleMouseEvent),e.off("dblclick",this._handleMouseEvent),this._deck?.finalize()}_onRemoveInterleaved(e){e.off("styledata",this._handleStyleChange),this._resolveLayers(e,this._deck,this._props.layers,[]),ee(e)}getDefaultPosition(){return"top-left"}pickObject(e){return(0,u.assert)(this._deck),this._deck.pickObject(e)}pickMultipleObjects(e){return(0,u.assert)(this._deck),this._deck.pickMultipleObjects(e)}pickObjects(e){return(0,u.assert)(this._deck),this._deck.pickObjects(e)}finalize(){this._map&&this._map.removeControl(this)}getCanvas(){return this._map?this._interleaved?this._map.getCanvas():this._deck.getCanvas():null}};return me(k);})();
|
|
7
|
+
"use strict";var __exports__=(()=>{var ce=Object.create;var S=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var pe=Object.getOwnPropertyNames;var ue=Object.getPrototypeOf,de=Object.prototype.hasOwnProperty;var he=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),fe=(t,e)=>{for(var o in e)S(t,o,{get:e[o],enumerable:!0})},j=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of pe(e))!de.call(t,r)&&r!==o&&S(t,r,{get:()=>e[r],enumerable:!(n=le(e,r))||n.enumerable});return t},h=(t,e,o)=>(j(t,e,"default"),o&&j(o,e,"default")),m=(t,e,o)=>(o=t!=null?ce(ue(t)):{},j(e||!t||!t.__esModule?S(o,"default",{value:t,enumerable:!0}):o,t)),me=t=>j(S({},"__esModule",{value:!0}),t);var f=he((Ge,q)=>{q.exports=globalThis.deck});var k={};fe(k,{MapboxOverlay:()=>E});var p={},H=m(f(),1);h(p,m(f(),1));if(!H.Layer)throw new Error("@deck.gl/core is not found");h(k,p);var u=m(f(),1);var b=m(f(),1);function O(t,e){if(!t)throw new Error(e||"@math.gl/web-mercator: assertion failed.")}var g=Math.PI,ve=g/4,V=g/180,We=180/g,G=512,be=4003e4;function v(t){let[e,o]=t;O(Number.isFinite(e)),O(Number.isFinite(o)&&o>=-90&&o<=90,"invalid latitude");let n=e*V,r=o*V,l=G*(n+g)/(2*g),s=G*(g+Math.log(Math.tan(ve+r*.5)))/(2*g);return[l,s]}function z(t){let e=Math.cos(t*V);return G/be/e}var Ke=Math.PI/180;var w="mapbox",N=512,Oe=Math.PI/180;function Q({map:t,deck:e}){if(t.__deck)return t.__deck;let o=e.props._customRender,n=e.props.onLoad,r={...e.props,_customRender:()=>{t.triggerRepaint(),o?.("")}};return r.views||=_(t),Object.assign(r,{width:null,height:null,touchAction:"unset",viewState:x(t)}),e.isInitialized?K(e,t):r.onLoad=()=>{n?.(),K(e,t)},e.setProps(r),t.__deck=e,t.on("render",()=>{e.isInitialized&&Fe(e,t)}),e}function K(t,e){let o=()=>{t.isInitialized?Re(t,e):e.off("move",o)};e.on("move",o)}function ee(t){t.__deck?.finalize(),t.__deck=null}function C(t,e){let o=e?{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 F(t)==="globe"&&(o.cullMode="back"),o}function te(t,e,o,n){if(!t.isInitialized)return;let{currentViewport:r}=t.userData,l=!1;r||(r=A(t,e,n),t.userData.currentViewport=r,l=!0),r&&t._drawLayers("mapbox-repaint",{viewports:[r],layerFilter:s=>(!t.props.layerFilter||t.props.layerFilter(s))&&(o.id===s.layer.id||s.layer.props.operation.includes("terrain")),clearStack:l,clearCanvas:!1})}function oe(t,e,o,n){if(!t.isInitialized)return;let{currentViewport:r}=t.userData,l=!1;r||(r=A(t,e,n),t.userData.currentViewport=r,l=!0),r&&t._drawLayers("mapbox-repaint",{viewports:[r],layerFilter:s=>{if(t.props.layerFilter&&!t.props.layerFilter(s))return!1;let i=s.layer;return i.props.beforeId===o.beforeId&&i.props.slot===o.slot},clearStack:l,clearCanvas:!1})}function F(t){let e=t.getProjection?.(),o=e?.type||e?.name;if(o==="globe")return"globe";if(o&&o!=="mercator")throw new Error("Unsupported projection");return"mercator"}function _(t){return F(t)==="globe"?new b._GlobeView({id:w}):new b.MapView({id:w})}function x(t){let{lng:e,lat:o}=t.getCenter(),n={longitude:(e+540)%360-180,latitude:o,zoom:t.getZoom(),bearing:t.getBearing(),pitch:t.getPitch(),padding:t.getPadding(),repeat:t.getRenderWorldCopies()};return t.getTerrain?.()&&Ce(t,n),n}function Ce(t,e){if(t.getFreeCameraOptions){let{position:o}=t.getFreeCameraOptions();if(!o||o.z===void 0)return;let n=t.transform.height,{longitude:r,latitude:l,pitch:s}=e,i=o.x*N,c=(1-o.y)*N,a=o.z*N,y=v([r,l]),d=i-y[0],M=c-y[1],I=Math.sqrt(d*d+M*M),T=s*Oe,R=1.5*n,Y=T<.001?R*Math.cos(T)/a:R*Math.sin(T)/I;e.zoom=Math.log2(Y);let se=R*Math.cos(T)/Y,ae=a-se;e.position=[0,0,ae/z(l)]}else typeof t.transform.elevation=="number"&&(e.position=[0,0,t.transform.elevation])}function A(t,e,o){let n=x(e),r=t.getView(w)||_(e);o&&(r.props.nearZMultiplier=.2);let l=o?.nearZ??e.transform._nearZ,s=o?.farZ??e.transform._farZ;return Number.isFinite(l)&&(n.nearZ=l/e.transform.height,n.farZ=s/e.transform.height),r.makeViewport({width:t.width,height:t.height,viewState:n})}function Fe(t,e){let n=(0,b._flatten)(t.props.layers,Boolean).some(i=>i&&!e.getLayer(i.id)),r=t.getViewports(),l=r.findIndex(i=>i.id===w),s=r.length>1||l<0;if(n||s){if(l>=0){r=r.slice();let i=A(t,e);i?r[l]=i:r.splice(l,1)}t._drawLayers("mapbox-repaint",{viewports:r,layerFilter:i=>(!t.props.layerFilter||t.props.layerFilter(i))&&(i.viewport.id!==w||!e.getLayer(i.layer.id)),clearCanvas:!1})}t.userData.currentViewport=null}function Re(t,e){t.setProps({viewState:x(e)}),t.needsRedraw({clearRedrawFlags:!0})}var U=m(f(),1);var P=class{constructor(e){if(!e.id)throw new Error("Layer must have an unique id");this.id=e.id,this.type="custom",this.renderingMode=e.renderingMode||"3d",this.slot=e.slot,this.map=null,this.props=e}onAdd(e,o){this.map=e}onRemove(){this.map=null}setProps(e){Object.assign(this.props,e,{id:this.id})}render(e,o){this.map&&te(this.map.__deck,this.map,this,o)}};var Z="__UNDEFINED__";function re(t,e,o,n){if(!t||!e||!t.style||!t.style._loaded)return;let r=(0,U._flatten)(n,Boolean);if(o!==n){let i=(0,U._flatten)(o,Boolean),c=new Set(i.map(a=>a.id));for(let a of r)c.delete(a.id);for(let a of c)t.getLayer(a)&&t.removeLayer(a)}for(let i of r){let c=t.getLayer(i.id);c?(c.implementation||c).setProps(i.props):t.addLayer(new P({id:i.id,slot:i.props.slot}),i.props.beforeId)}let l=t.style._order,s={};for(let i of r){let{beforeId:c}=i.props;(!c||!l.includes(c))&&(c=Z),s[c]=s[c]||[],s[c].push(i.id)}for(let i in s){let c=s[i],a=i===Z?l.length:l.indexOf(i),y=i===Z?void 0:i;for(let d=c.length-1;d>=0;d--){let M=c[d],I=l.indexOf(M);I!==a-1&&(t.moveLayer(M,y),I>a&&a++),a--,y=M}}}var X=m(f(),1);var ne=m(f(),1),D=class{constructor(e){(0,ne.assert)(e.id,"id is required"),this.id=e.id,this.type="custom",this.renderingMode=e.renderingMode||"3d",this.slot=e.slot,this.beforeId=e.beforeId,this.map=null}onAdd(e,o){this.map=e}render(e,o){this.map&&oe(this.map.__deck,this.map,this,o)}};var W="__UNDEFINED__";function B(t){return t.props.beforeId?`deck-layer-group-before:${t.props.beforeId}`:t.props.slot?`deck-layer-group-slot:${t.props.slot}`:"deck-layer-group-last"}function ie(t,e,o){if(!t||!t.style||!t.style._loaded)return;let n=(0,X._flatten)(o,Boolean);if(e!==o){let s=(0,X._flatten)(e,Boolean),i=new Set(s.map(a=>B(a))),c=new Set(n.map(a=>B(a)));for(let a of i)c.has(a)||t.getLayer(a)&&t.removeLayer(a)}let r={};for(let s of n){let i=B(s),c=t.getLayer(i);if(c){let a=c.implementation||c;r[i]=a}else{let a=new D({id:i,slot:s.props.slot,beforeId:s.props.beforeId});r[i]=a,t.addLayer(a,s.props.beforeId)}}let l=t.style._order;for(let[s,i]of Object.entries(r)){let c=i.beforeId||W,a=c===W?l.length:l.indexOf(c);if(l.indexOf(s)!==a-1){let d=c===W?void 0:c;t.moveLayer(s,d)}}}var E=class{constructor(e){this._handleStyleChange=()=>{if(this._resolveLayers(this._map,this._deck,this._props.layers,this._props.layers),!this._map)return;F(this._map)&&!this._props.views&&this._deck?.setProps({views:_(this._map)})};this._updateContainerSize=()=>{if(this._map&&this._container){let{clientWidth:e,clientHeight:o}=this._map.getContainer();Object.assign(this._container.style,{width:`${e}px`,height:`${o}px`})}};this._updateViewState=()=>{let e=this._deck,o=this._map;e&&o&&(e.setProps({views:this._props.views||_(o),viewState:x(o)}),e.isInitialized&&e.redraw())};this._handleMouseEvent=e=>{let o=this._deck;if(!o||!o.isInitialized)return;let n={type:e.type,offsetCenter:e.point,srcEvent:e},r=this._lastMouseDownPoint;switch(!e.point&&r&&(n.deltaX=e.originalEvent.clientX-r.clientX,n.deltaY=e.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={...e.point,clientX:e.originalEvent.clientX,clientY:e.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}=e;this._interleaved=o,this._renderLayersInGroups=e._renderLayersInGroups||!1,this._props=this.filterProps(e)}filterProps(e){let{interleaved:o=!1,useDevicePixels:n,...r}=e;return!o&&n!==void 0&&(r.useDevicePixels=n),r}setProps(e){this._interleaved&&e.layers&&this._resolveLayers(this._map,this._deck,this._props.layers,e.layers),Object.assign(this._props,this.filterProps(e)),this._deck&&this._map&&this._deck.setProps({...this._props,parameters:{...C(this._map,this._interleaved),...this._props.parameters}})}onAdd(e){return this._map=e,this._interleaved?this._onAddInterleaved(e):this._onAddOverlaid(e)}_onAddOverlaid(e){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 u.Deck({...this._props,parent:o,parameters:{...C(e,!1),...this._props.parameters},views:this._props.views||_(e),viewState:x(e)}),e.on("resize",this._updateContainerSize),e.on("render",this._updateViewState),e.on("mousedown",this._handleMouseEvent),e.on("dragstart",this._handleMouseEvent),e.on("drag",this._handleMouseEvent),e.on("dragend",this._handleMouseEvent),e.on("mousemove",this._handleMouseEvent),e.on("mouseout",this._handleMouseEvent),e.on("click",this._handleMouseEvent),e.on("dblclick",this._handleMouseEvent),this._updateContainerSize(),o}_onAddInterleaved(e){let o=e.painter.context.gl;return o instanceof WebGLRenderingContext&&u.log.warn("Incompatible basemap library. See: https://deck.gl/docs/api-reference/mapbox/overview#compatibility")(),this._deck=Q({map:e,deck:new u.Deck({...this._props,gl:o,parameters:{...C(e,!0),...this._props.parameters}})}),e.on("styledata",this._handleStyleChange),this._resolveLayers(e,this._deck,[],this._props.layers),document.createElement("div")}_resolveLayers(e,o,n,r){this._renderLayersInGroups?ie(e,n,r):re(e,o,n,r)}onRemove(){let e=this._map;e&&(this._interleaved?this._onRemoveInterleaved(e):this._onRemoveOverlaid(e)),this._deck=void 0,this._map=void 0,this._container=void 0}_onRemoveOverlaid(e){e.off("resize",this._updateContainerSize),e.off("render",this._updateViewState),e.off("mousedown",this._handleMouseEvent),e.off("dragstart",this._handleMouseEvent),e.off("drag",this._handleMouseEvent),e.off("dragend",this._handleMouseEvent),e.off("mousemove",this._handleMouseEvent),e.off("mouseout",this._handleMouseEvent),e.off("click",this._handleMouseEvent),e.off("dblclick",this._handleMouseEvent),this._deck?.finalize()}_onRemoveInterleaved(e){e.off("styledata",this._handleStyleChange),this._resolveLayers(e,this._deck,this._props.layers,[]),ee(e)}getDefaultPosition(){return"top-left"}pickObject(e){return(0,u.assert)(this._deck),this._deck.pickObject(e)}pickMultipleObjects(e){return(0,u.assert)(this._deck),this._deck.pickMultipleObjects(e)}pickObjects(e){return(0,u.assert)(this._deck),this._deck.pickObjects(e)}finalize(){this._map&&this._map.removeControl(this)}getCanvas(){return this._map?this._interleaved?this._map.getCanvas():this._deck.getCanvas():null}};return me(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
|
|
6
|
+
"version": "9.3.0-alpha.2",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
"prepublishOnly": "npm run build-bundle && npm run build-bundle -- --env=dev"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@luma.gl/constants": "
|
|
41
|
+
"@luma.gl/constants": "^9.3.0-alpha.6",
|
|
42
42
|
"@math.gl/web-mercator": "^4.1.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@deck.gl/core": "~9.2.0",
|
|
46
|
-
"@luma.gl/constants": "~9.
|
|
47
|
-
"@luma.gl/core": "~9.
|
|
46
|
+
"@luma.gl/constants": "~9.3.0-alpha.6",
|
|
47
|
+
"@luma.gl/core": "~9.3.0-alpha.6",
|
|
48
48
|
"@math.gl/web-mercator": "^4.1.0"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "135d329f4a4b596ae2c16e4eb801eda30252f3bc"
|
|
51
51
|
}
|
package/src/deck-utils.ts
CHANGED
|
@@ -137,6 +137,10 @@ export function drawLayer(
|
|
|
137
137
|
clearStack = true;
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
if (!currentViewport) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
|
|
140
144
|
deck._drawLayers('mapbox-repaint', {
|
|
141
145
|
viewports: [currentViewport],
|
|
142
146
|
layerFilter: params =>
|
|
@@ -167,6 +171,10 @@ export function drawLayerGroup(
|
|
|
167
171
|
clearStack = true;
|
|
168
172
|
}
|
|
169
173
|
|
|
174
|
+
if (!currentViewport) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
|
|
170
178
|
deck._drawLayers('mapbox-repaint', {
|
|
171
179
|
viewports: [currentViewport],
|
|
172
180
|
layerFilter: params => {
|
|
@@ -301,7 +309,7 @@ type MaplibreRenderParameters = {
|
|
|
301
309
|
projectionMatrix: number[];
|
|
302
310
|
};
|
|
303
311
|
|
|
304
|
-
function getViewport(deck: Deck, map: Map, renderParameters?: unknown): Viewport {
|
|
312
|
+
function getViewport(deck: Deck, map: Map, renderParameters?: unknown): Viewport | null {
|
|
305
313
|
const viewState = getViewState(map);
|
|
306
314
|
// View is always MapView or GlobeView in this context
|
|
307
315
|
const view = (deck.getView(MAPBOX_VIEW_ID) || getDefaultView(map)) as MapView | GlobeView;
|
|
@@ -327,7 +335,7 @@ function getViewport(deck: Deck, map: Map, renderParameters?: unknown): Viewport
|
|
|
327
335
|
width: deck.width,
|
|
328
336
|
height: deck.height,
|
|
329
337
|
viewState
|
|
330
|
-
})
|
|
338
|
+
});
|
|
331
339
|
}
|
|
332
340
|
|
|
333
341
|
function afterRender(deck: Deck, map: Map): void {
|
|
@@ -341,7 +349,12 @@ function afterRender(deck: Deck, map: Map): void {
|
|
|
341
349
|
if (hasNonMapboxLayers || hasNonMapboxViews) {
|
|
342
350
|
if (mapboxViewportIdx >= 0) {
|
|
343
351
|
viewports = viewports.slice();
|
|
344
|
-
|
|
352
|
+
const mapboxViewport = getViewport(deck, map);
|
|
353
|
+
if (mapboxViewport) {
|
|
354
|
+
viewports[mapboxViewportIdx] = mapboxViewport;
|
|
355
|
+
} else {
|
|
356
|
+
viewports.splice(mapboxViewportIdx, 1);
|
|
357
|
+
}
|
|
345
358
|
}
|
|
346
359
|
|
|
347
360
|
deck._drawLayers('mapbox-repaint', {
|