mirror of
https://github.com/heyarne/airsonic-ui.git
synced 2026-05-06 18:33:38 +02:00
Check left mouse button for all events fired when changing the volume
This commit is contained in:
parent
49631ff7d7
commit
158e018d35
1 changed files with 5 additions and 6 deletions
|
|
@ -80,9 +80,10 @@
|
||||||
(h/muted-dispatch [:audio-player/set-repeat-mode next-mode])))
|
(h/muted-dispatch [:audio-player/set-repeat-mode next-mode])))
|
||||||
|
|
||||||
(defn set-volume [ev]
|
(defn set-volume [ev]
|
||||||
|
(when (= 1 (.-buttons ev)) ;; only on left-click
|
||||||
(let [y-ratio (/ (.. ev -nativeEvent -offsetY)
|
(let [y-ratio (/ (.. ev -nativeEvent -offsetY)
|
||||||
(.. ev -target getBoundingClientRect -height))]
|
(.. ev -target getBoundingClientRect -height))]
|
||||||
(dispatch [:audio-player/set-volume (- 1 y-ratio)])))
|
(dispatch [:audio-player/set-volume (- 1 y-ratio)]))))
|
||||||
|
|
||||||
(defonce volume-slider-visible? (r/atom false))
|
(defonce volume-slider-visible? (r/atom false))
|
||||||
|
|
||||||
|
|
@ -100,9 +101,7 @@
|
||||||
[:rect.click-dummy {:x 0, :y 0, :width "100%", :height "100%"
|
[:rect.click-dummy {:x 0, :y 0, :width "100%", :height "100%"
|
||||||
:on-mouse-down set-volume
|
:on-mouse-down set-volume
|
||||||
:on-mouse-up set-volume
|
:on-mouse-up set-volume
|
||||||
;; fire the on-mouse-move only when left mouse button is pressed
|
:on-mouse-move set-volume}]]))
|
||||||
:on-mouse-move #(when (= 1 (.-buttons %))
|
|
||||||
(set-volume %))}]]))
|
|
||||||
|
|
||||||
(def toggle-volume-slider #(swap! volume-slider-visible? not))
|
(def toggle-volume-slider #(swap! volume-slider-visible? not))
|
||||||
(def hide-volume-slider #(reset! volume-slider-visible? false))
|
(def hide-volume-slider #(reset! volume-slider-visible? false))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue