From 1c83c42d75b992df0445b48cdc94bc0252fa1b67 Mon Sep 17 00:00:00 2001 From: vcoppe Date: Wed, 12 Jun 2024 14:53:43 +0200 Subject: [PATCH] disable crop when full selection --- website/src/lib/components/toolbar/tools/Scissors.svelte | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/website/src/lib/components/toolbar/tools/Scissors.svelte b/website/src/lib/components/toolbar/tools/Scissors.svelte index dc13c3e3..ca9ade90 100644 --- a/website/src/lib/components/toolbar/tools/Scissors.svelte +++ b/website/src/lib/components/toolbar/tools/Scissors.svelte @@ -27,8 +27,10 @@ let maxSliderValue = 100; let sliderValues = [0, 100]; + $: canCrop = sliderValues[0] != 0 || sliderValues[1] != maxSliderValue; + function updateSlicedGPXStatistics() { - if (validSelection && (sliderValues[0] != 0 || sliderValues[1] != maxSliderValue)) { + if (validSelection && canCrop) { slicedGPXStatistics.set([ get(gpxStatistics).slice(sliderValues[0], sliderValues[1]), sliderValues[0], @@ -40,7 +42,7 @@ } async function updateSliderLimits() { - if (validSelection) { + if (validSelection && $gpxStatistics.local.points.length > 0) { maxSliderValue = $gpxStatistics.local.points.length - 1; } else { maxSliderValue = 100; @@ -78,7 +80,7 @@