Files
iD/js/id/actions/copy_entity.js
2015-03-18 10:08:36 -04:00

22 lines
458 B
JavaScript

iD.actions.CopyEntity = function(id, fromGraph, deep) {
var newEntities = [];
var action = function(graph) {
var entity = fromGraph.entity(id);
newEntities = entity.copy(deep, fromGraph);
for (var i = 0; i < newEntities.length; i++) {
graph = graph.replace(newEntities[i]);
}
return graph;
};
action.newEntities = function() {
return newEntities;
};
return action;
};