From 66f58ac96b71ec065e442b632a1ecff056f34006 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Fri, 14 Dec 2012 13:42:53 -0500 Subject: [PATCH 1/9] Fix regressions in 9743ee282b3c5e84dc0d9f8cae38a323fb41fdd3 - .hint() is not meant to be chainable. --- js/id/modes/draw_area.js | 9 ++++----- js/id/modes/draw_line.js | 5 ++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/js/id/modes/draw_area.js b/js/id/modes/draw_area.js index c31544e5c..c7d91e158 100644 --- a/js/id/modes/draw_area.js +++ b/js/id/modes/draw_area.js @@ -15,8 +15,8 @@ iD.modes.DrawArea = function(wayId) { node = iD.Node({loc: map.mouseCoordinates()}); map.dblclickEnable(false) - .fastEnable(false) - .hint('Click on the map to add points to your area. Finish the ' + + .fastEnable(false); + map.hint('Click on the map to add points to your area. Finish the ' + 'area by clicking on your first point'); history.perform( @@ -107,9 +107,8 @@ iD.modes.DrawArea = function(wayId) { }; mode.exit = function() { - mode.map - .hint(false) - .fastEnable(true); + mode.map.hint(false); + mode.map.fastEnable(true); mode.map.surface .on('mousemove.drawarea', null) diff --git a/js/id/modes/draw_line.js b/js/id/modes/draw_line.js index 74c16095f..01b4de6b7 100644 --- a/js/id/modes/draw_line.js +++ b/js/id/modes/draw_line.js @@ -120,9 +120,8 @@ iD.modes.DrawLine = function(wayId, direction) { }; mode.exit = function() { - mode.map - .hint(false) - .fastEnable(true); + mode.map.hint(false); + mode.map.fastEnable(true); mode.map.surface .on('mousemove.drawline', null) From 1abffc6f8a4b1a1444ba772a5b023ef139ce9de4 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Fri, 14 Dec 2012 13:45:53 -0500 Subject: [PATCH 2/9] Finish areas on double-click. Fixes #272 --- js/id/modes/draw_area.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/js/id/modes/draw_area.js b/js/id/modes/draw_area.js index c7d91e158..687f5496c 100644 --- a/js/id/modes/draw_area.js +++ b/js/id/modes/draw_area.js @@ -38,6 +38,16 @@ iD.modes.DrawArea = function(wayId) { controller.enter(iD.modes.Select(way)); + } else if (datum.id === headId) { + + // finish the way + history.replace( + iD.actions.DeleteNode(node.id), + iD.actions.AddWayNode(way.id, tailId, -1), + 'added to an area'); + + controller.enter(iD.modes.Select(way)); + } else if (datum.type === 'node' && datum.id !== node.id) { // connect the way to an existing node history.replace( From b5065d81c4d226b6d07c410b8ef5f2ba34b3b745 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Fri, 14 Dec 2012 13:51:36 -0500 Subject: [PATCH 3/9] Fix way node dragging. Fixes #279 --- js/id/modes/drag_features.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/id/modes/drag_features.js b/js/id/modes/drag_features.js index d20119080..80017a306 100644 --- a/js/id/modes/drag_features.js +++ b/js/id/modes/drag_features.js @@ -4,7 +4,7 @@ iD.modes._dragFeatures = function(mode) { var dragbehavior = d3.behavior.drag() .origin(function(entity) { var p = mode.map.projection(entity.loc); - d3.event.sourceEvent.stopPropagation(); + // d3.event.sourceEvent.stopPropagation(); return { x: p[0], y: p[1] }; }) .on('drag', function(entity) { From 3803d28d74cf646cec6810e650448048c182491b Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Fri, 14 Dec 2012 14:20:17 -0500 Subject: [PATCH 4/9] Improve area-closed logic. Fixes #237 --- js/id/graph/entity.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/js/id/graph/entity.js b/js/id/graph/entity.js index 5c89e4890..3918f4172 100644 --- a/js/id/graph/entity.js +++ b/js/id/graph/entity.js @@ -115,8 +115,16 @@ iD.Way.isClosed = function(d) { return (!d.nodes.length) || d.nodes[d.nodes.length - 1].id === d.nodes[0].id; }; +// a way is an area if: +// +// - area=yes +// - closed and +// - doesn't have area=no +// - doesn't have highway tag iD.Way.isArea = function(d) { - return iD.Way.isClosed(d) || (d.tags.area && d.tags.area === 'yes'); + return (d.tags.area && d.tags.area === 'yes') || + (iD.Way.isClosed(d) && + (!d.tags.area || d.tags.area === 'no') && !d.tags.highway); }; iD.Relation = function(attrs) { From e9540bf281ca9d1656c4109fa1935247a4f18e9d Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Fri, 14 Dec 2012 14:25:14 -0500 Subject: [PATCH 5/9] Avoid barriers as well --- js/id/graph/entity.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/id/graph/entity.js b/js/id/graph/entity.js index 3918f4172..d0ed8b6e6 100644 --- a/js/id/graph/entity.js +++ b/js/id/graph/entity.js @@ -124,7 +124,12 @@ iD.Way.isClosed = function(d) { iD.Way.isArea = function(d) { return (d.tags.area && d.tags.area === 'yes') || (iD.Way.isClosed(d) && - (!d.tags.area || d.tags.area === 'no') && !d.tags.highway); + // area-ness is disabled + (!d.tags.area || d.tags.area !== 'no') && + // Tags that disable area-ness unless they are accompanied by + // area=yes + !d.tags.highway && + !d.tags.barrier); }; iD.Relation = function(attrs) { From 704b9a78a436eae4a0f104f0e369544e35319893 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Fri, 14 Dec 2012 14:32:04 -0500 Subject: [PATCH 6/9] Fixup local editors. Fixes #275 --- css/app.css | 4 ++++ js/id/id.js | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/css/app.css b/css/app.css index e297596bc..db2eed63c 100644 --- a/css/app.css +++ b/css/app.css @@ -572,6 +572,10 @@ img.tile { padding:2px 5px; } +#about #user-list a:not(:last-child):after { + content: ', '; +} + /* Account Information ------------------------------------------------------- */ diff --git a/js/id/id.js b/js/id/id.js index 8a65570e4..853d258c8 100644 --- a/js/id/id.js +++ b/js/id/id.js @@ -47,7 +47,7 @@ window.iD = function(container) { var showUsers = _.debounce(function() { var users = {}, - entities = map.history().graph().entities; + entities = map.history().graph().intersects(map.extent()); for (var i in entities) { users[entities[i].user] = true; if (Object.keys(users).length > 10) break; @@ -172,7 +172,9 @@ window.iD = function(container) { " "); about.append('div') - .attr('id', 'user-list'); + .attr('id', 'user-list') + .append('span') + .text('edited by '); history.on('change.buttons', function() { var undo = history.undoAnnotation(), From 9844bf1d31e20d593a577902f9888ce04555813f Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Fri, 14 Dec 2012 14:36:09 -0500 Subject: [PATCH 7/9] Fix saving keys. Fixes #280 --- js/id/ui/inspector.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/id/ui/inspector.js b/js/id/ui/inspector.js index 014ed09a3..ab52a2a62 100644 --- a/js/id/ui/inspector.js +++ b/js/id/ui/inspector.js @@ -69,6 +69,7 @@ iD.Inspector = function() { var inputs = row.append('div').attr('class','input-wrap'); function setValue(d, i) { d.value = this.value; } + function setKey(d, i) { d.key = this.value; } function emptyTag(d) { return d.key === ''; } @@ -95,7 +96,7 @@ iD.Inspector = function() { .property('type', 'text') .attr('class', 'key') .property('value', function(d, i) { return d.key; }) - .on('keyup.update', setValue); + .on('keyup.update', setKey); inputs.append('input') .property('type', 'text') @@ -109,7 +110,7 @@ iD.Inspector = function() { .attr('class','remove minor') .on('click', removeTag); - removeBtn.append('span').attr('class', 'icon remove') + removeBtn.append('span').attr('class', 'icon remove'); helpBtn = row.append('button').attr('class', 'tag-help minor').append('a') .attr('target', '_blank') @@ -117,7 +118,8 @@ iD.Inspector = function() { .attr('href', function(d) { return 'http://taginfo.openstreetmap.org/keys/' + d.key; }); - helpBtn.append('span').attr('class', 'icon inspect') + + helpBtn.append('span').attr('class', 'icon inspect'); } function grabtags() { From ae9ebda78b09cf7b64416d64a7e8841582246a34 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Fri, 14 Dec 2012 14:38:13 -0500 Subject: [PATCH 8/9] Add accuracy handles for areas as well. --- js/id/renderer/map.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/js/id/renderer/map.js b/js/id/renderer/map.js index 93a9dec86..af99cc057 100644 --- a/js/id/renderer/map.js +++ b/js/id/renderer/map.js @@ -77,7 +77,7 @@ iD.Map = function() { function drawVector(difference) { if (surface.style(transformProp) != 'none') return; - var filter, all, ways = [], areas = [], points = [], waynodes = [], + var filter, all, ways = [], lines = [], areas = [], points = [], waynodes = [], extent = map.extent(), graph = history.graph(); @@ -103,8 +103,9 @@ iD.Map = function() { var a = all[i]; if (a.type === 'way') { a._line = nodeline(a); + ways.push(a); if (iD.Way.isArea(a)) areas.push(a); - else ways.push(a); + else lines.push(a); } else if (a._poi) { points.push(a); } else if (!a._poi && a.type === 'node' && a.intersects(extent)) { @@ -116,9 +117,9 @@ iD.Map = function() { }, []); drawHandles(waynodes, filter); drawAccuracyHandles(wayAccuracyHandles, filter); - drawCasings(ways, filter); + drawCasings(lines, filter); drawFills(areas, filter); - drawStrokes(ways, filter); + drawStrokes(lines, filter); drawMarkers(points, filter); } From 09b20ffe9464be6f12c3a23682253464811414d7 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Fri, 14 Dec 2012 14:41:21 -0500 Subject: [PATCH 9/9] Fix inspector for things with no tags --- js/id/ui/inspector.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/id/ui/inspector.js b/js/id/ui/inspector.js index ab52a2a62..b8c834cc8 100644 --- a/js/id/ui/inspector.js +++ b/js/id/ui/inspector.js @@ -136,7 +136,9 @@ iD.Inspector = function() { .map(entries); } - draw(d3.entries(_.clone(entity.tags))); + var tags = d3.entries(_.clone(entity.tags)); + if (tags.length === 0) tags = [{ key: '', value: '' }]; + draw(tags); selection.select('input').node().focus();