Add a margin for point labels

This commit is contained in:
Ansis Brammanis
2013-01-23 16:18:57 -05:00
parent 3a48016e5f
commit 4714763ea3
+2 -1
View File
@@ -240,6 +240,7 @@ iD.svg.Labels = function(projection) {
function getPointLabel(entity, width, height) {
var coord = projection(entity.loc),
m = 5, // margin
offset = pointOffsets[0],
p = {
height: height,
@@ -248,7 +249,7 @@ iD.svg.Labels = function(projection) {
y: coord[1] + offset[1],
textAnchor: offset[2]
}
var rect = new RTree.Rectangle(p.x, p.y, width, height);
var rect = new RTree.Rectangle(p.x - m, p.y - m, width + 2*m, height + 2*m);
if (tryInsert(rect)) return p;
}