Files
iD/modules/actions/change_preset.js
Bryan Housel ea9e3008a5 addTags() -> setTags() / removeTags() -> unsetTags()
This avoids overriding the `addTags` and `removeTags` objects with functions
2018-11-21 12:59:43 -05:00

13 lines
431 B
JavaScript

export function actionChangePreset(entityID, oldPreset, newPreset) {
return function action(graph) {
var entity = graph.entity(entityID);
var geometry = entity.geometry(graph);
var tags = entity.tags;
if (oldPreset) tags = oldPreset.unsetTags(tags, geometry);
if (newPreset) tags = newPreset.setTags(tags, geometry);
return graph.replace(entity.update({tags: tags}));
};
}