Merge branch 'master' of github.com:systemed/iD

This commit is contained in:
Saman Bemel-Benrud
2012-12-14 14:48:47 -05:00
8 changed files with 52 additions and 20 deletions

View File

@@ -572,6 +572,10 @@ img.tile {
padding:2px 5px;
}
#about #user-list a:not(:last-child):after {
content: ', ';
}
/* Account Information
------------------------------------------------------- */

View File

@@ -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) {

View File

@@ -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) {
" <a href='http://opengeodata.org/microsoft-imagery-details'><img src='img/bing.png' /></a>");
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(),

View File

@@ -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) {

View File

@@ -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)

View File

@@ -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)

View File

@@ -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);
}

View File

@@ -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();