From 6a4bf5330845417d57c791fdc3576d3b48965eac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20Schl=C3=BCter?= Date: Sun, 14 Oct 2018 11:58:20 +0200 Subject: [PATCH] Make highres-canvas more reagent-y --- src/cljs/airsonic_ui/components/audio_player/views.cljs | 2 +- src/cljs/airsonic_ui/components/highres_canvas/views.cljs | 4 ++-- src/cljs/airsonic_ui/views/cover.cljs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cljs/airsonic_ui/components/audio_player/views.cljs b/src/cljs/airsonic_ui/components/audio_player/views.cljs index 8a51042..7583bd0 100644 --- a/src/cljs/airsonic_ui/components/audio_player/views.cljs +++ b/src/cljs/airsonic_ui/components/audio_player/views.cljs @@ -51,7 +51,7 @@ (defn current-progress [current-time seekable duration] [canvas {:class-name "current-progress-canvas" - :draw draw-progress} current-time seekable duration]) + :draw #(draw-progress % current-time seekable duration)}]) ;; FIXME: It's ugly to have the canvas padding and styling scattered everywhere (sass, drawing code above, and here) diff --git a/src/cljs/airsonic_ui/components/highres_canvas/views.cljs b/src/cljs/airsonic_ui/components/highres_canvas/views.cljs index 6c62bf7..54f2ee3 100644 --- a/src/cljs/airsonic_ui/components/highres_canvas/views.cljs +++ b/src/cljs/airsonic_ui/components/highres_canvas/views.cljs @@ -5,7 +5,7 @@ (:require [reagent.core :as reagent])) (defn redraw [this] - (let [[_ {draw :draw} & props] (reagent/argv this) + (let [draw (:draw (reagent/props this)) canvas (reagent/dom-node this) width (.-clientWidth canvas) height (.-clientHeight canvas) @@ -23,7 +23,7 @@ (set! (.. canvas -style -height) (str height "px")) (.setTransform ctx 1 0 0 1 0 0) (.scale ctx pixel-ratio pixel-ratio)) - (apply draw ctx props))) + (draw ctx))) (defn canvas [attrs & _] (reagent/create-class diff --git a/src/cljs/airsonic_ui/views/cover.cljs b/src/cljs/airsonic_ui/views/cover.cljs index 33efd36..8a0abfc 100644 --- a/src/cljs/airsonic_ui/views/cover.cljs +++ b/src/cljs/airsonic_ui/views/cover.cljs @@ -34,7 +34,7 @@ (defn missing-cover [item size] [canvas {:class-name "missing-cover" - :draw generate-cover} item]) + :draw #(generate-cover % item)}]) (defn has-cover? [item] (:coverArt item))