mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-18 14:45:12 +02:00
Run intersection on difference changes, do not use compact. Fixes #334
This commit is contained in:
+2
-1
@@ -6,7 +6,8 @@ iD.Way = iD.Entity.extend({
|
||||
return resolver.transient(this, 'extent', function() {
|
||||
var extent = [[-Infinity, Infinity], [Infinity, -Infinity]];
|
||||
for (var i = 0, l = this.nodes.length; i < l; i++) {
|
||||
var node = resolver.entity(this.nodes[i]);
|
||||
var node = this.nodes[i];
|
||||
if (node.loc === undefined) node = resolver.entity(node);
|
||||
if (node.loc[0] > extent[0][0]) extent[0][0] = node.loc[0];
|
||||
if (node.loc[0] < extent[1][0]) extent[1][0] = node.loc[0];
|
||||
if (node.loc[1] < extent[0][1]) extent[0][1] = node.loc[1];
|
||||
|
||||
+11
-8
@@ -65,18 +65,21 @@ iD.Map = function() {
|
||||
var only = {};
|
||||
for (var j = 0; j < difference.length; j++) {
|
||||
var id = difference[j];
|
||||
only[id] = graph.fetch(id);
|
||||
if (only[id] && only[id].type === 'node') {
|
||||
var parents = graph.parentWays(only[id]);
|
||||
for (var k = 0; k < parents.length; k++) {
|
||||
// Don't re-fetch parents
|
||||
if (only[parents[k].id] === undefined) {
|
||||
only[parents[k].id] = graph.fetch(parents[k].id);
|
||||
var entity = graph.fetch(id);
|
||||
if (entity && entity.intersects(extent, graph)) {
|
||||
only[id] = entity;
|
||||
if (only[id].type === 'node') {
|
||||
var parents = graph.parentWays(only[id]);
|
||||
for (var k = 0; k < parents.length; k++) {
|
||||
// Don't re-fetch parents
|
||||
if (only[parents[k].id] === undefined) {
|
||||
only[parents[k].id] = graph.fetch(parents[k].id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
all = _.compact(_.values(only));
|
||||
all = _.values(only);
|
||||
filter = function(d) { return d.midpoint ? d.way in only : d.id in only; };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user