|
@@ -37,8 +37,7 @@ class SettingsPG {
|
|
|
if (this.scriptLanguage == "JS") {
|
|
|
this.defaultScene = "scripts/basic scene.js";
|
|
|
this.parent.monacoCreator.monacoMode = "javascript";
|
|
|
- }
|
|
|
- else if (this.scriptLanguage == "TS") {
|
|
|
+ } else if (this.scriptLanguage == "TS") {
|
|
|
this.defaultScene = "scripts/basic scene.txt";
|
|
|
this.parent.monacoCreator.monacoMode = "typescript";
|
|
|
}
|
|
@@ -62,7 +61,9 @@ class SettingsPG {
|
|
|
setFontSize(size) {
|
|
|
localStorage.setItem("bjs-playground-font", size);
|
|
|
this.fontSize = size;
|
|
|
- this.parent.monacoCreator.jsEditor.updateOptions({ fontSize: size });
|
|
|
+ this.parent.monacoCreator.jsEditor.updateOptions({
|
|
|
+ fontSize: size
|
|
|
+ });
|
|
|
var array = document.getElementsByClassName("displayFontSize");
|
|
|
for (var i = 0; i < array.length; i++) {
|
|
|
var subArray = array[i].children;
|
|
@@ -96,8 +97,7 @@ class SettingsPG {
|
|
|
this.parent.utils.setToMultipleID("toJSbutton", "addClass", "selectedLanguage");
|
|
|
this.parent.utils.setToMultipleID("toJSbutton", "innerHTML", "Javascript");
|
|
|
this.parent.utils.setToMultipleID("toTSbutton", "title", "Switch to TypeScript");
|
|
|
- }
|
|
|
- else if (this.scriptLanguage == "TS") {
|
|
|
+ } else if (this.scriptLanguage == "TS") {
|
|
|
this.parent.utils.setToMultipleID("toJSbutton", "addClass", "floatLeft");
|
|
|
this.parent.utils.setToMultipleID("toTSbutton", "addClass", "selectedLanguage");
|
|
|
this.parent.utils.setToMultipleID("toTSbutton", "innerHTML", "Typescript");
|
|
@@ -117,8 +117,7 @@ class SettingsPG {
|
|
|
if (theme == 'dark') {
|
|
|
this.vsTheme = 'vs-dark';
|
|
|
this.parent.utils.setToMultipleID("darkTheme", "addClass", "selected");
|
|
|
- }
|
|
|
- else {
|
|
|
+ } else {
|
|
|
this.vsTheme = 'vs';
|
|
|
this.parent.utils.setToMultipleID("lightTheme", "addClass", "selected");
|
|
|
}
|
|
@@ -157,6 +156,9 @@ class SettingsPG {
|
|
|
if (this.mustModifyBJSversion()) {
|
|
|
this.parent.menuPG.displayWaitDiv();
|
|
|
|
|
|
+ window.def = window.define;
|
|
|
+ window.define = undefined;
|
|
|
+
|
|
|
var apiVersion = localStorage.getItem("bjs-playground-apiversion");
|
|
|
BABYLON = null;
|
|
|
|
|
@@ -168,34 +170,44 @@ class SettingsPG {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- var count = CONFIG_last_versions[position][1].length;
|
|
|
- for (var i = 0; i < CONFIG_last_versions[position][1].length; i++) {
|
|
|
- var newBJSscript = document.createElement('script');
|
|
|
- newBJSscript.src = CONFIG_last_versions[position][1][i];
|
|
|
- newBJSscript.onload = function () {
|
|
|
- count--;
|
|
|
- if (count == 0) {
|
|
|
- if (BABYLON.Engine.Version.search('-') != -1) this.parent.menuPG.displayVersionNumber("Latest");
|
|
|
- else this.parent.menuPG.displayVersionNumber(BABYLON.Engine.Version);
|
|
|
- this.parent.utils.setToMultipleID("mainTitle", "innerHTML", "v" + BABYLON.Engine.Version);
|
|
|
-
|
|
|
- this.parent.monacoCreator.setCode(localStorage.getItem("bjs-playground-apiversion-tempcode"));
|
|
|
-
|
|
|
- localStorage.removeItem("bjs-playground-apiversion");
|
|
|
- localStorage.removeItem("bjs-playground-apiversion-tempcode");
|
|
|
-
|
|
|
- this.parent.main.compileAndRunFromOutside();
|
|
|
- }
|
|
|
- }.bind(this);
|
|
|
-
|
|
|
- document.head.appendChild(newBJSscript);
|
|
|
- }
|
|
|
- }
|
|
|
- else return false;
|
|
|
+ var count = CONFIG_last_versions[position][1].length - 1;
|
|
|
+ var newBJSscript = document.createElement('script');
|
|
|
+ newBJSscript.src = CONFIG_last_versions[position][1][0];
|
|
|
+ newBJSscript.onload = function () {
|
|
|
+ for (var i = 1; i < CONFIG_last_versions[position][1].length; i++) {
|
|
|
+ var newBJSscript = document.createElement('script');
|
|
|
+ newBJSscript.src = CONFIG_last_versions[position][1][i];
|
|
|
+ newBJSscript.onload = function () {
|
|
|
+ count--;
|
|
|
+ if (count == 0) {
|
|
|
+ if (BABYLON.Engine.Version.search('-') != -1) this.parent.menuPG.displayVersionNumber("Latest");
|
|
|
+ else this.parent.menuPG.displayVersionNumber(BABYLON.Engine.Version);
|
|
|
+ this.parent.utils.setToMultipleID("mainTitle", "innerHTML", "v" + BABYLON.Engine.Version);
|
|
|
+ this.parent.monacoCreator.addOnMonacoLoadedCallback(() => {
|
|
|
+ this.parent.monacoCreator.setCode(localStorage.getItem("bjs-playground-apiversion-tempcode"));
|
|
|
+
|
|
|
+
|
|
|
+ localStorage.removeItem("bjs-playground-apiversion");
|
|
|
+ localStorage.removeItem("bjs-playground-apiversion-tempcode");
|
|
|
+ this.parent.main.compileAndRunFromOutside();
|
|
|
+ });
|
|
|
+
|
|
|
+ if (window.def) {
|
|
|
+ window.define = window.def;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }.bind(this);
|
|
|
+
|
|
|
+ document.head.appendChild(newBJSscript);
|
|
|
+ }
|
|
|
+ }.bind(this);
|
|
|
+ document.head.appendChild(newBJSscript);
|
|
|
+ } else return false;
|
|
|
};
|
|
|
|
|
|
mustModifyBJSversion() {
|
|
|
if (localStorage.getItem("bjs-playground-apiversion") && localStorage.getItem("bjs-playground-apiversion") != null && localStorage.getItem("bjs-playground-apiversion") != "Latest") return true;
|
|
|
else return false;
|
|
|
};
|
|
|
-};
|
|
|
+};
|