From d1f9f0135f0e954f38e806b18b2cdb1dfd51f28e Mon Sep 17 00:00:00 2001 From: Candid Dauth Date: Tue, 27 Dec 2016 12:37:55 +0100 Subject: [PATCH] Add possibility to add single letters as marker icons (fixes #46) --- frontend/app/utils/utils.js | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/frontend/app/utils/utils.js b/frontend/app/utils/utils.js index a269e6b4..7918bdc9 100644 --- a/frontend/app/utils/utils.js +++ b/frontend/app/utils/utils.js @@ -35,26 +35,23 @@ var width = Math.round(height * 23 / 31); padding = padding || 0; + var symbolCode = ""; + if(symbol && fmIcons[symbol]) { + symbolCode = '' + fmIcons[symbol].replace(/#000/g, '#' + borderColour) + ''; + } else if(symbol && symbol.length == "1") { + symbolCode = '' + fmUtils.quoteHtml(symbol) + ''; + } else { + symbolCode = ''; + } + var svg = '' + '' + '' + '' + - (symbol && fmIcons[symbol] ? - '' + fmIcons[symbol].replace(/#000/g, '#' + borderColour) + '' : - '' - ) + + symbolCode + '' + ''; - /*var svg = '' + - '' + - (randomTrash ? '' : '') + // Chrome seems to have a bug where it applies the CSS styles of one image the same code - (huge ? '' : '') + - '' + - '' + - (huge ? '' : '') + - '';*/ - return "data:image/svg+xml,"+encodeURIComponent(svg); };