Make images always fit the timeline

This commit is contained in:
Nicolas Werner 2019-12-13 02:16:12 +01:00
parent 9c1912ed93
commit a73ed771fa

View file

@ -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