浏览代码

Merge pull request #1217 from nockawa/master

Two small bug fixes
David Catuhe 9 年之前
父节点
当前提交
651fc25263
共有 2 个文件被更改,包括 11 次插入7 次删除
  1. 7 6
      src/Canvas2d/babylon.group2d.ts
  2. 4 1
      src/Tools/babylon.dynamicFloatArray.ts

+ 7 - 6
src/Canvas2d/babylon.group2d.ts

@@ -672,13 +672,14 @@
             else {
             else {
                 context.partDataStartIndex = 0;
                 context.partDataStartIndex = 0;
 
 
-                // Find the first valid object to get the count
-                let i = 0;
-                while (!context.groupInfoPartData[i]) {
-                    i++;
+                if (context.groupInfoPartData.length > 0) {
+                    // Find the first valid object to get the count
+                    let i = 0;
+                    while (!context.groupInfoPartData[i]) {
+                        i++;
+                    }
+                    context.partDataEndIndex = context.groupInfoPartData[i]._partData.usedElementCount;
                 }
                 }
-
-                context.partDataEndIndex = context.groupInfoPartData[i]._partData.usedElementCount;
             }
             }
 
 
             return renderCount;
             return renderCount;

+ 4 - 1
src/Tools/babylon.dynamicFloatArray.ts

@@ -259,7 +259,10 @@
                 let newCount = Math.min(this.totalElementCount, count * 2);
                 let newCount = Math.min(this.totalElementCount, count * 2);
 
 
                 this._sortTable = new Array<SortInfo>(newCount);
                 this._sortTable = new Array<SortInfo>(newCount);
-                this._sortedTable = new Array<SortInfo>(newCount);
+            }
+
+            if (!this._sortTable || this._sortTable.length !== count) {
+                this._sortedTable = new Array<SortInfo>(count);
             }
             }
 
 
             // Because, you know...
             // Because, you know...