diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..f477326 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "editor.detectIndentation": false, + "editor.tabSize": 2, + "editor.insertSpaces": true + } + \ No newline at end of file diff --git a/releases/index.html b/releases/index.html index 1bbb9ed..703b20c 100644 --- a/releases/index.html +++ b/releases/index.html @@ -2,35 +2,35 @@ - - - - Release Notes + + + + Release Notes - - - - - - - - - - - - - - - - - -
VersionChanges
1.1.0Using Render Bundles for Performance
1.0.0First WebGPU Implementation
- + + + + + + + + + + + + + + + + + +
VersionChanges
1.1.0Using Render Bundles for Performance
1.0.0First WebGPU Implementation
+ \ No newline at end of file diff --git a/test/index.html b/test/index.html index 67888d1..9cc2209 100644 --- a/test/index.html +++ b/test/index.html @@ -35,7 +35,9 @@ // Load Vega and the selected version of Vega WebGPU Renderer loadScript('https://cdn.jsdelivr.net/npm/vega@5.19.1/build/vega.js', function () { - loadScript(vegaWebGPURendererUrl); + loadScript(vegaWebGPURendererUrl, function() { + loadScript('./index.js'); + }); }); @@ -52,13 +54,16 @@ +   Version: +  
- \ No newline at end of file diff --git a/test/index.js b/test/index.js index ca908d4..307656b 100644 --- a/test/index.js +++ b/test/index.js @@ -2,8 +2,9 @@ const urlParams = new URLSearchParams(window.location.search); const urlSpec = urlParams.get('spec'); const urlRenderer = urlParams.get('renderer') ?? 'webgpu'; +const urlVersion = urlParams.get('version') ?? 'dev'; -let runtime, view, selectedSpec, selectedRenderer; +let runtime, view, selectedSpec, selectedRenderer, selectedVersion; const selectSpec = document.querySelector('#specs'); selectSpec.addEventListener('change', function () { @@ -22,12 +23,34 @@ selectRenderer.addEventListener('change', function () { view._renderer.simpleLine = true; } }); +const selectVersion = document.querySelector('#versions'); +selectVersion.addEventListener('change', function () { + selectedVersion = selectVersion.options[selectVersion.selectedIndex].value; + updateUrl(); + window.location.reload(true); +}); function updateUrl() { - if (!selectedSpec) + // Assuming selectedSpec and selectedRenderer are defined elsewhere + if (!selectedSpec) { selectedSpec = undefined; - window.history.replaceState({}, '', `?spec=${selectedSpec}&renderer=${selectedRenderer}`); + } + + const urlSearchParams = new URLSearchParams(window.location.search); + + if (selectedVersion) { + // If version parameter exists, set it as the first tag + urlSearchParams.set('spec', selectedSpec); + urlSearchParams.set('renderer', selectedRenderer); + urlSearchParams.set('version', selectedVersion); + } else { + urlSearchParams.set('spec', selectedSpec); + urlSearchParams.set('renderer', selectedRenderer); + urlSearchParams.set('version', vegaWevGPURendererVersions[vegaWevGPURendererVersions.length - 1]); + } + + window.history.replaceState({}, '', `?${urlSearchParams.toString()}`); } async function init() { @@ -42,11 +65,21 @@ async function init() { selectSpec.appendChild(opt); }); + vegaWevGPURendererVersions?.forEach(function (name) { + const opt = document.createElement('option'); + opt.setAttribute('value', name); + opt.textContent = name; + selectVersion.appendChild(opt); + }); + + if (urlSpec) { + selectedSpec = urlSpec; + } if (urlRenderer) { selectedRenderer = urlRenderer; } - if (urlSpec) { - selectedSpec = urlSpec; + if (urlVersion) { + selectedVersion = urlVersion; } } catch (err) { console.error(err, err.stack); @@ -75,8 +108,12 @@ async function load(name) { selectRenderer.selectedIndex = i; break; } - if (i + 1 == n) { - selectRenderer.selectedIndex = undefined; + } + selectVersion.selectedIndex = 0; + for (let i = 0, n = selectVersion.options.length; i < n; ++i) { + if (selectVersion.options[i].value === selectedVersion) { + selectVersion.selectedIndex = i; + break; } } @@ -105,5 +142,6 @@ async function load(name) { (async () => { await init(); + updateUrl(); await load(selectedSpec); })(); \ No newline at end of file