Ver Fonte

Limit cascade artwork to width of broadest column

Change-Id: Ic85fdbf2252d346b71e1a47a4a54c6a87a28c96f
Donald Carr há 8 anos atrás
pai
commit
5aecebf5f6
3 ficheiros alterados com 8 adições e 5 exclusões
  1. 5 2
      qml/cascade/Cascade.qml
  2. 2 2
      qml/common/ArtImage.qml
  3. 1 1
      qml/main.qml

+ 5 - 2
qml/cascade/Cascade.qml

@@ -101,7 +101,11 @@ Item {
                 stackHeight -= image.height
             }
 
-            width: d.columnWidth*Math.pow(d.columnRatio, index)
+            width: {
+                var colWidth = d.columnWidth*Math.pow(d.columnRatio, index)
+                index === cascadeSettings.columnCount - 1 && (globalVars.imageWidthOverride = colWidth)
+                return colWidth
+            }
             anchors { top: parent.top; bottom: parent.bottom }
 
             World {
@@ -164,7 +168,6 @@ Item {
     Keys.onDownPressed: root.drain()
 
     Component.onCompleted: {
-        globalVars.loadFullImage = true
         pictureDelegate.status !== Component.Ready && console.log('Component failed with:' + pictureDelegate.errorString())
     }
 }

+ 2 - 2
qml/common/ArtImage.qml

@@ -25,8 +25,8 @@ Rectangle {
         mirror: globalSettings.randomlyMirrorArt && (Math.random() < 0.5)
         smooth: globalSettings.smoothArt
 
-        sourceSize.height: globalVars.loadFullImage ? undefined : height
-        sourceSize.width: globalVars.loadFullImage ? undefined : width
+        sourceSize.height: globalVars.imageWidthOverride > 0 ? Math.ceil(globalVars.imageWidthOverride/imageModel.data(modelIndex, PictureModel.RatioRole)) : height
+        sourceSize.width: globalVars.imageWidthOverride > 0 ? globalVars.imageWidthOverride : width
 
         Behavior on opacity {
             SequentialAnimation {

+ 1 - 1
qml/main.qml

@@ -20,7 +20,7 @@ Window {
 
     QtObject {
         id: globalVars
-        property bool loadFullImage: false
+        property real imageWidthOverride: -1
     }
 
     QtObject {