Fix updating preset ui when undoing, address ui

This commit is contained in:
Ansis Brammanis
2013-02-23 16:54:51 -05:00
parent 8a6501998e
commit c00f4a8e2d
3 changed files with 20 additions and 16 deletions

View File

@@ -124,12 +124,8 @@ iD.modes.Select = function(context, selection, initial) {
// Exit mode if selected entity gets undone
context.enter(iD.modes.Browse(context));
} else if (entity) {
var newEntity = context.entity(selection[0]);
if (!_.isEqual(entity.tags, newEntity.tags)) {
inspector.tags(newEntity.tags);
}
entity = newEntity;
} else if (singular()) {
inspector.tags(context.entity(selection[0]).tags);
}
}
@@ -238,7 +234,8 @@ iD.modes.Select = function(context, selection, initial) {
keybinding.off();
context.history()
.on('change.select', null);
.on('undone.select', null)
.on('redone.select', null);
context.surface()
.call(radialMenu.close)

View File

@@ -1,6 +1,6 @@
iD.ui.preset.address = function() {
var event = d3.dispatch(),
var event = d3.dispatch('change'),
context,
entity;
@@ -36,17 +36,23 @@ iD.ui.preset.address = function() {
function address(selection) {
function change() { event.change(); }
selection.append('input')
.property('type', 'text')
.attr('placeholder', 'Housename')
.attr('class', 'addr-housename')
.datum({ 'key': 'addr:housename' });
.datum({ 'key': 'addr:housename' })
.on('blur', change)
.on('change', change);
selection.append('input')
.property('type', 'text')
.attr('placeholder', '123')
.attr('class', 'addr-number')
.datum({ 'key': 'addr:housenumber' });
.datum({ 'key': 'addr:housenumber' })
.on('blur', change)
.on('change', change);
var streetwrap = selection.append('span')
.attr('class', 'input-wrap-position')
@@ -55,7 +61,9 @@ iD.ui.preset.address = function() {
streetwrap.append('input')
.property('type', 'text')
.attr('placeholder', 'Oak Street')
.attr('class', 'addr-streetname');
.attr('class', 'addr-streetname')
.on('blur', change)
.on('change', change);
streetwrap.call(d3.combobox().data(getStreets()));
}

View File

@@ -22,9 +22,7 @@ iD.ui.preset = function() {
if (!sections) return;
sections.selectAll('input,select')
.each(function(d) {
if (tags[d.key]) {
this.value = tags[d.key];
}
this.value = tags[d.key] || '';
});
}
@@ -142,8 +140,9 @@ iD.ui.preset = function() {
wrap.append('div')
.attr('class', 'col9 preset-input', d)
.call(iD.ui.preset.address()
.context(context)
.entity(entity));
.context(context)
.on('change', key)
.entity(entity));
}
}
});