Fixup area drawing, removing bonus nodes, preventing selection of

mid-drawing areas which incurs an expensive fetch.
This commit is contained in:
Tom MacWright
2012-11-29 12:24:03 -05:00
parent 6ed368446e
commit d954a09184
4 changed files with 11 additions and 5 deletions
+1 -1
View File
@@ -292,7 +292,7 @@ input#geocode-location {
.commit-section {
max-height:250px;
overflow:scroll;
overflow:auto;
}
/* mobile tweaks */
+7 -3
View File
@@ -8,7 +8,8 @@ iD.modes = {};
iD.modes._node = function(ll) {
return iD.Node({
lat: ll[1],
lon: ll[0]
lon: ll[0],
tags: {}
});
};
@@ -219,7 +220,7 @@ iD.modes.AddArea = {
title: "+ Area",
way: function() {
return iD.Way({
tags: { building: 'yes', area: 'yes' }
tags: { building: 'yes', area: 'yes', elastic: 'true' }
});
},
enter: function() {
@@ -312,6 +313,8 @@ iD.modes.DrawArea = function(way_id) {
way.nodes.push(way.nodes[0]);
this.map.perform(iD.actions.addWayNode(way,
this.map.history.graph().entity(way.nodes[0])));
delete way.tags.elastic;
this.map.perform(iD.actions.changeTags(way, way.tags));
// End by clicking on own tail
return this.exit();
} else {
@@ -322,7 +325,8 @@ iD.modes.DrawArea = function(way_id) {
node = iD.modes._node(this.map.projection.invert(
d3.mouse(surface.node())));
}
way.nodes.pop();
var old = this.map.history.graph().entity(way.nodes.pop());
this.map.perform(iD.actions.removeWayNode(way, old));
way.nodes.push(node.id);
this.map.perform(iD.actions.addWayNode(way, node));
way.nodes = way.nodes.slice();
+1 -1
View File
@@ -370,7 +370,7 @@ iD.Map = function(elem, connection) {
function selectClick() {
var entity = d3.select(d3.event.target).data();
if (entity) entity = entity[0];
if (!entity || selection === entity.id) return;
if (!entity || selection === entity.id || (entity.tags && entity.tags.elastic)) return;
selection = entity.id;
d3.select('.inspector-wrap')
.style('display', 'block')
+2
View File
@@ -38,12 +38,14 @@ iD.commit = function() {
.attr('placeholder', 'Brief Description');
body.append('button').text('Save')
.attr('class', 'save')
.on('click', function() {
event.save({
comment: d3.select('textarea.changeset-comment').node().value
});
});
body.append('button').text('Cancel')
.attr('class', 'cancel')
.on('click', function() {
event.cancel();
});