Fix dragging nodes that are members of multiple ways

This commit is contained in:
Tom MacWright
2012-11-13 21:45:04 -05:00
parent 4bc8313157
commit f40e12ba1d
3 changed files with 20 additions and 9 deletions

View File

@@ -40,6 +40,11 @@ circle.teaser-point {
stroke-width: 3;
}
.casing:hover {
stroke:#FF0F0F !important;
opacity:0.8;
}
.casing.active {
stroke:#FFF9C9;
stroke-opacity:1;

View File

@@ -150,10 +150,16 @@ iD.actions.DrawRoad = function(way) {
this._doubleTime = window.setTimeout(function(e) {
return function() {
d3.event = e;
var t = d3.select(d3.event.target);
d3.event.stopPropagation();
// connect a way to an existing way
if (t.data() && t.data()[0] && t.data()[0].type === 'node') {
node = t.data()[0];
} else {
node = iD.actions._node(that.map.projection.invert(
d3.mouse(surface.node())));
}
way.nodes.pop();
var ll = that.map.projection.invert(d3.mouse(surface.node()));
var node = iD.actions._node(ll);
way.nodes.push(node.id);
that.map.operate(iD.operations.changeWayNodes(way, node));
way.nodes = way.nodes.slice();

View File

@@ -108,7 +108,10 @@ iD.Map = function(elem) {
var graph = history.graph(),
all = graph.intersects(getExtent());
var ways = [], areas = [], points = [];
var ways = [],
areas = [],
points = [],
waynodes = [];
var active_entity = null;
var selected_id = selection;
@@ -125,6 +128,8 @@ iD.Map = function(elem) {
}
} else if (a._poi) {
points.push(a);
} else if (!a._poi && a.type === 'node') {
waynodes.push(a);
}
}
@@ -183,12 +188,7 @@ iD.Map = function(elem) {
});
var handles = hit_g.selectAll('rect.handle')
// TODO: this could be faster
.data(areas.reduce(function(memo, w) {
return memo.concat(w.nodes);
}, ways.reduce(function(memo, w) {
return memo.concat(w.nodes);
}, [])), key);
.data(waynodes, key);
handles.exit().remove();
handles.enter().append('rect')