|
1 | 1 | import bbox from "@turf/bbox";
|
2 |
| -import clone from "@turf/clone"; |
3 | 2 | import { coordEach } from "@turf/meta";
|
4 | 3 | import { collectionOf } from "@turf/invariant";
|
5 | 4 | import { multiLineString, featureCollection, isObject } from "@turf/helpers";
|
@@ -157,35 +156,11 @@ function rescaleIsolines(
|
157 | 156 | point[1] = point[1] * scaleY + y0;
|
158 | 157 | };
|
159 | 158 |
|
160 |
| - // Ok. We need to *clone* the returned isolines due to the behaviour of |
161 |
| - // the marchingsquare library behaviour. Long story short, if we don't |
162 |
| - // do this, the last point in some isoLines has the coordEach function |
163 |
| - // run twice, leading to one point in the isoline rendering WAY out of |
164 |
| - // position. |
165 |
| - const clonedIsoLines: Feature<MultiLineString>[] = []; |
166 |
| - createdIsoLines.forEach((isoline) => { |
167 |
| - clonedIsoLines.push(clone(isoline)); |
168 |
| - }); |
169 |
| - |
170 | 159 | // resize and shift each point/line of the createdIsoLines
|
171 |
| - clonedIsoLines.forEach((isoline) => { |
| 160 | + createdIsoLines.forEach((isoline) => { |
172 | 161 | coordEach(isoline, resize);
|
173 | 162 | });
|
174 |
| - return clonedIsoLines; |
| 163 | + return createdIsoLines; |
175 | 164 | }
|
176 | 165 |
|
177 |
| -/* |
178 |
| - * A bit more background on the isoContours behaviour described above. It |
179 |
| - * seems like in some cases the last coord of the line references the same |
180 |
| - * coord array as the first point. This just seems to be the way they're |
181 |
| - * returned from the library: |
182 |
| - * [0] -> A |
183 |
| - * [1] -> B |
184 |
| - * [2] -> C |
185 |
| - * [3] -> A |
186 |
| - * Running coordEach over this mutates the values in A, then B and C, then |
187 |
| - * mutates [3] which happens to also be a reference to A. So the rescale |
188 |
| - * transform is run twice on that coord. |
189 |
| - */ |
190 |
| - |
191 | 166 | export default isolines;
|
0 commit comments