mirror of
https://github.com/FoggedLens/iD.git
synced 2026-04-22 03:36:37 +02:00
Draw only visible midpoints (#804)
This commit is contained in:
@@ -89,7 +89,7 @@ iD.Map = function(context) {
|
||||
.call(vertices, graph, all, filter)
|
||||
.call(lines, graph, all, filter)
|
||||
.call(areas, graph, all, filter)
|
||||
.call(midpoints, graph, all, filter)
|
||||
.call(midpoints, graph, all, filter, extent)
|
||||
.call(labels, graph, all, filter, dimensions, !difference);
|
||||
}
|
||||
dispatch.drawn(map);
|
||||
|
||||
+11
-8
@@ -1,5 +1,5 @@
|
||||
iD.svg.Midpoints = function(projection) {
|
||||
return function drawMidpoints(surface, graph, entities, filter) {
|
||||
return function drawMidpoints(surface, graph, entities, filter, extent) {
|
||||
var midpoints = {};
|
||||
|
||||
if (!surface.select('.layer-hit g.vertex').node()) {
|
||||
@@ -22,13 +22,16 @@ iD.svg.Midpoints = function(projection) {
|
||||
if (midpoints[id]) {
|
||||
midpoints[id].ways.push({id: entity.id, index: j + 1});
|
||||
|
||||
} else if (iD.geo.dist(projection(a.loc), projection(b.loc)) > 40) {
|
||||
midpoints[id] = {
|
||||
type: 'midpoint',
|
||||
id: id,
|
||||
loc: iD.geo.interp(a.loc, b.loc, 0.5),
|
||||
ways: [{id: entity.id, index: j + 1}]
|
||||
};
|
||||
} else {
|
||||
var loc = iD.geo.interp(a.loc, b.loc, 0.5);
|
||||
if (extent.intersects(loc) && iD.geo.dist(projection(a.loc), projection(b.loc)) > 40) {
|
||||
midpoints[id] = {
|
||||
type: 'midpoint',
|
||||
id: id,
|
||||
loc: loc,
|
||||
ways: [{id: entity.id, index: j + 1}]
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user