Avoid removing and re-adding address field (closes #2903)

This commit is contained in:
Bryan Housel
2016-01-17 23:22:32 -05:00
parent 4ecd0aa90d
commit 23b22fdaac
+7 -6
View File
@@ -97,17 +97,18 @@ iD.ui.preset.address = function(field, context) {
function address(selection) {
isInitialized = false;
selection.selectAll('.preset-input-wrap')
.remove();
var center = entity.extent(context.graph()).center(),
addressFormat;
wrap = selection.selectAll('.preset-input-wrap')
.data([0]);
// Enter
wrap = selection.append('div')
wrap.enter()
.append('div')
.attr('class', 'preset-input-wrap');
var center = entity.extent(context.graph()).center(),
addressFormat;
iD.countryCode().search(center, function (err, countryCode) {
addressFormat = _.find(iD.data.addressFormats, function (a) {
return a && a.countryCodes && _.contains(a.countryCodes, countryCode);