@deck.gl/google-maps 9.2.8 → 9.2.10
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/dist.dev.js +74 -35
- package/dist/google-maps-overlay.d.ts +12 -4
- package/dist/google-maps-overlay.d.ts.map +1 -1
- package/dist/google-maps-overlay.js +78 -32
- package/dist/google-maps-overlay.js.map +1 -1
- package/dist/index.cjs +76 -37
- package/dist/index.cjs.map +2 -2
- package/dist/utils.d.ts +1 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +12 -7
- package/dist/utils.js.map +1 -1
- package/dist.min.js +2 -2
- package/package.json +2 -2
- package/src/google-maps-overlay.ts +86 -39
- package/src/utils.ts +13 -6
package/dist/dist.dev.js
CHANGED
|
@@ -7596,6 +7596,7 @@ ${source}`;
|
|
|
7596
7596
|
}
|
|
7597
7597
|
|
|
7598
7598
|
// src/utils.ts
|
|
7599
|
+
var POSITIONING_CONTAINER_ID = "deck-gl-google-maps-container";
|
|
7599
7600
|
var MAX_LATITUDE = 85.05113;
|
|
7600
7601
|
function createDeckInstance(map2, overlay, deck, props) {
|
|
7601
7602
|
if (deck) {
|
|
@@ -7613,7 +7614,8 @@ ${source}`;
|
|
|
7613
7614
|
};
|
|
7614
7615
|
const newDeck = new import_core25.Deck({
|
|
7615
7616
|
...props,
|
|
7616
|
-
|
|
7617
|
+
// Default to true for high-DPI displays, but allow user override
|
|
7618
|
+
useDevicePixels: props.useDevicePixels ?? true,
|
|
7617
7619
|
style: props.interleaved ? null : { pointerEvents: "none" },
|
|
7618
7620
|
parent: getContainer(overlay, props.style),
|
|
7619
7621
|
views: new import_core25.MapView({ repeat: true }),
|
|
@@ -7638,10 +7640,12 @@ ${source}`;
|
|
|
7638
7640
|
const container = document.createElement("div");
|
|
7639
7641
|
container.style.position = "absolute";
|
|
7640
7642
|
Object.assign(container.style, style);
|
|
7641
|
-
|
|
7643
|
+
const googleMapsContainer = overlay.getMap().getDiv();
|
|
7644
|
+
const positioningContainer = googleMapsContainer.querySelector(`#${POSITIONING_CONTAINER_ID}`);
|
|
7645
|
+
if (positioningContainer) {
|
|
7646
|
+
positioningContainer.appendChild(container);
|
|
7647
|
+
} else if ("getPanes" in overlay) {
|
|
7642
7648
|
overlay.getPanes()?.overlayLayer.appendChild(container);
|
|
7643
|
-
} else {
|
|
7644
|
-
overlay.getMap()?.getDiv().appendChild(container);
|
|
7645
7649
|
}
|
|
7646
7650
|
return container;
|
|
7647
7651
|
}
|
|
@@ -7820,6 +7824,7 @@ ${source}`;
|
|
|
7820
7824
|
this._map = null;
|
|
7821
7825
|
this._deck = null;
|
|
7822
7826
|
this._overlay = null;
|
|
7827
|
+
this._positioningOverlay = null;
|
|
7823
7828
|
this.setProps({ ...defaultProps, ...props });
|
|
7824
7829
|
}
|
|
7825
7830
|
/* Public API */
|
|
@@ -7834,6 +7839,7 @@ ${source}`;
|
|
|
7834
7839
|
this._overlay.requestRedraw();
|
|
7835
7840
|
}
|
|
7836
7841
|
this._overlay?.setMap(null);
|
|
7842
|
+
this._positioningOverlay?.setMap(null);
|
|
7837
7843
|
this._map = null;
|
|
7838
7844
|
}
|
|
7839
7845
|
if (map2) {
|
|
@@ -7885,30 +7891,45 @@ ${source}`;
|
|
|
7885
7891
|
}
|
|
7886
7892
|
/* Private API */
|
|
7887
7893
|
_createOverlay(map2) {
|
|
7888
|
-
const { interleaved } = this.props;
|
|
7889
7894
|
const { VECTOR, UNINITIALIZED } = google.maps.RenderingType;
|
|
7890
7895
|
const renderingType = map2.getRenderingType();
|
|
7891
7896
|
if (renderingType === UNINITIALIZED) {
|
|
7892
7897
|
return;
|
|
7893
7898
|
}
|
|
7894
7899
|
const isVectorMap = renderingType === VECTOR && google.maps.WebGLOverlayView;
|
|
7895
|
-
|
|
7896
|
-
|
|
7897
|
-
if (overlay instanceof google.maps.WebGLOverlayView) {
|
|
7898
|
-
if (interleaved) {
|
|
7899
|
-
overlay.onAdd = noop;
|
|
7900
|
-
overlay.onContextRestored = this._onContextRestored.bind(this);
|
|
7901
|
-
overlay.onDraw = this._onDrawVectorInterleaved.bind(this);
|
|
7902
|
-
} else {
|
|
7903
|
-
overlay.onAdd = this._onAdd.bind(this);
|
|
7904
|
-
overlay.onContextRestored = noop;
|
|
7905
|
-
overlay.onDraw = this._onDrawVectorOverlay.bind(this);
|
|
7906
|
-
}
|
|
7907
|
-
overlay.onContextLost = this._onContextLost.bind(this);
|
|
7900
|
+
if (isVectorMap) {
|
|
7901
|
+
this._createOverlayVector(map2);
|
|
7908
7902
|
} else {
|
|
7909
|
-
|
|
7910
|
-
overlay.draw = this._onDrawRaster.bind(this);
|
|
7903
|
+
this._createOverlayRaster(map2);
|
|
7911
7904
|
}
|
|
7905
|
+
}
|
|
7906
|
+
/**
|
|
7907
|
+
* Create overlays for vector maps.
|
|
7908
|
+
* Uses OverlayView for DOM positioning (correct z-index) and
|
|
7909
|
+
* WebGLOverlayView for camera data (smooth animations).
|
|
7910
|
+
* In interleaved mode, WebGLOverlayView also provides the shared GL context.
|
|
7911
|
+
*/
|
|
7912
|
+
_createOverlayVector(map2) {
|
|
7913
|
+
const interleaved = this.props.interleaved ?? defaultProps.interleaved;
|
|
7914
|
+
const positioningOverlay = new google.maps.OverlayView();
|
|
7915
|
+
positioningOverlay.onAdd = this._onAddVectorOverlay.bind(this);
|
|
7916
|
+
positioningOverlay.draw = this._updateContainerSize.bind(this);
|
|
7917
|
+
positioningOverlay.onRemove = this._onRemove.bind(this);
|
|
7918
|
+
this._positioningOverlay = positioningOverlay;
|
|
7919
|
+
this._positioningOverlay.setMap(map2);
|
|
7920
|
+
const overlay = new google.maps.WebGLOverlayView();
|
|
7921
|
+
overlay.onAdd = noop;
|
|
7922
|
+
overlay.onContextRestored = interleaved ? this._onContextRestored.bind(this) : noop;
|
|
7923
|
+
overlay.onDraw = this._onDrawVector.bind(this);
|
|
7924
|
+
overlay.onContextLost = interleaved ? this._onContextLost.bind(this) : noop;
|
|
7925
|
+
overlay.onRemove = interleaved ? this._onRemove.bind(this) : noop;
|
|
7926
|
+
this._overlay = overlay;
|
|
7927
|
+
this._overlay.setMap(map2);
|
|
7928
|
+
}
|
|
7929
|
+
_createOverlayRaster(map2) {
|
|
7930
|
+
const overlay = new google.maps.OverlayView();
|
|
7931
|
+
overlay.onAdd = this._onAdd.bind(this);
|
|
7932
|
+
overlay.draw = this._onDrawRaster.bind(this);
|
|
7912
7933
|
overlay.onRemove = this._onRemove.bind(this);
|
|
7913
7934
|
this._overlay = overlay;
|
|
7914
7935
|
this._overlay.setMap(map2);
|
|
@@ -7916,6 +7937,33 @@ ${source}`;
|
|
|
7916
7937
|
_onAdd() {
|
|
7917
7938
|
this._deck = createDeckInstance(this._map, this._overlay, this._deck, this.props);
|
|
7918
7939
|
}
|
|
7940
|
+
_onAddVectorOverlay() {
|
|
7941
|
+
const overlay = this._positioningOverlay;
|
|
7942
|
+
const panes = overlay.getPanes();
|
|
7943
|
+
if (panes) {
|
|
7944
|
+
const container = document.createElement("div");
|
|
7945
|
+
container.id = POSITIONING_CONTAINER_ID;
|
|
7946
|
+
container.style.position = "absolute";
|
|
7947
|
+
panes.overlayLayer.appendChild(container);
|
|
7948
|
+
}
|
|
7949
|
+
this._deck = createDeckInstance(this._map, overlay, this._deck, this.props);
|
|
7950
|
+
}
|
|
7951
|
+
_updateContainerSize() {
|
|
7952
|
+
if (!this._map)
|
|
7953
|
+
return;
|
|
7954
|
+
const container = this._map.getDiv().querySelector(`#${POSITIONING_CONTAINER_ID}`);
|
|
7955
|
+
if (!container)
|
|
7956
|
+
return;
|
|
7957
|
+
const mapContainer = this._map.getDiv().firstChild;
|
|
7958
|
+
if (!mapContainer)
|
|
7959
|
+
return;
|
|
7960
|
+
const width = mapContainer.offsetWidth;
|
|
7961
|
+
const height = mapContainer.offsetHeight;
|
|
7962
|
+
container.style.width = `${width}px`;
|
|
7963
|
+
container.style.height = `${height}px`;
|
|
7964
|
+
container.style.left = `${-width / 2}px`;
|
|
7965
|
+
container.style.top = `${-height / 2}px`;
|
|
7966
|
+
}
|
|
7919
7967
|
_onContextRestored({ gl }) {
|
|
7920
7968
|
if (!this._map || !this._overlay) {
|
|
7921
7969
|
return;
|
|
@@ -7975,19 +8023,18 @@ ${source}`;
|
|
|
7975
8023
|
});
|
|
7976
8024
|
deck.redraw();
|
|
7977
8025
|
}
|
|
7978
|
-
|
|
7979
|
-
_onDrawVectorInterleaved({ gl, transformer }) {
|
|
8026
|
+
_onDrawVector({ gl, transformer }) {
|
|
7980
8027
|
if (!this._deck || !this._map) {
|
|
7981
8028
|
return;
|
|
7982
8029
|
}
|
|
7983
8030
|
const deck = this._deck;
|
|
8031
|
+
const { interleaved } = this.props;
|
|
7984
8032
|
deck.setProps({
|
|
7985
8033
|
...getViewPropsFromCoordinateTransformer(this._map, transformer),
|
|
7986
8034
|
// Using external gl context - do not set css size
|
|
7987
|
-
width: null,
|
|
7988
|
-
height: null
|
|
8035
|
+
...interleaved && { width: null, height: null }
|
|
7989
8036
|
});
|
|
7990
|
-
if (deck.isInitialized) {
|
|
8037
|
+
if (interleaved && deck.isInitialized) {
|
|
7991
8038
|
const device = deck.device;
|
|
7992
8039
|
if (device instanceof WebGLDevice) {
|
|
7993
8040
|
const _framebuffer = device.getParametersWebGL(GLEnum.FRAMEBUFFER_BINDING);
|
|
@@ -8006,18 +8053,10 @@ ${source}`;
|
|
|
8006
8053
|
});
|
|
8007
8054
|
});
|
|
8008
8055
|
}
|
|
8056
|
+
} else if (!interleaved) {
|
|
8057
|
+
deck.redraw();
|
|
8009
8058
|
}
|
|
8010
8059
|
}
|
|
8011
|
-
_onDrawVectorOverlay({ transformer }) {
|
|
8012
|
-
if (!this._deck || !this._map) {
|
|
8013
|
-
return;
|
|
8014
|
-
}
|
|
8015
|
-
const deck = this._deck;
|
|
8016
|
-
deck.setProps({
|
|
8017
|
-
...getViewPropsFromCoordinateTransformer(this._map, transformer)
|
|
8018
|
-
});
|
|
8019
|
-
deck.redraw();
|
|
8020
|
-
}
|
|
8021
8060
|
};
|
|
8022
8061
|
return __toCommonJS(bundle_exports);
|
|
8023
8062
|
})();
|
|
@@ -7,6 +7,7 @@ export default class GoogleMapsOverlay {
|
|
|
7
7
|
private _map;
|
|
8
8
|
private _deck;
|
|
9
9
|
private _overlay;
|
|
10
|
+
private _positioningOverlay;
|
|
10
11
|
constructor(props: GoogleMapsOverlayProps);
|
|
11
12
|
/** Add/remove the overlay from a map. */
|
|
12
13
|
setMap(map: google.maps.Map | null): void;
|
|
@@ -65,19 +66,26 @@ export default class GoogleMapsOverlay {
|
|
|
65
66
|
/** Remove the overlay and release all underlying resources. */
|
|
66
67
|
finalize(): void;
|
|
67
68
|
_createOverlay(map: google.maps.Map): void;
|
|
69
|
+
/**
|
|
70
|
+
* Create overlays for vector maps.
|
|
71
|
+
* Uses OverlayView for DOM positioning (correct z-index) and
|
|
72
|
+
* WebGLOverlayView for camera data (smooth animations).
|
|
73
|
+
* In interleaved mode, WebGLOverlayView also provides the shared GL context.
|
|
74
|
+
*/
|
|
75
|
+
_createOverlayVector(map: google.maps.Map): void;
|
|
76
|
+
_createOverlayRaster(map: google.maps.Map): void;
|
|
68
77
|
_onAdd(): void;
|
|
78
|
+
_onAddVectorOverlay(): void;
|
|
79
|
+
_updateContainerSize(): void;
|
|
69
80
|
_onContextRestored({ gl }: {
|
|
70
81
|
gl: any;
|
|
71
82
|
}): void;
|
|
72
83
|
_onContextLost(): void;
|
|
73
84
|
_onRemove(): void;
|
|
74
85
|
_onDrawRaster(): void;
|
|
75
|
-
|
|
86
|
+
_onDrawVector({ gl, transformer }: {
|
|
76
87
|
gl: any;
|
|
77
88
|
transformer: any;
|
|
78
89
|
}): void;
|
|
79
|
-
_onDrawVectorOverlay({ transformer }: {
|
|
80
|
-
transformer: any;
|
|
81
|
-
}): void;
|
|
82
90
|
}
|
|
83
91
|
//# sourceMappingURL=google-maps-overlay.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google-maps-overlay.d.ts","sourceRoot":"","sources":["../src/google-maps-overlay.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"google-maps-overlay.d.ts","sourceRoot":"","sources":["../src/google-maps-overlay.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAC,SAAS,EAAe,MAAM,eAAe,CAAC;AAkB3D,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACvC,SAAS,EACP,OAAO,GACP,QAAQ,GACR,IAAI,GACJ,aAAa,GACb,QAAQ,GACR,QAAQ,GACR,eAAe,GACf,WAAW,GACX,kBAAkB,GAClB,YAAY,CACf,GAAG;IACF,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,iBAAiB;IACpC,OAAO,CAAC,KAAK,CAA8B;IAC3C,OAAO,CAAC,IAAI,CAAgC;IAC5C,OAAO,CAAC,KAAK,CAAqB;IAClC,OAAO,CAAC,QAAQ,CAAuE;IACvF,OAAO,CAAC,mBAAmB,CAAwC;gBAEvD,KAAK,EAAE,sBAAsB;IAMzC,yCAAyC;IACzC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,GAAG,IAAI;IA2BzC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,sBAAsB,CAAC,GAAG,IAAI;IAatD,uCAAuC;IACvC,UAAU,CAAC,MAAM,KAAA;;;;;;;;;;;;;;;IAIjB,yCAAyC;IACzC,mBAAmB,CAAC,MAAM,KAAA;;;;;;;;;;;;;;;IAI1B,gDAAgD;IAChD,WAAW,CAAC,MAAM,KAAA;;;;;;;;;;;;;;;IAIlB,+DAA+D;IAC/D,QAAQ;IASR,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG;IAenC;;;;;OAKG;IACH,oBAAoB,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG;IAqBzC,oBAAoB,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG;IAUzC,MAAM;IAKN,mBAAmB;IAiBnB,oBAAoB;IAsBpB,kBAAkB,CAAC,EAAC,EAAE,EAAC;;KAAA;IAgCvB,cAAc;IAQd,SAAS;IAIT,aAAa;IA8Bb,aAAa,CAAC,EAAC,EAAE,EAAE,WAAW,EAAC;;;KAAA;CAiDhC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
/* global google */
|
|
5
5
|
import { GL } from '@luma.gl/constants';
|
|
6
6
|
import { WebGLDevice } from '@luma.gl/webgl';
|
|
7
|
-
import { createDeckInstance, destroyDeckInstance, getViewPropsFromOverlay, getViewPropsFromCoordinateTransformer } from "./utils.js";
|
|
7
|
+
import { createDeckInstance, destroyDeckInstance, getViewPropsFromOverlay, getViewPropsFromCoordinateTransformer, POSITIONING_CONTAINER_ID } from "./utils.js";
|
|
8
8
|
const HIDE_ALL_LAYERS = () => false;
|
|
9
9
|
const GL_STATE = {
|
|
10
10
|
depthMask: true,
|
|
@@ -24,6 +24,7 @@ export default class GoogleMapsOverlay {
|
|
|
24
24
|
this._map = null;
|
|
25
25
|
this._deck = null;
|
|
26
26
|
this._overlay = null;
|
|
27
|
+
this._positioningOverlay = null;
|
|
27
28
|
this.setProps({ ...defaultProps, ...props });
|
|
28
29
|
}
|
|
29
30
|
/* Public API */
|
|
@@ -38,6 +39,7 @@ export default class GoogleMapsOverlay {
|
|
|
38
39
|
this._overlay.requestRedraw();
|
|
39
40
|
}
|
|
40
41
|
this._overlay?.setMap(null);
|
|
42
|
+
this._positioningOverlay?.setMap(null);
|
|
41
43
|
this._map = null;
|
|
42
44
|
}
|
|
43
45
|
if (map) {
|
|
@@ -90,32 +92,49 @@ export default class GoogleMapsOverlay {
|
|
|
90
92
|
}
|
|
91
93
|
/* Private API */
|
|
92
94
|
_createOverlay(map) {
|
|
93
|
-
const { interleaved } = this.props;
|
|
94
95
|
const { VECTOR, UNINITIALIZED } = google.maps.RenderingType;
|
|
95
96
|
const renderingType = map.getRenderingType();
|
|
96
97
|
if (renderingType === UNINITIALIZED) {
|
|
97
98
|
return;
|
|
98
99
|
}
|
|
99
100
|
const isVectorMap = renderingType === VECTOR && google.maps.WebGLOverlayView;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
if (overlay instanceof google.maps.WebGLOverlayView) {
|
|
103
|
-
if (interleaved) {
|
|
104
|
-
overlay.onAdd = noop;
|
|
105
|
-
overlay.onContextRestored = this._onContextRestored.bind(this);
|
|
106
|
-
overlay.onDraw = this._onDrawVectorInterleaved.bind(this);
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
overlay.onAdd = this._onAdd.bind(this);
|
|
110
|
-
overlay.onContextRestored = noop;
|
|
111
|
-
overlay.onDraw = this._onDrawVectorOverlay.bind(this);
|
|
112
|
-
}
|
|
113
|
-
overlay.onContextLost = this._onContextLost.bind(this);
|
|
101
|
+
if (isVectorMap) {
|
|
102
|
+
this._createOverlayVector(map);
|
|
114
103
|
}
|
|
115
104
|
else {
|
|
116
|
-
|
|
117
|
-
overlay.draw = this._onDrawRaster.bind(this);
|
|
105
|
+
this._createOverlayRaster(map);
|
|
118
106
|
}
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Create overlays for vector maps.
|
|
110
|
+
* Uses OverlayView for DOM positioning (correct z-index) and
|
|
111
|
+
* WebGLOverlayView for camera data (smooth animations).
|
|
112
|
+
* In interleaved mode, WebGLOverlayView also provides the shared GL context.
|
|
113
|
+
*/
|
|
114
|
+
_createOverlayVector(map) {
|
|
115
|
+
const interleaved = this.props.interleaved ?? defaultProps.interleaved;
|
|
116
|
+
// Create positioning overlay for proper DOM placement
|
|
117
|
+
const positioningOverlay = new google.maps.OverlayView();
|
|
118
|
+
positioningOverlay.onAdd = this._onAddVectorOverlay.bind(this);
|
|
119
|
+
positioningOverlay.draw = this._updateContainerSize.bind(this);
|
|
120
|
+
positioningOverlay.onRemove = this._onRemove.bind(this);
|
|
121
|
+
this._positioningOverlay = positioningOverlay;
|
|
122
|
+
this._positioningOverlay.setMap(map);
|
|
123
|
+
// Create WebGL overlay for camera data (and GL context if interleaved)
|
|
124
|
+
const overlay = new google.maps.WebGLOverlayView();
|
|
125
|
+
overlay.onAdd = noop;
|
|
126
|
+
overlay.onContextRestored = interleaved ? this._onContextRestored.bind(this) : noop;
|
|
127
|
+
overlay.onDraw = this._onDrawVector.bind(this);
|
|
128
|
+
overlay.onContextLost = interleaved ? this._onContextLost.bind(this) : noop;
|
|
129
|
+
overlay.onRemove = interleaved ? this._onRemove.bind(this) : noop;
|
|
130
|
+
this._overlay = overlay;
|
|
131
|
+
this._overlay.setMap(map);
|
|
132
|
+
}
|
|
133
|
+
_createOverlayRaster(map) {
|
|
134
|
+
// Raster maps use standard OverlayView
|
|
135
|
+
const overlay = new google.maps.OverlayView();
|
|
136
|
+
overlay.onAdd = this._onAdd.bind(this);
|
|
137
|
+
overlay.draw = this._onDrawRaster.bind(this);
|
|
119
138
|
overlay.onRemove = this._onRemove.bind(this);
|
|
120
139
|
this._overlay = overlay;
|
|
121
140
|
this._overlay.setMap(map);
|
|
@@ -124,6 +143,41 @@ export default class GoogleMapsOverlay {
|
|
|
124
143
|
// @ts-ignore (TS2345) map is defined at this stage
|
|
125
144
|
this._deck = createDeckInstance(this._map, this._overlay, this._deck, this.props);
|
|
126
145
|
}
|
|
146
|
+
_onAddVectorOverlay() {
|
|
147
|
+
// For non-interleaved vector maps, create a positioning container
|
|
148
|
+
// that Google Maps will place correctly in the DOM with proper z-index
|
|
149
|
+
const overlay = this._positioningOverlay;
|
|
150
|
+
const panes = overlay.getPanes();
|
|
151
|
+
if (panes) {
|
|
152
|
+
const container = document.createElement('div');
|
|
153
|
+
container.id = POSITIONING_CONTAINER_ID;
|
|
154
|
+
container.style.position = 'absolute';
|
|
155
|
+
panes.overlayLayer.appendChild(container);
|
|
156
|
+
}
|
|
157
|
+
// @ts-ignore (TS2345) map is defined at this stage
|
|
158
|
+
// Pass the positioning overlay for deck canvas creation (not WebGL overlay)
|
|
159
|
+
this._deck = createDeckInstance(this._map, overlay, this._deck, this.props);
|
|
160
|
+
}
|
|
161
|
+
_updateContainerSize() {
|
|
162
|
+
// Update positioning container size and position to match map
|
|
163
|
+
if (!this._map)
|
|
164
|
+
return;
|
|
165
|
+
const container = this._map
|
|
166
|
+
.getDiv()
|
|
167
|
+
.querySelector(`#${POSITIONING_CONTAINER_ID}`);
|
|
168
|
+
if (!container)
|
|
169
|
+
return;
|
|
170
|
+
const mapContainer = this._map.getDiv().firstChild;
|
|
171
|
+
if (!mapContainer)
|
|
172
|
+
return;
|
|
173
|
+
const width = mapContainer.offsetWidth;
|
|
174
|
+
const height = mapContainer.offsetHeight;
|
|
175
|
+
container.style.width = `${width}px`;
|
|
176
|
+
container.style.height = `${height}px`;
|
|
177
|
+
// Position at top-left (overlayLayer uses centered coords, so offset by half)
|
|
178
|
+
container.style.left = `${-width / 2}px`;
|
|
179
|
+
container.style.top = `${-height / 2}px`;
|
|
180
|
+
}
|
|
127
181
|
_onContextRestored({ gl }) {
|
|
128
182
|
if (!this._map || !this._overlay) {
|
|
129
183
|
return;
|
|
@@ -187,19 +241,18 @@ export default class GoogleMapsOverlay {
|
|
|
187
241
|
// Deck is initialized
|
|
188
242
|
deck.redraw();
|
|
189
243
|
}
|
|
190
|
-
|
|
191
|
-
_onDrawVectorInterleaved({ gl, transformer }) {
|
|
244
|
+
_onDrawVector({ gl, transformer }) {
|
|
192
245
|
if (!this._deck || !this._map) {
|
|
193
246
|
return;
|
|
194
247
|
}
|
|
195
248
|
const deck = this._deck;
|
|
249
|
+
const { interleaved } = this.props;
|
|
196
250
|
deck.setProps({
|
|
197
251
|
...getViewPropsFromCoordinateTransformer(this._map, transformer),
|
|
198
252
|
// Using external gl context - do not set css size
|
|
199
|
-
width: null,
|
|
200
|
-
height: null
|
|
253
|
+
...(interleaved && { width: null, height: null })
|
|
201
254
|
});
|
|
202
|
-
if (deck.isInitialized) {
|
|
255
|
+
if (interleaved && deck.isInitialized) {
|
|
203
256
|
// @ts-expect-error
|
|
204
257
|
const device = deck.device;
|
|
205
258
|
// As an optimization, some renders are to an separate framebuffer
|
|
@@ -227,16 +280,9 @@ export default class GoogleMapsOverlay {
|
|
|
227
280
|
});
|
|
228
281
|
}
|
|
229
282
|
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
if (!this._deck || !this._map) {
|
|
233
|
-
return;
|
|
283
|
+
else if (!interleaved) {
|
|
284
|
+
deck.redraw();
|
|
234
285
|
}
|
|
235
|
-
const deck = this._deck;
|
|
236
|
-
deck.setProps({
|
|
237
|
-
...getViewPropsFromCoordinateTransformer(this._map, transformer)
|
|
238
|
-
});
|
|
239
|
-
deck.redraw();
|
|
240
286
|
}
|
|
241
287
|
}
|
|
242
288
|
//# sourceMappingURL=google-maps-overlay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google-maps-overlay.js","sourceRoot":"","sources":["../src/google-maps-overlay.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,mBAAmB;AACnB,OAAO,EAAC,EAAE,EAAe,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,qCAAqC,
|
|
1
|
+
{"version":3,"file":"google-maps-overlay.js","sourceRoot":"","sources":["../src/google-maps-overlay.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,mBAAmB;AACnB,OAAO,EAAC,EAAE,EAAe,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,qCAAqC,EACrC,wBAAwB,EACzB,mBAAgB;AAKjB,MAAM,eAAe,GAAG,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CAAC,CAAC;YAE3C,kEAAkE;YAClE,yBAAyB;YACzB,IAAI,MAAM,YAAY,WAAW,EAAE,CAAC;gBAClC,MAAM,CAAC,kBAAkB,CAAC;oBACxB,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC;oBACnD,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC;oBAClD,WAAW,EAAE,MAAY,CAAC,EAAE,GAAG,OAAa,CAAC,EAAE,GAAG,CAAC;iBACpD,CAAC,CAAC;gBAEH,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,GAAG,EAAE;oBACxC,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE;wBAChC,WAAW,EAAE,KAAK;qBACnB,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;aAAM,IAAI,CAAC,WAAW,EAAE,CAAC;YACxB,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,CAAC;IACH,CAAC;CACF"}
|
package/dist/index.cjs
CHANGED
|
@@ -31,6 +31,7 @@ var import_webgl = require("@luma.gl/webgl");
|
|
|
31
31
|
// dist/utils.js
|
|
32
32
|
var import_core = require("@deck.gl/core");
|
|
33
33
|
var import_core2 = require("@math.gl/core");
|
|
34
|
+
var POSITIONING_CONTAINER_ID = "deck-gl-google-maps-container";
|
|
34
35
|
var MAX_LATITUDE = 85.05113;
|
|
35
36
|
function createDeckInstance(map, overlay, deck, props) {
|
|
36
37
|
if (deck) {
|
|
@@ -48,7 +49,8 @@ function createDeckInstance(map, overlay, deck, props) {
|
|
|
48
49
|
};
|
|
49
50
|
const newDeck = new import_core.Deck({
|
|
50
51
|
...props,
|
|
51
|
-
|
|
52
|
+
// Default to true for high-DPI displays, but allow user override
|
|
53
|
+
useDevicePixels: props.useDevicePixels ?? true,
|
|
52
54
|
style: props.interleaved ? null : { pointerEvents: "none" },
|
|
53
55
|
parent: getContainer(overlay, props.style),
|
|
54
56
|
views: new import_core.MapView({ repeat: true }),
|
|
@@ -67,14 +69,16 @@ function createDeckInstance(map, overlay, deck, props) {
|
|
|
67
69
|
return newDeck;
|
|
68
70
|
}
|
|
69
71
|
function getContainer(overlay, style) {
|
|
70
|
-
var _a
|
|
72
|
+
var _a;
|
|
71
73
|
const container = document.createElement("div");
|
|
72
74
|
container.style.position = "absolute";
|
|
73
75
|
Object.assign(container.style, style);
|
|
74
|
-
|
|
76
|
+
const googleMapsContainer = overlay.getMap().getDiv();
|
|
77
|
+
const positioningContainer = googleMapsContainer.querySelector(`#${POSITIONING_CONTAINER_ID}`);
|
|
78
|
+
if (positioningContainer) {
|
|
79
|
+
positioningContainer.appendChild(container);
|
|
80
|
+
} else if ("getPanes" in overlay) {
|
|
75
81
|
(_a = overlay.getPanes()) == null ? void 0 : _a.overlayLayer.appendChild(container);
|
|
76
|
-
} else {
|
|
77
|
-
(_b = overlay.getMap()) == null ? void 0 : _b.getDiv().appendChild(container);
|
|
78
82
|
}
|
|
79
83
|
return container;
|
|
80
84
|
}
|
|
@@ -253,12 +257,13 @@ var GoogleMapsOverlay = class {
|
|
|
253
257
|
this._map = null;
|
|
254
258
|
this._deck = null;
|
|
255
259
|
this._overlay = null;
|
|
260
|
+
this._positioningOverlay = null;
|
|
256
261
|
this.setProps({ ...defaultProps, ...props });
|
|
257
262
|
}
|
|
258
263
|
/* Public API */
|
|
259
264
|
/** Add/remove the overlay from a map. */
|
|
260
265
|
setMap(map) {
|
|
261
|
-
var _a;
|
|
266
|
+
var _a, _b;
|
|
262
267
|
if (map === this._map) {
|
|
263
268
|
return;
|
|
264
269
|
}
|
|
@@ -268,6 +273,7 @@ var GoogleMapsOverlay = class {
|
|
|
268
273
|
this._overlay.requestRedraw();
|
|
269
274
|
}
|
|
270
275
|
(_a = this._overlay) == null ? void 0 : _a.setMap(null);
|
|
276
|
+
(_b = this._positioningOverlay) == null ? void 0 : _b.setMap(null);
|
|
271
277
|
this._map = null;
|
|
272
278
|
}
|
|
273
279
|
if (map) {
|
|
@@ -319,30 +325,45 @@ var GoogleMapsOverlay = class {
|
|
|
319
325
|
}
|
|
320
326
|
/* Private API */
|
|
321
327
|
_createOverlay(map) {
|
|
322
|
-
const { interleaved } = this.props;
|
|
323
328
|
const { VECTOR, UNINITIALIZED } = google.maps.RenderingType;
|
|
324
329
|
const renderingType = map.getRenderingType();
|
|
325
330
|
if (renderingType === UNINITIALIZED) {
|
|
326
331
|
return;
|
|
327
332
|
}
|
|
328
333
|
const isVectorMap = renderingType === VECTOR && google.maps.WebGLOverlayView;
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
if (overlay instanceof google.maps.WebGLOverlayView) {
|
|
332
|
-
if (interleaved) {
|
|
333
|
-
overlay.onAdd = noop;
|
|
334
|
-
overlay.onContextRestored = this._onContextRestored.bind(this);
|
|
335
|
-
overlay.onDraw = this._onDrawVectorInterleaved.bind(this);
|
|
336
|
-
} else {
|
|
337
|
-
overlay.onAdd = this._onAdd.bind(this);
|
|
338
|
-
overlay.onContextRestored = noop;
|
|
339
|
-
overlay.onDraw = this._onDrawVectorOverlay.bind(this);
|
|
340
|
-
}
|
|
341
|
-
overlay.onContextLost = this._onContextLost.bind(this);
|
|
334
|
+
if (isVectorMap) {
|
|
335
|
+
this._createOverlayVector(map);
|
|
342
336
|
} else {
|
|
343
|
-
|
|
344
|
-
overlay.draw = this._onDrawRaster.bind(this);
|
|
337
|
+
this._createOverlayRaster(map);
|
|
345
338
|
}
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Create overlays for vector maps.
|
|
342
|
+
* Uses OverlayView for DOM positioning (correct z-index) and
|
|
343
|
+
* WebGLOverlayView for camera data (smooth animations).
|
|
344
|
+
* In interleaved mode, WebGLOverlayView also provides the shared GL context.
|
|
345
|
+
*/
|
|
346
|
+
_createOverlayVector(map) {
|
|
347
|
+
const interleaved = this.props.interleaved ?? defaultProps.interleaved;
|
|
348
|
+
const positioningOverlay = new google.maps.OverlayView();
|
|
349
|
+
positioningOverlay.onAdd = this._onAddVectorOverlay.bind(this);
|
|
350
|
+
positioningOverlay.draw = this._updateContainerSize.bind(this);
|
|
351
|
+
positioningOverlay.onRemove = this._onRemove.bind(this);
|
|
352
|
+
this._positioningOverlay = positioningOverlay;
|
|
353
|
+
this._positioningOverlay.setMap(map);
|
|
354
|
+
const overlay = new google.maps.WebGLOverlayView();
|
|
355
|
+
overlay.onAdd = noop;
|
|
356
|
+
overlay.onContextRestored = interleaved ? this._onContextRestored.bind(this) : noop;
|
|
357
|
+
overlay.onDraw = this._onDrawVector.bind(this);
|
|
358
|
+
overlay.onContextLost = interleaved ? this._onContextLost.bind(this) : noop;
|
|
359
|
+
overlay.onRemove = interleaved ? this._onRemove.bind(this) : noop;
|
|
360
|
+
this._overlay = overlay;
|
|
361
|
+
this._overlay.setMap(map);
|
|
362
|
+
}
|
|
363
|
+
_createOverlayRaster(map) {
|
|
364
|
+
const overlay = new google.maps.OverlayView();
|
|
365
|
+
overlay.onAdd = this._onAdd.bind(this);
|
|
366
|
+
overlay.draw = this._onDrawRaster.bind(this);
|
|
346
367
|
overlay.onRemove = this._onRemove.bind(this);
|
|
347
368
|
this._overlay = overlay;
|
|
348
369
|
this._overlay.setMap(map);
|
|
@@ -350,6 +371,33 @@ var GoogleMapsOverlay = class {
|
|
|
350
371
|
_onAdd() {
|
|
351
372
|
this._deck = createDeckInstance(this._map, this._overlay, this._deck, this.props);
|
|
352
373
|
}
|
|
374
|
+
_onAddVectorOverlay() {
|
|
375
|
+
const overlay = this._positioningOverlay;
|
|
376
|
+
const panes = overlay.getPanes();
|
|
377
|
+
if (panes) {
|
|
378
|
+
const container = document.createElement("div");
|
|
379
|
+
container.id = POSITIONING_CONTAINER_ID;
|
|
380
|
+
container.style.position = "absolute";
|
|
381
|
+
panes.overlayLayer.appendChild(container);
|
|
382
|
+
}
|
|
383
|
+
this._deck = createDeckInstance(this._map, overlay, this._deck, this.props);
|
|
384
|
+
}
|
|
385
|
+
_updateContainerSize() {
|
|
386
|
+
if (!this._map)
|
|
387
|
+
return;
|
|
388
|
+
const container = this._map.getDiv().querySelector(`#${POSITIONING_CONTAINER_ID}`);
|
|
389
|
+
if (!container)
|
|
390
|
+
return;
|
|
391
|
+
const mapContainer = this._map.getDiv().firstChild;
|
|
392
|
+
if (!mapContainer)
|
|
393
|
+
return;
|
|
394
|
+
const width = mapContainer.offsetWidth;
|
|
395
|
+
const height = mapContainer.offsetHeight;
|
|
396
|
+
container.style.width = `${width}px`;
|
|
397
|
+
container.style.height = `${height}px`;
|
|
398
|
+
container.style.left = `${-width / 2}px`;
|
|
399
|
+
container.style.top = `${-height / 2}px`;
|
|
400
|
+
}
|
|
353
401
|
_onContextRestored({ gl }) {
|
|
354
402
|
if (!this._map || !this._overlay) {
|
|
355
403
|
return;
|
|
@@ -407,19 +455,18 @@ var GoogleMapsOverlay = class {
|
|
|
407
455
|
});
|
|
408
456
|
deck.redraw();
|
|
409
457
|
}
|
|
410
|
-
|
|
411
|
-
_onDrawVectorInterleaved({ gl, transformer }) {
|
|
458
|
+
_onDrawVector({ gl, transformer }) {
|
|
412
459
|
if (!this._deck || !this._map) {
|
|
413
460
|
return;
|
|
414
461
|
}
|
|
415
462
|
const deck = this._deck;
|
|
463
|
+
const { interleaved } = this.props;
|
|
416
464
|
deck.setProps({
|
|
417
465
|
...getViewPropsFromCoordinateTransformer(this._map, transformer),
|
|
418
466
|
// Using external gl context - do not set css size
|
|
419
|
-
width: null,
|
|
420
|
-
height: null
|
|
467
|
+
...interleaved && { width: null, height: null }
|
|
421
468
|
});
|
|
422
|
-
if (deck.isInitialized) {
|
|
469
|
+
if (interleaved && deck.isInitialized) {
|
|
423
470
|
const device = deck.device;
|
|
424
471
|
if (device instanceof import_webgl.WebGLDevice) {
|
|
425
472
|
const _framebuffer = device.getParametersWebGL(36006);
|
|
@@ -438,17 +485,9 @@ var GoogleMapsOverlay = class {
|
|
|
438
485
|
});
|
|
439
486
|
});
|
|
440
487
|
}
|
|
488
|
+
} else if (!interleaved) {
|
|
489
|
+
deck.redraw();
|
|
441
490
|
}
|
|
442
491
|
}
|
|
443
|
-
_onDrawVectorOverlay({ transformer }) {
|
|
444
|
-
if (!this._deck || !this._map) {
|
|
445
|
-
return;
|
|
446
|
-
}
|
|
447
|
-
const deck = this._deck;
|
|
448
|
-
deck.setProps({
|
|
449
|
-
...getViewPropsFromCoordinateTransformer(this._map, transformer)
|
|
450
|
-
});
|
|
451
|
-
deck.redraw();
|
|
452
|
-
}
|
|
453
492
|
};
|
|
454
493
|
//# sourceMappingURL=index.cjs.map
|