From a73ed771fa9fabefe5199fb8aa269ac55a9a03c9 Mon Sep 17 00:00:00 2001
From: Nicolas Werner <nicolas.werner@hotmail.de>
Date: Fri, 13 Dec 2019 02:16:12 +0100
Subject: [PATCH] Make images always fit the timeline

---
 resources/qml/delegates/ImageMessage.qml | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/resources/qml/delegates/ImageMessage.qml b/resources/qml/delegates/ImageMessage.qml
index 1b6e57298..15ce29b72 100644
--- a/resources/qml/delegates/ImageMessage.qml
+++ b/resources/qml/delegates/ImageMessage.qml
@@ -3,8 +3,13 @@ import QtQuick 2.6
 import im.nheko 1.0
 
 Item {
-	width: Math.min(parent ? parent.width : undefined, model.width)
-	height: width * model.proportionalHeight
+	property double tempWidth: Math.min(parent ? parent.width : undefined, model.width)
+	property double tempHeight: tempWidth * model.proportionalHeight
+
+	property bool tooHigh: tempHeight > chat.height - 40
+
+	height: tooHigh ? chat.height - 40 : tempHeight
+	width: tooHigh ? (chat.height - 40) / model.proportionalHeight : tempWidth
 
 	Image {
 		id: img
-- 
GitLab