mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-21 07:46:58 +02:00
Use geoEuclideanDistance for simpler code
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { actionDeleteNode } from './delete_node';
|
||||
import { geoEuclideanDistance } from '../geo/index';
|
||||
|
||||
|
||||
/*
|
||||
@@ -60,7 +61,7 @@ export function actionStraighten(wayId, projection) {
|
||||
points = nodes.map(function(n) { return projection(n.loc); }),
|
||||
startPoint = points[0],
|
||||
endPoint = points[points.length-1],
|
||||
threshold = 0.2 * Math.sqrt(Math.pow(startPoint[0] - endPoint[0], 2) + Math.pow(startPoint[1] - endPoint[1], 2)),
|
||||
threshold = 0.2 * geoEuclideanDistance(startPoint, endPoint),
|
||||
i;
|
||||
|
||||
if (threshold === 0) {
|
||||
|
||||
Reference in New Issue
Block a user