From 6cdd41355328adbc1bda919aa51026a5d502972b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20Schl=C3=BCter?= Date: Tue, 23 Oct 2018 15:55:47 +0200 Subject: [PATCH] Fix canvas aspect ration on non-retina displays --- src/cljs/airsonic_ui/components/highres_canvas/views.cljs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cljs/airsonic_ui/components/highres_canvas/views.cljs b/src/cljs/airsonic_ui/components/highres_canvas/views.cljs index 54f2ee3..bf528b0 100644 --- a/src/cljs/airsonic_ui/components/highres_canvas/views.cljs +++ b/src/cljs/airsonic_ui/components/highres_canvas/views.cljs @@ -13,14 +13,14 @@ pixel-ratio (.-devicePixelRatio js/window)] (set! (. canvas -width) width) (set! (. canvas -height) height) + (set! (.. canvas -style -width) (str width "px")) + (set! (.. canvas -style -height) (str height "px")) ;; retina drawing code: ;; set up dimensions, reset the transform matrix to the identity ;; matrix and automatically scale up (when (> pixel-ratio 1) (set! (. canvas -width) (* pixel-ratio width)) (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) (.scale ctx pixel-ratio pixel-ratio)) (draw ctx)))