Adjust fix for #2040

This commit is contained in:
John Firebaugh
2013-12-10 10:17:25 -05:00
parent 4294ed4561
commit 3f67b1e513
2 changed files with 6 additions and 9 deletions

View File

@@ -119,13 +119,6 @@ iD.Map = function(context) {
}
return true;
} else if (d.type === 'node') {
// if a node was deleted, only the way will be in the diff
// so we should redraw midpoints for all nodes in that way
var parentWays = graph.parentWays({ id: d.id });
if (parentWays.length > 0 && parentWays[0].id in complete) return true;
return d.id in complete;
} else {
return d.id in complete;
}

View File

@@ -17,8 +17,12 @@ iD.svg.Midpoints = function(projection, context) {
b = nodes[j + 1],
id = [a.id, b.id].sort().join('-');
// If neither of the nodes changed, no need to redraw midpoint
if (!midpoints[id] && (filter(a) || filter(b))) {
// Redraw midpoints in two cases:
// 1. One of the two endpoint nodes changed (e.g. was moved).
// 2. A node was deleted. The midpoint between the two new
// endpoints needs to be redrawn. In this case only the
// way will be in the diff.
if (!midpoints[id] && (filter(a) || filter(b) || filter(entity))) {
var loc = iD.geo.interp(a.loc, b.loc, 0.5);
if (extent.intersects(loc) && iD.geo.euclideanDistance(projection(a.loc), projection(b.loc)) > 40) {
midpoints[id] = {