mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-18 14:45:12 +02:00
Merge pull request #8708 from k-yle/keep-oldest-feature-in-merge
keep the oldest Way when merging
This commit is contained in:
@@ -27,7 +27,6 @@ export function actionJoin(ids) {
|
||||
|
||||
var action = function(graph) {
|
||||
var ways = ids.map(graph.entity, graph);
|
||||
var survivorID = ways[0].id;
|
||||
|
||||
// if any of the ways are sided (e.g. coastline, cliff, kerb)
|
||||
// sort them first so they establish the overall order - #6033
|
||||
@@ -40,12 +39,15 @@ export function actionJoin(ids) {
|
||||
});
|
||||
|
||||
// Prefer to keep an existing way.
|
||||
for (var i = 0; i < ways.length; i++) {
|
||||
if (!ways[i].isNew()) {
|
||||
survivorID = ways[i].id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// if there are mulitple existing ways, keep the oldest one
|
||||
// the oldest way is determined by the ID of the way
|
||||
const survivorID = (
|
||||
ways
|
||||
.filter((way) => !way.isNew())
|
||||
.sort((a, b) => +a.osmId() - +b.osmId())[0] || ways[0]
|
||||
).id;
|
||||
|
||||
|
||||
|
||||
var sequences = osmJoinWays(ways, graph);
|
||||
var joined = sequences[0];
|
||||
|
||||
Reference in New Issue
Block a user