Sfoglia il codice sorgente

Dabble in map reduce

Change-Id: I706350978fb4bef168fdae52a718dd6450b717d4
Donald Carr 9 anni fa
parent
commit
7c3028aee8
1 ha cambiato i file con 1 aggiunte e 2 eliminazioni
  1. 1 2
      Gravity.qml

+ 1 - 2
Gravity.qml

@@ -76,8 +76,7 @@ Item {
                         pictureArray.shift().world = bullshitWorld
                     }
 
-                    var colHeight = 0
-                    pictureArray.forEach(function (picture) { colHeight += picture.height; })
+                    var colHeight = pictureArray.reduce(function (height, image) { return height + image.height; }, 0)
 
                     do {
                         var item = pictureDelegate.createObject(column)