mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 13:38:26 +02:00
Fix tag updating
This commit is contained in:
@@ -374,7 +374,8 @@ iD.Map = function(elem, connection) {
|
||||
}
|
||||
|
||||
inspector.on('changeTags', function(d, tags) {
|
||||
map.perform(iD.actions.changeTags(d, tags));
|
||||
var entity = map.history.graph().entity(d.id);
|
||||
map.perform(iD.actions.changeTags(entity, tags));
|
||||
}).on('changeWayDirection', function(d, tags) {
|
||||
map.perform(iD.actions.changeWayDirection(d));
|
||||
}).on('remove', function(d) {
|
||||
|
||||
+16
-7
@@ -83,18 +83,27 @@ iD.Inspector = function() {
|
||||
});
|
||||
}
|
||||
|
||||
function update() {
|
||||
function clean(x) {
|
||||
for (var i in x) if (!i) delete x[i];
|
||||
return x;
|
||||
}
|
||||
|
||||
function pad(x) {
|
||||
if (!x['']) x[''] = '';
|
||||
return x;
|
||||
}
|
||||
|
||||
function grabtags() {
|
||||
var grabbed = {};
|
||||
function grab(d) { grabbed[d.key] = d.value; }
|
||||
tbody.selectAll('td').each(grab);
|
||||
if (!grabbed['']) {
|
||||
grabbed[''] = '';
|
||||
draw(grabbed);
|
||||
}
|
||||
draw(grabbed);
|
||||
return grabbed;
|
||||
}
|
||||
|
||||
function update() {
|
||||
draw(pad(grabtags()));
|
||||
}
|
||||
|
||||
var data = _.clone(entity.tags);
|
||||
draw(data);
|
||||
update();
|
||||
@@ -102,7 +111,7 @@ iD.Inspector = function() {
|
||||
selection.append('button')
|
||||
.attr('class', 'save').text('Save')
|
||||
.on('click', function() {
|
||||
event.changeTags(entity, update());
|
||||
event.changeTags(entity, clean(grabtags()));
|
||||
});
|
||||
|
||||
selection.append('button')
|
||||
|
||||
Reference in New Issue
Block a user