mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
[@types/mapbox-gl] Expose MercatorCoordinate class (#35553)
This commit is contained in:
parent
d625bf3d51
commit
a4ca3e967b
29
types/mapbox-gl/index.d.ts
vendored
29
types/mapbox-gl/index.d.ts
vendored
@ -971,6 +971,35 @@ declare namespace mapboxgl {
|
||||
static convert(a: PointLike): Point;
|
||||
}
|
||||
|
||||
/**
|
||||
* MercatorCoordinate
|
||||
*/
|
||||
export class MercatorCoordinate {
|
||||
/** The x component of the position. */
|
||||
x: number;
|
||||
|
||||
/** The y component of the position. */
|
||||
y: number;
|
||||
|
||||
/**
|
||||
* The z component of the position.
|
||||
*
|
||||
* @default 0
|
||||
*/
|
||||
z?: number;
|
||||
|
||||
constructor(x: number, y: number, z?: number);
|
||||
|
||||
/** Returns the altitude in meters of the coordinate. */
|
||||
toAltitude(): number;
|
||||
|
||||
/** Returns the LngLat for the coordinate. */
|
||||
toLngLat(): LngLat;
|
||||
|
||||
/** Project a LngLat to a MercatorCoordinate. */
|
||||
static fromLngLat(lngLatLike: LngLatLike, altitude?: number): MercatorCoordinate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Marker
|
||||
*/
|
||||
|
||||
@ -407,6 +407,7 @@ attributionControl.on('click', () => {});
|
||||
declare var lnglat: mapboxgl.LngLat;
|
||||
declare var lnglatlike: mapboxgl.LngLatLike;
|
||||
declare var lnglatboundslike: mapboxgl.LngLatBoundsLike;
|
||||
declare var mercatorcoordinate: mapboxgl.MercatorCoordinate;
|
||||
declare var pointlike: mapboxgl.PointLike;
|
||||
|
||||
function expectType<T>(value: T) { /* let the compiler handle things */ }
|
||||
@ -460,6 +461,17 @@ expectType<mapboxgl.PointLike>([0, 0]);
|
||||
new mapboxgl.Point(0, 0);
|
||||
expectType<mapboxgl.Point>(mapboxgl.Point.convert(pointlike));
|
||||
|
||||
/*
|
||||
* MercatorCoordinate
|
||||
*/
|
||||
|
||||
new mapboxgl.MercatorCoordinate(0, 0);
|
||||
new mapboxgl.MercatorCoordinate(0, 0, 0);
|
||||
expectType<number>(mercatorcoordinate.toAltitude());
|
||||
expectType<mapboxgl.LngLat>(mercatorcoordinate.toLngLat());
|
||||
expectType<mapboxgl.MercatorCoordinate>(mapboxgl.MercatorCoordinate.fromLngLat(lnglatlike));
|
||||
expectType<mapboxgl.MercatorCoordinate>(mapboxgl.MercatorCoordinate.fromLngLat(lnglatlike, 0));
|
||||
|
||||
/*
|
||||
* TransformRequestFunction
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user