mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-20 23:44:47 +02:00
Fix accuracy nodes
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user