From 8f381adf3b0b3f40668b78c7b93fd1e1a027dd73 Mon Sep 17 00:00:00 2001 From: Werner Kramer Date: Thu, 30 May 2024 19:26:36 +0200 Subject: [PATCH] Always use white text --- src/components/wms/ColourBar.vue | 47 +++++++++++++++++------------ src/components/wms/ColourLegend.vue | 16 ++++------ 2 files changed, 34 insertions(+), 29 deletions(-) diff --git a/src/components/wms/ColourBar.vue b/src/components/wms/ColourBar.vue index c2f04af3..31dd9eba 100644 --- a/src/components/wms/ColourBar.vue +++ b/src/components/wms/ColourBar.vue @@ -4,7 +4,7 @@ :class="isVisible ? 'invisible' : ''" class="legend_container" > - + (), { const range = defineModel('range', { required: true }) +const colourbarElement = ref() + const isVisible = ref(true) const isEditingMin = ref(false) const isEditingMax = ref(false) -let group: d3.Selection +let group: d3.Selection onMounted(() => { - const svg = d3.select('#colourbar') - group = svg - .append('g') - .attr('transform', 'translate(25, 25)') - .style('pointer-events', 'visiblePainted') - updateColourBar() + if (colourbarElement.value !== undefined) { + const svg = d3.select(colourbarElement.value) + group = svg + .append('g') + .attr('transform', 'translate(25, 25)') + .style('pointer-events', 'visiblePainted') + updateColourBar() + } }) watch(props, updateColourBar) @@ -94,25 +98,30 @@ function updateColourBar() { display: none; } -.colourbar { +.map__colour-bar { width: 300px; height: 60px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; +} + +.map__colour-bar :deep(text) { + fill: white; text-rendering: optimizeLegibility; text-shadow: - rgb(var(--v-theme-background)) 0px 0px 1px, - rgb(var(--v-theme-background)) 0px 0px 2px, - rgb(var(--v-theme-background)) 0px 0px 3px, - rgb(var(--v-theme-background)) 0px 0px 4px, - rgb(var(--v-theme-background)) 0px 0px 5px, - rgb(var(--v-theme-background)) 0px 0px 6px; + black 0px 0px 2px, + black 0px 0px 4px, + black 0px 0px 6px; +} + +.map__colour-bar :deep(.axis .tick line) { + stroke: white; + filter: drop-shadow(0px 0px 2px black) drop-shadow(0px 0px 4px black) + drop-shadow(0px 0px 6px black); } -.colourbar :deep(.axis .tick line) { - filter: drop-shadow(0px 0px 1px rgb(var(--v-theme-background))) - drop-shadow(0px 0px 1px rgb(var(--v-theme-background))) - drop-shadow(0px 0px 1px rgb(var(--v-theme-background))); +.map__colour-bar :deep(.grid) { + stroke: white; } :deep(g) { diff --git a/src/components/wms/ColourLegend.vue b/src/components/wms/ColourLegend.vue index c177938f..61ddf214 100644 --- a/src/components/wms/ColourLegend.vue +++ b/src/components/wms/ColourLegend.vue @@ -1,5 +1,5 @@