-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Eslint JSDoc fixes #8960
Eslint JSDoc fixes #8960
Changes from 8 commits
1469d23
8bcc7a9
c5e967a
54b7841
021056e
910b2b5
fe585c9
39c15d3
97ad850
8812751
f957713
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -206,10 +206,10 @@ class Transform { | |
|
||
/** | ||
* Return a zoom level that will cover all tiles the transform | ||
* @param {Object} options | ||
* @param {number} options.tileSize | ||
* @param {boolean} options.roundZoom | ||
* @returns {number} zoom level | ||
* @param {Object} options options | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are a lot of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's see how this looks on the live docs — we might need to come up with a way to filter this out or maybe PR the plugin repo with an option to ignore. |
||
* @param {number} options.tileSize Tile size, expressed in pixels. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Might be worth mentioning what pixel space, in this case logical pixels. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @karimnaaji I'm don't think our end users will understand what we mean by "logical pixels." How about "screen pixels" instead? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That would work I think, I've seen Mapkit make use of CSS pixels to denote the same, anything that suggests invariance over pixel resolution/retina displays is good. |
||
* @param {boolean} options.roundZoom Target zoom level. This value will be rounded to the nearest integer. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We might want to express what happens in both cases here, what about the following?
|
||
* @returns {number} zoom level An integer zoom level at which all tiles will be visible. | ||
*/ | ||
coveringZoomLevel(options: {roundZoom?: boolean, tileSize: number}) { | ||
const z = (options.roundZoom ? Math.round : Math.floor)( | ||
|
@@ -259,6 +259,7 @@ class Transform { | |
* @param {boolean} options.reparseOverscaled | ||
* @param {boolean} options.renderWorldCopies | ||
* @returns {Array<OverscaledTileID>} OverscaledTileIDs | ||
* @private | ||
*/ | ||
coveringTiles( | ||
options: { | ||
|
@@ -408,6 +409,7 @@ class Transform { | |
* Given a location, return the screen point that corresponds to it | ||
* @param {LngLat} lnglat location | ||
* @returns {Point} screen point | ||
* @private | ||
*/ | ||
locationPoint(lnglat: LngLat) { | ||
return this.coordinatePoint(this.locationCoordinate(lnglat)); | ||
|
@@ -417,6 +419,7 @@ class Transform { | |
* Given a point on screen, return its lnglat | ||
* @param {Point} p screen point | ||
* @returns {LngLat} lnglat location | ||
* @private | ||
*/ | ||
pointLocation(p: Point) { | ||
return this.coordinateLocation(this.pointCoordinate(p)); | ||
|
@@ -427,6 +430,7 @@ class Transform { | |
* coordinate that represents it at this transform's zoom level. | ||
* @param {LngLat} lnglat | ||
* @returns {Coordinate} | ||
* @private | ||
*/ | ||
locationCoordinate(lnglat: LngLat) { | ||
return MercatorCoordinate.fromLngLat(lnglat); | ||
|
@@ -436,6 +440,7 @@ class Transform { | |
* Given a Coordinate, return its geographical position. | ||
* @param {Coordinate} coord | ||
* @returns {LngLat} lnglat | ||
* @private | ||
*/ | ||
coordinateLocation(coord: MercatorCoordinate) { | ||
return coord.toLngLat(); | ||
|
@@ -473,6 +478,7 @@ class Transform { | |
* Given a coordinate, return the screen point that corresponds to it | ||
* @param {Coordinate} coord | ||
* @returns {Point} screen point | ||
* @private | ||
*/ | ||
coordinatePoint(coord: MercatorCoordinate) { | ||
const p = [coord.x * this.worldSize, coord.y * this.worldSize, 0, 1]; | ||
|
@@ -483,6 +489,7 @@ class Transform { | |
/** | ||
* Returns the map's geographical bounds. When the bearing or pitch is non-zero, the visible region is not | ||
* an axis-aligned rectangle, and the result is the smallest bounds that encompasses the visible region. | ||
* @returns {LngLatBounds} Returns a {@link LngLatBounds} object describing the map's geographical bounds. | ||
*/ | ||
getBounds(): LngLatBounds { | ||
return new LngLatBounds() | ||
|
@@ -494,6 +501,7 @@ class Transform { | |
|
||
/** | ||
* Returns the maximum geographical bounds the map is constrained to, or `null` if none set. | ||
* @returns {LngLatBounds} {@link LngLatBounds} | ||
*/ | ||
getMaxBounds(): LngLatBounds | null { | ||
if (!this.latRange || this.latRange.length !== 2 || | ||
|
@@ -504,6 +512,7 @@ class Transform { | |
|
||
/** | ||
* Sets or clears the map's geographical constraints. | ||
* @param {LngLatBounds} bounds A {@link LngLatBounds} object describing the new geographic boundaries of the map. | ||
*/ | ||
setMaxBounds(bounds?: LngLatBounds) { | ||
if (bounds) { | ||
|
@@ -519,6 +528,7 @@ class Transform { | |
/** | ||
* Calculate the posMatrix that, given a tile coordinate, would be used to display the tile on a map. | ||
* @param {UnwrappedTileID} unwrappedTileID; | ||
* @private | ||
*/ | ||
calculatePosMatrix(unwrappedTileID: UnwrappedTileID, aligned: boolean = false): Float32Array { | ||
const posMatrixKey = unwrappedTileID.key; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -167,10 +167,6 @@ class CanvasSource extends ImageSource { | |
* @method setCoordinates | ||
* @instance | ||
* @memberof CanvasSource | ||
* @param {Array<Array<number>>} coordinates Four geographical coordinates, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we need to specify params for inherited methods. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this information expressed anywhere else after we delete it? |
||
* represented as arrays of longitude and latitude numbers, which define the corners of the canvas. | ||
* The coordinates start at the top left corner of the canvas and proceed in clockwise order. | ||
* They do not have to represent a rectangle. | ||
* @returns {CanvasSource} this | ||
*/ | ||
// setCoordinates inherited from ImageSource | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,7 +137,7 @@ class ImageSource extends Evented implements Source { | |
* Updates the image URL and, optionally, the coordinates. To avoid having the image flash after changing, | ||
* set the `raster-fade-duration` paint property on the raster layer to 0. | ||
* | ||
* @param {Object} options | ||
* @param {Object} options Options object. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have the type annotations, should we use that instead of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that's a good long-term goal, but I think it's out of scope for this change. Or is there a technique you know of to link type annotations automatically? |
||
* @param {string} [options.url] Required image URL. | ||
* @param {Array<Array<number>>} [options.coordinates] Four geographical coordinates, | ||
* represented as arrays of longitude and latitude numbers, which define the corners of the image. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -191,6 +191,8 @@ class TileCache { | |
/** | ||
* Remove entries that do not pass a filter function. Used for removing | ||
* stale tiles from the cache. | ||
* | ||
* @param filterFn filter function to check. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not really sure how to describe this param. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about describing what the function signature would be? Worthwhile information in that case would be what it should return and in each case how it would impact the filtering. It's taking as input a
Feel free to make it more succinct. |
||
*/ | ||
filter(filterFn: (tile: Tile) => boolean) { | ||
const removed = []; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to prevent redundantly specifying
@private
on every method if the parent class is marked@private
anyway?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this is not supported. From the JSDoc docs: