mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-14 17:52:55 +00:00
Merge branch 'master' of github.com:systemed/iD
This commit is contained in:
@@ -36,7 +36,6 @@ window.iD = function(container) {
|
||||
.call(bootstrap.tooltip().placement('bottom'))
|
||||
.on('click', function (mode) { controller.enter(mode); });
|
||||
|
||||
|
||||
map.on('move.disable-buttons', function() {
|
||||
if (map.zoom() < 16) {
|
||||
buttons.attr('disabled', 'disabled');
|
||||
|
||||
@@ -40,10 +40,10 @@ iD.modes.Select = function (entity) {
|
||||
function remove() {
|
||||
switch (entity.type) {
|
||||
case 'way':
|
||||
mode.history.perform(iD.actions.DeleteWay(entity));
|
||||
mode.history.perform(iD.actions.DeleteWay(entity.id));
|
||||
break;
|
||||
case 'node':
|
||||
mode.history.perform(iD.actions.DeleteNode(entity));
|
||||
mode.history.perform(iD.actions.DeleteNode(entity.id));
|
||||
}
|
||||
|
||||
mode.controller.exit();
|
||||
@@ -60,7 +60,7 @@ iD.modes.Select = function (entity) {
|
||||
.call(inspector);
|
||||
|
||||
inspector.on('changeTags', function(d, tags) {
|
||||
mode.history.perform(iD.actions.ChangeEntityTags(mode.history.graph().entity(d.id), tags));
|
||||
mode.history.perform(iD.actions.ChangeEntityTags(d.id, tags));
|
||||
}).on('changeWayDirection', function(d) {
|
||||
mode.history.perform(iD.actions.ReverseWay(d));
|
||||
}).on('remove', function() {
|
||||
|
||||
@@ -13,19 +13,6 @@ iD.Inspector = function() {
|
||||
d.type + '/' + d.osmId();
|
||||
})
|
||||
.text('View on OSM');
|
||||
selection.append('a')
|
||||
.attr({ 'class': 'permalink', href: '#' }).text('XML')
|
||||
.on('click', function(d) {
|
||||
d3.event.stopPropagation();
|
||||
iD.util.codeWindow(iD.format.XML.mapping(d));
|
||||
});
|
||||
selection.append('a')
|
||||
.attr({ 'class': 'permalink', href: '#' }).text('GeoJSON')
|
||||
.on('click', function(d) {
|
||||
d3.event.stopPropagation();
|
||||
iD.util.codeWindow(JSON.stringify(
|
||||
iD.format.GeoJSON.mapping(d), null, 2));
|
||||
});
|
||||
if (selection.datum().type === 'way') {
|
||||
selection.append('a')
|
||||
.attr('class', 'permalink')
|
||||
@@ -59,17 +46,23 @@ iD.Inspector = function() {
|
||||
.attr('class', 'head inspector-inner').call(drawhead);
|
||||
|
||||
var inspectorwrap = selection
|
||||
.append('ul').attr('class', 'inspector-inner tag-wrap fillL2')
|
||||
.append('ul').attr('class', 'inspector-inner tag-wrap fillL2');
|
||||
|
||||
inspectorwrap.append('h4').text('Edit tags')
|
||||
|
||||
inspectorwrap
|
||||
.data(['tag', 'value', ''])
|
||||
.enter()
|
||||
.enter();
|
||||
|
||||
function removeTag(d) {
|
||||
var tags = pad(grabtags());
|
||||
delete tags[d.key];
|
||||
draw(tags);
|
||||
}
|
||||
|
||||
function draw(data) {
|
||||
var tr = inspectorwrap.selectAll('li')
|
||||
.data(d3.entries(data));
|
||||
.data(d3.entries(data), function(d) { return [d.key, d.value]; });
|
||||
tr.exit().remove();
|
||||
var row = tr.enter().append('li').attr('class','tag-row');
|
||||
var inputs = row.append('div').attr('class','input-wrap').selectAll('input')
|
||||
@@ -95,7 +88,7 @@ iD.Inspector = function() {
|
||||
});
|
||||
}));
|
||||
});
|
||||
row.append('button').attr('class','remove minor');
|
||||
row.append('button').attr('class','remove minor').on('click', removeTag);
|
||||
row.append('button').attr('class', 'tag-help minor').append('a')
|
||||
.text('?')
|
||||
.attr('target', '_blank')
|
||||
@@ -107,7 +100,10 @@ iD.Inspector = function() {
|
||||
|
||||
// Remove any blank key-values
|
||||
function clean(x) {
|
||||
for (var i in x) if (!i) delete x[i];
|
||||
for (var i in x) {
|
||||
// undefined is cast to a string as an object key
|
||||
if (!i || i === 'undefined') delete x[i];
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
@@ -119,7 +115,7 @@ iD.Inspector = function() {
|
||||
|
||||
function grabtags() {
|
||||
var grabbed = {};
|
||||
function grab(d) { grabbed[d.key] = d.value; }
|
||||
function grab(d) { if (d.key !== undefined) grabbed[d.key] = d.value; }
|
||||
inspectorwrap.selectAll('input').each(grab);
|
||||
return grabbed;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user