From 75b55c5c2c3743fa8cdfb772d87c3d53e91e389a 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 --- packages/client/src/ui/deck.vue | 20 ++++++++++---------- packages/client/src/ui/deck/column.vue | 2 ++ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/packages/client/src/ui/deck.vue b/packages/client/src/ui/deck.vue index 6da6ad506..270a92a5e 100644 --- a/packages/client/src/ui/deck.vue +++ b/packages/client/src/ui/deck.vue @@ -9,6 +9,7 @@ class="columns" :class="deckStore.reactiveState.columnAlign.value" @contextmenu.self.prevent="onContextmenu" + @wheel.self="onWheel" >
@@ -279,18 +282,15 @@ const onContextmenu = (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(); function moveFocus(id: string, direction: "up" | "down" | "left" | "right") { diff --git a/packages/client/src/ui/deck/column.vue b/packages/client/src/ui/deck/column.vue index 03859abc0..dcf94b31a 100644 --- a/packages/client/src/ui/deck/column.vue +++ b/packages/client/src/ui/deck/column.vue @@ -23,6 +23,7 @@ @dragstart="onDragstart" @dragend="onDragend" @contextmenu.prevent.stop="onContextmenu" + @wheel="emit('headerWheel', $event)" >