mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 13:38:26 +02:00
Fix point averaging code in improveOSM service
re: https://github.com/openstreetmap/iD/commit/4a8c20c56e4549da94555958acd34f649ca18fe9#r32961438
This commit is contained in:
@@ -68,7 +68,10 @@ function linkEntity(d) {
|
||||
|
||||
function pointAverage(points) {
|
||||
if (points.length) {
|
||||
return geoVecScale(points.reduce(geoVecAdd, [0,0]), 1 / points.length);
|
||||
var sum = points.reduce(function(acc, point) {
|
||||
return geoVecAdd(acc, [point.lon, point.lat]);
|
||||
}, [0,0]);
|
||||
return geoVecScale(sum, 1 / points.length);
|
||||
} else {
|
||||
return [0,0];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user