mirror of
https://github.com/Leaflet/Leaflet.git
synced 2025-07-29 11:53:03 +00:00
Fix closed coord's reference in latLngsToCoords (#7344)
Co-authored-by: Florian Bischof <design.falke@gmail.com>
This commit is contained in:
@ -882,6 +882,11 @@ describe("L.GeoJSON functions", () => {
|
||||
]
|
||||
});
|
||||
});
|
||||
it("has no reference between first and last coordinates", () => {
|
||||
const coords = L.GeoJSON.latLngsToCoords([[2, 1, 3], [5, 4, 6]], null, true);
|
||||
expect(coords).to.eql([[1, 2, 3], [4, 5, 6], [1, 2, 3]]);
|
||||
expect(coords[0] === coords[2]).to.not.ok();
|
||||
});
|
||||
});
|
||||
|
||||
describe("#asFeature", () => {
|
||||
|
@ -288,7 +288,7 @@ export function latLngsToCoords(latlngs, levelsDeep, closed, precision) {
|
||||
}
|
||||
|
||||
if (!levelsDeep && closed) {
|
||||
coords.push(coords[0]);
|
||||
coords.push(coords[0].slice());
|
||||
}
|
||||
|
||||
return coords;
|
||||
|
Reference in New Issue
Block a user