From afb51ab4bde55355df8baf9607e7b4de84a185ed Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Sun, 15 Jan 2017 01:10:28 +0530 Subject: [PATCH] Add halo for area icons (closes #3762) --- css/map.css | 13 +++++++++++-- modules/svg/labels.js | 13 +++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/css/map.css b/css/map.css index be5e930fd..46f530336 100644 --- a/css/map.css +++ b/css/map.css @@ -1375,10 +1375,19 @@ text.point { font-size: 10px; } -.icon.areaicon { - opacity: 0.7; +.icon.areaicon-halo { + opacity: 0.6; + stroke: #999; + stroke-width: 2px; + stroke-miterlimit: 1; } +.icon.areaicon { + fill: #222; + opacity: 0.8; +} + + /* Turns */ g.turn rect, diff --git a/modules/svg/labels.js b/modules/svg/labels.js index 64169cfba..dfb0ce40e 100644 --- a/modules/svg/labels.js +++ b/modules/svg/labels.js @@ -183,7 +183,7 @@ export function svgLabels(projection, context) { function drawAreaIcons(selection, entities, filter, classes, labels) { - var icons = selection.selectAll('use') + var icons = selection.selectAll('use.' + classes) .filter(filter) .data(entities, osmEntity.key); @@ -192,9 +192,9 @@ export function svgLabels(projection, context) { icons = icons.enter() .append('use') - .attr('class', 'icon areaicon') - .attr('width', '18px') - .attr('height', '18px') + .attr('class', 'icon ' + classes) + .attr('width', '17px') + .attr('height', '17px') .merge(icons); icons @@ -503,7 +503,7 @@ export function svgLabels(projection, context) { if (isNaN(centroid[0]) || entitywidth < 20) return; - var iconSize = 18, + var iconSize = 20, iconX = centroid[0] - (iconSize / 2), iconY = centroid[1] - (iconSize / 2), margin = 2, @@ -592,7 +592,8 @@ export function svgLabels(projection, context) { // areas drawAreaLabels(label, labelled.area, filter, 'arealabel', positions.area); drawAreaLabels(halo, labelled.area, filter, 'arealabel-halo', positions.area); - drawAreaIcons(label, labelled.area, filter, 'arealabel-icon', positions.area); + drawAreaIcons(label, labelled.area, filter, 'areaicon', positions.area); + drawAreaIcons(halo, labelled.area, filter, 'areaicon-halo', positions.area); // debug drawCollisionBoxes(label, rskipped, 'debug-skipped');