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

This commit is contained in:
Tom MacWright
2013-02-04 18:48:56 -05:00
7 changed files with 6 additions and 50 deletions
+1 -2
View File
@@ -1,12 +1,11 @@
iD.behavior.AddWay = function(context) {
var event = d3.dispatch('start', 'startFromWay', 'startFromNode', 'startFromMidpoint'),
var event = d3.dispatch('start', 'startFromWay', 'startFromNode')
draw = iD.behavior.Draw(context);
var addWay = function(surface) {
draw.on('click', event.start)
.on('clickWay', event.startFromWay)
.on('clickNode', event.startFromNode)
.on('clickMidpoint', event.startFromMidpoint)
.on('cancel', addWay.cancel)
.on('finish', addWay.cancel);
+1 -4
View File
@@ -1,5 +1,5 @@
iD.behavior.Draw = function(context) {
var event = d3.dispatch('move', 'click', 'clickWay', 'clickNode', 'clickMidpoint', 'undo', 'cancel', 'finish'),
var event = d3.dispatch('move', 'click', 'clickWay', 'clickNode', 'undo', 'cancel', 'finish'),
keybinding = d3.keybinding('draw'),
hover = iD.behavior.Hover();
@@ -34,9 +34,6 @@ iD.behavior.Draw = function(context) {
} else if (d.type === 'node') {
event.clickNode(d);
} else if (d.type === 'midpoint') {
event.clickMidpoint(d);
} else {
event.click(context.map().mouseCoordinates());
}
-14
View File
@@ -46,7 +46,6 @@ iD.behavior.DrawWay = function(context, wayId, index, mode, baseGraph) {
.on('click', drawWay.add)
.on('clickWay', drawWay.addWay)
.on('clickNode', drawWay.addNode)
.on('clickMidpoint', drawWay.addMidpoint)
.on('undo', context.undo)
.on('cancel', drawWay.cancel)
.on('finish', drawWay.finish);
@@ -140,19 +139,6 @@ iD.behavior.DrawWay = function(context, wayId, index, mode, baseGraph) {
context.enter(mode);
};
// Add a midpoint, connect the way to it, and continue drawing.
drawWay.addMidpoint = function(midpoint) {
var node = iD.Node();
context.perform(
iD.actions.AddMidpoint(midpoint, node),
ReplaceTemporaryNode(node),
annotation);
finished = true;
context.enter(mode);
};
// Finish the draw operation, removing the temporary node. If the way has enough
// nodes to be valid, it's selected. Otherwise, return to browse mode.
drawWay.finish = function() {
-15
View File
@@ -11,7 +11,6 @@ iD.modes.AddArea = function(context) {
.on('start', start)
.on('startFromWay', startFromWay)
.on('startFromNode', startFromNode)
.on('startFromMidpoint', startFromMidpoint),
defaultTags = {area: 'yes'};
function start(loc) {
@@ -55,20 +54,6 @@ iD.modes.AddArea = function(context) {
context.enter(iD.modes.DrawArea(context, way.id, graph));
}
function startFromMidpoint(midpoint) {
var graph = context.graph(),
node = iD.Node(),
way = iD.Way({tags: defaultTags});
context.perform(
iD.actions.AddMidpoint(midpoint, node),
iD.actions.AddEntity(way),
iD.actions.AddVertex(way.id, node.id),
iD.actions.AddVertex(way.id, node.id));
context.enter(iD.modes.DrawArea(context, way.id, graph));
}
mode.enter = function() {
context.install(behavior);
context.tail(t('modes.add_area.tail'));
-14
View File
@@ -11,7 +11,6 @@ iD.modes.AddLine = function(context) {
.on('start', start)
.on('startFromWay', startFromWay)
.on('startFromNode', startFromNode)
.on('startFromMidpoint', startFromMidpoint),
defaultTags = {highway: 'residential'};
function start(loc) {
@@ -63,19 +62,6 @@ iD.modes.AddLine = function(context) {
}
}
function startFromMidpoint(midpoint) {
var graph = context.graph(),
node = iD.Node(),
way = iD.Way({tags: defaultTags});
context.perform(
iD.actions.AddMidpoint(midpoint, node),
iD.actions.AddEntity(way),
iD.actions.AddVertex(way.id, node.id));
context.enter(iD.modes.DrawLine(context, way.id, 'forward', graph));
}
mode.enter = function() {
context.install(behavior);
context.tail(t('modes.add_line.tail'));
-1
View File
@@ -10,7 +10,6 @@ iD.modes.AddPoint = function(context) {
.on('click', add)
.on('clickWay', addWay)
.on('clickNode', addNode)
.on('clickMidpoint', addNode)
.on('cancel', cancel)
.on('finish', cancel);
+4
View File
@@ -2,6 +2,10 @@ iD.svg.Midpoints = function(projection) {
return function drawMidpoints(surface, graph, entities, filter) {
var midpoints = {};
if (!surface.select('.layer-hit g.vertex').node()) {
return surface.selectAll('.layer-hit g.midpoint').remove();
}
for (var i = 0; i < entities.length; i++) {
if (entities[i].type !== 'way') continue;