aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/main.js b/main.js
index 41a34ce..94ccc9c 100644
--- a/main.js
+++ b/main.js
@@ -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)) {