Improve timeline image sizing
Improve the initial resizing of an image in the timeline by always looking to see whether sourcesize or image.info is populated first. This allows the actual size of the image to be calculated as soon as possible while still maintaining the fix fo CCBUG: 460205 May also help CCBUG: 463235 I need help testing this it currently no longer happens for me.
This commit is contained in:
@@ -31,10 +31,30 @@ TimelineContainer {
|
||||
innerObject: AnimatedImage {
|
||||
id: img
|
||||
|
||||
property var imageWidth: {
|
||||
if (imageDelegate.info.w > 0) {
|
||||
return imageDelegate.info.w;
|
||||
} else if (sourceSize.width > 0) {
|
||||
return sourceSize.width;
|
||||
} else {
|
||||
return imageDelegate.contentMaxWidth;
|
||||
}
|
||||
}
|
||||
property var imageHeight: {
|
||||
if (imageDelegate.info.h > 0) {
|
||||
return imageDelegate.info.h;
|
||||
} else if (sourceSize.height > 0) {
|
||||
return sourceSize.height;
|
||||
} else {
|
||||
// Default to a 16:9 placeholder
|
||||
return imageDelegate.contentMaxWidth / 16 * 9;
|
||||
}
|
||||
}
|
||||
|
||||
Layout.maximumWidth: Math.min(imageDelegate.contentMaxWidth, imageDelegate.maxWidth)
|
||||
Layout.maximumHeight: Math.min(imageDelegate.contentMaxWidth / sourceSize.width * sourceSize.height, imageDelegate.maxWidth / sourceSize.width * sourceSize.height)
|
||||
Layout.preferredWidth: imageDelegate.info.w > 0 ? imageDelegate.info.w : sourceSize.width
|
||||
Layout.preferredHeight: imageDelegate.info.h > 0 ? imageDelegate.info.h : sourceSize.height
|
||||
Layout.maximumHeight: Math.min(imageDelegate.contentMaxWidth / imageWidth * imageHeight, imageDelegate.maxWidth / imageWidth * imageHeight)
|
||||
Layout.preferredWidth: imageWidth
|
||||
Layout.preferredHeight: imageHeight
|
||||
source: model.mediaUrl
|
||||
|
||||
Image {
|
||||
|
||||
Reference in New Issue
Block a user