mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 21:48:20 +02:00
Fixed sort to sort by integer
This commit is contained in:
@@ -51,9 +51,13 @@ export function actionStraighten(selectedIDs, projection) {
|
||||
|
||||
// If user selected 2 nodes to straighten between, then slice nodes array to those nodes
|
||||
if (selectedNodes.length) {
|
||||
startNode = nodes.indexOf(graph.entity(selectedNodes[0]));
|
||||
endNode = nodes.indexOf(graph.entity(selectedNodes[1]));
|
||||
var sortedStartEnd = [startNode, endNode].sort();
|
||||
var startNodeIdx = nodes.indexOf(graph.entity(selectedNodes[0])),
|
||||
endNodeIdx = nodes.indexOf(graph.entity(selectedNodes[1])),
|
||||
sortedStartEnd = [startNodeIdx, endNodeIdx];
|
||||
|
||||
sortedStartEnd.sort(function(a,b) {
|
||||
return a - b;
|
||||
});
|
||||
|
||||
nodes = nodes.slice(sortedStartEnd[0], sortedStartEnd[1]+1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user