OSDN Git Service

描画する順番を depth の降順から昇順に修正
authorYoshihiro Yamazaki <yoya@awm.jp>
Sun, 30 Dec 2012 07:27:09 +0000 (16:27 +0900)
committerYoshihiro Yamazaki <yoya@awm.jp>
Sun, 30 Dec 2012 07:27:09 +0000 (16:27 +0900)
src/display.js
src/movieclip.js

index 6103aeb..b805429 100644 (file)
@@ -37,10 +37,10 @@ FlappDisplay.prototype = {
        this.objs[depth].destroy();
         delete this.objs[depth];
     },
-    descSortedDepth: function() {
+    ascSortedDepth: function() {
         var keys = Object.keys(this.objs);
         return keys.sort(
-            function(a,b) { return (a>b)?-1:((a<b)?1:0); }
+            function(a,b) { return (a<b)?-1:((a>b)?1:0); }
         );
     }
 };
index 187613e..a6fc0d5 100644 (file)
@@ -202,7 +202,7 @@ FlappMovieClip.prototype = {
     },
     render: function(canvas, dict) {
        console.debug("FlappMovieClip::render: name:"+this.name);
-        var depthList = this.displayList.descSortedDepth();
+        var depthList = this.displayList.ascSortedDepth();
         for (var i = 0, l = depthList.length  ; i < l ; i++) {
             var depth = depthList[i];
             var obj = this.displayList.get(depth);