Browse Source

set viewer config numbers even when scene's object is null

Trevor Baron 6 năm trước cách đây
mục cha
commit
a9332ba760
1 tập tin đã thay đổi với 2 bổ sung1 xóa
  1. 2 1
      Viewer/src/helper/index.ts

+ 2 - 1
Viewer/src/helper/index.ts

@@ -45,7 +45,8 @@ export function extendClassWithConfig(object: any, config: any) {
         if (key in object && typeof object[key] !== 'function') {
             // if (typeof object[key] === 'function') return;
             // if it is an object, iterate internally until reaching basic types
-            if (typeof object[key] === 'object') {
+            // but null is an object so if its null and config[key] is not an object eg. number, the number should be set
+            if ((typeof object[key] === 'object') && (object[key] !== null || typeof config[key] === "object")) {
                 extendClassWithConfig(object[key], config[key]);
             } else {
                 if (config[key] !== undefined) {