Don't snap to midpoints, snap to their parent way

This commit is contained in:
Ansis Brammanis
2013-02-02 23:47:29 -05:00
parent 441be74539
commit 13b0b540a7
+6 -3
View File
@@ -16,10 +16,13 @@ iD.behavior.DrawWay = function(context, wayId, index, mode, baseGraph) {
function move(datum) {
var loc = context.map().mouseCoordinates();
if (datum.type === 'node' || datum.type === 'midpoint') {
if (datum.type === 'node') {
loc = datum.loc;
} else if (datum.type === 'way') {
loc = iD.geo.chooseIndex(datum, d3.mouse(context.surface().node()), context).loc;
} else if (datum.type === 'midpoint' || datum.type === 'way') {
var way = datum.type === 'way' ?
datum :
baseGraph.entity(datum.ways[0].id);
loc = iD.geo.chooseIndex(way, d3.mouse(context.surface().node()), context).loc;
}
context.replace(iD.actions.MoveNode(nodeId, loc));