Skip to content

Commit dd02a68

Browse files
authored
fix: Stackblitz canvas resize observers (#1044)
* fix: Stackblitz canvas resize observers * Fix unexpected color behavior in fluid with atomics example
1 parent 4c37f01 commit dd02a68

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

Diff for: apps/typegpu-docs/src/components/stackblitz/openInStackBlitz.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const openInStackBlitz = (example: Example) => {
3333
template: 'node',
3434
title: example.metadata.title,
3535
files: {
36-
'index.ts': index.slice('// @ts-ignore\n'.length),
36+
'index.ts': index.replaceAll(/\/\/\s*@ts-ignore\s*\n/g, ''),
3737
...tsFiles,
3838
'index.html': `\
3939
<!DOCTYPE html>

Diff for: apps/typegpu-docs/src/components/stackblitz/stackBlitzIndex.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// @ts-ignore
2-
import * as example from './src/index.ts';
3-
41
const body = document.querySelector('body') as HTMLBodyElement;
52
body.style.display = 'flex';
63
body.style.flexDirection = 'column';
@@ -67,6 +64,10 @@ if (body.firstChild) {
6764
body.appendChild(controlsPanel);
6865
}
6966

67+
// Execute example
68+
// @ts-ignore
69+
const example = import('./src/index.ts');
70+
7071
// Create example controls
7172
for (const controls of Object.values(example)) {
7273
if (typeof controls === 'function') {

Diff for: apps/typegpu-docs/src/content/examples/simulation/fluid-with-atomics/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ const fragment = tgpu['~unstable']
328328
}
329329

330330
const res = 1 / (1 + std.exp(-(normalized - 0.2) * 10));
331-
return d.vec4f(0, 0, std.max(0.5, res), res);
331+
return d.vec4f(0, 0, res, res);
332332
});
333333

334334
const vertexInstanceLayout = tgpu.vertexLayout(

0 commit comments

Comments
 (0)