Skip to content

Commit

Permalink
fix forloop for extractPolygonData (#2030)
Browse files Browse the repository at this point in the history
  • Loading branch information
yzlucas authored Jul 16, 2024
1 parent 0d3a4b6 commit ea4c3c1
Showing 1 changed file with 6 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,24 +302,15 @@ export class CommonUtilityService {
}

extractPolygonData(response) {
const isWebkitBrowser = navigator.userAgent.indexOf('AppleWebKit') > -1;
const polygonData = [];

if (this.capacitorService.isIOS() || isWebkitBrowser) {
// eslint-disable-next-line @typescript-eslint/prefer-for-of
for (let i = 0; i < response.length; i++) {
// iOS does not like the splat operator
polygonData.push(response[i][0], response[i][1]);
}
} else {
for (const element of response) {
polygonData.push(...element);
}
let polygonData = [];

for (const element of response) {
polygonData = polygonData.concat(element);
}

return polygonData;
}

createConvex(polygonData) {
const turfPoints = polygonData.map(coord => window['turf'].point(coord));
const pointsFeatureCollection = window['turf'].featureCollection(turfPoints);
Expand Down

0 comments on commit ea4c3c1

Please sign in to comment.