From bb0adfb00b43848525816e37ad2ff0bdc105e870 Mon Sep 17 00:00:00 2001 From: Toks Date: Sun, 26 Oct 2014 11:34:57 -0400 Subject: [PATCH] #2284 fix aspect ratio with "resize to window" For some reason the height is getting scaled twice for ugoira, causing a messed up aspect ratio because it was relative to the current height. This makes it relative to the original height, so it should always be correct even after multiple scales. --- app/assets/javascripts/posts.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/posts.js b/app/assets/javascripts/posts.js index 84bbd2609..6f15842fa 100644 --- a/app/assets/javascripts/posts.js +++ b/app/assets/javascripts/posts.js @@ -358,8 +358,8 @@ if ($img.width() > client_width) { var ratio = client_width / $img.width(); $img.data("scale_factor", ratio); - $img.css("width", $img.width() * ratio); - $img.css("height", $img.height() * ratio); + $img.css("width", $img.data("original_width") * ratio); + $img.css("height", $img.data("original_height") * ratio); } } else { $img.data("scale_factor", 1);