summary refs log tree commit diff
path: root/resources
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2019-12-13 02:16:12 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2019-12-13 02:16:12 +0100
commita73ed771fa9fabefe5199fb8aa269ac55a9a03c9 (patch)
tree797c4b81bdda68c5f5b4bf8a608a9cff3f6497a8 /resources
parentFix preview of sent encrypted images (diff)
downloadnheko-a73ed771fa9fabefe5199fb8aa269ac55a9a03c9.tar.xz
Make images always fit the timeline
Diffstat (limited to 'resources')
-rw-r--r--resources/qml/delegates/ImageMessage.qml9
1 files changed, 7 insertions, 2 deletions
diff --git a/resources/qml/delegates/ImageMessage.qml b/resources/qml/delegates/ImageMessage.qml
index 1b6e5729..15ce29b7 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