mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-09-02 08:42:31 +00:00
disable crop when full selection
This commit is contained in:
@@ -27,8 +27,10 @@
|
|||||||
let maxSliderValue = 100;
|
let maxSliderValue = 100;
|
||||||
let sliderValues = [0, 100];
|
let sliderValues = [0, 100];
|
||||||
|
|
||||||
|
$: canCrop = sliderValues[0] != 0 || sliderValues[1] != maxSliderValue;
|
||||||
|
|
||||||
function updateSlicedGPXStatistics() {
|
function updateSlicedGPXStatistics() {
|
||||||
if (validSelection && (sliderValues[0] != 0 || sliderValues[1] != maxSliderValue)) {
|
if (validSelection && canCrop) {
|
||||||
slicedGPXStatistics.set([
|
slicedGPXStatistics.set([
|
||||||
get(gpxStatistics).slice(sliderValues[0], sliderValues[1]),
|
get(gpxStatistics).slice(sliderValues[0], sliderValues[1]),
|
||||||
sliderValues[0],
|
sliderValues[0],
|
||||||
@@ -40,7 +42,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function updateSliderLimits() {
|
async function updateSliderLimits() {
|
||||||
if (validSelection) {
|
if (validSelection && $gpxStatistics.local.points.length > 0) {
|
||||||
maxSliderValue = $gpxStatistics.local.points.length - 1;
|
maxSliderValue = $gpxStatistics.local.points.length - 1;
|
||||||
} else {
|
} else {
|
||||||
maxSliderValue = 100;
|
maxSliderValue = 100;
|
||||||
@@ -78,7 +80,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
disabled={!validSelection}
|
disabled={!validSelection || !canCrop}
|
||||||
on:click={() => dbUtils.cropSelection(sliderValues[0], sliderValues[1])}
|
on:click={() => dbUtils.cropSelection(sliderValues[0], sliderValues[1])}
|
||||||
><Crop size="16" class="mr-1" />{$_('toolbar.scissors.crop')}</Button
|
><Crop size="16" class="mr-1" />{$_('toolbar.scissors.crop')}</Button
|
||||||
>
|
>
|
||||||
|
Reference in New Issue
Block a user