瀏覽代碼

Fixed ObservableDictionary bug

nockawa 8 年之前
父節點
當前提交
fd5bd92303

+ 7 - 5
canvas2D/src/Tools/babylon.observableStringDictionary.ts

@@ -218,11 +218,13 @@
          * Clear the whole content of the dictionary
          */
         public clear() {
-            this._watchedObjectList.forEach((k, v) => {
-                let el = this.get(k);
-                this._removeWatchedElement(k, el);
-            });
-            this._watchedObjectList.clear();
+            if (this._watchedObjectList) {
+                this._watchedObjectList.forEach((k, v) => {
+                    let el = this.get(k);
+                    this._removeWatchedElement(k, el);
+                });
+                this._watchedObjectList.clear();
+            }
 
             let oldCount = this.count;
             super.clear();

+ 7 - 5
dist/preview release/canvas2D/babylon.canvas2d.js

@@ -1085,11 +1085,13 @@ var BABYLON;
          */
         ObservableStringDictionary.prototype.clear = function () {
             var _this = this;
-            this._watchedObjectList.forEach(function (k, v) {
-                var el = _this.get(k);
-                _this._removeWatchedElement(k, el);
-            });
-            this._watchedObjectList.clear();
+            if (this._watchedObjectList) {
+                this._watchedObjectList.forEach(function (k, v) {
+                    var el = _this.get(k);
+                    _this._removeWatchedElement(k, el);
+                });
+                this._watchedObjectList.clear();
+            }
             var oldCount = this.count;
             _super.prototype.clear.call(this);
             this.onDictionaryChanged(DictionaryChanged.clearAction, null, null, null);

文件差異過大導致無法顯示
+ 1 - 1
dist/preview release/canvas2D/babylon.canvas2d.min.js