Skip to content

Commit

Permalink
Don't rm old preset tags post merge, but do rm area=yes when setting …
Browse files Browse the repository at this point in the history
…preset

(closes #4114)
  • Loading branch information
bhousel committed Jun 22, 2017
1 parent 3ebb90a commit 9882cf1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
14 changes: 6 additions & 8 deletions modules/operations/merge.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}


Expand Down Expand Up @@ -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));
Expand Down
1 change: 1 addition & 0 deletions modules/presets/preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 9882cf1

Please sign in to comment.