mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-18 14:45:12 +02:00
Support changing tags
This commit is contained in:
@@ -38,6 +38,16 @@ iD.operations.addTemporary = function(map, node) {
|
||||
map.update();
|
||||
};
|
||||
|
||||
iD.operations.changeTags = function(map, node, tags) {
|
||||
map.graph.modify(function(graph) {
|
||||
var o = {};
|
||||
var copy = pdata.object(node).set({ tags: tags }).get();
|
||||
o[copy.id] = copy;
|
||||
return graph.set(o);
|
||||
}, 'changed tags');
|
||||
map.update();
|
||||
};
|
||||
|
||||
iD.operations.removeTemporary = function(map, node) {
|
||||
map.graph.modify(function(graph) {
|
||||
return graph.remove(node.id);
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
iD.Node = function(id, lat, lon, tags, loaded) {
|
||||
this.id = id;
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
this.tags = tags || {};
|
||||
this.children = [];
|
||||
this.loaded = (loaded === undefined) ? true : loaded;
|
||||
};
|
||||
|
||||
iD.Node.prototype = {
|
||||
type: 'node',
|
||||
|
||||
intersects: function(extent) {
|
||||
return (this.lon >= extent[0][0]) &&
|
||||
(this.lon <= extent[1][0]) &&
|
||||
(this.lat <= extent[0][1]) &&
|
||||
(this.lat >= extent[1][1]);
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
iD.Relation = function(id, uid, children, tags, loaded) {
|
||||
this.id = id;
|
||||
this.uid = uid;
|
||||
this.children = children || [];
|
||||
this.tags = tags || {};
|
||||
this.loaded = (loaded === undefined) ? true : loaded;
|
||||
};
|
||||
|
||||
iD.Relation.prototype = {
|
||||
type: 'relation',
|
||||
|
||||
intersects: function() { return true; }
|
||||
};
|
||||
|
||||
@@ -221,11 +221,15 @@ iD.Map = function(elem) {
|
||||
selection = [d.id];
|
||||
drawVector();
|
||||
d3.select('.inspector-wrap')
|
||||
.style('display', 'block')
|
||||
.datum(d).call(inspector);
|
||||
.style('display', 'block')
|
||||
.datum(d).call(inspector);
|
||||
d3.event.stopPropagation();
|
||||
}
|
||||
|
||||
inspector.on('change', function(d, tags) {
|
||||
iD.operations.changeTags(map, d, tags);
|
||||
});
|
||||
|
||||
function zoomPan() {
|
||||
projection
|
||||
.translate(d3.event.translate)
|
||||
|
||||
Reference in New Issue
Block a user