From 7febf330ac25b597b5fc9f7cd4fbb5c9ba74f39e Mon Sep 17 00:00:00 2001 From: Miguel de Benito Delgado Date: Sat, 19 Jul 2025 11:08:15 +0000 Subject: [PATCH] :sparkles: Enable wheel scrolling over templates-section in the dashboard --- frontend/src/app/main/ui/dashboard/templates.cljs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/frontend/src/app/main/ui/dashboard/templates.cljs b/frontend/src/app/main/ui/dashboard/templates.cljs index ac4a62512b..86c7db5678 100644 --- a/frontend/src/app/main/ui/dashboard/templates.cljs +++ b/frontend/src/app/main/ui/dashboard/templates.cljs @@ -17,6 +17,7 @@ [app.main.store :as st] [app.main.ui.icons :as i] [app.util.dom :as dom] + [app.util.dom.normalize-wheel :as nw] [app.util.i18n :refer [tr]] [app.util.keyboard :as kbd] [app.util.storage :as storage] @@ -206,6 +207,17 @@ (fn [_event] (swap! collapsed* not))) + on-wheel + (mf/use-fn + (mf/deps content-ref) + (fn [^js event] + (let [event* (nw/normalize-wheel event) + deltaY (.-spinY event*) + deltaX (.-spinX event*) + node (mf/ref-val content-ref)] + (when (> (abs deltaY) (abs deltaX)) + (.scrollBy node #js {:left (* 300 deltaY) :mode "smooth"}))))) + on-scroll (mf/use-fn (fn [e] @@ -258,6 +270,7 @@ [:div {:class (stl/css :content) :on-scroll on-scroll + :on-wheel on-wheel :ref content-ref} (for [index (range (count templates))]