Use a temporary area tag for drawing. Fixes #1014

This commit is contained in:
Tom MacWright
2013-03-15 18:27:06 -04:00
parent caca26dc11
commit 4184b503f9
3 changed files with 12 additions and 2 deletions
+10
View File
@@ -110,6 +110,14 @@ iD.behavior.DrawWay = function(context, wayId, index, mode, baseGraph) {
};
}
function RemoveTemporaryTag(way) {
return function(graph) {
var area = graph.entity(wayId);
return graph
.replace(area.update({tags:_.omit(area.tags, '__area__')}));
};
}
// Accept the current position of the temporary node and continue drawing.
drawWay.add = function(loc) {
var newNode = iD.Node({loc: loc});
@@ -163,6 +171,8 @@ iD.behavior.DrawWay = function(context, wayId, index, mode, baseGraph) {
var way = context.entity(wayId);
if (way) {
context.perform(
RemoveTemporaryTag(way));
context.enter(iD.modes.Select(context, [way.id], true));
} else {
context.enter(iD.modes.Browse(context));
+1 -1
View File
@@ -43,7 +43,7 @@ _.extend(iD.Way.prototype, {
},
isArea: function() {
if (this.tags.area === 'yes')
if (this.tags.area === 'yes' || this.tags.__area__ === 'yes')
return true;
if (!this.isClosed() || this.tags.area === 'no')
return false;
+1 -1
View File
@@ -11,7 +11,7 @@ iD.modes.AddArea = function(context) {
.on('start', start)
.on('startFromWay', startFromWay)
.on('startFromNode', startFromNode),
defaultTags = {area: 'yes'};
defaultTags = {__area__: 'yes'};
function start(loc) {
var graph = context.graph(),