mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-31 09:19:25 +02:00
Exclude child nodes from newIDs if their parent way was also copied
for #3656 item 1
This commit is contained in:
@@ -59,15 +59,29 @@ export function behaviorPaste(context) {
|
||||
context.perform(action);
|
||||
|
||||
var copies = action.copies();
|
||||
var originals = _.invert(_.mapValues(copies, 'id'));
|
||||
for (var id in copies) {
|
||||
var oldEntity = oldGraph.entity(id),
|
||||
newEntity = copies[id];
|
||||
|
||||
extent._extend(oldEntity.extent(oldGraph));
|
||||
newIDs.push(newEntity.id);
|
||||
context.perform(
|
||||
actionChangeTags(newEntity.id, _.omit(newEntity.tags, omitTag))
|
||||
);
|
||||
|
||||
// Exclude child nodes from newIDs if their parent way was also copied.
|
||||
var parents = context.graph().parentWays(newEntity),
|
||||
parentCopied = false;
|
||||
for (var i = 0; i < parents.length; i++) {
|
||||
if (originals[parents[i].id]) {
|
||||
parentCopied = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!parentCopied) {
|
||||
newIDs.push(newEntity.id);
|
||||
}
|
||||
}
|
||||
|
||||
// Put pasted objects where mouse pointer is..
|
||||
|
||||
Reference in New Issue
Block a user