@deck.gl/mapbox 9.2.0-beta.2 → 9.2.0-beta.4
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 +1 -0
- package/dist/deck-utils.d.ts.map +1 -1
- package/dist/deck-utils.js +1 -1
- package/dist/deck-utils.js.map +1 -1
- package/dist/dist.dev.js +22 -4
- package/dist/index.cjs +23 -4
- package/dist/index.cjs.map +2 -2
- package/dist/mapbox-overlay.d.ts +2 -0
- package/dist/mapbox-overlay.d.ts.map +1 -1
- package/dist/mapbox-overlay.js +25 -5
- package/dist/mapbox-overlay.js.map +1 -1
- package/dist.min.js +1 -1
- package/package.json +5 -5
- package/src/deck-utils.ts +1 -1
- package/src/mapbox-overlay.ts +27 -5
package/dist/deck-utils.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export declare function addLayer(deck: Deck, layer: MapboxLayer<any>): void;
|
|
|
18
18
|
export declare function removeLayer(deck: Deck, layer: MapboxLayer<any>): void;
|
|
19
19
|
export declare function updateLayer(deck: Deck, layer: MapboxLayer<any>): void;
|
|
20
20
|
export declare function drawLayer(deck: Deck, map: Map, layer: MapboxLayer<any>, renderParameters: any): void;
|
|
21
|
+
export declare function getProjection(map: Map): 'mercator' | 'globe';
|
|
21
22
|
export declare function getDefaultView(map: Map): GlobeView | MapView;
|
|
22
23
|
export declare function getViewState(map: Map): MapViewState & {
|
|
23
24
|
repeat: boolean;
|
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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,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
|
@@ -141,7 +141,7 @@ export function drawLayer(deck, map, layer, renderParameters) {
|
|
|
141
141
|
clearCanvas: false
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
|
-
function getProjection(map) {
|
|
144
|
+
export function getProjection(map) {
|
|
145
145
|
const projection = map.getProjection?.();
|
|
146
146
|
const type =
|
|
147
147
|
// maplibre projection spec
|
package/dist/deck-utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deck-utils.js","sourceRoot":"","sources":["../src/deck-utils.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,IAAI,EAAE,OAAO,EAAE,UAAU,IAAI,SAAS,EAAE,QAAQ,IAAI,OAAO,EAAC,MAAM,eAAe,CAAC;AAM1F,OAAO,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,uBAAuB,CAAC;AAEnE,MAAM,cAAc,GAAG,QAAQ,CAAC;AAShC,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,EAAE,EACF,IAAI,EAKL;IACC,4CAA4C;IAC5C,IAAI,GAAG,CAAC,MAAM,EAAE,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,CAAC,CAAC;AAC1B,CAAC"}
|
package/dist/dist.dev.js
CHANGED
|
@@ -465,6 +465,12 @@ var __exports__ = (() => {
|
|
|
465
465
|
constructor(props) {
|
|
466
466
|
this._handleStyleChange = () => {
|
|
467
467
|
resolveLayers(this._map, this._deck, this._props.layers, this._props.layers);
|
|
468
|
+
if (!this._map)
|
|
469
|
+
return;
|
|
470
|
+
const projection = getProjection(this._map);
|
|
471
|
+
if (projection && !this._props.views) {
|
|
472
|
+
this._deck?.setProps({ views: getDefaultView(this._map) });
|
|
473
|
+
}
|
|
468
474
|
};
|
|
469
475
|
this._updateContainerSize = () => {
|
|
470
476
|
if (this._map && this._container) {
|
|
@@ -550,16 +556,24 @@ var __exports__ = (() => {
|
|
|
550
556
|
return;
|
|
551
557
|
}
|
|
552
558
|
};
|
|
553
|
-
const { interleaved = false
|
|
559
|
+
const { interleaved = false } = props;
|
|
554
560
|
this._interleaved = interleaved;
|
|
555
|
-
this._props =
|
|
561
|
+
this._props = this.filterProps(props);
|
|
562
|
+
}
|
|
563
|
+
/** Filter out props to pass to Deck **/
|
|
564
|
+
filterProps(props) {
|
|
565
|
+
const { interleaved = false, useDevicePixels, ...deckProps } = props;
|
|
566
|
+
if (!interleaved && useDevicePixels !== void 0) {
|
|
567
|
+
deckProps.useDevicePixels = useDevicePixels;
|
|
568
|
+
}
|
|
569
|
+
return deckProps;
|
|
556
570
|
}
|
|
557
571
|
/** Update (partial) props of the underlying Deck instance. */
|
|
558
572
|
setProps(props) {
|
|
559
573
|
if (this._interleaved && props.layers) {
|
|
560
574
|
resolveLayers(this._map, this._deck, this._props.layers, props.layers);
|
|
561
575
|
}
|
|
562
|
-
Object.assign(this._props, props);
|
|
576
|
+
Object.assign(this._props, this.filterProps(props));
|
|
563
577
|
if (this._deck && this._map) {
|
|
564
578
|
this._deck.setProps({
|
|
565
579
|
...this._props,
|
|
@@ -619,7 +633,11 @@ var __exports__ = (() => {
|
|
|
619
633
|
gl,
|
|
620
634
|
deck: new import_core4.Deck({
|
|
621
635
|
...this._props,
|
|
622
|
-
gl
|
|
636
|
+
gl,
|
|
637
|
+
parameters: { ...getDefaultParameters(map, false), ...this._props.parameters },
|
|
638
|
+
deviceProps: {
|
|
639
|
+
createCanvasContext: { autoResize: true }
|
|
640
|
+
}
|
|
623
641
|
})
|
|
624
642
|
});
|
|
625
643
|
map.on("styledata", this._handleStyleChange);
|
package/dist/index.cjs
CHANGED
|
@@ -390,7 +390,14 @@ function resolveLayers(map, deck, oldLayers, newLayers) {
|
|
|
390
390
|
var MapboxOverlay = class {
|
|
391
391
|
constructor(props) {
|
|
392
392
|
this._handleStyleChange = () => {
|
|
393
|
+
var _a;
|
|
393
394
|
resolveLayers(this._map, this._deck, this._props.layers, this._props.layers);
|
|
395
|
+
if (!this._map)
|
|
396
|
+
return;
|
|
397
|
+
const projection = getProjection(this._map);
|
|
398
|
+
if (projection && !this._props.views) {
|
|
399
|
+
(_a = this._deck) == null ? void 0 : _a.setProps({ views: getDefaultView(this._map) });
|
|
400
|
+
}
|
|
394
401
|
};
|
|
395
402
|
this._updateContainerSize = () => {
|
|
396
403
|
if (this._map && this._container) {
|
|
@@ -475,16 +482,24 @@ var MapboxOverlay = class {
|
|
|
475
482
|
return;
|
|
476
483
|
}
|
|
477
484
|
};
|
|
478
|
-
const { interleaved = false
|
|
485
|
+
const { interleaved = false } = props;
|
|
479
486
|
this._interleaved = interleaved;
|
|
480
|
-
this._props =
|
|
487
|
+
this._props = this.filterProps(props);
|
|
488
|
+
}
|
|
489
|
+
/** Filter out props to pass to Deck **/
|
|
490
|
+
filterProps(props) {
|
|
491
|
+
const { interleaved = false, useDevicePixels, ...deckProps } = props;
|
|
492
|
+
if (!interleaved && useDevicePixels !== void 0) {
|
|
493
|
+
deckProps.useDevicePixels = useDevicePixels;
|
|
494
|
+
}
|
|
495
|
+
return deckProps;
|
|
481
496
|
}
|
|
482
497
|
/** Update (partial) props of the underlying Deck instance. */
|
|
483
498
|
setProps(props) {
|
|
484
499
|
if (this._interleaved && props.layers) {
|
|
485
500
|
resolveLayers(this._map, this._deck, this._props.layers, props.layers);
|
|
486
501
|
}
|
|
487
|
-
Object.assign(this._props, props);
|
|
502
|
+
Object.assign(this._props, this.filterProps(props));
|
|
488
503
|
if (this._deck && this._map) {
|
|
489
504
|
this._deck.setProps({
|
|
490
505
|
...this._props,
|
|
@@ -542,7 +557,11 @@ var MapboxOverlay = class {
|
|
|
542
557
|
gl,
|
|
543
558
|
deck: new import_core3.Deck({
|
|
544
559
|
...this._props,
|
|
545
|
-
gl
|
|
560
|
+
gl,
|
|
561
|
+
parameters: { ...getDefaultParameters(map, false), ...this._props.parameters },
|
|
562
|
+
deviceProps: {
|
|
563
|
+
createCanvasContext: { autoResize: true }
|
|
564
|
+
}
|
|
546
565
|
})
|
|
547
566
|
});
|
|
548
567
|
map.on("styledata", this._handleStyleChange);
|
package/dist/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts", "../src/mapbox-overlay.ts", "../src/deck-utils.ts", "../src/resolve-layers.ts", "../src/mapbox-layer.ts"],
|
|
4
|
-
"sourcesContent": ["// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport {default as MapboxOverlay} from './mapbox-overlay';\n\nexport type {MapboxOverlayProps} from './mapbox-overlay';\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {Deck, assert} from '@deck.gl/core';\nimport {\n getViewState,\n getDefaultView,\n getDeckInstance,\n removeDeckInstance,\n getDefaultParameters\n} from './deck-utils';\n\nimport type {Map, IControl, MapMouseEvent, ControlPosition} from './types';\nimport type {MjolnirGestureEvent, MjolnirPointerEvent} from 'mjolnir.js';\nimport type {DeckProps} from '@deck.gl/core';\nimport {log} from '@deck.gl/core';\n\nimport {resolveLayers} from './resolve-layers';\n\nexport type MapboxOverlayProps = Omit<\n DeckProps,\n | 'width'\n | 'height'\n | 'gl'\n | 'parent'\n | 'canvas'\n | '_customRender'\n | 'viewState'\n | 'initialViewState'\n | 'controller'\n> & {\n interleaved?: boolean;\n};\n\n/**\n * Implements Mapbox [IControl](https://docs.mapbox.com/mapbox-gl-js/api/markers/#icontrol) interface\n * Renders deck.gl layers over the base map and automatically synchronizes with the map's camera\n */\nexport default class MapboxOverlay implements IControl {\n private _props: MapboxOverlayProps;\n private _deck?: Deck<any>;\n private _map?: Map;\n private _container?: HTMLDivElement;\n private _interleaved: boolean;\n private _lastMouseDownPoint?: {x: number; y: number; clientX: number; clientY: number};\n\n constructor(props: MapboxOverlayProps) {\n const {interleaved = false, ...otherProps} = props;\n this._interleaved = interleaved;\n this._props = otherProps;\n }\n\n /** Update (partial) props of the underlying Deck instance. */\n setProps(props: MapboxOverlayProps): void {\n if (this._interleaved && props.layers) {\n resolveLayers(this._map, this._deck, this._props.layers, props.layers);\n }\n\n Object.assign(this._props, props);\n\n if (this._deck && this._map) {\n this._deck.setProps({\n ...this._props,\n parameters: {\n ...getDefaultParameters(this._map, this._interleaved),\n ...this._props.parameters\n }\n });\n }\n }\n\n // The local Map type is for internal typecheck only. It does not necesarily satisefy mapbox/maplibre types at runtime.\n // Do not restrict the argument type here to avoid type conflict.\n /** Called when the control is added to a map */\n onAdd(map: unknown): HTMLDivElement {\n this._map = map as Map;\n return this._interleaved ? this._onAddInterleaved(map as Map) : this._onAddOverlaid(map as Map);\n }\n\n private _onAddOverlaid(map: Map): HTMLDivElement {\n /* global document */\n const container = document.createElement('div');\n Object.assign(container.style, {\n position: 'absolute',\n left: 0,\n top: 0,\n textAlign: 'initial',\n pointerEvents: 'none'\n });\n this._container = container;\n\n this._deck = new Deck<any>({\n ...this._props,\n parent: container,\n parameters: {...getDefaultParameters(map, false), ...this._props.parameters},\n views: this._props.views || getDefaultView(map),\n viewState: getViewState(map)\n });\n\n map.on('resize', this._updateContainerSize);\n map.on('render', this._updateViewState);\n map.on('mousedown', this._handleMouseEvent);\n map.on('dragstart', this._handleMouseEvent);\n map.on('drag', this._handleMouseEvent);\n map.on('dragend', this._handleMouseEvent);\n map.on('mousemove', this._handleMouseEvent);\n map.on('mouseout', this._handleMouseEvent);\n map.on('click', this._handleMouseEvent);\n map.on('dblclick', this._handleMouseEvent);\n\n this._updateContainerSize();\n return container;\n }\n\n private _onAddInterleaved(map: Map): HTMLDivElement {\n // @ts-ignore non-public map property\n const gl = map.painter.context.gl;\n if (gl instanceof WebGLRenderingContext) {\n log.warn(\n 'Incompatible basemap library. See: https://deck.gl/docs/api-reference/mapbox/overview#compatibility'\n )();\n }\n this._deck = getDeckInstance({\n map,\n gl,\n deck: new Deck({\n ...this._props,\n gl\n })\n });\n\n map.on('styledata', this._handleStyleChange);\n resolveLayers(map, this._deck, [], this._props.layers);\n\n return document.createElement('div');\n }\n\n /** Called when the control is removed from a map */\n onRemove(): void {\n const map = this._map;\n\n if (map) {\n if (this._interleaved) {\n this._onRemoveInterleaved(map);\n } else {\n this._onRemoveOverlaid(map);\n }\n }\n\n this._deck = undefined;\n this._map = undefined;\n this._container = undefined;\n }\n\n private _onRemoveOverlaid(map: Map): void {\n map.off('resize', this._updateContainerSize);\n map.off('render', this._updateViewState);\n map.off('mousedown', this._handleMouseEvent);\n map.off('dragstart', this._handleMouseEvent);\n map.off('drag', this._handleMouseEvent);\n map.off('dragend', this._handleMouseEvent);\n map.off('mousemove', this._handleMouseEvent);\n map.off('mouseout', this._handleMouseEvent);\n map.off('click', this._handleMouseEvent);\n map.off('dblclick', this._handleMouseEvent);\n this._deck?.finalize();\n }\n\n private _onRemoveInterleaved(map: Map): void {\n map.off('styledata', this._handleStyleChange);\n resolveLayers(map, this._deck, this._props.layers, []);\n removeDeckInstance(map);\n }\n\n getDefaultPosition(): ControlPosition {\n return 'top-left';\n }\n\n /** Forwards the Deck.pickObject method */\n pickObject(params: Parameters<Deck['pickObject']>[0]): ReturnType<Deck['pickObject']> {\n assert(this._deck);\n return this._deck.pickObject(params);\n }\n\n /** Forwards the Deck.pickMultipleObjects method */\n pickMultipleObjects(\n params: Parameters<Deck['pickMultipleObjects']>[0]\n ): ReturnType<Deck['pickMultipleObjects']> {\n assert(this._deck);\n return this._deck.pickMultipleObjects(params);\n }\n\n /** Forwards the Deck.pickObjects method */\n pickObjects(params: Parameters<Deck['pickObjects']>[0]): ReturnType<Deck['pickObjects']> {\n assert(this._deck);\n return this._deck.pickObjects(params);\n }\n\n /** Remove from map and releases all resources */\n finalize() {\n if (this._map) {\n this._map.removeControl(this);\n }\n }\n\n /** If interleaved: true, returns base map's canvas, otherwise forwards the Deck.getCanvas method. */\n getCanvas(): HTMLCanvasElement | null {\n if (!this._map) {\n return null;\n }\n return this._interleaved ? this._map.getCanvas() : this._deck!.getCanvas();\n }\n\n private _handleStyleChange = () => {\n resolveLayers(this._map, this._deck, this._props.layers, this._props.layers);\n };\n\n private _updateContainerSize = () => {\n if (this._map && this._container) {\n const {clientWidth, clientHeight} = this._map.getContainer();\n Object.assign(this._container.style, {\n width: `${clientWidth}px`,\n height: `${clientHeight}px`\n });\n }\n };\n\n private _updateViewState = () => {\n const deck = this._deck;\n const map = this._map;\n if (deck && map) {\n deck.setProps({\n views: this._props.views || getDefaultView(map),\n viewState: getViewState(map)\n });\n // Redraw immediately if view state has changed\n if (deck.isInitialized) {\n deck.redraw();\n }\n }\n };\n\n // eslint-disable-next-line complexity\n private _handleMouseEvent = (event: MapMouseEvent) => {\n const deck = this._deck;\n if (!deck || !deck.isInitialized) {\n return;\n }\n\n const mockEvent: {\n type: string;\n deltaX?: number;\n deltaY?: number;\n offsetCenter: {x: number; y: number};\n srcEvent: MapMouseEvent;\n tapCount?: number;\n } = {\n type: event.type,\n offsetCenter: event.point,\n srcEvent: event\n };\n\n const lastDown = this._lastMouseDownPoint;\n if (!event.point && lastDown) {\n // drag* events do not contain a `point` field\n mockEvent.deltaX = event.originalEvent.clientX - lastDown.clientX;\n mockEvent.deltaY = event.originalEvent.clientY - lastDown.clientY;\n mockEvent.offsetCenter = {\n x: lastDown.x + mockEvent.deltaX,\n y: lastDown.y + mockEvent.deltaY\n };\n }\n\n switch (mockEvent.type) {\n case 'mousedown':\n deck._onPointerDown(mockEvent as unknown as MjolnirPointerEvent);\n this._lastMouseDownPoint = {\n ...event.point,\n clientX: event.originalEvent.clientX,\n clientY: event.originalEvent.clientY\n };\n break;\n\n case 'dragstart':\n mockEvent.type = 'panstart';\n deck._onEvent(mockEvent as unknown as MjolnirGestureEvent);\n break;\n\n case 'drag':\n mockEvent.type = 'panmove';\n deck._onEvent(mockEvent as unknown as MjolnirGestureEvent);\n break;\n\n case 'dragend':\n mockEvent.type = 'panend';\n deck._onEvent(mockEvent as unknown as MjolnirGestureEvent);\n break;\n\n case 'click':\n mockEvent.tapCount = 1;\n deck._onEvent(mockEvent as unknown as MjolnirGestureEvent);\n break;\n\n case 'dblclick':\n mockEvent.type = 'click';\n mockEvent.tapCount = 2;\n deck._onEvent(mockEvent as unknown as MjolnirGestureEvent);\n break;\n\n case 'mousemove':\n mockEvent.type = 'pointermove';\n deck._onPointerMove(mockEvent as unknown as MjolnirPointerEvent);\n break;\n\n case 'mouseout':\n mockEvent.type = 'pointerleave';\n deck._onPointerMove(mockEvent as unknown as MjolnirPointerEvent);\n break;\n\n default:\n return;\n }\n };\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {Deck, MapView, _GlobeView as GlobeView, _flatten as flatten} from '@deck.gl/core';\nimport type {Viewport, MapViewState, Layer} from '@deck.gl/core';\nimport type {Parameters} from '@luma.gl/core';\nimport type MapboxLayer from './mapbox-layer';\nimport type {Map} from './types';\n\nimport {lngLatToWorld, unitsPerMeter} from '@math.gl/web-mercator';\n\nconst MAPBOX_VIEW_ID = 'mapbox';\n\ntype UserData = {\n isExternal: boolean;\n currentViewport?: Viewport | null;\n mapboxLayers: Set<MapboxLayer<any>>;\n // mapboxVersion: {minor: number; major: number};\n};\n\n// Mercator constants\nconst TILE_SIZE = 512;\nconst DEGREES_TO_RADIANS = Math.PI / 180;\n\n// Create an interleaved deck instance.\nexport function getDeckInstance({\n map,\n gl,\n deck\n}: {\n map: Map & {__deck?: Deck<any> | null};\n gl: WebGL2RenderingContext;\n deck?: Deck<any>;\n}): Deck<any> {\n // Only create one deck instance per context\n if (map.__deck) {\n return map.__deck;\n }\n\n // Only initialize certain props once per context\n const customRender = deck?.props._customRender;\n const onLoad = deck?.props.onLoad;\n\n const deckProps = {\n ...deck?.props,\n _customRender: () => {\n map.triggerRepaint();\n // customRender may be subscribed by DeckGL React component to update child props\n // make sure it is still called\n // Hack - do not pass a redraw reason here to prevent the React component from clearing the context\n // Rerender will be triggered by MapboxLayer's render()\n customRender?.('');\n }\n };\n deckProps.parameters = {...getDefaultParameters(map, true), ...deckProps.parameters};\n deckProps.views ||= getDefaultView(map);\n\n let deckInstance: Deck;\n\n if (!deck || deck.props.gl === gl) {\n // If deck isn't defined (Internal MapboxLayer use case),\n // or if deck is defined and is using the WebGLContext created by mapbox (MapboxOverlay and External MapboxLayer use case),\n // block deck from setting the canvas size, and use the map's viewState to drive deck.\n // Otherwise, we use deck's viewState to drive the map.\n Object.assign(deckProps, {\n gl,\n width: null,\n height: null,\n touchAction: 'unset',\n viewState: getViewState(map)\n });\n if (deck?.isInitialized) {\n watchMapMove(deck, map);\n } else {\n deckProps.onLoad = () => {\n onLoad?.();\n watchMapMove(deckInstance, map);\n };\n }\n }\n\n if (deck) {\n deckInstance = deck;\n deck.setProps(deckProps);\n (deck.userData as UserData).isExternal = true;\n } else {\n deckInstance = new Deck(deckProps);\n map.on('remove', () => {\n removeDeckInstance(map);\n });\n }\n\n (deckInstance.userData as UserData).mapboxLayers = new Set();\n // (deckInstance.userData as UserData).mapboxVersion = getMapboxVersion(map);\n map.__deck = deckInstance;\n map.on('render', () => {\n if (deckInstance.isInitialized) afterRender(deckInstance, map);\n });\n\n return deckInstance;\n}\n\nfunction watchMapMove(deck: Deck, map: Map & {__deck?: Deck | null}) {\n const _handleMapMove = () => {\n if (deck.isInitialized) {\n // call view state methods\n onMapMove(deck, map);\n } else {\n // deregister itself when deck is finalized\n map.off('move', _handleMapMove);\n }\n };\n map.on('move', _handleMapMove);\n}\n\nexport function removeDeckInstance(map: Map & {__deck?: Deck | null}) {\n map.__deck?.finalize();\n map.__deck = null;\n}\n\nexport function getDefaultParameters(map: Map, interleaved: boolean): Parameters {\n const result: Parameters = interleaved\n ? {\n depthWriteEnabled: true,\n depthCompare: 'less-equal',\n depthBias: 0,\n blend: true,\n blendColorSrcFactor: 'src-alpha',\n blendColorDstFactor: 'one-minus-src-alpha',\n blendAlphaSrcFactor: 'one',\n blendAlphaDstFactor: 'one-minus-src-alpha',\n blendColorOperation: 'add',\n blendAlphaOperation: 'add'\n }\n : {};\n if (getProjection(map) === 'globe') {\n result.cullMode = 'back';\n }\n return result;\n}\n\nexport function addLayer(deck: Deck, layer: MapboxLayer<any>): void {\n (deck.userData as UserData).mapboxLayers.add(layer);\n updateLayers(deck);\n}\n\nexport function removeLayer(deck: Deck, layer: MapboxLayer<any>): void {\n (deck.userData as UserData).mapboxLayers.delete(layer);\n updateLayers(deck);\n}\n\nexport function updateLayer(deck: Deck, layer: MapboxLayer<any>): void {\n updateLayers(deck);\n}\n\nexport function drawLayer(\n deck: Deck,\n map: Map,\n layer: MapboxLayer<any>,\n renderParameters: any\n): void {\n let {currentViewport} = deck.userData as UserData;\n let clearStack: boolean = false;\n if (!currentViewport) {\n // This is the first layer drawn in this render cycle.\n // Generate viewport from the current map state.\n currentViewport = getViewport(deck, map, renderParameters);\n (deck.userData as UserData).currentViewport = currentViewport;\n clearStack = true;\n }\n\n if (!deck.isInitialized) {\n return;\n }\n\n deck._drawLayers('mapbox-repaint', {\n viewports: [currentViewport],\n layerFilter: params =>\n (!deck.props.layerFilter || deck.props.layerFilter(params)) &&\n (layer.id === params.layer.id || params.layer.props.operation.includes('terrain')),\n clearStack,\n clearCanvas: false\n });\n}\n\nfunction getProjection(map: Map): 'mercator' | 'globe' {\n const projection = map.getProjection?.();\n const type =\n // maplibre projection spec\n projection?.type ||\n // mapbox projection spec\n projection?.name;\n if (type === 'globe') {\n return 'globe';\n }\n if (type && type !== 'mercator') {\n throw new Error('Unsupported projection');\n }\n return 'mercator';\n}\n\nexport function getDefaultView(map: Map): GlobeView | MapView {\n if (getProjection(map) === 'globe') {\n return new GlobeView({id: MAPBOX_VIEW_ID});\n }\n return new MapView({id: MAPBOX_VIEW_ID});\n}\n\nexport function getViewState(map: Map): MapViewState & {\n repeat: boolean;\n padding: {\n left: number;\n right: number;\n top: number;\n bottom: number;\n };\n} {\n const {lng, lat} = map.getCenter();\n\n const viewState: MapViewState & {\n repeat: boolean;\n padding: {\n left: number;\n right: number;\n top: number;\n bottom: number;\n };\n } = {\n // Longitude returned by getCenter can be outside of [-180, 180] when zooming near the anti meridian\n // https://github.com/visgl/deck.gl/issues/6894\n longitude: ((lng + 540) % 360) - 180,\n latitude: lat,\n zoom: map.getZoom(),\n bearing: map.getBearing(),\n pitch: map.getPitch(),\n padding: map.getPadding(),\n repeat: map.getRenderWorldCopies()\n };\n\n if (map.getTerrain?.()) {\n // When the base map has terrain, we need to target the camera at the terrain surface\n centerCameraOnTerrain(map, viewState);\n }\n\n return viewState;\n}\n\nfunction centerCameraOnTerrain(map: Map, viewState: MapViewState) {\n if (map.getFreeCameraOptions) {\n // mapbox-gl v2\n const {position} = map.getFreeCameraOptions();\n if (!position || position.z === undefined) {\n return;\n }\n\n // @ts-ignore transform is not typed\n const height = map.transform.height;\n const {longitude, latitude, pitch} = viewState;\n\n // Convert mapbox mercator coordinate to deck common space\n const cameraX = position.x * TILE_SIZE;\n const cameraY = (1 - position.y) * TILE_SIZE;\n const cameraZ = position.z * TILE_SIZE;\n\n // Mapbox manipulates zoom in terrain mode, see discussion here: https://github.com/mapbox/mapbox-gl-js/issues/12040\n const center = lngLatToWorld([longitude, latitude]);\n const dx = cameraX - center[0];\n const dy = cameraY - center[1];\n const cameraToCenterDistanceGround = Math.sqrt(dx * dx + dy * dy);\n\n const pitchRadians = pitch! * DEGREES_TO_RADIANS;\n const altitudePixels = 1.5 * height;\n const scale =\n pitchRadians < 0.001\n ? // Pitch angle too small to deduce the look at point, assume elevation is 0\n (altitudePixels * Math.cos(pitchRadians)) / cameraZ\n : (altitudePixels * Math.sin(pitchRadians)) / cameraToCenterDistanceGround;\n viewState.zoom = Math.log2(scale);\n\n const cameraZFromSurface = (altitudePixels * Math.cos(pitchRadians)) / scale;\n const surfaceElevation = cameraZ - cameraZFromSurface;\n viewState.position = [0, 0, surfaceElevation / unitsPerMeter(latitude)];\n }\n // @ts-ignore transform is not typed\n else if (typeof map.transform.elevation === 'number') {\n // maplibre-gl\n // @ts-ignore transform is not typed\n viewState.position = [0, 0, map.transform.elevation];\n }\n}\n\n// Since maplibre-gl@5\n// https://github.com/maplibre/maplibre-gl-js/blob/main/src/style/style_layer/custom_style_layer.ts\ntype MaplibreRenderParameters = {\n farZ: number;\n nearZ: number;\n fov: number;\n modelViewProjectionMatrix: number[];\n projectionMatrix: number[];\n};\n\nfunction getViewport(deck: Deck, map: Map, renderParameters?: unknown): Viewport {\n const viewState = getViewState(map);\n const {views} = deck.props;\n const view =\n (views && flatten(views).find((v: {id: string}) => v.id === MAPBOX_VIEW_ID)) ||\n getDefaultView(map);\n\n if (renderParameters) {\n // Called from MapboxLayer.render\n // Magic number, matches mapbox-gl@>=1.3.0's projection matrix\n view.props.nearZMultiplier = 0.2;\n }\n\n // Get the base map near/far plane\n // renderParameters is maplibre API but not mapbox\n // Transform is not an official API, properties could be undefined for older versions\n const nearZ = (renderParameters as MaplibreRenderParameters)?.nearZ ?? map.transform._nearZ;\n const farZ = (renderParameters as MaplibreRenderParameters)?.farZ ?? map.transform._farZ;\n if (Number.isFinite(nearZ)) {\n viewState.nearZ = nearZ / map.transform.height;\n viewState.farZ = farZ / map.transform.height;\n }\n // Otherwise fallback to default calculation using nearZMultiplier/farZMultiplier\n\n return view.makeViewport({\n width: deck.width,\n height: deck.height,\n viewState\n }) as Viewport;\n}\n\nfunction afterRender(deck: Deck, map: Map): void {\n const {mapboxLayers, isExternal} = deck.userData as UserData;\n\n if (isExternal) {\n // Draw non-Mapbox layers\n const mapboxLayerIds = Array.from(mapboxLayers, layer => layer.id);\n const deckLayers = flatten(deck.props.layers, Boolean) as Layer[];\n const hasNonMapboxLayers = deckLayers.some(\n layer => layer && !mapboxLayerIds.includes(layer.id)\n );\n let viewports = deck.getViewports();\n const mapboxViewportIdx = viewports.findIndex(vp => vp.id === MAPBOX_VIEW_ID);\n const hasNonMapboxViews = viewports.length > 1 || mapboxViewportIdx < 0;\n\n if (hasNonMapboxLayers || hasNonMapboxViews) {\n if (mapboxViewportIdx >= 0) {\n viewports = viewports.slice();\n viewports[mapboxViewportIdx] = getViewport(deck, map);\n }\n\n deck._drawLayers('mapbox-repaint', {\n viewports,\n layerFilter: params =>\n (!deck.props.layerFilter || deck.props.layerFilter(params)) &&\n (params.viewport.id !== MAPBOX_VIEW_ID || !mapboxLayerIds.includes(params.layer.id)),\n clearCanvas: false\n });\n }\n }\n\n // End of render cycle, clear generated viewport\n (deck.userData as UserData).currentViewport = null;\n}\n\nfunction onMapMove(deck: Deck, map: Map): void {\n deck.setProps({\n viewState: getViewState(map)\n });\n // Camera changed, will trigger a map repaint right after this\n // Clear any change flag triggered by setting viewState so that deck does not request\n // a second repaint\n deck.needsRedraw({clearRedrawFlags: true});\n}\n\nfunction updateLayers(deck: Deck): void {\n if ((deck.userData as UserData).isExternal) {\n return;\n }\n\n const layers: Layer[] = [];\n (deck.userData as UserData).mapboxLayers.forEach(deckLayer => {\n const LayerType = deckLayer.props.type;\n const layer = new LayerType(deckLayer.props);\n layers.push(layer);\n });\n deck.setProps({layers});\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {_flatten as flatten} from '@deck.gl/core';\nimport MapboxLayer from './mapbox-layer';\n\nimport type {Deck, LayersList, Layer} from '@deck.gl/core';\nimport type {Map} from './types';\n\nconst UNDEFINED_BEFORE_ID = '__UNDEFINED__';\n\n/** Insert Deck layers into the mapbox Map according to the user-defined order */\n// eslint-disable-next-line complexity, max-statements\nexport function resolveLayers(\n map?: Map,\n deck?: Deck,\n oldLayers?: LayersList,\n newLayers?: LayersList\n) {\n // Wait until map style is loaded\n // @ts-ignore non-public map property\n if (!map || !deck || !map.style || !map.style._loaded) {\n return;\n }\n\n const layers = flatten(newLayers, Boolean) as Layer[];\n\n if (oldLayers !== newLayers) {\n // Step 1: remove layers that no longer exist\n const prevLayers = flatten(oldLayers, Boolean) as Layer[];\n const prevLayerIds = new Set<string>(prevLayers.map(l => l.id));\n\n for (const layer of layers) {\n prevLayerIds.delete(layer.id);\n }\n\n for (const id of prevLayerIds) {\n if (map.getLayer(id)) {\n map.removeLayer(id);\n }\n }\n }\n\n // Step 2: add missing layers\n for (const layer of layers) {\n const mapboxLayer = map.getLayer(layer.id) as MapboxLayer<Layer>;\n if (mapboxLayer) {\n // Mapbox's map.getLayer() had a breaking change in v3.6.0, see https://github.com/visgl/deck.gl/issues/9086\n // @ts-expect-error not typed\n const layerInstance = mapboxLayer.implementation || mapboxLayer;\n layerInstance.setProps(layer.props);\n } else {\n map.addLayer(\n new MapboxLayer({\n id: layer.id,\n deck,\n // @ts-expect-error slot is not defined in LayerProps\n slot: layer.props.slot\n }),\n // @ts-expect-error beforeId is not defined in LayerProps\n layer.props.beforeId\n );\n }\n }\n\n // Step 3: check the order of layers\n // If beforeId is defined, the deck layer should always render before the mapbox layer [beforeId]\n // If beforeId is not defined, the deck layer should appear after all mapbox layers\n // When two deck layers share the same beforeId, they are rendered in the order that is passed into Deck props.layers\n // @ts-ignore non-public map property\n const mapLayers: string[] = map.style._order;\n\n // Group deck layers by beforeId\n const layerGroups: Record<string, string[]> = {};\n for (const layer of layers) {\n // @ts-expect-error beforeId is not defined in LayerProps\n let {beforeId} = layer.props;\n if (!beforeId || !mapLayers.includes(beforeId)) {\n beforeId = UNDEFINED_BEFORE_ID;\n }\n layerGroups[beforeId] = layerGroups[beforeId] || [];\n layerGroups[beforeId].push(layer.id);\n }\n\n for (const beforeId in layerGroups) {\n const layerGroup = layerGroups[beforeId];\n let lastLayerIndex =\n beforeId === UNDEFINED_BEFORE_ID ? mapLayers.length : mapLayers.indexOf(beforeId);\n let lastLayerId = beforeId === UNDEFINED_BEFORE_ID ? undefined : beforeId;\n for (let i = layerGroup.length - 1; i >= 0; i--) {\n const layerId = layerGroup[i];\n const layerIndex = mapLayers.indexOf(layerId);\n if (layerIndex !== lastLayerIndex - 1) {\n map.moveLayer(layerId, lastLayerId);\n if (layerIndex > lastLayerIndex) {\n // The last layer's index have changed\n lastLayerIndex++;\n }\n }\n lastLayerIndex--;\n lastLayerId = layerId;\n }\n }\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {getDeckInstance, addLayer, removeLayer, updateLayer, drawLayer} from './deck-utils';\nimport type {Map, CustomLayerInterface} from './types';\nimport type {Deck, Layer} from '@deck.gl/core';\n\nexport type MapboxLayerProps<LayerT extends Layer> = Partial<LayerT['props']> & {\n id: string;\n renderingMode?: '2d' | '3d';\n deck?: Deck;\n /* Mapbox v3 Standard style */\n slot?: 'bottom' | 'middle' | 'top';\n};\n\nexport default class MapboxLayer<LayerT extends Layer> implements CustomLayerInterface {\n id: string;\n type: 'custom';\n renderingMode: '2d' | '3d';\n /* Mapbox v3 Standard style */\n slot?: 'bottom' | 'middle' | 'top';\n map: Map | null;\n deck: Deck | null;\n props: MapboxLayerProps<LayerT>;\n\n /* eslint-disable no-this-before-super */\n constructor(props: MapboxLayerProps<LayerT>) {\n if (!props.id) {\n throw new Error('Layer must have an unique id');\n }\n\n this.id = props.id;\n this.type = 'custom';\n this.renderingMode = props.renderingMode || '3d';\n this.slot = props.slot;\n this.map = null;\n this.deck = null;\n this.props = props;\n }\n\n /* Mapbox custom layer methods */\n\n onAdd(map: Map, gl: WebGL2RenderingContext): void {\n this.map = map;\n this.deck = getDeckInstance({map, gl, deck: this.props.deck});\n addLayer(this.deck, this);\n }\n\n onRemove(): void {\n if (this.deck) {\n removeLayer(this.deck, this);\n }\n }\n\n setProps(props: MapboxLayerProps<LayerT>) {\n // id cannot be changed\n Object.assign(this.props, props, {id: this.id});\n // safe guard in case setProps is called before onAdd\n if (this.deck) {\n updateLayer(this.deck, this);\n }\n }\n\n render(gl, renderParameters) {\n drawLayer(this.deck!, this.map!, this, renderParameters);\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACIA,IAAAA,eAA2B;;;ACA3B,kBAA0E;AAM1E,0BAA2C;AAE3C,IAAM,iBAAiB;AAUvB,IAAM,YAAY;AAClB,IAAM,qBAAqB,KAAK,KAAK;AAG/B,SAAU,gBAAgB,EAC9B,KACA,IACA,KAAI,GAKL;AAEC,MAAI,IAAI,QAAQ;AACd,WAAO,IAAI;EACb;AAGA,QAAM,eAAe,6BAAM,MAAM;AACjC,QAAM,SAAS,6BAAM,MAAM;AAE3B,QAAM,YAAY;IAChB,GAAG,6BAAM;IACT,eAAe,MAAK;AAClB,UAAI,eAAc;AAKlB,mDAAe;IACjB;;AAEF,YAAU,aAAa,EAAC,GAAG,qBAAqB,KAAK,IAAI,GAAG,GAAG,UAAU,WAAU;AACnF,YAAU,UAAV,UAAU,QAAU,eAAe,GAAG;AAEtC,MAAI;AAEJ,MAAI,CAAC,QAAQ,KAAK,MAAM,OAAO,IAAI;AAKjC,WAAO,OAAO,WAAW;MACvB;MACA,OAAO;MACP,QAAQ;MACR,aAAa;MACb,WAAW,aAAa,GAAG;KAC5B;AACD,QAAI,6BAAM,eAAe;AACvB,mBAAa,MAAM,GAAG;IACxB,OAAO;AACL,gBAAU,SAAS,MAAK;AACtB;AACA,qBAAa,cAAc,GAAG;MAChC;IACF;EACF;AAEA,MAAI,MAAM;AACR,mBAAe;AACf,SAAK,SAAS,SAAS;A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gB;AACvC,QAAI,IAAI,aAAa,KAAK,iBAAiB;AAC3C,QAAI,IAAI,aAAa,KAAK,iBAAiB;AAC3C,QAAI,IAAI,QAAQ,KAAK,iBAAiB;AACtC,QAAI,IAAI,WAAW,KAAK,iBAAiB;AACzC,QAAI,IAAI,aAAa,KAAK,iBAAiB;AAC3C,QAAI,IAAI,YAAY,KAAK,iBAAiB;AAC1C,QAAI,IAAI,SAAS,KAAK,iBAAiB;AACvC,QAAI,IAAI,YAAY,KAAK,iBAAiB;AAC1C,eAAK,UAAL,mBAAY;EACd;EAEQ,qBAAqB,KAAQ;AACnC,QAAI,IAAI,aAAa,KAAK,kBAAkB;AAC5C,kBAAc,KAAK,KAAK,OAAO,KAAK,OAAO,QAAQ,CAAA,CAAE;AACrD,uBAAmB,GAAG;EACxB;EAEA,qBAAkB;AAChB,WAAO;EACT;;EAGA,WAAW,QAAyC;AAClD,6BAAO,KAAK,KAAK;AACjB,WAAO,KAAK,MAAM,WAAW,MAAM;EACrC;;EAGA,oBACE,QAAkD;AAElD,6BAAO,KAAK,KAAK;AACjB,WAAO,KAAK,MAAM,oBAAoB,MAAM;EAC9C;;EAGA,YAAY,QAA0C;AACpD,6BAAO,KAAK,KAAK;AACjB,WAAO,KAAK,MAAM,YAAY,MAAM;EACtC;;EAGA,WAAQ;AACN,QAAI,KAAK,MAAM;AACb,WAAK,KAAK,cAAc,IAAI;IAC9B;EACF;;EAGA,YAAS;AACP,QAAI,CAAC,KAAK,MAAM;AACd,aAAO;IACT;AACA,WAAO,KAAK,eAAe,KAAK,KAAK,UAAS,IAAK,KAAK,MAAO,UAAS;EAC1E;;",
|
|
4
|
+
"sourcesContent": ["// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport {default as MapboxOverlay} from './mapbox-overlay';\n\nexport type {MapboxOverlayProps} from './mapbox-overlay';\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {Deck, assert} from '@deck.gl/core';\nimport {\n getViewState,\n getDefaultView,\n getDeckInstance,\n removeDeckInstance,\n getDefaultParameters,\n getProjection\n} from './deck-utils';\n\nimport type {Map, IControl, MapMouseEvent, ControlPosition} from './types';\nimport type {MjolnirGestureEvent, MjolnirPointerEvent} from 'mjolnir.js';\nimport type {DeckProps} from '@deck.gl/core';\nimport {log} from '@deck.gl/core';\n\nimport {resolveLayers} from './resolve-layers';\n\nexport type MapboxOverlayProps = Omit<\n DeckProps,\n | 'width'\n | 'height'\n | 'gl'\n | 'parent'\n | 'canvas'\n | '_customRender'\n | 'viewState'\n | 'initialViewState'\n | 'controller'\n> & {\n interleaved?: boolean;\n};\n\n/**\n * Implements Mapbox [IControl](https://docs.mapbox.com/mapbox-gl-js/api/markers/#icontrol) interface\n * Renders deck.gl layers over the base map and automatically synchronizes with the map's camera\n */\nexport default class MapboxOverlay implements IControl {\n private _props: MapboxOverlayProps;\n private _deck?: Deck<any>;\n private _map?: Map;\n private _container?: HTMLDivElement;\n private _interleaved: boolean;\n private _lastMouseDownPoint?: {x: number; y: number; clientX: number; clientY: number};\n\n constructor(props: MapboxOverlayProps) {\n const {interleaved = false} = props;\n this._interleaved = interleaved;\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 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 = map.painter.context.gl;\n if (gl instanceof WebGLRenderingContext) {\n log.warn(\n 'Incompatible basemap library. See: https://deck.gl/docs/api-reference/mapbox/overview#compatibility'\n )();\n }\n this._deck = getDeckInstance({\n map,\n gl,\n deck: new Deck({\n ...this._props,\n gl,\n parameters: {...getDefaultParameters(map, false), ...this._props.parameters},\n deviceProps: {\n createCanvasContext: {autoResize: true}\n }\n })\n });\n\n map.on('styledata', this._handleStyleChange);\n resolveLayers(map, this._deck, [], this._props.layers);\n\n return document.createElement('div');\n }\n\n /** Called when the control is removed from a map */\n onRemove(): void {\n const map = this._map;\n\n if (map) {\n if (this._interleaved) {\n this._onRemoveInterleaved(map);\n } else {\n this._onRemoveOverlaid(map);\n }\n }\n\n this._deck = undefined;\n this._map = undefined;\n this._container = undefined;\n }\n\n private _onRemoveOverlaid(map: Map): void {\n map.off('resize', this._updateContainerSize);\n map.off('render', this._updateViewState);\n map.off('mousedown', this._handleMouseEvent);\n map.off('dragstart', this._handleMouseEvent);\n map.off('drag', this._handleMouseEvent);\n map.off('dragend', this._handleMouseEvent);\n map.off('mousemove', this._handleMouseEvent);\n map.off('mouseout', this._handleMouseEvent);\n map.off('click', this._handleMouseEvent);\n map.off('dblclick', this._handleMouseEvent);\n this._deck?.finalize();\n }\n\n private _onRemoveInterleaved(map: Map): void {\n map.off('styledata', this._handleStyleChange);\n resolveLayers(map, this._deck, this._props.layers, []);\n removeDeckInstance(map);\n }\n\n getDefaultPosition(): ControlPosition {\n return 'top-left';\n }\n\n /** Forwards the Deck.pickObject method */\n pickObject(params: Parameters<Deck['pickObject']>[0]): ReturnType<Deck['pickObject']> {\n assert(this._deck);\n return this._deck.pickObject(params);\n }\n\n /** Forwards the Deck.pickMultipleObjects method */\n pickMultipleObjects(\n params: Parameters<Deck['pickMultipleObjects']>[0]\n ): ReturnType<Deck['pickMultipleObjects']> {\n assert(this._deck);\n return this._deck.pickMultipleObjects(params);\n }\n\n /** Forwards the Deck.pickObjects method */\n pickObjects(params: Parameters<Deck['pickObjects']>[0]): ReturnType<Deck['pickObjects']> {\n assert(this._deck);\n return this._deck.pickObjects(params);\n }\n\n /** Remove from map and releases all resources */\n finalize() {\n if (this._map) {\n this._map.removeControl(this);\n }\n }\n\n /** If interleaved: true, returns base map's canvas, otherwise forwards the Deck.getCanvas method. */\n getCanvas(): HTMLCanvasElement | null {\n if (!this._map) {\n return null;\n }\n return this._interleaved ? this._map.getCanvas() : this._deck!.getCanvas();\n }\n\n private _handleStyleChange = () => {\n resolveLayers(this._map, this._deck, this._props.layers, this._props.layers);\n 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 {Map} from './types';\n\nimport {lngLatToWorld, unitsPerMeter} from '@math.gl/web-mercator';\n\nconst MAPBOX_VIEW_ID = 'mapbox';\n\ntype UserData = {\n isExternal: boolean;\n currentViewport?: Viewport | null;\n mapboxLayers: Set<MapboxLayer<any>>;\n // mapboxVersion: {minor: number; major: number};\n};\n\n// Mercator constants\nconst TILE_SIZE = 512;\nconst DEGREES_TO_RADIANS = Math.PI / 180;\n\n// Create an interleaved deck instance.\nexport function getDeckInstance({\n map,\n gl,\n deck\n}: {\n map: Map & {__deck?: Deck<any> | null};\n gl: WebGL2RenderingContext;\n deck?: Deck<any>;\n}): Deck<any> {\n // Only create one deck instance per context\n if (map.__deck) {\n return map.__deck;\n }\n\n // Only initialize certain props once per context\n const customRender = deck?.props._customRender;\n const onLoad = deck?.props.onLoad;\n\n const deckProps = {\n ...deck?.props,\n _customRender: () => {\n map.triggerRepaint();\n // customRender may be subscribed by DeckGL React component to update child props\n // make sure it is still called\n // Hack - do not pass a redraw reason here to prevent the React component from clearing the context\n // Rerender will be triggered by MapboxLayer's render()\n customRender?.('');\n }\n };\n deckProps.parameters = {...getDefaultParameters(map, true), ...deckProps.parameters};\n deckProps.views ||= getDefaultView(map);\n\n let deckInstance: Deck;\n\n if (!deck || deck.props.gl === gl) {\n // If deck isn't defined (Internal MapboxLayer use case),\n // or if deck is defined and is using the WebGLContext created by mapbox (MapboxOverlay and External MapboxLayer use case),\n // block deck from setting the canvas size, and use the map's viewState to drive deck.\n // Otherwise, we use deck's viewState to drive the map.\n Object.assign(deckProps, {\n gl,\n width: null,\n height: null,\n touchAction: 'unset',\n viewState: getViewState(map)\n });\n if (deck?.isInitialized) {\n watchMapMove(deck, map);\n } else {\n deckProps.onLoad = () => {\n onLoad?.();\n watchMapMove(deckInstance, map);\n };\n }\n }\n\n if (deck) {\n deckInstance = deck;\n deck.setProps(deckProps);\n (deck.userData as UserData).isExternal = true;\n } else {\n deckInstance = new Deck(deckProps);\n map.on('remove', () => {\n removeDeckInstance(map);\n });\n }\n\n (deckInstance.userData as UserData).mapboxLayers = new Set();\n // (deckInstance.userData as UserData).mapboxVersion = getMapboxVersion(map);\n map.__deck = deckInstance;\n map.on('render', () => {\n if (deckInstance.isInitialized) afterRender(deckInstance, map);\n });\n\n return deckInstance;\n}\n\nfunction watchMapMove(deck: Deck, map: Map & {__deck?: Deck | null}) {\n const _handleMapMove = () => {\n if (deck.isInitialized) {\n // call view state methods\n onMapMove(deck, map);\n } else {\n // deregister itself when deck is finalized\n map.off('move', _handleMapMove);\n }\n };\n map.on('move', _handleMapMove);\n}\n\nexport function removeDeckInstance(map: Map & {__deck?: Deck | null}) {\n map.__deck?.finalize();\n map.__deck = null;\n}\n\nexport function getDefaultParameters(map: Map, interleaved: boolean): Parameters {\n const result: Parameters = interleaved\n ? {\n depthWriteEnabled: true,\n depthCompare: 'less-equal',\n depthBias: 0,\n blend: true,\n blendColorSrcFactor: 'src-alpha',\n blendColorDstFactor: 'one-minus-src-alpha',\n blendAlphaSrcFactor: 'one',\n blendAlphaDstFactor: 'one-minus-src-alpha',\n blendColorOperation: 'add',\n blendAlphaOperation: 'add'\n }\n : {};\n if (getProjection(map) === 'globe') {\n result.cullMode = 'back';\n }\n return result;\n}\n\nexport function addLayer(deck: Deck, layer: MapboxLayer<any>): void {\n (deck.userData as UserData).mapboxLayers.add(layer);\n updateLayers(deck);\n}\n\nexport function removeLayer(deck: Deck, layer: MapboxLayer<any>): void {\n (deck.userData as UserData).mapboxLayers.delete(layer);\n updateLayers(deck);\n}\n\nexport function updateLayer(deck: Deck, layer: MapboxLayer<any>): void {\n updateLayers(deck);\n}\n\nexport function drawLayer(\n deck: Deck,\n map: Map,\n layer: MapboxLayer<any>,\n renderParameters: any\n): void {\n let {currentViewport} = deck.userData as UserData;\n let clearStack: boolean = false;\n if (!currentViewport) {\n // This is the first layer drawn in this render cycle.\n // Generate viewport from the current map state.\n currentViewport = getViewport(deck, map, renderParameters);\n (deck.userData as UserData).currentViewport = currentViewport;\n clearStack = true;\n }\n\n if (!deck.isInitialized) {\n return;\n }\n\n deck._drawLayers('mapbox-repaint', {\n viewports: [currentViewport],\n layerFilter: params =>\n (!deck.props.layerFilter || deck.props.layerFilter(params)) &&\n (layer.id === params.layer.id || params.layer.props.operation.includes('terrain')),\n clearStack,\n clearCanvas: false\n });\n}\n\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 const {views} = deck.props;\n const view =\n (views && flatten(views).find((v: {id: string}) => v.id === MAPBOX_VIEW_ID)) ||\n getDefaultView(map);\n\n if (renderParameters) {\n // Called from MapboxLayer.render\n // Magic number, matches mapbox-gl@>=1.3.0's projection matrix\n view.props.nearZMultiplier = 0.2;\n }\n\n // Get the base map near/far plane\n // renderParameters is maplibre API but not mapbox\n // Transform is not an official API, properties could be undefined for older versions\n const nearZ = (renderParameters as MaplibreRenderParameters)?.nearZ ?? map.transform._nearZ;\n const farZ = (renderParameters as MaplibreRenderParameters)?.farZ ?? map.transform._farZ;\n if (Number.isFinite(nearZ)) {\n viewState.nearZ = nearZ / map.transform.height;\n viewState.farZ = farZ / map.transform.height;\n }\n // Otherwise fallback to default calculation using nearZMultiplier/farZMultiplier\n\n return view.makeViewport({\n width: deck.width,\n height: deck.height,\n viewState\n }) as Viewport;\n}\n\nfunction afterRender(deck: Deck, map: Map): void {\n const {mapboxLayers, isExternal} = deck.userData as UserData;\n\n if (isExternal) {\n // Draw non-Mapbox layers\n const mapboxLayerIds = Array.from(mapboxLayers, layer => layer.id);\n const deckLayers = flatten(deck.props.layers, Boolean) as Layer[];\n const hasNonMapboxLayers = deckLayers.some(\n layer => layer && !mapboxLayerIds.includes(layer.id)\n );\n let viewports = deck.getViewports();\n const mapboxViewportIdx = viewports.findIndex(vp => vp.id === MAPBOX_VIEW_ID);\n const hasNonMapboxViews = viewports.length > 1 || mapboxViewportIdx < 0;\n\n if (hasNonMapboxLayers || hasNonMapboxViews) {\n if (mapboxViewportIdx >= 0) {\n viewports = viewports.slice();\n viewports[mapboxViewportIdx] = getViewport(deck, map);\n }\n\n deck._drawLayers('mapbox-repaint', {\n viewports,\n layerFilter: params =>\n (!deck.props.layerFilter || deck.props.layerFilter(params)) &&\n (params.viewport.id !== MAPBOX_VIEW_ID || !mapboxLayerIds.includes(params.layer.id)),\n clearCanvas: false\n });\n }\n }\n\n // End of render cycle, clear generated viewport\n (deck.userData as UserData).currentViewport = null;\n}\n\nfunction onMapMove(deck: Deck, map: Map): void {\n deck.setProps({\n viewState: getViewState(map)\n });\n // Camera changed, will trigger a map repaint right after this\n // Clear any change flag triggered by setting viewState so that deck does not request\n // a second repaint\n deck.needsRedraw({clearRedrawFlags: true});\n}\n\nfunction updateLayers(deck: Deck): void {\n if ((deck.userData as UserData).isExternal) {\n return;\n }\n\n const layers: Layer[] = [];\n (deck.userData as UserData).mapboxLayers.forEach(deckLayer => {\n const LayerType = deckLayer.props.type;\n const layer = new LayerType(deckLayer.props);\n layers.push(layer);\n });\n deck.setProps({layers});\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {_flatten as flatten} from '@deck.gl/core';\nimport MapboxLayer from './mapbox-layer';\n\nimport type {Deck, LayersList, Layer} from '@deck.gl/core';\nimport type {Map} from './types';\n\nconst UNDEFINED_BEFORE_ID = '__UNDEFINED__';\n\n/** Insert Deck layers into the mapbox Map according to the user-defined order */\n// eslint-disable-next-line complexity, max-statements\nexport function resolveLayers(\n map?: Map,\n deck?: Deck,\n oldLayers?: LayersList,\n newLayers?: LayersList\n) {\n // Wait until map style is loaded\n // @ts-ignore non-public map property\n if (!map || !deck || !map.style || !map.style._loaded) {\n return;\n }\n\n const layers = flatten(newLayers, Boolean) as Layer[];\n\n if (oldLayers !== newLayers) {\n // Step 1: remove layers that no longer exist\n const prevLayers = flatten(oldLayers, Boolean) as Layer[];\n const prevLayerIds = new Set<string>(prevLayers.map(l => l.id));\n\n for (const layer of layers) {\n prevLayerIds.delete(layer.id);\n }\n\n for (const id of prevLayerIds) {\n if (map.getLayer(id)) {\n map.removeLayer(id);\n }\n }\n }\n\n // Step 2: add missing layers\n for (const layer of layers) {\n const mapboxLayer = map.getLayer(layer.id) as MapboxLayer<Layer>;\n if (mapboxLayer) {\n // Mapbox's map.getLayer() had a breaking change in v3.6.0, see https://github.com/visgl/deck.gl/issues/9086\n // @ts-expect-error not typed\n const layerInstance = mapboxLayer.implementation || mapboxLayer;\n layerInstance.setProps(layer.props);\n } else {\n map.addLayer(\n new MapboxLayer({\n id: layer.id,\n deck,\n // @ts-expect-error slot is not defined in LayerProps\n slot: layer.props.slot\n }),\n // @ts-expect-error beforeId is not defined in LayerProps\n layer.props.beforeId\n );\n }\n }\n\n // Step 3: check the order of layers\n // If beforeId is defined, the deck layer should always render before the mapbox layer [beforeId]\n // If beforeId is not defined, the deck layer should appear after all mapbox layers\n // When two deck layers share the same beforeId, they are rendered in the order that is passed into Deck props.layers\n // @ts-ignore non-public map property\n const mapLayers: string[] = map.style._order;\n\n // Group deck layers by beforeId\n const layerGroups: Record<string, string[]> = {};\n for (const layer of layers) {\n // @ts-expect-error beforeId is not defined in LayerProps\n let {beforeId} = layer.props;\n if (!beforeId || !mapLayers.includes(beforeId)) {\n beforeId = UNDEFINED_BEFORE_ID;\n }\n layerGroups[beforeId] = layerGroups[beforeId] || [];\n layerGroups[beforeId].push(layer.id);\n }\n\n for (const beforeId in layerGroups) {\n const layerGroup = layerGroups[beforeId];\n let lastLayerIndex =\n beforeId === UNDEFINED_BEFORE_ID ? mapLayers.length : mapLayers.indexOf(beforeId);\n let lastLayerId = beforeId === UNDEFINED_BEFORE_ID ? undefined : beforeId;\n for (let i = layerGroup.length - 1; i >= 0; i--) {\n const layerId = layerGroup[i];\n const layerIndex = mapLayers.indexOf(layerId);\n if (layerIndex !== lastLayerIndex - 1) {\n map.moveLayer(layerId, lastLayerId);\n if (layerIndex > lastLayerIndex) {\n // The last layer's index have changed\n lastLayerIndex++;\n }\n }\n lastLayerIndex--;\n lastLayerId = layerId;\n }\n }\n}\n", "// deck.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {getDeckInstance, addLayer, removeLayer, updateLayer, drawLayer} from './deck-utils';\nimport type {Map, CustomLayerInterface} from './types';\nimport type {Deck, Layer} from '@deck.gl/core';\n\nexport type MapboxLayerProps<LayerT extends Layer> = Partial<LayerT['props']> & {\n id: string;\n renderingMode?: '2d' | '3d';\n deck?: Deck;\n /* Mapbox v3 Standard style */\n slot?: 'bottom' | 'middle' | 'top';\n};\n\nexport default class MapboxLayer<LayerT extends Layer> implements CustomLayerInterface {\n id: string;\n type: 'custom';\n renderingMode: '2d' | '3d';\n /* Mapbox v3 Standard style */\n slot?: 'bottom' | 'middle' | 'top';\n map: Map | null;\n deck: Deck | null;\n props: MapboxLayerProps<LayerT>;\n\n /* eslint-disable no-this-before-super */\n constructor(props: MapboxLayerProps<LayerT>) {\n if (!props.id) {\n throw new Error('Layer must have an unique id');\n }\n\n this.id = props.id;\n this.type = 'custom';\n this.renderingMode = props.renderingMode || '3d';\n this.slot = props.slot;\n this.map = null;\n this.deck = null;\n this.props = props;\n }\n\n /* Mapbox custom layer methods */\n\n onAdd(map: Map, gl: WebGL2RenderingContext): void {\n this.map = map;\n this.deck = getDeckInstance({map, gl, deck: this.props.deck});\n addLayer(this.deck, this);\n }\n\n onRemove(): void {\n if (this.deck) {\n removeLayer(this.deck, this);\n }\n }\n\n setProps(props: MapboxLayerProps<LayerT>) {\n // id cannot be changed\n Object.assign(this.props, props, {id: this.id});\n // safe guard in case setProps is called before onAdd\n if (this.deck) {\n updateLayer(this.deck, this);\n }\n }\n\n render(gl, renderParameters) {\n drawLayer(this.deck!, this.map!, this, renderParameters);\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACIA,IAAAA,eAA2B;;;ACA3B,kBAA0E;AAM1E,0BAA2C;AAE3C,IAAM,iBAAiB;AAUvB,IAAM,YAAY;AAClB,IAAM,qBAAqB,KAAK,KAAK;AAG/B,SAAU,gBAAgB,E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;AAC3C,QAAI,IAAI,aAAa,KAAK,iBAAiB;AAC3C,QAAI,IAAI,QAAQ,KAAK,iBAAiB;AACtC,QAAI,IAAI,WAAW,KAAK,iBAAiB;AACzC,QAAI,IAAI,aAAa,KAAK,iBAAiB;AAC3C,QAAI,IAAI,YAAY,KAAK,iBAAiB;AAC1C,QAAI,IAAI,SAAS,KAAK,iBAAiB;AACvC,QAAI,IAAI,YAAY,KAAK,iBAAiB;AAC1C,eAAK,UAAL,mBAAY;EACd;EAEQ,qBAAqB,KAAQ;AACnC,QAAI,IAAI,aAAa,KAAK,kBAAkB;AAC5C,kBAAc,KAAK,KAAK,OAAO,KAAK,OAAO,QAAQ,CAAA,CAAE;AACrD,uBAAmB,GAAG;EACxB;EAEA,qBAAkB;AAChB,WAAO;EACT;;EAGA,WAAW,QAAyC;AAClD,6BAAO,KAAK,KAAK;AACjB,WAAO,KAAK,MAAM,WAAW,MAAM;EACrC;;EAGA,oBACE,QAAkD;AAElD,6BAAO,KAAK,KAAK;AACjB,WAAO,KAAK,MAAM,oBAAoB,MAAM;EAC9C;;EAGA,YAAY,QAA0C;AACpD,6BAAO,KAAK,KAAK;AACjB,WAAO,KAAK,MAAM,YAAY,MAAM;EACtC;;EAGA,WAAQ;AACN,QAAI,KAAK,MAAM;AACb,WAAK,KAAK,cAAc,IAAI;IAC9B;EACF;;EAGA,YAAS;AACP,QAAI,CAAC,KAAK,MAAM;AACd,aAAO;IACT;AACA,WAAO,KAAK,eAAe,KAAK,KAAK,UAAS,IAAK,KAAK,MAAO,UAAS;EAC1E;;",
|
|
6
6
|
"names": ["import_core", "GlobeView", "flatten", "import_core", "import_core", "flatten"]
|
|
7
7
|
}
|
package/dist/mapbox-overlay.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export default class MapboxOverlay implements IControl {
|
|
|
16
16
|
private _interleaved;
|
|
17
17
|
private _lastMouseDownPoint?;
|
|
18
18
|
constructor(props: MapboxOverlayProps);
|
|
19
|
+
/** Filter out props to pass to Deck **/
|
|
20
|
+
filterProps(props: MapboxOverlayProps): MapboxOverlayProps;
|
|
19
21
|
/** Update (partial) props of the underlying Deck instance. */
|
|
20
22
|
setProps(props: MapboxOverlayProps): void;
|
|
21
23
|
/** Called when the control is added to a map */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapbox-overlay.d.ts","sourceRoot":"","sources":["../src/mapbox-overlay.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,IAAI,EAAS,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"mapbox-overlay.d.ts","sourceRoot":"","sources":["../src/mapbox-overlay.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,IAAI,EAAS,MAAM,eAAe,CAAC;AAU3C,OAAO,KAAK,EAAM,QAAQ,EAAiB,eAAe,EAAC,mBAAgB;AAE3E,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAK7C,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,SAAS,EACP,OAAO,GACP,QAAQ,GACR,IAAI,GACJ,QAAQ,GACR,QAAQ,GACR,eAAe,GACf,WAAW,GACX,kBAAkB,GAClB,YAAY,CACf,GAAG;IACF,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,aAAc,YAAW,QAAQ;IACpD,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,KAAK,CAAC,CAAY;IAC1B,OAAO,CAAC,IAAI,CAAC,CAAM;IACnB,OAAO,CAAC,UAAU,CAAC,CAAiB;IACpC,OAAO,CAAC,YAAY,CAAU;IAC9B,OAAO,CAAC,mBAAmB,CAAC,CAA2D;gBAE3E,KAAK,EAAE,kBAAkB;IAMrC,wCAAwC;IACxC,WAAW,CAAC,KAAK,EAAE,kBAAkB,GAAG,kBAAkB;IAS1D,8DAA8D;IAC9D,QAAQ,CAAC,KAAK,EAAE,kBAAkB,GAAG,IAAI;IAoBzC,gDAAgD;IAChD,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,cAAc;IAKnC,OAAO,CAAC,cAAc;IAmCtB,OAAO,CAAC,iBAAiB;IA2BzB,oDAAoD;IACpD,QAAQ,IAAI,IAAI;IAgBhB,OAAO,CAAC,iBAAiB;IAczB,OAAO,CAAC,oBAAoB;IAM5B,kBAAkB,IAAI,eAAe;IAIrC,0CAA0C;IAC1C,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAKrF,mDAAmD;IACnD,mBAAmB,CACjB,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,GACjD,UAAU,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IAK1C,2CAA2C;IAC3C,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAKxF,iDAAiD;IACjD,QAAQ;IAMR,qGAAqG;IACrG,SAAS,IAAI,iBAAiB,GAAG,IAAI;IAOrC,OAAO,CAAC,kBAAkB,CASxB;IAEF,OAAO,CAAC,oBAAoB,CAQ1B;IAEF,OAAO,CAAC,gBAAgB,CAatB;IAGF,OAAO,CAAC,iBAAiB,CA+EvB;CACH"}
|
package/dist/mapbox-overlay.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
import { Deck, assert } from '@deck.gl/core';
|
|
5
|
-
import { getViewState, getDefaultView, getDeckInstance, removeDeckInstance, getDefaultParameters } from "./deck-utils.js";
|
|
5
|
+
import { getViewState, getDefaultView, getDeckInstance, removeDeckInstance, getDefaultParameters, getProjection } from "./deck-utils.js";
|
|
6
6
|
import { log } from '@deck.gl/core';
|
|
7
7
|
import { resolveLayers } from "./resolve-layers.js";
|
|
8
8
|
/**
|
|
@@ -13,6 +13,13 @@ export default class MapboxOverlay {
|
|
|
13
13
|
constructor(props) {
|
|
14
14
|
this._handleStyleChange = () => {
|
|
15
15
|
resolveLayers(this._map, this._deck, this._props.layers, this._props.layers);
|
|
16
|
+
if (!this._map)
|
|
17
|
+
return;
|
|
18
|
+
// getProjection() returns undefined before style is loaded
|
|
19
|
+
const projection = getProjection(this._map);
|
|
20
|
+
if (projection && !this._props.views) {
|
|
21
|
+
this._deck?.setProps({ views: getDefaultView(this._map) });
|
|
22
|
+
}
|
|
16
23
|
};
|
|
17
24
|
this._updateContainerSize = () => {
|
|
18
25
|
if (this._map && this._container) {
|
|
@@ -100,16 +107,25 @@ export default class MapboxOverlay {
|
|
|
100
107
|
return;
|
|
101
108
|
}
|
|
102
109
|
};
|
|
103
|
-
const { interleaved = false
|
|
110
|
+
const { interleaved = false } = props;
|
|
104
111
|
this._interleaved = interleaved;
|
|
105
|
-
this._props =
|
|
112
|
+
this._props = this.filterProps(props);
|
|
113
|
+
}
|
|
114
|
+
/** Filter out props to pass to Deck **/
|
|
115
|
+
filterProps(props) {
|
|
116
|
+
const { interleaved = false, useDevicePixels, ...deckProps } = props;
|
|
117
|
+
if (!interleaved && useDevicePixels !== undefined) {
|
|
118
|
+
// useDevicePixels cannot be used in interleaved mode
|
|
119
|
+
deckProps.useDevicePixels = useDevicePixels;
|
|
120
|
+
}
|
|
121
|
+
return deckProps;
|
|
106
122
|
}
|
|
107
123
|
/** Update (partial) props of the underlying Deck instance. */
|
|
108
124
|
setProps(props) {
|
|
109
125
|
if (this._interleaved && props.layers) {
|
|
110
126
|
resolveLayers(this._map, this._deck, this._props.layers, props.layers);
|
|
111
127
|
}
|
|
112
|
-
Object.assign(this._props, props);
|
|
128
|
+
Object.assign(this._props, this.filterProps(props));
|
|
113
129
|
if (this._deck && this._map) {
|
|
114
130
|
this._deck.setProps({
|
|
115
131
|
...this._props,
|
|
@@ -169,7 +185,11 @@ export default class MapboxOverlay {
|
|
|
169
185
|
gl,
|
|
170
186
|
deck: new Deck({
|
|
171
187
|
...this._props,
|
|
172
|
-
gl
|
|
188
|
+
gl,
|
|
189
|
+
parameters: { ...getDefaultParameters(map, false), ...this._props.parameters },
|
|
190
|
+
deviceProps: {
|
|
191
|
+
createCanvasContext: { autoResize: true }
|
|
192
|
+
}
|
|
173
193
|
})
|
|
174
194
|
});
|
|
175
195
|
map.on('styledata', this._handleStyleChange);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapbox-overlay.js","sourceRoot":"","sources":["../src/mapbox-overlay.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,IAAI,EAAE,MAAM,EAAC,MAAM,eAAe,CAAC;AAC3C,OAAO,EACL,YAAY,EACZ,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"mapbox-overlay.js","sourceRoot":"","sources":["../src/mapbox-overlay.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,IAAI,EAAE,MAAM,EAAC,MAAM,eAAe,CAAC;AAC3C,OAAO,EACL,YAAY,EACZ,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACd,wBAAqB;AAKtB,OAAO,EAAC,GAAG,EAAC,MAAM,eAAe,CAAC;AAElC,OAAO,EAAC,aAAa,EAAC,4BAAyB;AAiB/C;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,aAAa;IAQhC,YAAY,KAAyB;QAqL7B,uBAAkB,GAAG,GAAG,EAAE;YAChC,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,I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AC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACvD,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;IAED,kBAAkB;QAChB,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,0CAA0C;IAC1C,UAAU,CAAC,MAAyC;QAClD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;IAED,mDAAmD;IACnD,mBAAmB,CACjB,MAAkD;QAElD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAChD,CAAC;IAED,2CAA2C;IAC3C,WAAW,CAAC,MAA0C;QACpD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAED,iDAAiD;IACjD,QAAQ;QACN,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IAED,qGAAqG;IACrG,SAAS;QACP,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACf,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAM,CAAC,SAAS,EAAE,CAAC;IAC7E,CAAC;CAuHF"}
|
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 st=Object.create;var S=Object.defineProperty;var at=Object.getOwnPropertyDescriptor;var ct=Object.getOwnPropertyNames;var lt=Object.getPrototypeOf,ut=Object.prototype.hasOwnProperty;var pt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),dt=(e,t)=>{for(var o in t)S(e,o,{get:t[o],enumerable:!0})},j=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ct(t))!ut.call(e,r)&&r!==o&&S(e,r,{get:()=>t[r],enumerable:!(n=at(t,r))||n.enumerable});return e},h=(e,t,o)=>(j(e,t,"default"),o&&j(o,t,"default")),b=(e,t,o)=>(o=e!=null?st(lt(e)):{},j(t||!e||!e.__esModule?S(o,"default",{value:e,enumerable:!0}):o,e)),ht=e=>j(S({},"__esModule",{value:!0}),e);var f=pt((Rt,Y)=>{Y.exports=globalThis.deck});var k={};dt(k,{MapboxOverlay:()=>E});var p={},W=b(f(),1);h(p,b(f(),1));if(!W.Layer)throw new Error("@deck.gl/core is not found");h(k,p);var M=b(f(),1);var d=b(f(),1);function C(e,t){if(!e)throw new Error(t||"@math.gl/web-mercator: assertion failed.")}var m=Math.PI,gt=m/4,z=m/180,Ut=180/m,V=512,yt=4003e4;function v(e){let[t,o]=e;C(Number.isFinite(t)),C(Number.isFinite(o)&&o>=-90&&o<=90,"invalid latitude");let n=t*z,r=o*z,a=V*(n+m)/(2*m),i=V*(m+Math.log(Math.tan(gt+r*.5)))/(2*m);return[a,i]}function A(e){let t=Math.cos(e*z);return V/yt/t}var $t=Math.PI/180;var w="mapbox",Z=512,jt=Math.PI/180;function F({map:e,gl:t,deck:o}){if(e.__deck)return e.__deck;let n=o?.props._customRender,r=o?.props.onLoad,a={...o?.props,_customRender:()=>{e.triggerRepaint(),n?.("")}};a.parameters={...O(e,!0),...a.parameters},a.views||=L(e);let i;return(!o||o.props.gl===t)&&(Object.assign(a,{gl:t,width:null,height:null,touchAction:"unset",viewState:_(e)}),o?.isInitialized?$(o,e):a.onLoad=()=>{r?.(),$(i,e)}),o?(i=o,o.setProps(a),o.userData.isExternal=!0):(i=new d.Deck(a),e.on("remove",()=>{N(e)})),i.userData.mapboxLayers=new Set,e.__deck=i,e.on("render",()=>{i.isInitialized&&Ct(i,e)}),i}function $(e,t){let o=()=>{e.isInitialized?Ft(e,t):t.off("move",o)};t.on("move",o)}function N(e){e.__deck?.finalize(),e.__deck=null}function O(e,t){let o=t?{depthWriteEnabled:!0,depthCompare:"less-equal",depthBias:0,blend:!0,blendColorSrcFactor:"src-alpha",blendColorDstFactor:"one-minus-src-alpha",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one-minus-src-alpha",blendColorOperation:"add",blendAlphaOperation:"add"}:{};return et(e)==="globe"&&(o.cullMode="back"),o}function J(e,t){e.userData.mapboxLayers.add(t),U(e)}function K(e,t){e.userData.mapboxLayers.delete(t),U(e)}function Q(e,t){U(e)}function tt(e,t,o,n){let{currentViewport:r}=e.userData,a=!1;r||(r=ot(e,t,n),e.userData.currentViewport=r,a=!0),e.isInitialized&&e._drawLayers("mapbox-repaint",{viewports:[r],layerFilter:i=>(!e.props.layerFilter||e.props.layerFilter(i))&&(o.id===i.layer.id||i.layer.props.operation.includes("terrain")),clearStack:a,clearCanvas:!1})}function et(e){let t=e.getProjection?.(),o=t?.type||t?.name;if(o==="globe")return"globe";if(o&&o!=="mercator")throw new Error("Unsupported projection");return"mercator"}function L(e){return et(e)==="globe"?new d._GlobeView({id:w}):new d.MapView({id:w})}function _(e){let{lng:t,lat:o}=e.getCenter(),n={longitude:(t+540)%360-180,latitude:o,zoom:e.getZoom(),bearing:e.getBearing(),pitch:e.getPitch(),padding:e.getPadding(),repeat:e.getRenderWorldCopies()};return e.getTerrain?.()&&St(e,n),n}function St(e,t){if(e.getFreeCameraOptions){let{position:o}=e.getFreeCameraOptions();if(!o||o.z===void 0)return;let n=e.transform.height,{longitude:r,latitude:a,pitch:i}=t,s=o.x*Z,c=(1-o.y)*Z,l=o.z*Z,u=v([r,a]),g=s-u[0],y=c-u[1],T=Math.sqrt(g*g+y*y),I=i*jt,R=1.5*n,B=I<.001?R*Math.cos(I)/l:R*Math.sin(I)/T;t.zoom=Math.log2(B);let rt=R*Math.cos(I)/B,it=l-rt;t.position=[0,0,it/A(a)]}else typeof e.transform.elevation=="number"&&(t.position=[0,0,e.transform.elevation])}function ot(e,t,o){let n=_(t),{views:r}=e.props,a=r&&(0,d._flatten)(r).find(c=>c.id===w)||L(t);o&&(a.props.nearZMultiplier=.2);let i=o?.nearZ??t.transform._nearZ,s=o?.farZ??t.transform._farZ;return Number.isFinite(i)&&(n.nearZ=i/t.transform.height,n.farZ=s/t.transform.height),a.makeViewport({width:e.width,height:e.height,viewState:n})}function Ct(e,t){let{mapboxLayers:o,isExternal:n}=e.userData;if(n){let r=Array.from(o,u=>u.id),i=(0,d._flatten)(e.props.layers,Boolean).some(u=>u&&!r.includes(u.id)),s=e.getViewports(),c=s.findIndex(u=>u.id===w),l=s.length>1||c<0;(i||l)&&(c>=0&&(s=s.slice(),s[c]=ot(e,t)),e._drawLayers("mapbox-repaint",{viewports:s,layerFilter:u=>(!e.props.layerFilter||e.props.layerFilter(u))&&(u.viewport.id!==w||!r.includes(u.layer.id)),clearCanvas:!1}))}e.userData.currentViewport=null}function Ft(e,t){e.setProps({viewState:_(t)}),e.needsRedraw({clearRedrawFlags:!0})}function U(e){if(e.userData.isExternal)return;let t=[];e.userData.mapboxLayers.forEach(o=>{let n=o.props.type,r=new n(o.props);t.push(r)}),e.setProps({layers:t})}var nt=b(f(),1);var G=b(f(),1);var D=class{constructor(t){if(!t.id)throw new Error("Layer must have an unique id");this.id=t.id,this.type="custom",this.renderingMode=t.renderingMode||"3d",this.slot=t.slot,this.map=null,this.deck=null,this.props=t}onAdd(t,o){this.map=t,this.deck=F({map:t,gl:o,deck:this.props.deck}),J(this.deck,this)}onRemove(){this.deck&&K(this.deck,this)}setProps(t){Object.assign(this.props,t,{id:this.id}),this.deck&&Q(this.deck,this)}render(t,o){tt(this.deck,this.map,this,o)}};var X="__UNDEFINED__";function P(e,t,o,n){if(!e||!t||!e.style||!e.style._loaded)return;let r=(0,G._flatten)(n,Boolean);if(o!==n){let s=(0,G._flatten)(o,Boolean),c=new Set(s.map(l=>l.id));for(let l of r)c.delete(l.id);for(let l of c)e.getLayer(l)&&e.removeLayer(l)}for(let s of r){let c=e.getLayer(s.id);c?(c.implementation||c).setProps(s.props):e.addLayer(new D({id:s.id,deck:t,slot:s.props.slot}),s.props.beforeId)}let a=e.style._order,i={};for(let s of r){let{beforeId:c}=s.props;(!c||!a.includes(c))&&(c=X),i[c]=i[c]||[],i[c].push(s.id)}for(let s in i){let c=i[s],l=s===X?a.length:a.indexOf(s),u=s===X?void 0:s;for(let g=c.length-1;g>=0;g--){let y=c[g],T=a.indexOf(y);T!==l-1&&(e.moveLayer(y,u),T>l&&l++),l--,u=y}}}var E=class{constructor(t){this._handleStyleChange=()=>{P(this._map,this._deck,this._props.layers,this._props.layers)};this._updateContainerSize=()=>{if(this._map&&this._container){let{clientWidth:t,clientHeight:o}=this._map.getContainer();Object.assign(this._container.style,{width:`${t}px`,height:`${o}px`})}};this._updateViewState=()=>{let t=this._deck,o=this._map;t&&o&&(t.setProps({views:this._props.views||L(o),viewState:_(o)}),t.isInitialized&&t.redraw())};this._handleMouseEvent=t=>{let o=this._deck;if(!o||!o.isInitialized)return;let n={type:t.type,offsetCenter:t.point,srcEvent:t},r=this._lastMouseDownPoint;switch(!t.point&&r&&(n.deltaX=t.originalEvent.clientX-r.clientX,n.deltaY=t.originalEvent.clientY-r.clientY,n.offsetCenter={x:r.x+n.deltaX,y:r.y+n.deltaY}),n.type){case"mousedown":o._onPointerDown(n),this._lastMouseDownPoint={...t.point,clientX:t.originalEvent.clientX,clientY:t.originalEvent.clientY};break;case"dragstart":n.type="panstart",o._onEvent(n);break;case"drag":n.type="panmove",o._onEvent(n);break;case"dragend":n.type="panend",o._onEvent(n);break;case"click":n.tapCount=1,o._onEvent(n);break;case"dblclick":n.type="click",n.tapCount=2,o._onEvent(n);break;case"mousemove":n.type="pointermove",o._onPointerMove(n);break;case"mouseout":n.type="pointerleave",o._onPointerMove(n);break;default:return}};let{interleaved:o=!1,...n}=t;this._interleaved=o,this._props=n}setProps(t){this._interleaved&&t.layers&&P(this._map,this._deck,this._props.layers,t.layers),Object.assign(this._props,t),this._deck&&this._map&&this._deck.setProps({...this._props,parameters:{...O(this._map,this._interleaved),...this._props.parameters}})}onAdd(t){return this._map=t,this._interleaved?this._onAddInterleaved(t):this._onAddOverlaid(t)}_onAddOverlaid(t){let o=document.createElement("div");return Object.assign(o.style,{position:"absolute",left:0,top:0,textAlign:"initial",pointerEvents:"none"}),this._container=o,this._deck=new M.Deck({...this._props,parent:o,parameters:{...O(t,!1),...this._props.parameters},views:this._props.views||L(t),viewState:_(t)}),t.on("resize",this._updateContainerSize),t.on("render",this._updateViewState),t.on("mousedown",this._handleMouseEvent),t.on("dragstart",this._handleMouseEvent),t.on("drag",this._handleMouseEvent),t.on("dragend",this._handleMouseEvent),t.on("mousemove",this._handleMouseEvent),t.on("mouseout",this._handleMouseEvent),t.on("click",this._handleMouseEvent),t.on("dblclick",this._handleMouseEvent),this._updateContainerSize(),o}_onAddInterleaved(t){let o=t.painter.context.gl;return o instanceof WebGLRenderingContext&&nt.log.warn("Incompatible basemap library. See: https://deck.gl/docs/api-reference/mapbox/overview#compatibility")(),this._deck=F({map:t,gl:o,deck:new M.Deck({...this._props,gl:o})}),t.on("styledata",this._handleStyleChange),P(t,this._deck,[],this._props.layers),document.createElement("div")}onRemove(){let t=this._map;t&&(this._interleaved?this._onRemoveInterleaved(t):this._onRemoveOverlaid(t)),this._deck=void 0,this._map=void 0,this._container=void 0}_onRemoveOverlaid(t){t.off("resize",this._updateContainerSize),t.off("render",this._updateViewState),t.off("mousedown",this._handleMouseEvent),t.off("dragstart",this._handleMouseEvent),t.off("drag",this._handleMouseEvent),t.off("dragend",this._handleMouseEvent),t.off("mousemove",this._handleMouseEvent),t.off("mouseout",this._handleMouseEvent),t.off("click",this._handleMouseEvent),t.off("dblclick",this._handleMouseEvent),this._deck?.finalize()}_onRemoveInterleaved(t){t.off("styledata",this._handleStyleChange),P(t,this._deck,this._props.layers,[]),N(t)}getDefaultPosition(){return"top-left"}pickObject(t){return(0,M.assert)(this._deck),this._deck.pickObject(t)}pickMultipleObjects(t){return(0,M.assert)(this._deck),this._deck.pickMultipleObjects(t)}pickObjects(t){return(0,M.assert)(this._deck),this._deck.pickObjects(t)}finalize(){this._map&&this._map.removeControl(this)}getCanvas(){return this._map?this._interleaved?this._map.getCanvas():this._deck.getCanvas():null}};return ht(k);})();
|
|
7
|
+
"use strict";var __exports__=(()=>{var st=Object.create;var C=Object.defineProperty;var at=Object.getOwnPropertyDescriptor;var ct=Object.getOwnPropertyNames;var lt=Object.getPrototypeOf,pt=Object.prototype.hasOwnProperty;var ut=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),dt=(e,t)=>{for(var o in t)C(e,o,{get:t[o],enumerable:!0})},S=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ct(t))!pt.call(e,r)&&r!==o&&C(e,r,{get:()=>t[r],enumerable:!(n=at(t,r))||n.enumerable});return e},h=(e,t,o)=>(S(e,t,"default"),o&&S(o,t,"default")),v=(e,t,o)=>(o=e!=null?st(lt(e)):{},S(t||!e||!e.__esModule?C(o,"default",{value:e,enumerable:!0}):o,e)),ht=e=>S(C({},"__esModule",{value:!0}),e);var f=ut((Rt,W)=>{W.exports=globalThis.deck});var T={};dt(T,{MapboxOverlay:()=>k});var u={},H=v(f(),1);h(u,v(f(),1));if(!H.Layer)throw new Error("@deck.gl/core is not found");h(T,u);var M=v(f(),1);var d=v(f(),1);function O(e,t){if(!e)throw new Error(t||"@math.gl/web-mercator: assertion failed.")}var m=Math.PI,gt=m/4,V=m/180,Ut=180/m,A=512,yt=4003e4;function b(e){let[t,o]=e;O(Number.isFinite(t)),O(Number.isFinite(o)&&o>=-90&&o<=90,"invalid latitude");let n=t*V,r=o*V,a=A*(n+m)/(2*m),i=A*(m+Math.log(Math.tan(gt+r*.5)))/(2*m);return[a,i]}function Z(e){let t=Math.cos(e*V);return A/yt/t}var $t=Math.PI/180;var L="mapbox",N=512,It=Math.PI/180;function F({map:e,gl:t,deck:o}){if(e.__deck)return e.__deck;let n=o?.props._customRender,r=o?.props.onLoad,a={...o?.props,_customRender:()=>{e.triggerRepaint(),n?.("")}};a.parameters={...P(e,!0),...a.parameters},a.views||=x(e);let i;return(!o||o.props.gl===t)&&(Object.assign(a,{gl:t,width:null,height:null,touchAction:"unset",viewState:_(e)}),o?.isInitialized?J(o,e):a.onLoad=()=>{r?.(),J(i,e)}),o?(i=o,o.setProps(a),o.userData.isExternal=!0):(i=new d.Deck(a),e.on("remove",()=>{U(e)})),i.userData.mapboxLayers=new Set,e.__deck=i,e.on("render",()=>{i.isInitialized&&Ct(i,e)}),i}function J(e,t){let o=()=>{e.isInitialized?Ot(e,t):t.off("move",o)};t.on("move",o)}function U(e){e.__deck?.finalize(),e.__deck=null}function P(e,t){let o=t?{depthWriteEnabled:!0,depthCompare:"less-equal",depthBias:0,blend:!0,blendColorSrcFactor:"src-alpha",blendColorDstFactor:"one-minus-src-alpha",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one-minus-src-alpha",blendColorOperation:"add",blendAlphaOperation:"add"}:{};return R(e)==="globe"&&(o.cullMode="back"),o}function K(e,t){e.userData.mapboxLayers.add(t),X(e)}function Q(e,t){e.userData.mapboxLayers.delete(t),X(e)}function tt(e,t){X(e)}function et(e,t,o,n){let{currentViewport:r}=e.userData,a=!1;r||(r=ot(e,t,n),e.userData.currentViewport=r,a=!0),e.isInitialized&&e._drawLayers("mapbox-repaint",{viewports:[r],layerFilter:i=>(!e.props.layerFilter||e.props.layerFilter(i))&&(o.id===i.layer.id||i.layer.props.operation.includes("terrain")),clearStack:a,clearCanvas:!1})}function R(e){let t=e.getProjection?.(),o=t?.type||t?.name;if(o==="globe")return"globe";if(o&&o!=="mercator")throw new Error("Unsupported projection");return"mercator"}function x(e){return R(e)==="globe"?new d._GlobeView({id:L}):new d.MapView({id:L})}function _(e){let{lng:t,lat:o}=e.getCenter(),n={longitude:(t+540)%360-180,latitude:o,zoom:e.getZoom(),bearing:e.getBearing(),pitch:e.getPitch(),padding:e.getPadding(),repeat:e.getRenderWorldCopies()};return e.getTerrain?.()&&St(e,n),n}function St(e,t){if(e.getFreeCameraOptions){let{position:o}=e.getFreeCameraOptions();if(!o||o.z===void 0)return;let n=e.transform.height,{longitude:r,latitude:a,pitch:i}=t,s=o.x*N,c=(1-o.y)*N,l=o.z*N,p=b([r,a]),g=s-p[0],y=c-p[1],j=Math.sqrt(g*g+y*y),I=i*It,z=1.5*n,Y=I<.001?z*Math.cos(I)/l:z*Math.sin(I)/j;t.zoom=Math.log2(Y);let rt=z*Math.cos(I)/Y,it=l-rt;t.position=[0,0,it/Z(a)]}else typeof e.transform.elevation=="number"&&(t.position=[0,0,e.transform.elevation])}function ot(e,t,o){let n=_(t),{views:r}=e.props,a=r&&(0,d._flatten)(r).find(c=>c.id===L)||x(t);o&&(a.props.nearZMultiplier=.2);let i=o?.nearZ??t.transform._nearZ,s=o?.farZ??t.transform._farZ;return Number.isFinite(i)&&(n.nearZ=i/t.transform.height,n.farZ=s/t.transform.height),a.makeViewport({width:e.width,height:e.height,viewState:n})}function Ct(e,t){let{mapboxLayers:o,isExternal:n}=e.userData;if(n){let r=Array.from(o,p=>p.id),i=(0,d._flatten)(e.props.layers,Boolean).some(p=>p&&!r.includes(p.id)),s=e.getViewports(),c=s.findIndex(p=>p.id===L),l=s.length>1||c<0;(i||l)&&(c>=0&&(s=s.slice(),s[c]=ot(e,t)),e._drawLayers("mapbox-repaint",{viewports:s,layerFilter:p=>(!e.props.layerFilter||e.props.layerFilter(p))&&(p.viewport.id!==L||!r.includes(p.layer.id)),clearCanvas:!1}))}e.userData.currentViewport=null}function Ot(e,t){e.setProps({viewState:_(t)}),e.needsRedraw({clearRedrawFlags:!0})}function X(e){if(e.userData.isExternal)return;let t=[];e.userData.mapboxLayers.forEach(o=>{let n=o.props.type,r=new n(o.props);t.push(r)}),e.setProps({layers:t})}var nt=v(f(),1);var B=v(f(),1);var D=class{constructor(t){if(!t.id)throw new Error("Layer must have an unique id");this.id=t.id,this.type="custom",this.renderingMode=t.renderingMode||"3d",this.slot=t.slot,this.map=null,this.deck=null,this.props=t}onAdd(t,o){this.map=t,this.deck=F({map:t,gl:o,deck:this.props.deck}),K(this.deck,this)}onRemove(){this.deck&&Q(this.deck,this)}setProps(t){Object.assign(this.props,t,{id:this.id}),this.deck&&tt(this.deck,this)}render(t,o){et(this.deck,this.map,this,o)}};var G="__UNDEFINED__";function E(e,t,o,n){if(!e||!t||!e.style||!e.style._loaded)return;let r=(0,B._flatten)(n,Boolean);if(o!==n){let s=(0,B._flatten)(o,Boolean),c=new Set(s.map(l=>l.id));for(let l of r)c.delete(l.id);for(let l of c)e.getLayer(l)&&e.removeLayer(l)}for(let s of r){let c=e.getLayer(s.id);c?(c.implementation||c).setProps(s.props):e.addLayer(new D({id:s.id,deck:t,slot:s.props.slot}),s.props.beforeId)}let a=e.style._order,i={};for(let s of r){let{beforeId:c}=s.props;(!c||!a.includes(c))&&(c=G),i[c]=i[c]||[],i[c].push(s.id)}for(let s in i){let c=i[s],l=s===G?a.length:a.indexOf(s),p=s===G?void 0:s;for(let g=c.length-1;g>=0;g--){let y=c[g],j=a.indexOf(y);j!==l-1&&(e.moveLayer(y,p),j>l&&l++),l--,p=y}}}var k=class{constructor(t){this._handleStyleChange=()=>{if(E(this._map,this._deck,this._props.layers,this._props.layers),!this._map)return;R(this._map)&&!this._props.views&&this._deck?.setProps({views:x(this._map)})};this._updateContainerSize=()=>{if(this._map&&this._container){let{clientWidth:t,clientHeight:o}=this._map.getContainer();Object.assign(this._container.style,{width:`${t}px`,height:`${o}px`})}};this._updateViewState=()=>{let t=this._deck,o=this._map;t&&o&&(t.setProps({views:this._props.views||x(o),viewState:_(o)}),t.isInitialized&&t.redraw())};this._handleMouseEvent=t=>{let o=this._deck;if(!o||!o.isInitialized)return;let n={type:t.type,offsetCenter:t.point,srcEvent:t},r=this._lastMouseDownPoint;switch(!t.point&&r&&(n.deltaX=t.originalEvent.clientX-r.clientX,n.deltaY=t.originalEvent.clientY-r.clientY,n.offsetCenter={x:r.x+n.deltaX,y:r.y+n.deltaY}),n.type){case"mousedown":o._onPointerDown(n),this._lastMouseDownPoint={...t.point,clientX:t.originalEvent.clientX,clientY:t.originalEvent.clientY};break;case"dragstart":n.type="panstart",o._onEvent(n);break;case"drag":n.type="panmove",o._onEvent(n);break;case"dragend":n.type="panend",o._onEvent(n);break;case"click":n.tapCount=1,o._onEvent(n);break;case"dblclick":n.type="click",n.tapCount=2,o._onEvent(n);break;case"mousemove":n.type="pointermove",o._onPointerMove(n);break;case"mouseout":n.type="pointerleave",o._onPointerMove(n);break;default:return}};let{interleaved:o=!1}=t;this._interleaved=o,this._props=this.filterProps(t)}filterProps(t){let{interleaved:o=!1,useDevicePixels:n,...r}=t;return!o&&n!==void 0&&(r.useDevicePixels=n),r}setProps(t){this._interleaved&&t.layers&&E(this._map,this._deck,this._props.layers,t.layers),Object.assign(this._props,this.filterProps(t)),this._deck&&this._map&&this._deck.setProps({...this._props,parameters:{...P(this._map,this._interleaved),...this._props.parameters}})}onAdd(t){return this._map=t,this._interleaved?this._onAddInterleaved(t):this._onAddOverlaid(t)}_onAddOverlaid(t){let o=document.createElement("div");return Object.assign(o.style,{position:"absolute",left:0,top:0,textAlign:"initial",pointerEvents:"none"}),this._container=o,this._deck=new M.Deck({...this._props,parent:o,parameters:{...P(t,!1),...this._props.parameters},views:this._props.views||x(t),viewState:_(t)}),t.on("resize",this._updateContainerSize),t.on("render",this._updateViewState),t.on("mousedown",this._handleMouseEvent),t.on("dragstart",this._handleMouseEvent),t.on("drag",this._handleMouseEvent),t.on("dragend",this._handleMouseEvent),t.on("mousemove",this._handleMouseEvent),t.on("mouseout",this._handleMouseEvent),t.on("click",this._handleMouseEvent),t.on("dblclick",this._handleMouseEvent),this._updateContainerSize(),o}_onAddInterleaved(t){let o=t.painter.context.gl;return o instanceof WebGLRenderingContext&&nt.log.warn("Incompatible basemap library. See: https://deck.gl/docs/api-reference/mapbox/overview#compatibility")(),this._deck=F({map:t,gl:o,deck:new M.Deck({...this._props,gl:o,parameters:{...P(t,!1),...this._props.parameters},deviceProps:{createCanvasContext:{autoResize:!0}}})}),t.on("styledata",this._handleStyleChange),E(t,this._deck,[],this._props.layers),document.createElement("div")}onRemove(){let t=this._map;t&&(this._interleaved?this._onRemoveInterleaved(t):this._onRemoveOverlaid(t)),this._deck=void 0,this._map=void 0,this._container=void 0}_onRemoveOverlaid(t){t.off("resize",this._updateContainerSize),t.off("render",this._updateViewState),t.off("mousedown",this._handleMouseEvent),t.off("dragstart",this._handleMouseEvent),t.off("drag",this._handleMouseEvent),t.off("dragend",this._handleMouseEvent),t.off("mousemove",this._handleMouseEvent),t.off("mouseout",this._handleMouseEvent),t.off("click",this._handleMouseEvent),t.off("dblclick",this._handleMouseEvent),this._deck?.finalize()}_onRemoveInterleaved(t){t.off("styledata",this._handleStyleChange),E(t,this._deck,this._props.layers,[]),U(t)}getDefaultPosition(){return"top-left"}pickObject(t){return(0,M.assert)(this._deck),this._deck.pickObject(t)}pickMultipleObjects(t){return(0,M.assert)(this._deck),this._deck.pickMultipleObjects(t)}pickObjects(t){return(0,M.assert)(this._deck),this._deck.pickObjects(t)}finalize(){this._map&&this._map.removeControl(this)}getCanvas(){return this._map?this._interleaved?this._map.getCanvas():this._deck.getCanvas():null}};return ht(T);})();
|
|
8
8
|
return __exports__;
|
|
9
9
|
});
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Use deck.gl layers as custom mapbox-gl-js layers",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"version": "9.2.0-beta.
|
|
6
|
+
"version": "9.2.0-beta.4",
|
|
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": "^9.2.
|
|
41
|
+
"@luma.gl/constants": "^9.2.2",
|
|
42
42
|
"@math.gl/web-mercator": "^4.1.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@deck.gl/core": "^9.1.0",
|
|
46
|
-
"@luma.gl/constants": "^9.2.
|
|
47
|
-
"@luma.gl/core": "^9.2.
|
|
46
|
+
"@luma.gl/constants": "^9.2.2",
|
|
47
|
+
"@luma.gl/core": "^9.2.2",
|
|
48
48
|
"@math.gl/web-mercator": "^4.1.0"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "33a6d99157900066f8f4d4daa9c3bd2053cd25df"
|
|
51
51
|
}
|
package/src/deck-utils.ts
CHANGED
|
@@ -184,7 +184,7 @@ export function drawLayer(
|
|
|
184
184
|
});
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
function getProjection(map: Map): 'mercator' | 'globe' {
|
|
187
|
+
export function getProjection(map: Map): 'mercator' | 'globe' {
|
|
188
188
|
const projection = map.getProjection?.();
|
|
189
189
|
const type =
|
|
190
190
|
// maplibre projection spec
|
package/src/mapbox-overlay.ts
CHANGED
|
@@ -8,7 +8,8 @@ import {
|
|
|
8
8
|
getDefaultView,
|
|
9
9
|
getDeckInstance,
|
|
10
10
|
removeDeckInstance,
|
|
11
|
-
getDefaultParameters
|
|
11
|
+
getDefaultParameters,
|
|
12
|
+
getProjection
|
|
12
13
|
} from './deck-utils';
|
|
13
14
|
|
|
14
15
|
import type {Map, IControl, MapMouseEvent, ControlPosition} from './types';
|
|
@@ -46,9 +47,19 @@ export default class MapboxOverlay implements IControl {
|
|
|
46
47
|
private _lastMouseDownPoint?: {x: number; y: number; clientX: number; clientY: number};
|
|
47
48
|
|
|
48
49
|
constructor(props: MapboxOverlayProps) {
|
|
49
|
-
const {interleaved = false
|
|
50
|
+
const {interleaved = false} = props;
|
|
50
51
|
this._interleaved = interleaved;
|
|
51
|
-
this._props =
|
|
52
|
+
this._props = this.filterProps(props);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Filter out props to pass to Deck **/
|
|
56
|
+
filterProps(props: MapboxOverlayProps): MapboxOverlayProps {
|
|
57
|
+
const {interleaved = false, useDevicePixels, ...deckProps} = props;
|
|
58
|
+
if (!interleaved && useDevicePixels !== undefined) {
|
|
59
|
+
// useDevicePixels cannot be used in interleaved mode
|
|
60
|
+
(deckProps as MapboxOverlayProps).useDevicePixels = useDevicePixels;
|
|
61
|
+
}
|
|
62
|
+
return deckProps;
|
|
52
63
|
}
|
|
53
64
|
|
|
54
65
|
/** Update (partial) props of the underlying Deck instance. */
|
|
@@ -57,7 +68,7 @@ export default class MapboxOverlay implements IControl {
|
|
|
57
68
|
resolveLayers(this._map, this._deck, this._props.layers, props.layers);
|
|
58
69
|
}
|
|
59
70
|
|
|
60
|
-
Object.assign(this._props, props);
|
|
71
|
+
Object.assign(this._props, this.filterProps(props));
|
|
61
72
|
|
|
62
73
|
if (this._deck && this._map) {
|
|
63
74
|
this._deck.setProps({
|
|
@@ -126,7 +137,11 @@ export default class MapboxOverlay implements IControl {
|
|
|
126
137
|
gl,
|
|
127
138
|
deck: new Deck({
|
|
128
139
|
...this._props,
|
|
129
|
-
gl
|
|
140
|
+
gl,
|
|
141
|
+
parameters: {...getDefaultParameters(map, false), ...this._props.parameters},
|
|
142
|
+
deviceProps: {
|
|
143
|
+
createCanvasContext: {autoResize: true}
|
|
144
|
+
}
|
|
130
145
|
})
|
|
131
146
|
});
|
|
132
147
|
|
|
@@ -214,6 +229,13 @@ export default class MapboxOverlay implements IControl {
|
|
|
214
229
|
|
|
215
230
|
private _handleStyleChange = () => {
|
|
216
231
|
resolveLayers(this._map, this._deck, this._props.layers, this._props.layers);
|
|
232
|
+
if (!this._map) return;
|
|
233
|
+
|
|
234
|
+
// getProjection() returns undefined before style is loaded
|
|
235
|
+
const projection = getProjection(this._map);
|
|
236
|
+
if (projection && !this._props.views) {
|
|
237
|
+
this._deck?.setProps({views: getDefaultView(this._map)});
|
|
238
|
+
}
|
|
217
239
|
};
|
|
218
240
|
|
|
219
241
|
private _updateContainerSize = () => {
|