Explorar o código

Playground v4.0.7 : Style fix. "Latest" instead of version number

Jaskar %!s(int64=6) %!d(string=hai) anos
pai
achega
f86084067f

+ 3 - 0
Playground/css/index.css

@@ -459,6 +459,9 @@ body {
     width: 100%;
     display: none;
 }
+.navbar .select .toDisplay.currentVersionDisplay .option {
+    margin-left: -3px;
+}
 .navbar .select .toDisplay .option {
     font-size: 20px;
     height: 35px;

+ 1 - 1
Playground/js/config_versions.js

@@ -1,5 +1,5 @@
 CONFIG_last_versions = [
-    ["4.1.0","https://unpkg.com/babylonjs@4.0.3/babylon.js"], // TO DO - Mettre la v4.1 sur UNPKG
+    ["Latest","https://preview.babylonjs.com/babylon.js"],
     ["4.0.3","https://unpkg.com/babylonjs@4.0.3/babylon.js"],
     ["4.0.0","https://unpkg.com/babylonjs@4.0.0/babylon.js"],
     ["3.0","https://unpkg.com/babylonjs@3.0.7/dist/preview%20release/babylon.js"]

+ 7 - 4
Playground/js/menuPG.js

@@ -124,7 +124,8 @@ class MenuPG {
             for (var j = 0; j < CONFIG_last_versions.length; j++) {
                 var newButton = document.createElement("div");
                 newButton.classList.add("option");
-                newButton.innerText = "v" + CONFIG_last_versions[j][0];
+                if(CONFIG_last_versions[j][0] == "Latest") newButton.innerText = "Latest";
+                else newButton.innerText = "v" + CONFIG_last_versions[j][0];
                 newButton.value = CONFIG_last_versions[j][1];
 
                 newButton.addEventListener("click", function (evt) {
@@ -135,7 +136,7 @@ class MenuPG {
                 versionButtons.lastElementChild.appendChild(newButton);
             }
         }
-        this.displayVersionNumber(BABYLON.Engine.Version.substring(0, BABYLON.Engine.Version.search('-')));
+        this.displayVersionNumber("Latest");
 
         // There's a metadatas close button on the mobile interface.
         document.getElementById('saveFormButtonClose').addEventListener('click', this.hideMetadata.bind(this));
@@ -158,10 +159,12 @@ class MenuPG {
     displayVersionNumber(version) {
         for (var i = 0; i < this.parent.utils.multipleSize.length; i++) {
             if (this.parent.utils.multipleSize[i] == "Mobile") {
-                document.getElementById("currentVersion" + this.parent.utils.multipleSize[i]).innerText = "Version " + version;
+                if(version == "Latest") document.getElementById("currentVersion" + this.parent.utils.multipleSize[i]).innerText = version;
+                else document.getElementById("currentVersion" + this.parent.utils.multipleSize[i]).innerText = "Version " + version;
             }
             else {
-                document.getElementById("currentVersion" + this.parent.utils.multipleSize[i]).parentElement.firstElementChild.innerText = "v" + version;
+                if(version == "Latest") document.getElementById("currentVersion" + this.parent.utils.multipleSize[i]).parentElement.firstElementChild.innerText = version;
+                else document.getElementById("currentVersion" + this.parent.utils.multipleSize[i]).parentElement.firstElementChild.innerText = "v" + version;
             }
         }
     };

+ 2 - 2
Playground/js/settingsPG.js

@@ -153,8 +153,8 @@ class SettingsPG {
             var newBJSscript = document.createElement('script');
             newBJSscript.src = localStorage.getItem("bjs-playground-apiversion");
             newBJSscript.onload = function () {
-                console.log(BABYLON.Engine.Version);
-                this.parent.menuPG.displayVersionNumber(BABYLON.Engine.Version);
+                if(BABYLON.Engine.Version.search('-') != -1) this.parent.menuPG.displayVersionNumber("Latest");
+                else this.parent.menuPG.displayVersionNumber(BABYLON.Engine.Version);
                 this.parent.monacoCreator.setCode(localStorage.getItem("bjs-playground-apiversion-tempcode"));
 
                 localStorage.removeItem("bjs-playground-apiversion");