maplibre-gl-js
maplibre-gl-js copied to clipboard
`Point.convert()` with `{x: number, y: number}`
The convert function of @mapbox/point-geometry
:
https://github.com/mapbox/point-geometry/blob/bf471dc7ceb56299d4f5152c4badbeba193b0903/index.js#L304-L312
Point.convert = function (a) {
if (a instanceof Point) {
return a;
}
if (Array.isArray(a)) {
return new Point(a[0], a[1]);
}
return a;
};
does not do the same as our v2.0.0 convert
function that we made in the TypeScript migration:
static convert(a: PointLike | {x: number; y: number}): Point {
if (a instanceof Point) {
return a;
}
if (Array.isArray(a)) {
return new Point(a[0], a[1]);
}
if (typeof a.x === 'number') {
return new Point(a.x, a.y);
}
throw new Error(`Unable to convert to point: ${JSON.stringify(a)}`);
}
With pull request #800, we roll back from our Point
class to the mapbox one. Let's keep an eye on this change.
The following is the original code before typescript changes: https://github.com/maplibre/maplibre-gl-js/blob/cb3a4200bfbc113969e9dcbedae2aa7655f9aa98/src/ui/camera.js#L574 We might consider creating a PR for the point-geomerty package to support this :-)
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days.
@wipfli do we want to do something here or can this be closed?
Thanks for the issue triage, @HarelM. Can be closed since no problems were reported.