Explorar o código

Dabble in map reduce

Change-Id: I706350978fb4bef168fdae52a718dd6450b717d4
Donald Carr %!s(int64=9) %!d(string=hai) anos
pai
achega
7c3028aee8
Modificáronse 1 ficheiros con 1 adicións e 2 borrados
  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)