mirror of
https://github.com/heyarne/airsonic-ui.git
synced 2026-05-06 18:33:38 +02:00
Fix canvas aspect ration on non-retina displays
This commit is contained in:
parent
779f99243c
commit
6cdd413553
1 changed files with 2 additions and 2 deletions
|
|
@ -13,14 +13,14 @@
|
||||||
pixel-ratio (.-devicePixelRatio js/window)]
|
pixel-ratio (.-devicePixelRatio js/window)]
|
||||||
(set! (. canvas -width) width)
|
(set! (. canvas -width) width)
|
||||||
(set! (. canvas -height) height)
|
(set! (. canvas -height) height)
|
||||||
|
(set! (.. canvas -style -width) (str width "px"))
|
||||||
|
(set! (.. canvas -style -height) (str height "px"))
|
||||||
;; retina drawing code:
|
;; retina drawing code:
|
||||||
;; set up dimensions, reset the transform matrix to the identity
|
;; set up dimensions, reset the transform matrix to the identity
|
||||||
;; matrix and automatically scale up
|
;; matrix and automatically scale up
|
||||||
(when (> pixel-ratio 1)
|
(when (> pixel-ratio 1)
|
||||||
(set! (. canvas -width) (* pixel-ratio width))
|
(set! (. canvas -width) (* pixel-ratio width))
|
||||||
(set! (. canvas -height) (* pixel-ratio height))
|
(set! (. canvas -height) (* pixel-ratio height))
|
||||||
(set! (.. canvas -style -width) (str width "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))
|
||||||
(draw ctx)))
|
(draw ctx)))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue