ソースを参照

Girish is pretty cool, except to Roop

Change-Id: I3c3c052b261d5710558b0f6e694a034ea285e5ee
Donald Carr 9 年 前
コミット
3276fc2443
2 ファイル変更11 行追加9 行削除
  1. 2 7
      ArtDelegate.qml
  2. 9 2
      Gravity.qml

+ 2 - 7
ArtDelegate.qml

@@ -5,14 +5,9 @@ import Qt.labs.settings 1.0
 ImageBoxBody {
     id: picture
 
-    signal leftViewport
+    property bool freefall: false
 
-    function detonate() {
-        leftViewport()
-        picture.destroy()
-    }
-
-    onYChanged: y <= floor.y || detonate()
+    onYChanged: freefall && ((y <= floor.y) || picture.destroy())
 
     density: 0.01
     friction: 1.0

+ 9 - 2
Gravity.qml

@@ -42,7 +42,6 @@ Item {
 
                 if (colHeight < 1.5*root.height) {
                     var item = pictureDelegate.createObject(column)
-                    item.leftViewport.connect(function() { d.itemCount--; })
                     item.y = -colHeight - item.height
                     d.itemCount++
                     pictureArray.push(item)
@@ -97,7 +96,10 @@ Item {
                 interval: 1000*(settings.interval > 60 ? 60*(settings.interval-60) : settings.interval)*(Math.random()+1)
                 onTriggered: {
                     if (pictureArray.length > 0) {
-                        pictureArray.shift().world = bullshitWorld
+                        var image = pictureArray.shift()
+                        image.world = bullshitWorld
+                        image.freefall = true
+                        d.itemCount--
                     }
                 }
             }
@@ -139,6 +141,11 @@ Item {
         delegate: columnComponent
     }
 
+    Connections {
+        target: settings
+        onColumnCountChanged: d.itemCount = 0
+    }
+
     // TODO: The boot (Monty Python foot) of death to be applied to the stacks
     RectangleBoxBody {
         id: rect