Skip to content

Commit

Permalink
Fix docs for Point and PointLike (#817)
Browse files Browse the repository at this point in the history
  • Loading branch information
wipfli authored Jan 23, 2022
1 parent 67dcbab commit 3e23fbf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/ui/camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ import type {LngLatBoundsLike} from '../geo/lng_lat_bounds';
import type {TaskID} from '../util/task_queue';
import type {PaddingOptions} from '../geo/edge_insets';

/**
* A [Point](https://github.com/mapbox/point-geometry) or an array of two numbers representing `x` and `y` screen coordinates in pixels.
*
* @typedef {(Point | [number, number])} PointLike
* @example
* var p1 = new Point(-77, 38); // a PointLike which is a Point
* var p2 = [-77, 38]; // a PointLike which is an array of two numbers
*/
export type PointLike = Point | [number, number];

export type RequireAtLeastOne<T> = { [K in keyof T]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<keyof T, K>>>; }[keyof T];
Expand Down
4 changes: 2 additions & 2 deletions src/ui/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -828,11 +828,11 @@ class Map extends Camera {
}

/**
* Returns a {@link Point} representing pixel coordinates, relative to the map's `container`,
* Returns a [Point](https://github.com/mapbox/point-geometry) representing pixel coordinates, relative to the map's `container`,
* that correspond to the specified geographical location.
*
* @param {LngLatLike} lnglat The geographical location to project.
* @returns {Point} The {@link Point} corresponding to `lnglat`, relative to the map's `container`.
* @returns {Point} The [Point](https://github.com/mapbox/point-geometry) corresponding to `lnglat`, relative to the map's `container`.
* @example
* var coordinate = [-122.420679, 37.772537];
* var point = map.project(coordinate);
Expand Down

0 comments on commit 3e23fbf

Please sign in to comment.