[mapbox-gl] Update mapbox-gl to v1.7.0 (#42003)

This commit is contained in:
Dmytro Gokun
2020-01-31 13:26:23 -08:00
committed by GitHub
parent 338d1b8ada
commit 63bf4488c8
2 changed files with 24 additions and 6 deletions
+11 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for Mapbox GL JS 1.6
// Type definitions for Mapbox GL JS 1.7
// Project: https://github.com/mapbox/mapbox-gl-js
// Definitions by: Dominik Bruderer <https://github.com/dobrud>
// Patrick Reames <https://github.com/patrickr>
@@ -820,6 +820,11 @@ declare namespace mapboxgl {
closeOnClick?: boolean;
/**
* @param {boolean} [options.closeOnMove=false] If `true`, the popup will closed when the map moves.
*/
closeOnMove?: boolean;
anchor?: Anchor;
offset?: number | PointLike | { [key: string]: PointLike; };
@@ -864,6 +869,8 @@ declare namespace mapboxgl {
[sourceName: string]: AnySourceData;
}
export type PromoteIdSpecification = {[key: string]: string} | string;
export type AnySourceData = GeoJSONSourceRaw | VideoSourceRaw | ImageSourceRaw | CanvasSourceRaw | VectorSource | RasterSource | RasterDemSource
export type AnySourceImpl = GeoJSONSource | VideoSource | ImageSource | CanvasSource | VectorSource | RasterSource | RasterDemSource
@@ -914,6 +921,8 @@ declare namespace mapboxgl {
lineMetrics?: boolean;
generateId?: boolean;
promoteId?: PromoteIdSpecification;
}
/**
@@ -1002,6 +1011,7 @@ declare namespace mapboxgl {
minzoom?: number;
maxzoom?: number;
attribution?: string;
promoteId?: PromoteIdSpecification;
}
interface RasterSource extends Source {
+13 -5
View File
@@ -189,7 +189,8 @@ map.on('load', function() {
[-122.49378204345702, 37.83368330777276]
]
}
}
},
promoteId: {"original": "COUNTY"}
});
map.addLayer({
@@ -227,6 +228,12 @@ map.on('load', function() {
}
});
// Add a vector source
map.addSource("vector-source", {
type: "vector",
promoteId: {"original": "COUNTY"}
});
// Add a custom layer
map.addLayer({
id: 'custom',
@@ -365,8 +372,9 @@ map.removeFeatureState(featureIdentifier);
/**
* Popup
*/
const popupOptions = {
closeOnClick: false,
const popupOptions: mapboxgl.PopupOptions = {
closeOnClick: false,
closeOnMove: true,
closeButton: true,
anchor: 'top-right' as mapboxgl.Anchor,
offset: {
@@ -376,7 +384,7 @@ const popupOptions = {
className: 'custom-class',
maxWidth: '400px'
};
expectType<mapboxgl.PopupOptions>(popupOptions);
const popup = new mapboxgl.Popup(popupOptions)
.setLngLat([-50, 50])
.trackPointer()
@@ -398,7 +406,7 @@ var mapStyle = {
"sources": {
"mapbox": {
"type": "vector",
"url": "mapbox://mapbox.mapbox-streets-v6"
"url": "mapbox://mapbox.mapbox-streets-v6"
},
"overlay": {
"type": "image",