From 3eb911a271aa02c7c4e4602697b888ac41798277 Mon Sep 17 00:00:00 2001
From: David Smadja <david.smadja@assemblee-nationale.fr>
Date: Thu, 27 Feb 2025 18:17:00 +0100
Subject: [PATCH] Prevent testcase indicator from showing when out of graph
boundaries
---
.../piece_of_cake/VerticalLine.svelte | 23 ++++++++++++-------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/src/lib/components/ui_transverse_components/piece_of_cake/VerticalLine.svelte b/src/lib/components/ui_transverse_components/piece_of_cake/VerticalLine.svelte
index 71744754b..ca6adc15b 100644
--- a/src/lib/components/ui_transverse_components/piece_of_cake/VerticalLine.svelte
+++ b/src/lib/components/ui_transverse_components/piece_of_cake/VerticalLine.svelte
@@ -49,14 +49,21 @@
(100 / (max - min)) * (Number(firstPersonVariableOfInterestValue) - min),
),
)
+
+ let outOfBounds = $derived(
+ Number(firstPersonVariableOfInterestValue) > max ||
+ Number(firstPersonVariableOfInterestValue) < min,
+ )
</script>
-<div
- class="pointer-events-none absolute inset-y-0 inline border-l-2 border-neutral-600"
- style:left="{linePositionX}%"
->
- <div class="relative" style:top="-50px" style:left="-20px">
- <PictoBigPersonneACharge />
+{#if !outOfBounds}
+ <div
+ class="pointer-events-none absolute inset-y-0 inline border-l-2 border-neutral-600"
+ style:left="{linePositionX}%"
+ >
+ <div class="relative" style:top="-50px" style:left="-20px">
+ <PictoBigPersonneACharge />
+ </div>
+ <div class="relative" style:top="-80px" style:left="20px">Cas type</div>
</div>
- <div class="relative" style:top="-80px" style:left="20px">Cas type</div>
-</div>
+{/if}
--
GitLab