Skip to content

Commit

Permalink
Remove unused code paths.
Browse files Browse the repository at this point in the history
  • Loading branch information
dpmcmlxxvi committed Jun 2, 2019
1 parent 33c7f8e commit 9b77279
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/util/clipper.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,11 @@ const clipDifference = (subject, clipper) => {
if (difference === null) {
return null;
}
if (difference && difference.geometry.type.includes('Polygon')) {
turf.flattenEach(difference, (flattened) => {
turf.featureEach(triangulate(flattened), (feature) => {
triangles.push(feature);
});
turf.flattenEach(difference, (flattened) => {
turf.featureEach(triangulate(flattened), (feature) => {
triangles.push(feature);
});
}
});
} catch (e) {
// Turf differrence can fail for edge cases due to one of their
// dependencies not handling numerical precision well.
Expand Down Expand Up @@ -142,12 +140,10 @@ const segment = (subject, clippers) => {
});

// Sort all coordinates in order from first vertex.
if (vertices.length >= 2) {
vertices.sort((a, b) => {
const start = subject.geometry.coordinates[0];
return turf.distance(a, start) - turf.distance(b, start);
});
}
vertices.sort((a, b) => {
const start = subject.geometry.coordinates[0];
return turf.distance(a, start) - turf.distance(b, start);
});

return turf.lineString(vertices);
};
Expand Down

0 comments on commit 9b77279

Please sign in to comment.