update for mapbox-gl to v0.35.1 (#16005)

* update for mapbox-gl to v0.35.1

* fix to mapbox-gl update
This commit is contained in:
bryanjjohnson
2017-05-01 17:30:55 -06:00
committed by Mohamed Hegazy
parent 8279081781
commit d9be5adccd

View File

@@ -1,4 +1,4 @@
// Type definitions for Mapbox GL JS v0.30.0
// Type definitions for Mapbox GL JS v0.35.1
// Project: https://github.com/mapbox/mapbox-gl-js
// Definitions by: Dominik Bruderer <https://github.com/dobrud>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -9,6 +9,7 @@ declare namespace mapboxgl {
let accessToken: string;
let version: string;
export function supported(options?: {failIfMajorPerformanceCaveat?: boolean}): boolean;
export function setRTLTextPlugin(pluginURL: string, callback: Function): void;
/**
* Map
@@ -50,7 +51,7 @@ declare namespace mapboxgl {
queryRenderedFeatures(pointOrBox?: mapboxgl.Point|number[]|mapboxgl.Point[]|number[][], parameters?: {layers?: string[], filter?: any[]}): GeoJSON.Feature<GeoJSON.GeometryObject>[];
querySourceFeatures(sourceID: string, parameters: {sourceLayer?: string, filter?: any[]}): GeoJSON.Feature<GeoJSON.GeometryObject>[];
querySourceFeatures(sourceID: string, parameters?: {sourceLayer?: string, filter?: any[]}): GeoJSON.Feature<GeoJSON.GeometryObject>[];
setStyle(style: mapboxgl.Style | string): this;
@@ -58,10 +59,18 @@ declare namespace mapboxgl {
addSource(id: string, source: VectorSource | RasterSource | GeoJSONSource | ImageSource | VideoSource | GeoJSONSourceRaw): this;
isSourceLoaded(id: string): boolean;
removeSource(id: string): this;
getSource(id: string): VectorSource | RasterSource | GeoJSONSource | ImageSource | VideoSource;
addImage(name: string, image: HTMLImageElement | ArrayBufferView, options?: {width?: number, height?: number, pixelRatio?: number}): this;
removeImage(name: string): this;
loadImage(url: string, callback: Function): this;
addLayer(layer: mapboxgl.Layer, before?: string): this;
moveLayer(id: string, beforeId?: string): this;
@@ -84,6 +93,10 @@ declare namespace mapboxgl {
getLayoutProperty(layer: string, name: string, klass?: string): any;
setLight(options: mapboxgl.Light, lightOptions: any): this;
getLight(): mapboxgl.Light;
getContainer(): HTMLElement;
getCanvasContainer(): HTMLElement;
@@ -134,7 +147,7 @@ declare namespace mapboxgl {
setPitch(pitch: number, eventData?: EventData): this;
fitBounds(bounds: mapboxgl.LngLatBounds | number[][], options?: { linear?: boolean, easing?: Function, padding?: number, offset?: Point|number[],maxZoom?: number }): this;
fitBounds(bounds: mapboxgl.LngLatBounds | number[][], options?: { linear?: boolean, easing?: Function, padding?: number | mapboxgl.PaddingOptions, offset?: Point|number[],maxZoom?: number }, eventData?: mapboxgl.EventData): this;
jumpTo(options: mapboxgl.CameraOptions, eventData?: mapboxgl.EventData): this;
@@ -142,6 +155,8 @@ declare namespace mapboxgl {
flyTo(options: mapboxgl.FlyToOptions, eventData?: mapboxgl.EventData): this;
isMoving(): boolean;
stop(): this;
scrollZoom: ScrollZoomHandler;
@@ -201,6 +216,8 @@ declare namespace mapboxgl {
/** If true, enable keyboard shortcuts (see KeyboardHandler). */
keyboard?: boolean;
logoPosition?: boolean;
/** If set, the map is constrained to the given bounds. */
maxBounds?: mapboxgl.LngLatBounds | number[][];
@@ -215,6 +232,10 @@ declare namespace mapboxgl {
pitch?: number;
refreshExpiredTiles?: boolean;
renderWorldCopies?: boolean;
/** If true, enable the "scroll to zoom" interaction */
scrollZoom?: boolean;
@@ -231,6 +252,13 @@ declare namespace mapboxgl {
zoom?: number;
}
export class PaddingOptions extends Evented {
top: number;
bottom: number;
left: number;
right: number;
}
/**
* BoxZoomHandler
*/
@@ -368,7 +396,7 @@ declare namespace mapboxgl {
* Attribution
*/
export class AttributionControl extends Control {
constructor();
constructor(options?: {compact?: boolean});
}
/**
@@ -378,6 +406,13 @@ declare namespace mapboxgl {
constructor(options?: {maxWidth?: number, unit?: string})
}
/**
* Fullscreen
*/
export class FullscreenControl extends Control {
constructor();
}
/**
* Popup
*/
@@ -440,7 +475,7 @@ declare namespace mapboxgl {
}
export interface Source {
type: "vector" | "raster" | "geojson" | "image" | "video";
type: "vector" | "raster" | "geojson" | "image" | "video" | "canvas";
}
/**
@@ -511,6 +546,29 @@ declare namespace mapboxgl {
coordinates?: number[][];
}
/**
* CanvasSource
*/
export class CanvasSource implements Source, CanvasSourceOptions {
type: "canvas";
coordinates: number[][];
canvas: string;
getCanvas(): HTMLCanvasElement;
setCoordinates(coordinates: number[][]): this;
}
export interface CanvasSourceOptions {
coordinates: number[][];
animate?: boolean;
canvas: string;
}
interface VectorSource extends Source {
type: "vector";
url?: string;
@@ -540,6 +598,8 @@ declare namespace mapboxgl {
/** Return a new LngLat object whose longitude is wrapped to the range (-180, 180). */
wrap(): mapboxgl.LngLat;
wrapToBestWorld(center: mapboxgl.LngLat): mapboxgl.LngLat;
/** Return a LngLat as an array */
toArray(): number[];
@@ -665,8 +725,12 @@ declare namespace mapboxgl {
export class Evented {
on(type: string, listener: Function): this;
on(type: string, layer: string, listener: Function): this;
off(type?: string | any, listener?: Function): this;
off(type?: string | any, layer?: string, listener?: Function): this;
once(type: string, listener: Function): this;
fire(type: string, data?: mapboxgl.EventData | Object): this;
@@ -810,7 +874,7 @@ declare namespace mapboxgl {
export interface Layer {
id: string;
type?: "fill" | "line" | "symbol" | "circle" | "raster" | "background" | string; //TODO: Ideally we wouldn't accept string here, just these specific strings
type?: "fill" | "line" | "symbol" | "circle" | "fill-extrusion" | "raster" | "background";
metadata?: any;
ref?: string;
@@ -834,6 +898,7 @@ declare namespace mapboxgl {
property?: string;
base?: number;
type?: "identity" | "exponential" | "interval" | "categorical";
default?: any;
"colorSpace"?: "rgb" | "lab" | "interval";
}
@@ -881,14 +946,14 @@ declare namespace mapboxgl {
"line-round-limit"?: number;
}
export interface LinePaint {
"line-opacity"?: number;
"line-opacity"?: number | StyleFunction;
"line-color"?: string| StyleFunction;
"line-translate"?: number[];
"line-translate-anchor"?: "map" | "viewport";
"line-width"?: number;
"line-gap-width"?: number;
"line-offset"?: number;
"line-blur"?: number;
"line-gap-width"?: number | StyleFunction;
"line-offset"?: number | StyleFunction;
"line-blur"?: number | StyleFunction;
"line-dasharray"?: number[];
"line-dasharray-transition"?: Transition;
"line-pattern"?: string;
@@ -904,29 +969,29 @@ declare namespace mapboxgl {
"icon-ignore-placement"?: boolean;
"icon-optional"?: boolean;
"icon-rotation-alignment"?: "map" | "viewport" | "auto";
"icon-size"?: number;
"icon-size"?: number | StyleFunction;
"icon-text-fit"?: "none" | "both" | "width" | "height";
"icon-text-fit-padding"?: number[];
"icon-image"?: string;
"icon-image"?: string | StyleFunction;
"icon-rotate"?: number | StyleFunction;
"icon-padding"?: number;
"icon-keep-upright"?: boolean;
"icon-offset"?: number[] | StyleFunction;
"text-pitch-alignment"?: "map" | "viewport" | "auto";
"text-rotation-alignment"?: "map" | "viewport" | "auto";
"text-field"?: string;
"text-field"?: string | StyleFunction;
"text-font"?: string | string[];
"text-size"?: number;
"text-size"?: number | StyleFunction;
"text-max-width"?: number;
"text-line-height"?: number;
"text-letter-spacing"?: number;
"text-justify"?: "left" | "center" | "right";
"text-anchor"?: "center" | "left" | "right" | "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
"text-max-angle"?: number;
"text-rotate"?: number;
"text-rotate"?: number | StyleFunction;
"text-padding"?: number;
"text-keep-upright"?: boolean;
"text-transform"?: "none" | "uppercase" | "lowercase";
"text-transform"?: "none" | "uppercase" | "lowercase" | StyleFunction;
"text-offset"?: number[];
"text-allow-overlap"?: boolean;
"text-ignore-placement"?: boolean;
@@ -934,18 +999,18 @@ declare namespace mapboxgl {
}
export interface SymbolPaint {
"icon-opacity"?: number;
"icon-color"?: string;
"icon-halo-color"?: string;
"icon-halo-width"?: number;
"icon-halo-blur"?: number;
"icon-opacity"?: number | StyleFunction;
"icon-color"?: string | StyleFunction;
"icon-halo-color"?: string | StyleFunction;
"icon-halo-width"?: number | StyleFunction;
"icon-halo-blur"?: number | StyleFunction;
"icon-translate"?: number[];
"icon-translate-anchor"?: "map" | "viewport";
"text-opacity"?: number;
"text-color"?: "string";
"text-halo-color"?: "string";
"text-halo-width"?: number;
"text-halo-blur"?: number;
"text-opacity"?: number | StyleFunction;
"text-color"?: string | StyleFunction;
"text-halo-color"?: string | StyleFunction;
"text-halo-width"?: number | StyleFunction;
"text-halo-blur"?: number | StyleFunction;
"text-translate"?: number[];
"text-translate-anchor"?: "map" | "viewport";
}