diff options
-rw-r--r-- | main.js | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -721,7 +721,7 @@ const layers = { popoverTitle: 'Kraftledning (befintlig)', popover: [ ['Förläggn', 'FÖRLÄGGN'], - ['Spänning', 'SPÄNNING', { fn: (v) => v + '\u202FkV' }], + ['Spänning', 'SPÄNNING', { unit: 'kV' }], ], style: [1, 1.5, 2, 2, 2, 2, 3, 4, 5, 6, 8, 10].map(function(width) { return new Style({ @@ -751,7 +751,7 @@ const layers = { popoverTitle: 'Transmissionsnätsprojekt', popover: [ ['Projektnamn', 'name'], - ['Spänning', 'voltage', { fn: (v) => v + '\u202FkV' }], + ['Spänning', 'voltage', { unit: 'kV' }], ['Länk', 'url', { fn: function(v) { const a = document.createElement('a'); a.href = v; @@ -1331,6 +1331,9 @@ map.addLayer(vectorLayer); if (opts.fn !== undefined) { v = opts.fn(v); } + if (opts.unit !== undefined && v !== undefined && v !== '') { + v += '\u202F' + opts.unit; + } if (v === undefined) { v = document.createTextNode(''); } else if (!(v instanceof HTMLElement)) { |