From dc27ba6f036c15ff94aaa76b3a6928e97c934fe7 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 24 Jun 2023 12:58:26 +0900 Subject: [PATCH] enhance(frontend): improve ux of deck scroll Resolve #11007 --- packages/frontend/src/ui/deck.vue | 17 +++++++++-------- packages/frontend/src/ui/deck/column.vue | 5 +++++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/packages/frontend/src/ui/deck.vue b/packages/frontend/src/ui/deck.vue index bd5d5beb8..988fda1c2 100644 --- a/packages/frontend/src/ui/deck.vue +++ b/packages/frontend/src/ui/deck.vue @@ -4,12 +4,13 @@
-
+
@@ -196,15 +198,14 @@ const onContextmenu = (ev) => { }], ev); }; -document.documentElement.style.overflowY = 'hidden'; -document.documentElement.style.scrollBehavior = 'auto'; -window.addEventListener('wheel', (ev) => { - if (ev.target === columnsEl && ev.deltaX === 0) { - columnsEl.scrollLeft += ev.deltaY; - } else if (getScrollContainer(ev.target as HTMLElement) == null && ev.deltaX === 0) { +function onWheel(ev: WheelEvent) { + if (ev.deltaX === 0) { columnsEl.scrollLeft += ev.deltaY; } -}); +} + +document.documentElement.style.overflowY = 'hidden'; +document.documentElement.style.scrollBehavior = 'auto'; loadDeck(); diff --git a/packages/frontend/src/ui/deck/column.vue b/packages/frontend/src/ui/deck/column.vue index c8d6744a3..f6c5c8de4 100644 --- a/packages/frontend/src/ui/deck/column.vue +++ b/packages/frontend/src/ui/deck/column.vue @@ -12,6 +12,7 @@ @dragstart="onDragstart" @dragend="onDragend" @contextmenu.prevent.stop="onContextmenu" + @wheel="emit('headerWheel', $event)" > @@ -56,6 +57,10 @@ const props = withDefaults(defineProps<{ naked: false, }); +const emit = defineEmits<{ + (ev: 'headerWheel', ctx: WheelEvent): void; +}>(); + let body = $shallowRef(); let dragging = $ref(false);