From 47e7f699320d9e0541a1be22622706513d39a17f Mon Sep 17 00:00:00 2001 From: Zanna_37 <> Date: Sun, 6 Nov 2022 22:28:42 +0000 Subject: [PATCH] fix: swipe not possible with animation="none" --- src/swipe-navigation.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/swipe-navigation.ts b/src/swipe-navigation.ts index a655a20..5a4f4e4 100644 --- a/src/swipe-navigation.ts +++ b/src/swipe-navigation.ts @@ -577,7 +577,11 @@ class swipeManager { const tabs = this.#getTabsArray(); if (view != null) { - if (Config.animate) { + + if (Config.animate == "none") { + tabs[index].dispatchEvent(new MouseEvent("click", { bubbles: false, cancelable: true })); + + } else { const duration = 200; view.style.transition = `transform ${duration}ms ease-in, opacity ${duration}ms ease-in`; @@ -607,6 +611,10 @@ class swipeManager { view.style.transition = ""; tabs[index].dispatchEvent(new MouseEvent("click", { bubbles: false, cancelable: true })); }, duration + 10); + + } else { + const exhaustiveCheck: never = Config.animate; + throw new Error(`Unhandled case: ${exhaustiveCheck}`); } setTimeout(function () { @@ -614,9 +622,6 @@ class swipeManager { view.style.opacity = "1"; view.style.transform = ""; }, duration + 50); - - } else { - tabs[index].dispatchEvent(new MouseEvent("click", { bubbles: false, cancelable: true })); } } }