Kaynağa Gözat

Fix a flurry of issues

Change-Id: Ic9aed2e595680f78982a01bb36f7c986dc2f2ec2
Donald Carr 9 yıl önce
ebeveyn
işleme
59a07dd0a2
4 değiştirilmiş dosya ile 14 ekleme ve 8 silme
  1. 5 2
      ArtDelegate.qml
  2. 4 4
      Gravity.qml
  3. 1 1
      HorizontalArtDelegate.qml
  4. 4 1
      main.qml

+ 5 - 2
ArtDelegate.qml

@@ -5,11 +5,14 @@ import Qt.labs.settings 1.0
 ImageBoxBody {
     id: picture
 
+    signal leftViewport
+
     function detonate() {
-        picture.world = bullshitWorld
+        leftViewport()
+        picture.destroy()
     }
 
-    onYChanged: y <= floor.y || picture.destroy()
+    onYChanged: y <= floor.y || detonate()
 
     density: 0.01
     friction: 1.0

+ 4 - 4
Gravity.qml

@@ -73,8 +73,7 @@ Item {
                 interval: 1000*(settings.interval > 60 ? 60*(settings.interval-60) : settings.interval)*(Math.random()+1)
                 onTriggered: {
                     if (pictureArray.length > 0) {
-                        pictureArray.shift().detonate()
-                        d.itemCount--
+                        pictureArray.shift().world = bullshitWorld
                     }
 
                     var colHeight = 0
@@ -82,11 +81,12 @@ Item {
 
                     do {
                         var item = pictureDelegate.createObject(column)
+                        item.leftViewport.connect(function() { d.itemCount--; })
                         item.y = -colHeight - item.height
                         d.itemCount++
                         pictureArray.push(item)
                         colHeight += item.height
-                    } while (colHeight < root.height)
+                    } while (colHeight < 1.5*root.height)
                 }
             }
 
@@ -100,7 +100,7 @@ Item {
             Timer {
                 id: settleTimer
                 running: false
-                interval: 500
+                interval: 200
                 onTriggered: feedTimer.triggered()
             }
 

+ 1 - 1
HorizontalArtDelegate.qml

@@ -1,7 +1,7 @@
 import QtQuick 2.5
 
 ArtDelegate {
-    height: implicitHeight/implicitWidth*width
+    //height: implicitHeight/implicitWidth*width
     width: parent.width
     onXChanged: x = 0
 }

+ 4 - 1
main.qml

@@ -4,7 +4,8 @@ import Qt.labs.settings 1.0
 
 Window {
     id: appWindow
-    visibility: Window.FullScreen
+    //visibility: Window.FullScreen
+    visible: true
 
     width: 1024
     height: 768
@@ -35,4 +36,6 @@ Window {
         Keys.onLeftPressed: settings.columnCount = Math.max(settings.columnCount-1,1)
         Keys.onRightPressed: settings.columnCount++
     }
+
+    Component.onCompleted: showFullScreen()
 }