mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 20:06:00 +00:00
Fix horizontal scrolling on macOS trackpad/Magic Mouse #1250
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
<script lang="ts" context="module">
|
<script lang="ts" context="module">
|
||||||
|
|
||||||
const getCurrentValueMarker: any = {};
|
const getCurrentValueMarker: any = {};
|
||||||
|
|
||||||
export function shouldShowTab(tab, lockedDbModeArg = getCurrentValueMarker, currentDbArg = getCurrentValueMarker) {
|
export function shouldShowTab(tab, lockedDbModeArg = getCurrentValueMarker, currentDbArg = getCurrentValueMarker) {
|
||||||
@@ -498,11 +497,17 @@
|
|||||||
conid &&
|
conid &&
|
||||||
database && [
|
database && [
|
||||||
{
|
{
|
||||||
text: _t('tabsPanel.closeTabsWithDb', { defaultMessage: 'Close tabs with DB {database}', values: { database } }),
|
text: _t('tabsPanel.closeTabsWithDb', {
|
||||||
|
defaultMessage: 'Close tabs with DB {database}',
|
||||||
|
values: { database },
|
||||||
|
}),
|
||||||
onClick: () => closeWithSameDb(tabid),
|
onClick: () => closeWithSameDb(tabid),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: _t('tabsPanel.closeTabsWithOtherDb', { defaultMessage: `Close tabs with other DB than {database}`, values: { database } }),
|
text: _t('tabsPanel.closeTabsWithOtherDb', {
|
||||||
|
defaultMessage: `Close tabs with other DB than {database}`,
|
||||||
|
values: { database },
|
||||||
|
}),
|
||||||
onClick: () => closeWithOtherDb(tabid),
|
onClick: () => closeWithOtherDb(tabid),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -577,9 +582,19 @@
|
|||||||
let domTabs;
|
let domTabs;
|
||||||
|
|
||||||
function handleTabsWheel(e) {
|
function handleTabsWheel(e) {
|
||||||
if (!e.shiftKey) {
|
// if (!e.shiftKey) {
|
||||||
|
// e.preventDefault();
|
||||||
|
// domTabs.scrollBy({ top: 0, left: e.deltaY < 0 ? -150 : 150, behavior: 'smooth' });
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Handle horizontal scrolling from trackpad gestures (deltaX)
|
||||||
|
// or vertical scrolling converted to horizontal (deltaY with Shift)
|
||||||
|
|
||||||
|
const scrollAmount = Math.abs(e.deltaX) > Math.abs(e.deltaY) ? e.deltaX : e.shiftKey ? 0 : e.deltaY;
|
||||||
|
|
||||||
|
if (scrollAmount !== 0) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
domTabs.scrollBy({ top: 0, left: e.deltaY < 0 ? -150 : 150, behavior: 'smooth' });
|
domTabs.scrollBy({ left: scrollAmount, behavior: 'auto' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user