From 425ad4325917a0783e3df96e08079b9166399fd9 Mon Sep 17 00:00:00 2001 From: Giulio Malventi Date: Fri, 8 Mar 2024 04:36:58 +0100 Subject: [PATCH 1/8] Adjust parameter triangle size and position --- apps/jscad-web/static/main.css | 3 ++- apps/vue3-jscad/src/App.vue | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/jscad-web/static/main.css b/apps/jscad-web/static/main.css index c65023f..ba6361e 100644 --- a/apps/jscad-web/static/main.css +++ b/apps/jscad-web/static/main.css @@ -515,10 +515,11 @@ p { #paramsDiv .form-line[type="group"]:before { content: "\25bc"; padding-right: 10px; + padding-top: 3px; cursor: pointer; } #paramsDiv .form-line[type="group"][closed="1"]:before { - content: "\25b6"; + content: "\25ba"; } #paramsDiv .form-line[type="group"] label { font-weight: 500; diff --git a/apps/vue3-jscad/src/App.vue b/apps/vue3-jscad/src/App.vue index 4cc2399..b50cb95 100644 --- a/apps/vue3-jscad/src/App.vue +++ b/apps/vue3-jscad/src/App.vue @@ -890,11 +890,12 @@ p { #paramsDiv .form-line[type="group"]:before { content: "\25bc"; padding-right: 10px; + padding-top: 3px; cursor: pointer; } #paramsDiv .form-line[type="group"][closed="1"]:before { - content: "\25b6"; + content: "\25ba"; } #paramsDiv .form-line[type="group"] label { From cb6ef0e81939203a302fefd27694d5b3a8ef3a83 Mon Sep 17 00:00:00 2001 From: Giulio Malventi Date: Sun, 10 Mar 2024 05:27:05 +0100 Subject: [PATCH 2/8] Use progress element --- apps/jscad-web/main.js | 1 + apps/jscad-web/static/index.html | 2 +- apps/jscad-web/static/main.css | 14 ++------------ 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/apps/jscad-web/main.js b/apps/jscad-web/main.js index 944565a..1d6a532 100644 --- a/apps/jscad-web/main.js +++ b/apps/jscad-web/main.js @@ -165,6 +165,7 @@ const handlers = { console.log('Main execution:', mainTime?.toFixed(2), ', jscad mesh -> gl:', convertTime?.toFixed(2)) setError(undefined) }, + progress: ({ progress }) => spinner.value = progress, } const { sendCmd, sendNotify } = initMessaging(worker, handlers) diff --git a/apps/jscad-web/static/index.html b/apps/jscad-web/static/index.html index 1aa9471..6f1af07 100644 --- a/apps/jscad-web/static/index.html +++ b/apps/jscad-web/static/index.html @@ -44,7 +44,7 @@

JSCAD

-
+
diff --git a/apps/jscad-web/static/main.css b/apps/jscad-web/static/main.css index ba6361e..ecc805f 100644 --- a/apps/jscad-web/static/main.css +++ b/apps/jscad-web/static/main.css @@ -573,21 +573,11 @@ p { position: absolute; bottom: 10px; right: 10px; - border: 6px solid #f3f3f3; - border-top: 6px solid #27c; - border-radius: 50%; - width: 32px; - height: 32px; - animation: spin 1s linear infinite; display: none; + accent-color: #27c; } .dark #spinner { - border: 6px solid #222; - border-top: 6px solid #16a; -} -@keyframes spin { - 0% { transform: rotate(0deg); } - 100% { transform: rotate(360deg); } + accent-color: #2e96ea; } .above-error { From b2d062a70714ef017db3f16b610a7b6bb40702fa Mon Sep 17 00:00:00 2001 From: Giulio Malventi Date: Sun, 10 Mar 2024 11:05:11 +0100 Subject: [PATCH 3/8] Reset spinner --- apps/jscad-web/main.js | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/jscad-web/main.js b/apps/jscad-web/main.js index 1d6a532..6539e51 100644 --- a/apps/jscad-web/main.js +++ b/apps/jscad-web/main.js @@ -178,6 +178,7 @@ async function sendCmdAndSpin(method, params) { // do not show spinner for fast renders firstJobTimer = setTimeout(() => { spinner.style.display = 'block' + spinner.removeAttribute('value') }, 300) } try { From e6c683d405dab29713f13a6d821a92251a0de36c Mon Sep 17 00:00:00 2001 From: Giulio Malventi Date: Fri, 15 Mar 2024 12:18:21 +0100 Subject: [PATCH 4/8] Rename spinner to progress, add note --- apps/jscad-web/main.js | 22 ++++++++++++++++------ apps/jscad-web/static/index.html | 5 ++++- apps/jscad-web/static/main.css | 8 ++++++-- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/apps/jscad-web/main.js b/apps/jscad-web/main.js index 6539e51..4ea81e1 100644 --- a/apps/jscad-web/main.js +++ b/apps/jscad-web/main.js @@ -157,6 +157,16 @@ const exportModel = async (format, extension) => { } } +const onProgress = ([value, note]) => { + const el = progress.querySelector('progress') + if (value == undefined) { + el.removeAttribute('value') + } else { + el.value = value + } + progress.querySelector('div').innerText = note ?? '' +} + const worker = new Worker('./build/bundle.worker.js') const handlers = { entities: ({ entities, mainTime, convertTime }) => { @@ -165,20 +175,20 @@ const handlers = { console.log('Main execution:', mainTime?.toFixed(2), ', jscad mesh -> gl:', convertTime?.toFixed(2)) setError(undefined) }, - progress: ({ progress }) => spinner.value = progress, + onProgress, } const { sendCmd, sendNotify } = initMessaging(worker, handlers) -const spinner = byId('spinner') +const progress = byId('progress') let jobs = 0 let firstJobTimer async function sendCmdAndSpin(method, params) { jobs++ if (jobs === 1) { - // do not show spinner for fast renders + // do not show progress for fast renders firstJobTimer = setTimeout(() => { - spinner.style.display = 'block' - spinner.removeAttribute('value') + onProgress([]) + progress.style.display = 'block' }, 300) } try { @@ -189,7 +199,7 @@ async function sendCmdAndSpin(method, params) { } finally { if (--jobs === 0) { clearTimeout(firstJobTimer) - spinner.style.display = 'none' + progress.style.display = 'none' } } } diff --git a/apps/jscad-web/static/index.html b/apps/jscad-web/static/index.html index 6f1af07..6286ac2 100644 --- a/apps/jscad-web/static/index.html +++ b/apps/jscad-web/static/index.html @@ -44,7 +44,10 @@

JSCAD

- +
+
+ +
diff --git a/apps/jscad-web/static/main.css b/apps/jscad-web/static/main.css index ecc805f..08cc7c8 100644 --- a/apps/jscad-web/static/main.css +++ b/apps/jscad-web/static/main.css @@ -569,16 +569,20 @@ p { border-top-left-radius: 4px; } -#spinner { +#progress { position: absolute; bottom: 10px; right: 10px; display: none; accent-color: #27c; } -.dark #spinner { +.dark #progress { accent-color: #2e96ea; } +#progress > div { + font-size: small; + text-align: right; +} .above-error { flex: 1; From a47929bb3385d6a64ffa86bb8704dcca1ace687d Mon Sep 17 00:00:00 2001 From: Davor Hrg Date: Fri, 15 Mar 2024 12:39:20 +0100 Subject: [PATCH 5/8] Update main.js --- apps/jscad-web/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/jscad-web/main.js b/apps/jscad-web/main.js index 9dab9fb..c39d222 100644 --- a/apps/jscad-web/main.js +++ b/apps/jscad-web/main.js @@ -172,7 +172,7 @@ const exportModel = async (format, extension) => { } } -const onProgress = ([value, note]) => { +const onProgress = (value, note) => { const el = progress.querySelector('progress') if (value == undefined) { el.removeAttribute('value') From 3a45b0e589d76b79b89bf8d75a6f64538d0c0772 Mon Sep 17 00:00:00 2001 From: Davor Hrg Date: Fri, 15 Mar 2024 12:52:17 +0100 Subject: [PATCH 6/8] github actions --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5f896a6..81dd9c3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,7 @@ jobs: name: SonarCloud runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - name: SonarCloud Scan From 8ee6795b0e76d9a38125b0542be695a0690a84fe Mon Sep 17 00:00:00 2001 From: Davor Hrg Date: Fri, 15 Mar 2024 12:58:47 +0100 Subject: [PATCH 7/8] remove sonarbube, unused --- .github/workflows/build.yml | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 81dd9c3..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Build -on: - push: - branches: - - master - pull_request: - types: [opened, synchronize, reopened] -jobs: - sonarcloud: - name: SonarCloud - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - name: SonarCloud Scan - uses: SonarSource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From 050a7bfb5122b3d77fe93e4e47ae11c74cb6e92b Mon Sep 17 00:00:00 2001 From: Giulio Malventi Date: Fri, 15 Mar 2024 15:59:41 +0100 Subject: [PATCH 8/8] Update onProgress reset call --- apps/jscad-web/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/jscad-web/main.js b/apps/jscad-web/main.js index c39d222..f478eaa 100644 --- a/apps/jscad-web/main.js +++ b/apps/jscad-web/main.js @@ -205,7 +205,7 @@ function trackJobs(jobs) { // do not show progress for fast renders clearTimeout(firstJobTimer) firstJobTimer = setTimeout(() => { - onProgress([]) + onProgress() progress.style.display = 'block' }, 300) }