Use biggest image for detail page
This commit is contained in:
parent
bba5bf94b8
commit
117e7e9310
1 changed files with 8 additions and 11 deletions
|
@ -47,18 +47,16 @@ Page {
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (photoData) {
|
if (photoData) {
|
||||||
// Check first which size fits best...
|
var biggestIndex = -1
|
||||||
var photo
|
|
||||||
for (var i = 0; i < photoData.sizes.length; i++) {
|
for (var i = 0; i < photoData.sizes.length; i++) {
|
||||||
imagePage.imageWidth = photoData.sizes[i].width;
|
if (biggestIndex === -1 || photoData.sizes[i].width > photoData.sizes[biggestIndex].width) {
|
||||||
imagePage.imageHeight = photoData.sizes[i].height;
|
biggestIndex = i;
|
||||||
photo = photoData.sizes[i].photo
|
|
||||||
if (photoData.sizes[i].width >= imagePage.width) {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (photo) {
|
if (biggestIndex > -1) {
|
||||||
imageFile.fileInformation = photo
|
imagePage.imageWidth = photoData.sizes[biggestIndex].width;
|
||||||
|
imagePage.imageHeight = photoData.sizes[biggestIndex].height;
|
||||||
|
singleImage.fileInformation = photoData.sizes[biggestIndex].photo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,9 +120,8 @@ Page {
|
||||||
imageFlickable.returnToBounds()
|
imageFlickable.returnToBounds()
|
||||||
}
|
}
|
||||||
|
|
||||||
Image {
|
TDLibImage {
|
||||||
id: singleImage
|
id: singleImage
|
||||||
source: imageFile.isDownloadingCompleted ? imageFile.path : ""
|
|
||||||
width: imagePage.imageWidth * imagePage.sizingFactor
|
width: imagePage.imageWidth * imagePage.sizingFactor
|
||||||
height: imagePage.imageHeight * imagePage.sizingFactor
|
height: imagePage.imageHeight * imagePage.sizingFactor
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|
Loading…
Reference in a new issue