From 2cdc67bef9e5e8fc184d05d6f66bd2eb7af78672 Mon Sep 17 00:00:00 2001 From: Louis Chemineau Date: Sun, 1 Sep 2024 01:33:36 +0200 Subject: [PATCH] feat: Prevent swiping when zoomed --- src/components/WeatherForecasts.vue | 40 +++++++++++++++++------------ 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/src/components/WeatherForecasts.vue b/src/components/WeatherForecasts.vue index aadb641..fd0615c 100644 --- a/src/components/WeatherForecasts.vue +++ b/src/components/WeatherForecasts.vue @@ -51,16 +51,19 @@ function handleHoldStart(event: HoldStartEvent) { return } - // Allow swiping to next or previous chart when on edges. - if (zoom.value.min === forecast.value?.hourly[0].time.getTime()) { - return - } - if (zoom.value.max === forecast.value?.hourly[forecast.value.hourly.length - 1].time.getTime()) { - return - } - - console.debug("Flicking: abort flick") event.stop() + return + + // // Allow swiping to next or previous chart when on edges. + // if (zoom.value.min === forecast.value?.hourly[0].time.getTime()) { + // return + // } + // if (zoom.value.max === forecast.value?.hourly[forecast.value.hourly.length - 1].time.getTime()) { + // return + // } + + // console.debug("Flicking: abort flick") + // event.stop() } function handleMoveStart(event: MoveStartEvent) { @@ -84,15 +87,18 @@ function handleMoveStart(event: MoveStartEvent) { return } - if (zoom.value.min === forecast.value?.hourly[0].time.getTime() && event.direction === 'NEXT') { - console.debug("Flicking: abort flick") - event.stop() - } + event.stop() + return - if (zoom.value.max === forecast.value?.hourly[forecast.value.hourly.length - 1].time.getTime() && event.direction === 'PREV') { - console.debug("Flicking: abort flick") - event.stop() - } + // if (zoom.value.min === forecast.value?.hourly[0].time.getTime() && event.direction === 'NEXT') { + // console.debug("Flicking: abort flick") + // event.stop() + // } + + // if (zoom.value.max === forecast.value?.hourly[forecast.value.hourly.length - 1].time.getTime() && event.direction === 'PREV') { + // console.debug("Flicking: abort flick") + // event.stop() + // } } function handlePanelChanged({index}: WillChangeEvent) {