From ffde8d2f697a23824a8b5d626a62d62b5b4a2872 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABlis?= Date: Fri, 21 Feb 2025 17:05:50 +0100 Subject: [PATCH] set better default values --- .../common/slider-range/slider-range-thumb.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/common/slider-range/slider-range-thumb.vue b/src/components/common/slider-range/slider-range-thumb.vue index 5da92646..b52c1bfb 100644 --- a/src/components/common/slider-range/slider-range-thumb.vue +++ b/src/components/common/slider-range/slider-range-thumb.vue @@ -21,8 +21,13 @@ const emit = defineEmits<{ const isDragging = ref(false) const elRefTrack = ref() const elRefThumb = ref() -const elRefTrackWidth = computed(() => elRefTrack.value?.offsetWidth || 0) -const elRefThumbWidth = computed(() => elRefThumb.value?.offsetWidth || 40) +/* + TODO: Since we now use v-show instead of v-if in layer-panel.vue, the element is present in the DOM but remains hidden. + As a result, offsetWidth always returns its default value instead of the actual one. + We need to find a way to retrieve the correct offsetWidth value. +*/ +const elRefTrackWidth = computed(() => elRefTrack.value?.offsetWidth || 274) +const elRefThumbWidth = computed(() => elRefThumb.value?.offsetWidth || 9) const currentValue = ref(props.selectedValue) // Is detached from selectedValue, keep its own state const currentLeftOffset = computed(() => { const offset = (elRefTrackWidth.value * currentValue.value) / 100