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

This commit is contained in:
Saman Bemel-Benrud
2012-12-13 12:16:25 -05:00
8 changed files with 50 additions and 62 deletions

View File

@@ -251,7 +251,7 @@ button.action .label {
/* Definitions for every icon */
.icon.browse { background-position: 0px 0px;}
.icon.add-place { background-position: -20px 0px;}
.icon.add-road { background-position: -40px 0px;}
.icon.add-line { background-position: -40px 0px;}
.icon.add-area { background-position: -60px 0px;}
.icon.undo { background-position: -80px 0px;}
.icon.redo { background-position: -100px 0px;}
@@ -268,7 +268,7 @@ button.action .label {
.active .icon.browse { background-position: 0px -20px;}
.active .icon.add-place { background-position: -20px -20px;}
.active .icon.add-road { background-position: -40px -20px;}
.active .icon.add-line { background-position: -40px -20px;}
.active .icon.add-area { background-position: -60px -20px;}
.active .icon.undo { background-position: -80px -20px;}
.active .icon.redo { background-position: -100px -20px;}
@@ -285,7 +285,7 @@ button.action .label {
button[disabled] .icon.browse { background-position: 0px -40px;}
button[disabled] .icon.add-place { background-position: -20px -40px;}
button[disabled] .icon.add-road { background-position: -40px -40px;}
button[disabled] .icon.add-line { background-position: -40px -40px;}
button[disabled] .icon.add-area { background-position: -60px -40px;}
button[disabled] .icon.undo { background-position: -80px -40px;}
button[disabled] .icon.redo { background-position: -100px -40px;}

View File

@@ -63,10 +63,10 @@
<script src='js/id/modes/drag_features.js'></script>
<script src='js/id/modes/add_area.js'></script>
<script src='js/id/modes/add_place.js'></script>
<script src='js/id/modes/add_road.js'></script>
<script src='js/id/modes/add_line.js'></script>
<script src='js/id/modes/browse.js'></script>
<script src='js/id/modes/draw_area.js'></script>
<script src='js/id/modes/draw_road.js'></script>
<script src='js/id/modes/draw_line.js'></script>
<script src='js/id/modes/select.js'></script>
<script src='js/id/controller/controller.js'></script>

View File

@@ -29,7 +29,7 @@ window.iD = function(container) {
.attr('class', 'buttons-joined');
var buttons = buttons_joined.selectAll('button.add-button')
.data([iD.modes.Browse(), iD.modes.AddPlace(), iD.modes.AddRoad(), iD.modes.AddArea()])
.data([iD.modes.Browse(), iD.modes.AddPlace(), iD.modes.AddLine(), iD.modes.AddArea()])
.enter().append('button')
.attr('class', function (mode) { return mode.title + ' add-button'; })
.attr('data-original-title', function (mode) { return mode.description; })
@@ -131,7 +131,7 @@ window.iD = function(container) {
.on('click', function(d) { return d[2](); })
.append('span')
.attr('class', function(d) {
return d[0] + ' icon'
return d[0] + ' icon';
});
var gc = this.append('div').attr('class', 'geocode-control map-control');
@@ -139,18 +139,11 @@ window.iD = function(container) {
.attr('class','narrow')
.html("<span class='geocode icon'></span>")
.on('click', function() {
d3.select(this)
.classed('active', function() {
if ( !gcForm.classed('hide')) {
return false;
} else {
return true;
}
});
gcForm.classed('hide', function() {
return !gcForm.classed('hide');
});
d3.select('.map-overlay input').node().focus();
d3.select(this).classed('active', gcForm.classed('hide'));
gcForm.classed('hide', !gcForm.classed('hide'));
if (!gcForm.classed('hide')) d3.select('.map-overlay input').node().focus();
else map.surface.node().focus();
});
var gcForm = gc.append('form');
gcForm.attr('class','content map-overlay hide')
@@ -164,6 +157,7 @@ window.iD = function(container) {
d3.event.preventDefault();
d3.json('http://api.tiles.mapbox.com/v3/mapbox/geocode/' +
encodeURIComponent(this.value) + '.json', function(err, resp) {
gc.select('button').on('click').apply(gc.select('button').node());
map.center([resp.results[0][0].lon, resp.results[0][0].lat]);
});
});
@@ -206,7 +200,7 @@ window.iD = function(container) {
controller.enter(iD.modes.AddPlace());
})
.on('r', function(evt, mods) {
controller.enter(iD.modes.AddRoad());
controller.enter(iD.modes.AddLine());
})
.on('z', function(evt, mods) {
if (mods === '⇧⌘') history.redo();

View File

@@ -1,9 +1,9 @@
iD.modes.AddRoad = function() {
iD.modes.AddLine = function() {
var mode = {
id: 'add-road',
button: 'road',
title: 'Road',
description: 'Roads can be highways, streets, pedestrian paths, or even canals.'
id: 'add-line',
button: 'line',
title: 'Line',
description: 'Lines can be highways, streets, pedestrian paths, or even canals.'
};
mode.enter = function() {
@@ -59,7 +59,7 @@ iD.modes.AddRoad = function() {
'started a road');
}
controller.enter(iD.modes.DrawRoad(way.id, direction));
controller.enter(iD.modes.DrawLine(way.id, direction));
});
map.keybinding().on('⎋.addroad', function() {

View File

@@ -1,6 +1,6 @@
iD.modes.DrawRoad = function(wayId, direction) {
iD.modes.DrawLine = function(wayId, direction) {
var mode = {
button: 'road'
button: 'line'
};
mode.enter = function() {
@@ -16,19 +16,19 @@ iD.modes.DrawRoad = function(wayId, direction) {
map.dblclickEnable(false)
.fastEnable(false)
.hint('Click to add more points to the road. ' +
'Click on other roads to connect to them, and double-click to ' +
'end the road.');
.hint('Click to add more points to the line. ' +
'Click on other lines to connect to them, and double-click to ' +
'end the line.');
history.perform(
iD.actions.AddNode(node),
iD.actions.AddWayNode(wayId, node.id, index));
map.surface.on('mousemove.drawroad', function() {
map.surface.on('mousemove.drawline', function() {
history.replace(iD.actions.Move(node.id, map.mouseCoordinates()));
});
map.surface.on('click.drawroad', function() {
map.surface.on('click.drawline', function() {
var datum = d3.select(d3.event.target).datum() || {};
if (datum.id === tailId) {
@@ -36,7 +36,7 @@ iD.modes.DrawRoad = function(wayId, direction) {
history.replace(
iD.actions.DeleteNode(node.id),
iD.actions.AddWayNode(wayId, tailId, index),
'added to a road');
'added to a line');
controller.enter(iD.modes.Select(way));
@@ -51,9 +51,9 @@ iD.modes.DrawRoad = function(wayId, direction) {
history.replace(
iD.actions.DeleteNode(node.id),
iD.actions.AddWayNode(wayId, datum.id, index),
'added to a road');
'added to a line');
controller.enter(iD.modes.DrawRoad(wayId, direction));
controller.enter(iD.modes.DrawLine(wayId, direction));
} else if (datum.type === 'way') {
// connect the way to an existing way
@@ -61,16 +61,16 @@ iD.modes.DrawRoad = function(wayId, direction) {
history.replace(
iD.actions.AddWayNode(datum.id, node.id, connectedIndex),
'added to a road');
'added to a line');
controller.enter(iD.modes.DrawRoad(wayId, direction));
controller.enter(iD.modes.DrawLine(wayId, direction));
} else {
history.replace(
iD.actions.Noop(),
'added to a road');
'added to a line');
controller.enter(iD.modes.DrawRoad(wayId, direction));
controller.enter(iD.modes.DrawLine(wayId, direction));
}
});
@@ -92,7 +92,7 @@ iD.modes.DrawRoad = function(wayId, direction) {
history.replace(iD.actions.DeleteWay(wayId));
controller.enter(iD.modes.Browse());
} else {
controller.enter(iD.modes.DrawRoad(wayId, direction));
controller.enter(iD.modes.DrawLine(wayId, direction));
}
}
@@ -108,10 +108,10 @@ iD.modes.DrawRoad = function(wayId, direction) {
controller.enter(iD.modes.Browse());
}
map.keybinding().on('⎋.drawroad', esc)
.on('⌫.drawroad', backspace)
.on('delete.drawroad', del)
.on('↩.drawroad', ret);
map.keybinding().on('⎋.drawline', esc)
.on('⌫.drawline', backspace)
.on('delete.drawline', del)
.on('↩.drawline', ret);
};
mode.exit = function() {
@@ -119,12 +119,12 @@ iD.modes.DrawRoad = function(wayId, direction) {
mode.map.fastEnable(true);
mode.map.surface
.on('mousemove.drawroad', null)
.on('click.drawroad', null);
mode.map.keybinding().on('⎋.drawroad', null)
.on('⌫.drawroad', null)
.on('delete.drawroad', null)
.on('↩.drawroad', null);
.on('mousemove.drawline', null)
.on('click.drawline', null);
mode.map.keybinding().on('⎋.drawline', null)
.on('⌫.drawline', null)
.on('delete.drawline', null)
.on('↩.drawline', null);
window.setTimeout(function() {
mode.map.dblclickEnable(true);
}, 1000);

View File

@@ -42,6 +42,7 @@
<script src='../js/id/ui/commit.js'></script>
<script src='../js/id/ui/loading.js'></script>
<script src='../js/id/ui/userpanel.js'></script>
<script src='../js/id/ui/notice.js'></script>
<script src='../js/id/actions.js'></script>
<script src='../js/id/actions/add_node.js'></script>
@@ -59,10 +60,10 @@
<script src='../js/id/modes.js'></script>
<script src='../js/id/modes/add_area.js'></script>
<script src='../js/id/modes/add_place.js'></script>
<script src='../js/id/modes/add_road.js'></script>
<script src='../js/id/modes/add_line.js'></script>
<script src='../js/id/modes/browse.js'></script>
<script src='../js/id/modes/draw_area.js'></script>
<script src='../js/id/modes/draw_road.js'></script>
<script src='../js/id/modes/draw_line.js'></script>
<script src='../js/id/modes/select.js'></script>
<script src='../js/id/controller/controller.js'></script>

View File

@@ -49,12 +49,5 @@ describe('Connection', function() {
});
});
it('passes errors for 404s', function(done) {
c.loadFromURL('404', function(err, graph) {
expect(graph).to.be.a('Error');
done();
});
});
});
});

View File

@@ -56,8 +56,8 @@ describe('Map', function() {
it('reports extent', function() {
expect(map.size([100, 100])).to.equal(map);
expect(map.center([0, 0])).to.equal(map);
expect(map.extent()[0][0]).to.be.closeTo(-36, 0.5);
expect(map.extent()[1][0]).to.be.closeTo(36, 0.5);
expect(map.extent()[0][0]).to.be.closeTo(-17.5, 0.5);
expect(map.extent()[1][0]).to.be.closeTo(17.5, 0.5);
});
});