From fba7adde0987116907eb2eaac6f492a9d882e6f9 Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 30 Oct 2024 18:50:08 -0700 Subject: [PATCH 1/3] More UI fixes. --- language-server.js | 7 ------- styles/styles.css | 11 +++++++++++ ui.js | 10 +++++++++- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/language-server.js b/language-server.js index c1d329a..6af372b 100644 --- a/language-server.js +++ b/language-server.js @@ -286,11 +286,6 @@ function initMonaco() { monaco.languages.register({ id: "spirv" }); monaco.languages.setMonarchTokensProvider("spirv", { - brackets: [ - { open: '{', close: '}', token: 'delimiter.curly' }, - { open: '[', close: ']', token: 'delimiter.square' }, - { open: '(', close: ')', token: 'delimiter.parenthesis' }, - ], operators: [ '=', ], @@ -322,8 +317,6 @@ function initMonaco() { [/;.*/, 'comment'], // delimiters and operators - [/[{}()\[\]]/, '@brackets'], - [/[<>](?!@symbols)/, '@brackets'], [/@symbols/, { cases: { '@operators': 'operator', diff --git a/styles/styles.css b/styles/styles.css index 95c8859..5b8c73b 100644 --- a/styles/styles.css +++ b/styles/styles.css @@ -184,6 +184,7 @@ button:disabled:hover { background-color: var(--panel-background); padding: 10px; flex-wrap: wrap; + overflow-x: hidden; } .logo-img { @@ -448,4 +449,14 @@ label { /* Visible tooltip styling */ .tooltip.show { opacity: 1; +} + +/* Narrow screen */ +@media screen and (max-width: 450px) { + .dropdown-select{ + min-width: 100px; + } + #demo-select{ + width: 150px; + } } \ No newline at end of file diff --git a/ui.js b/ui.js index 09e1589..637f990 100644 --- a/ui.js +++ b/ui.js @@ -83,6 +83,10 @@ function prepareForResize() { var codeEditors = document.getElementsByClassName("editorContainer"); for (var i = 0; i < codeEditors.length; i++) { + if (codeEditors[i].parentNode.clientWidth < 30) + codeEditors[i].style.display = "none"; + else + codeEditors[i].style.display = "inherit"; codeEditors[i].style.overflow = "hidden"; } document.getElementById("workSpaceDiv").style.overflow = "hidden"; @@ -95,6 +99,10 @@ function finishResizing() { document.getElementById("leftContainerDiv").style.overflow = "visible"; for (var i = 0; i < codeEditors.length; i++) { codeEditors[i].style.overflow = "visible"; + if (codeEditors[i].parentNode.clientWidth < 30) + codeEditors[i].style.display = "none"; + else + codeEditors[i].style.display = "inherit"; } } @@ -115,7 +123,7 @@ function initializeModal() { const closeBtn = document.querySelector(".close"); btn.onclick = () => { - modal.style.display = "block"; + modal.style.display = "flex"; }; closeBtn.onclick = () => { From 63507075279986cda0960489f4a384106ca4fefb Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 30 Oct 2024 19:48:01 -0700 Subject: [PATCH 2/3] Fix script. --- try-slang.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/try-slang.js b/try-slang.js index 65112bf..36fe6ee 100644 --- a/try-slang.js +++ b/try-slang.js @@ -448,7 +448,6 @@ var Module = { label.innerText = "Initializing Slang Compiler..."; compiler = new SlangCompiler(Module); slangd = Module.createLanguageServer(); - initLanguageServer(); var result = compiler.init(); if (result.ret) { document.getElementById("compile-btn").disabled = false; @@ -495,6 +494,9 @@ function runIfFullyInitialized() { if (compiler && slangd && pageLoaded) { + slangd = Module.createLanguageServer(); + initLanguageServer(); + const loadingScreen = document.getElementById('loading-screen'); // Start fade-out by setting opacity to 0 loadingScreen.style.opacity = '0'; From 0fd4a25b9c3ced10485f70becfbf28407805bf96 Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 30 Oct 2024 22:12:59 -0700 Subject: [PATCH 3/3] Fix. --- try-slang.js | 1 - 1 file changed, 1 deletion(-) diff --git a/try-slang.js b/try-slang.js index 36fe6ee..9ea36fb 100644 --- a/try-slang.js +++ b/try-slang.js @@ -494,7 +494,6 @@ function runIfFullyInitialized() { if (compiler && slangd && pageLoaded) { - slangd = Module.createLanguageServer(); initLanguageServer(); const loadingScreen = document.getElementById('loading-screen');