Browse Source

fix after update

Nikolay Suslov 6 years ago
parent
commit
36bc8d82af
2 changed files with 69 additions and 59 deletions
  1. 3 2
      public/vwf/model/aframe.js
  2. 66 57
      public/web/world-app.js

+ 3 - 2
public/vwf/model/aframe.js

@@ -615,8 +615,9 @@ define(["module", "vwf/model", "vwf/utility"], function (module, model, utility)
                                     if (response) {
 
                                         if (Object.keys(response).length > 0) {
-                                        console.log(JSON.parse(response));
-                                        let assets = JSON.parse(response);
+                                        //console.log(JSON.parse(response));
+
+                                        let assets = (typeof(response) == 'object') ? response: JSON.parse(response);
                                         for (var prop in assets) {
                                             var elm = document.createElement(assets[prop].tag);
                                             elm.setAttribute('id', prop);

+ 66 - 57
public/web/world-app.js

@@ -116,63 +116,9 @@ class WorldApp {
         let worldCardGUI = _app.indexApp.createWorldCard(cardID, 'full');
         let worldStatesGUI = [];
 
-       
-
-        var runWorldGUI = {};
-        let settings = worldCardGUI._worldInfo.settings;
-        if (settings) {
-            if (settings.ar) {
-
-                runWorldGUI = {
-                    id: "runWorldGUI",
-                    $type: "div",
-                    $init: function () {
-                        console.log(worldCardGUI);
-                    },
-                    _arSwitch: null,
-                    _turnArOnSwitch: null,
-                    $components: [
-                        {
-                            $type: "div",
-                            $text: "Settings for start:"
-                        },
-                        _cellWidgets.switch({
-                            'id': 'arjsView',
-                            'init': function () {
-                                this._switch = new mdc.switchControl.MDCSwitch(this);
-                                this._switch.checked = false;
-                                this._arSwitch = this._switch;
-                            }
-                        }
-                        ),
-                        {
-                            $type: 'label',
-                            for: 'input-forceReplace',
-                            $text: 'Edit mode'
-                        },
-                        {$type: "div", style: "margin-top: 20px"},
-                        _cellWidgets.switch({
-                            'id': 'arOnView',
-                            'init': function () {
-                                this._turnArOn = new mdc.switchControl.MDCSwitch(this);
-                                this._turnArOn.checked = false;
-                                this._turnArOnSwitch = this._turnArOn;
-                            }
-                        }
-                        ),
-                        {
-                            $type: 'label',
-                            for: 'input-forceReplace',
-                            $text: 'Ar mode'
-                        }
-                    ]
-
-                }
-            }
-
-        }
-
+        //var runWorldGUI = {};
 
+     
 
         let actionsGUI = {
             $cell: true,
@@ -406,6 +352,7 @@ class WorldApp {
             id: 'aboutWorld',
             $cell: true,
             $type: "div",
+            _runWorldGUI: {},
             $update: function(){
                 this.$components = [
                 {
@@ -433,7 +380,7 @@ class WorldApp {
                                     $components: [
                                         worldCardGUI,
                                         { $type: 'p' },
-                                        runWorldGUI
+                                        this._runWorldGUI
                                     ]
                                 },
                                 {
@@ -496,6 +443,68 @@ class WorldApp {
         }
 
 
+       
+        let settings = worldCardGUI._worldInfo.settings;
+        if (settings) {
+            if (settings.ar) {
+
+               let runWorldGUI = {
+                    id: "runWorldGUI",
+                    $type: "div",
+                    $init: function () {
+                        console.log(worldCardGUI);
+                    },
+                    _arSwitch: null,
+                    _turnArOnSwitch: null,
+                    $components: [
+                        {
+                            $type: "div",
+                            $text: "Settings for start:"
+                        },
+                        _cellWidgets.switch({
+                            'id': 'arjsView',
+                            'init': function () {
+                                this._switch = new mdc.switchControl.MDCSwitch(this);
+                                this._switch.checked = false;
+                                this._arSwitch = this._switch;
+                            }
+                        }
+                        ),
+                        {
+                            $type: 'label',
+                            for: 'input-forceReplace',
+                            $text: 'Edit mode'
+                        },
+                        {$type: "div", style: "margin-top: 20px"},
+                        _cellWidgets.switch({
+                            'id': 'arOnView',
+                            'init': function () {
+                                this._turnArOn = new mdc.switchControl.MDCSwitch(this);
+                                this._turnArOn.checked = false;
+                                this._turnArOnSwitch = this._turnArOn;
+                            }
+                        }
+                        ),
+                        {
+                            $type: 'label',
+                            for: 'input-forceReplace',
+                            $text: 'Ar mode'
+                        }
+                    ]
+
+                }
+
+            document.querySelector("#aboutWorld")._runWorldGUI = runWorldGUI;
+            }
+
+            
+
+        }
+
+
+
+
+
 
     }