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/graph/entity.js b/js/id/graph/entity.js index 5c89e4890..d0ed8b6e6 100644 --- a/js/id/graph/entity.js +++ b/js/id/graph/entity.js @@ -115,8 +115,21 @@ 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) && + // 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) { 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(), 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) { diff --git a/js/id/modes/draw_area.js b/js/id/modes/draw_area.js index c31544e5c..687f5496c 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( @@ -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( @@ -107,9 +117,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) 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); } diff --git a/js/id/ui/inspector.js b/js/id/ui/inspector.js index 014ed09a3..b8c834cc8 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() { @@ -134,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();