moved from Array<> to LatLngTuple[] types

This commit is contained in:
Mrkartoshka 2020-08-11 16:23:41 +03:00
parent 5db2c85f4c
commit ac6e946b2b
2 changed files with 10 additions and 10 deletions

View File

@ -362,12 +362,12 @@ export default abstract class LeafletMap {
return L.latLng(lat, lng) as L.LatLng;
}
convertPositionPolygon(expression:LatLngExpression[][] | LatLngExpression[][][]) {
return (expression as Array<any>).map((el) => {
if (el.length === 2 && !el.some(isNaN)) {
convertPositionPolygon(expression: (LatLngTuple | LatLngTuple[] | LatLngTuple[][])[]) {
return (expression).map((el) => {
if (!Array.isArray(el[0]) && el.length === 2) {
return el;
} else if (isArray(el) && el.length) {
return this.convertPositionPolygon(el);
} else if (Array.isArray(el) && el.length) {
return this.convertPositionPolygon(el as LatLngTuple[] | LatLngTuple[][]);
} else {
return null;
}

View File

@ -224,14 +224,14 @@ export class ImageMap extends LeafletMap {
expression.y * this.height);
}
convertPositionPolygon(expression: LatLngExpression[][] | LatLngExpression[][][]) {
return (expression as Array<any>).map((el) => {
if (el.length === 2 && !el.some(isNaN)) {
convertPositionPolygon(expression: (LatLngTuple | LatLngTuple[] | LatLngTuple[][])[]){
return (expression).map((el) => {
if (!Array.isArray(el[0]) && !Array.isArray(el[1]) && el.length === 2) {
return this.pointToLatLng(
el[0] * this.width,
el[1] * this.height)
} else if (isArray(el) && el.length) {
return this.convertPositionPolygon(el);
} else if (Array.isArray(el) && el.length) {
return this.convertPositionPolygon(el as LatLngTuple[] | LatLngTuple[][]);
} else {
return null;
}