From 144c8735e45722f067215b705df7ddd0c00944c5 Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Tue, 26 Feb 2013 16:44:24 -0500 Subject: [PATCH] change preset ui when undone/redone if necessary --- js/id/ui/tageditor.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/js/id/ui/tageditor.js b/js/id/ui/tageditor.js index 94a47fe2f..6394efb9e 100644 --- a/js/id/ui/tageditor.js +++ b/js/id/ui/tageditor.js @@ -5,6 +5,7 @@ iD.ui.TagEditor = function() { tags, name, presetMatch, + selection_, presetUI, tagList, context; @@ -12,6 +13,7 @@ iD.ui.TagEditor = function() { function tageditor(selection, preset) { entity = selection.datum(); + selection_ = selection; var type = entity.type === 'node' ? entity.type : entity.geometry(); // preset was explicitly chosen @@ -153,6 +155,13 @@ iD.ui.TagEditor = function() { } else { tags = _.clone(newtags); if (presetUI && tagList) { + + // change preset if necessary (undos/redos) + var newmatch = presetData.matchTags(entity.update({ tags: tags })); + if (newmatch !== presetMatch) { + return tageditor(selection_, newmatch); + } + name.property('value', tags.name || ''); presetUI.change(tags); tagList.tags(_.omit(tags, _.keys(presetUI.tags() || {}).concat(['name'])));