From 99748dba4e0d3c874273b7adce24f08410651a1e Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Wed, 23 Jan 2013 18:54:31 -0500 Subject: [PATCH] Fix several small label related bugs --- css/map.css | 8 ++++---- js/id/svg/labels.js | 13 ++++++++----- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/css/map.css b/css/map.css index 594b23b61..06afe4584 100644 --- a/css/map.css +++ b/css/map.css @@ -586,18 +586,18 @@ text.pointlabel { .pointlabel-halo, .linelabel-halo, -.area-halo { +.arealabel-halo { opacity: 0.7; pointer-events: none; } -text.area-leisure-park { +text.area.tag-leisure-park { font-size: 16px; } -text.point-shop, -text.point-amenity { +text.point.tag-shop, +text.point.tag-amenity { font-size: 9px; } diff --git a/js/id/svg/labels.js b/js/id/svg/labels.js index 0db2c59e2..44e8bad27 100644 --- a/js/id/svg/labels.js +++ b/js/id/svg/labels.js @@ -12,16 +12,17 @@ iD.svg.Labels = function(projection) { var default_size = 12; var font_sizes = label_stack.map(function(d) { - var style = iD.util.getStyle('text.' + d.join('-')); + var style = iD.util.getStyle( + 'text.' + d[0] + '.tag-' + d.slice(1).join('-')); var m = style && style.cssText.match("font-size: ([0-9]{1,2})px;"); if (!m) return default_size; return parseInt(m[1], 10); }); var pointOffsets = [ - [10, 3, 'start'], // right - [10, 0, 'start'], - [-15, 0, 'end'], // left + [15, 3, 'start'], // right + [10, 0, 'start'], // unused right now + [-15, 0, 'end'] ]; var lineOffsets = [ @@ -103,6 +104,8 @@ iD.svg.Labels = function(projection) { return x; }, 'y': function(d, i) { return labels[i]['y'] - labels[i]['height'] + 1 - 2; }, + 'rx': 3, + 'ry': 3, 'width': function(d, i) { return textWidth(d.tags.name, labels[i]['height']) + 4 }, 'height': function(d, i) { return labels[i]['height'] + 4 }, 'fill': 'white', @@ -231,7 +234,7 @@ iD.svg.Labels = function(projection) { p = getAreaLabel(entity, width, font_size); } if (p) { - p.classes = label_stack[k].join('-'); + p.classes = entity.geometry() + ' tag-' + label_stack[k].slice(1).join('-'); positions[entity.geometry()].push(p); labelled[entity.geometry()].push(entity); }