From 4b01d37f3098cb781bad7761f38455943585400b Mon Sep 17 00:00:00 2001 From: Daniel Leal Date: Mon, 29 Jan 2018 12:35:11 +0100 Subject: [PATCH] Hotfix for ImageConfig: we had missed the growth ratio for MatchParent case --- .../src/main/java/ru/noties/markwon/spans/AsyncDrawable.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/src/main/java/ru/noties/markwon/spans/AsyncDrawable.java b/library/src/main/java/ru/noties/markwon/spans/AsyncDrawable.java index 1593e60d..42dce54a 100644 --- a/library/src/main/java/ru/noties/markwon/spans/AsyncDrawable.java +++ b/library/src/main/java/ru/noties/markwon/spans/AsyncDrawable.java @@ -189,10 +189,10 @@ public class AsyncDrawable extends Drawable { final ImageWidth imageWidth = imageConfig.getImageWidth(); if (imageWidth == ImageWidth.MatchParent) { - final float aspectRatio = (float) bounds.width() / bounds.height(); + final float growthRatio = (float) canvasWidth / bounds.width(); bounds.left = 0; bounds.right = canvasWidth; - bounds.bottom = (int) (bounds.top + bounds.height() * aspectRatio); + bounds.bottom = (int) (bounds.top + bounds.height() * growthRatio); } else { switch (gravity) { case Left: