From be8ee350cb625b7c5028f14c878f50f9fa51d8f9 Mon Sep 17 00:00:00 2001 From: SiriusXT <1160925501@qq.com> Date: Thu, 5 Jun 2025 19:54:37 +0800 Subject: [PATCH] fix(tab-row): ensure similar behavior between horizontal/vertical scrolling --- apps/client/src/widgets/tab_row.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/client/src/widgets/tab_row.ts b/apps/client/src/widgets/tab_row.ts index 3de5b796b..79a9eb960 100644 --- a/apps/client/src/widgets/tab_row.ts +++ b/apps/client/src/widgets/tab_row.ts @@ -405,11 +405,12 @@ export default class TabRowWidget extends BasicWidget { } event.preventDefault(); event.stopImmediatePropagation(); - if (!event.shiftKey) { - // Set an upper limit to avoid scrolling too fast - // no lower limit is set because touchpad deltas are usually small - const delta = Math.sign( event.deltaX + event.deltaY ) * Math.min(Math.abs(event.deltaX + event.deltaY), TAB_CONTAINER_MIN_WIDTH * 3); - + + // Set an upper limit to avoid scrolling too fast + // no lower limit is set because touchpad deltas are usually small + const delta = Math.sign(event.deltaX + event.deltaY) * Math.min(Math.abs(event.deltaX + event.deltaY), TAB_CONTAINER_MIN_WIDTH * 3); + + if (!event.shiftKey) { // Check if the device has reduced motion enabled if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) { this.scrollTabContainer(delta, "instant"); @@ -421,7 +422,7 @@ export default class TabRowWidget extends BasicWidget { } } } else if (event.shiftKey) { - if (event.deltaY > 0) { + if (delta > 0) { await appContext.tabManager.activateNextTabCommand(); } else { await appContext.tabManager.activatePreviousTabCommand();