Fix accuracy nodes

This commit is contained in:
Tom MacWright
2012-12-06 19:41:43 -05:00
parent 1e7cf70050
commit 9b71f48521
2 changed files with 6 additions and 4 deletions
+6 -3
View File
@@ -6,7 +6,7 @@ iD.modes.Browse = function() {
description: 'Pan and zoom the map'
};
var dragging;
var dragging, incarnated;
var dragbehavior = d3.behavior.drag()
.origin(function(entity) {
@@ -17,21 +17,24 @@ iD.modes.Browse = function() {
d3.event.sourceEvent.stopPropagation();
if (!dragging) {
if (entity.accuracy) {
var node = iD.Node(entity);
var node = iD.Node({ loc: entity.loc });
mode.history.perform(
iD.actions.AddNode(node),
iD.actions.AddWayNode(entity.way, node.id, entity.index));
incarnated = node.id;
}
dragging = iD.util.trueObj([entity.id].concat(
_.pluck(mode.history.graph().parentWays(entity.id), 'id')));
mode.history.perform(iD.actions.Noop());
}
if (incarnated) entity = mode.history.graph().entity(incarnated);
var to = mode.map.projection.invert([d3.event.x, d3.event.y]);
mode.history.replace(iD.actions.Move(entity.id, to));
})
.on('dragend', function () {
if (!dragging) return;
dragging = undefined;
incarnated = undefined;
});
mode.enter = function() {
@@ -39,7 +42,7 @@ iD.modes.Browse = function() {
.call(dragbehavior)
.call(d3.latedrag()
.filter(function(d) {
return d.type === 'node';
return (d.type === 'node' || d.accuracy);
}));
mode.map.surface.on('click.browse', function () {
var datum = d3.select(d3.event.target).datum();
-1
View File
@@ -116,7 +116,6 @@ iD.Map = function() {
handles.push({
loc: iD.util.geo.interp(way.nodes[i].loc, way.nodes[i + 1].loc, 0.5),
way: way.id,
id: way.id,
index: i + 1,
accuracy: true
});