From f295c217e88cd82f25e18937d7195829216b27bd Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Mon, 18 Mar 2013 14:25:32 -0400 Subject: [PATCH] Add area tag by default, remove when applying preset --- js/id/presets.js | 8 ++++++-- js/id/ui/tag_editor.js | 11 ++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/js/id/presets.js b/js/id/presets.js index f71cf010e..152a080f9 100644 --- a/js/id/presets.js +++ b/js/id/presets.js @@ -5,9 +5,13 @@ iD.presets = function(context) { var other = iD.presets.Preset('other', { tags: {}, - geometry: ['point', 'vertex', 'line', 'area'] + geometry: ['point', 'vertex', 'line'] }), - all = iD.presets.Collection([other]), + otherarea = iD.presets.Preset('other/area', { + tags: { area: 'yes' }, + geometry: ['area'] + }), + all = iD.presets.Collection([other, otherarea]), defaults = { area: all, line: all, point: all, vertex: all }, fields = {}, universal = [], diff --git a/js/id/ui/tag_editor.js b/js/id/ui/tag_editor.js index d84cd0ece..4f081d1fd 100644 --- a/js/id/ui/tag_editor.js +++ b/js/id/ui/tag_editor.js @@ -13,18 +13,15 @@ iD.ui.TagEditor = function(context, entity) { selection_ = selection; var geometry = entity.geometry(context.graph()); + if (!preset) preset = presets.match(entity, context.graph()); + // preset was explicitly chosen if (newpreset) { - if (preset) { - tags = preset.removeTags(tags, geometry); - } + + tags = preset.removeTags(tags, geometry); newpreset.applyTags(tags, geometry); preset = newpreset; - - // find a preset that best fits - } else if (!preset) { - preset = presets.match(entity, context.graph()); } selection.html('');