mirror of
https://github.com/heyarne/airsonic-ui.git
synced 2026-05-06 18:33:38 +02:00
Make highres-canvas more reagent-y
This commit is contained in:
parent
83e845f58b
commit
6a4bf53308
3 changed files with 4 additions and 4 deletions
|
|
@ -51,7 +51,7 @@
|
||||||
|
|
||||||
(defn current-progress [current-time seekable duration]
|
(defn current-progress [current-time seekable duration]
|
||||||
[canvas {:class-name "current-progress-canvas"
|
[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)
|
;; FIXME: It's ugly to have the canvas padding and styling scattered everywhere (sass, drawing code above, and here)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
(:require [reagent.core :as reagent]))
|
(:require [reagent.core :as reagent]))
|
||||||
|
|
||||||
(defn redraw [this]
|
(defn redraw [this]
|
||||||
(let [[_ {draw :draw} & props] (reagent/argv this)
|
(let [draw (:draw (reagent/props this))
|
||||||
canvas (reagent/dom-node this)
|
canvas (reagent/dom-node this)
|
||||||
width (.-clientWidth canvas)
|
width (.-clientWidth canvas)
|
||||||
height (.-clientHeight canvas)
|
height (.-clientHeight canvas)
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
(set! (.. canvas -style -height) (str height "px"))
|
(set! (.. canvas -style -height) (str height "px"))
|
||||||
(.setTransform ctx 1 0 0 1 0 0)
|
(.setTransform ctx 1 0 0 1 0 0)
|
||||||
(.scale ctx pixel-ratio pixel-ratio))
|
(.scale ctx pixel-ratio pixel-ratio))
|
||||||
(apply draw ctx props)))
|
(draw ctx)))
|
||||||
|
|
||||||
(defn canvas [attrs & _]
|
(defn canvas [attrs & _]
|
||||||
(reagent/create-class
|
(reagent/create-class
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
(defn missing-cover
|
(defn missing-cover
|
||||||
[item size]
|
[item size]
|
||||||
[canvas {:class-name "missing-cover"
|
[canvas {:class-name "missing-cover"
|
||||||
:draw generate-cover} item])
|
:draw #(generate-cover % item)}])
|
||||||
|
|
||||||
(defn has-cover? [item]
|
(defn has-cover? [item]
|
||||||
(:coverArt item))
|
(:coverArt item))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue