1
0
Fork 0
mirror of https://github.com/heyarne/airsonic-ui.git synced 2026-05-07 02:33:39 +02:00

Make highres-canvas more reagent-y

This commit is contained in:
Arne Schlüter 2018-10-14 11:58:20 +02:00
commit 6a4bf53308
3 changed files with 4 additions and 4 deletions

View file

@ -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)

View file

@ -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

View file

@ -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))