diff --git a/package-lock.json b/package-lock.json index 0a229f5a3..b5a5c9874 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "com.foxdebug.acode", - "version": "1.10.6", + "version": "1.10.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "com.foxdebug.acode", - "version": "1.10.6", + "version": "1.10.7", "license": "MIT", "dependencies": { "@deadlyjack/ajax": "^1.2.6", diff --git a/package.json b/package.json index 334cb9c6c..fc4de384c 100644 --- a/package.json +++ b/package.json @@ -108,4 +108,4 @@ "yargs": "^17.7.2" }, "browserslist": "cover 100%,not android < 5" -} +} \ No newline at end of file diff --git a/src/components/tabView.js b/src/components/tabView.js index c5ae760a7..95b9e3fa0 100644 --- a/src/components/tabView.js +++ b/src/components/tabView.js @@ -8,7 +8,10 @@ import Ref from "html-tag-js/ref"; */ export default function TabView({ id }, children) { let moveX = 0; + let moveY = 0; let lastX = 0; + let lastY = 0; + let isScrolling = false; const el = new Ref(); return (
Math.abs(deltaX); + } + + if (!isScrolling) { + moveX += deltaX; + e.preventDefault(); + } + lastX = clientX; + lastY = clientY; } function omtouchend() { document.removeEventListener("touchmove", omtouchmove); document.removeEventListener("touchend", omtouchend); document.removeEventListener("touchcancel", omtouchend); - if (Math.abs(moveX) <= 100) return; - const tabs = Array.from(el.get(".options").children); - const currentTab = el.get(".options>span.active"); - const direction = moveX > 0 ? 1 : -1; - const currentTabIndex = tabs.indexOf(currentTab); - const nextTabIndex = - (currentTabIndex + direction + tabs.length) % tabs.length; - tabs[nextTabIndex].click(); - currentTab.classList.remove("active"); - tabs[nextTabIndex].classList.add("active"); + + // Only change tabs when a significant horizontal swipe is detected and not scrolling vertically + if (!isScrolling && Math.abs(moveX) > 100) { + const tabs = Array.from(el.get(".options").children); + const currentTab = el.get(".options>span.active"); + const direction = moveX > 0 ? 1 : -1; + const currentTabIndex = tabs.indexOf(currentTab); + const nextTabIndex = + (currentTabIndex + direction + tabs.length) % tabs.length; + tabs[nextTabIndex].click(); + currentTab.classList.remove("active"); + tabs[nextTabIndex].classList.add("active"); + } } function changeTab(e) {