🤖 Merge PR #46865 [mapbox-gl] update to mapbox-gl 1.12 by @dmytro-gokun

This commit is contained in:
Dmytro Gokun 2020-09-14 10:08:43 +03:00 committed by GitHub
parent 392fb6935a
commit a797941634
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 2 deletions

View File

@ -1,4 +1,4 @@
// Type definitions for Mapbox GL JS 1.11
// Type definitions for Mapbox GL JS 1.12
// Project: https://github.com/mapbox/mapbox-gl-js
// Definitions by: Dominik Bruderer <https://github.com/dobrud>
// Patrick Reames <https://github.com/patrickr>
@ -1075,12 +1075,30 @@ declare namespace mapboxgl {
| RasterSource
| RasterDemSource;
interface VectorSourceImpl extends VectorSource {
/**
* Sets the source `tiles` property and re-renders the map.
*
* @param {string[]} tiles An array of one or more tile source URLs, as in the TileJSON spec.
* @returns {VectorTileSource} this
*/
setTiles(tiles: ReadonlyArray<string>): VectorSourceImpl;
/**
* Sets the source `url` property and re-renders the map.
*
* @param {string} url A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://<Tileset ID>`.
* @returns {VectorTileSource} this
*/
setUrl(url: string): VectorSourceImpl;
}
export type AnySourceImpl =
| GeoJSONSource
| VideoSource
| ImageSource
| CanvasSource
| VectorSource
| VectorSourceImpl
| RasterSource
| RasterDemSource;
@ -1147,6 +1165,8 @@ declare namespace mapboxgl {
generateId?: boolean;
promoteId?: PromoteIdSpecification;
filter?: any;
}
/**

View File

@ -124,6 +124,7 @@ map.on('load', function () {
clusterMinPoints: 8,
clusterRadius: 50, // Radius of each cluster when clustering points (defaults to 50)
clusterProperties: { sum: ['+', ['get', 'property']] },
filter: 'something',
});
map.addLayer({
@ -344,6 +345,15 @@ var videoSourceObj = new mapboxgl.VideoSource({
map.addSource('some id', videoSourceObj); // add
map.removeSource('some id'); // remove
/**
* Vector Source
*/
const vectorSource = map.getSource('tile-source') as mapboxgl.VectorSourceImpl;
// $ExpectType VectorSourceImpl
vectorSource.setTiles(['a', 'b']);
// $ExpectType VectorSourceImpl
vectorSource.setUrl('https://github.com');
/**
* Add Raster Source /// made URL optional to allow only tiles.
*/