Don't rm old preset tags post merge, but do rm area=yes when setting preset

(closes #4114)
This commit is contained in:
Bryan Housel
2017-06-22 17:47:48 -04:00
parent 3ebb90a9d2
commit 9882cf1d7b
2 changed files with 7 additions and 8 deletions
+6 -8
View File
@@ -12,17 +12,15 @@ import { modeSelect } from '../modes';
export function operationMerge(selectedIDs, context) {
function updatePresetTags(oldGraph, newGraph, ids) {
function updatePresetTags(newGraph, ids) {
var id = ids[0],
oldEntity = oldGraph.hasEntity(id),
newEntity = newGraph.hasEntity(id);
if (!oldEntity || !newEntity) return;
if (!newEntity) return;
var oldPreset = context.presets().match(oldEntity, oldGraph),
newPreset = context.presets().match(newEntity, newGraph);
var newPreset = context.presets().match(newEntity, newGraph);
context.replace(actionChangePreset(id, oldPreset, newPreset), operation.annotation());
context.replace(actionChangePreset(id, null, newPreset), operation.annotation());
}
@@ -50,9 +48,9 @@ export function operationMerge(selectedIDs, context) {
return entity && entity.type !== 'node';
});
// if we merged tags, rematch preset and update tags if necessary (#3851)
// if we merged tags, rematch preset to update tags if necessary (#3851)
if (action === merge) {
updatePresetTags(origGraph, context.graph(), ids);
updatePresetTags(context.graph(), ids);
}
context.enter(modeSelect(context, ids));
+1
View File
@@ -125,6 +125,7 @@ export function presetPreset(id, preset, fields) {
// This is necessary if the geometry is already an area (e.g. user drew an area) AND any of:
// 1. chosen preset could be either an area or a line (`barrier=city_wall`)
// 2. chosen preset doesn't have a key in areaKeys (`railway=station`)
delete tags.area;
if (geometry === 'area') {
var needsAreaTag = true;
if (preset.geometry.indexOf('line') === -1) {