Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
691a67d
feat: implement autosize with children nodes
wouterlucas Dec 17, 2025
1e1d5b5
feat: adjust container size calculation to maintain fixed position
wouterlucas Dec 17, 2025
05bb2a9
chore: remove example, add VRT test
wouterlucas Dec 28, 2025
f2e9d25
fix: make sure parent autosizes on child updates
wouterlucas Dec 28, 2025
54da239
Autosizer changes
jfboeve Jan 9, 2026
c88c4b8
Create canvas w/ platform
estobbart Dec 22, 2025
8ff8350
fixed maxWidth, maxHeight, contain
jfboeve Dec 9, 2025
ba3404b
fixed truncation issues, fixed text engine tests
jfboeve Dec 12, 2025
a88d110
fixed tests, added CoreTextNode set w/h blockers
jfboeve Dec 15, 2025
8819b76
fix maxHeight, if calcs to 0 ensure 1 line.
jfboeve Dec 15, 2025
21160dd
update vrt screenshots
jfboeve Dec 15, 2025
2ec4f97
Move FontFaceSet into Platform layer
estobbart Dec 22, 2025
71c4105
3.0.0-beta17
jfboeve Dec 29, 2025
18bd294
fix initial node
jfboeve Dec 29, 2025
203a0e6
fixed issue where w/h are multiplied by half
jfboeve Dec 29, 2025
b8e7842
fixed gradient when using special texture, added test
jfboeve Dec 30, 2025
0ac5e31
revert resize mode vrt's
jfboeve Dec 30, 2025
9f9bcf3
changed radial gradient from total width/height to radial width/heigh…
jfboeve Dec 30, 2025
11a9b99
CanvasTextRenderer to use settings dpr
estobbart Dec 29, 2025
0cc6a01
feedback
estobbart Dec 29, 2025
40b3087
3.0.0-beta18
jfboeve Dec 31, 2025
e6365a4
support for undefined target
estobbart Jan 5, 2026
ed13b9a
added improved texture compression, refactored texturecoord flow
jfboeve Jan 5, 2026
cdb19ea
microqueue text loaded emit
jfboeve Jan 6, 2026
3dc8076
fix rounding to be smoother on retina devices and smooth correctly fr…
chiefcll Jan 5, 2026
0b88beb
add another test for circles of different sizes
chiefcll Jan 6, 2026
505ecc0
(v3) Texture Management / GC
jfboeve Jan 7, 2026
65c7bad
resolving texture props fixed. avoid infinite retries
jfboeve Jan 7, 2026
f1b3f20
subtexture retry count now properly updates
jfboeve Jan 7, 2026
8767f55
optimize the update loop
chiefcll Jan 7, 2026
d4c53d4
update new vrt result
chiefcll Jan 7, 2026
bf739d2
Merge branch 'main' into feat/autosize
jfboeve Jan 9, 2026
13e3000
Merge branch 'main' into feat/autosize
jfboeve Jan 9, 2026
3be6383
fixes after merge with main
jfboeve Jan 9, 2026
33945c4
removed unneeded queueMicrotask, updated autosize test
jfboeve Jan 12, 2026
2b50ddc
added autosizer mode, fixed tiny texture bug
jfboeve Jan 12, 2026
a5b85bf
Merge branch 'main' into feat/autosize
jfboeve Jan 12, 2026
f7ae948
fine tuning some bits.
jfboeve Jan 15, 2026
64fcf76
Merge branch 'main' into feat/autosize
jfboeve Jan 15, 2026
828d57b
use enum value for better readability
jfboeve Jan 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
269 changes: 269 additions & 0 deletions examples/tests/autosize.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
/*
* Visual Regression Test: Autosize System
*
* This test demonstrates various autosize scenarios for visual regression testing.
* All tests are 200x200px and arranged in a grid across a 1080p screen.
*/

import type { ExampleSettings } from '../common/ExampleSettings.js';
import rockoImg from '../assets/rocko.png';

export async function automation(settings: ExampleSettings) {
// Snapshot single page
await autosizeExample(settings);
}

export default async function autosizeExample({
renderer,
testRoot,
snapshot,
}: ExampleSettings) {
const rootNode = testRoot;

// Helper function to create text label
const createLabel = (text: string, x: number, y: number) => {
return renderer.createTextNode({
x,
y,
text: text,
fontSize: 20,
fontFamily: 'sans-serif',
color: 0xffffffff,
parent: rootNode,
});
};

// Test 1: Autosize parent with 2 children
createLabel('1. Parent w/ 2 children', 50, 50);
const test1Parent = renderer.createNode({
x: 50,
y: 80,
color: 0x00ff0088,
autosize: true,
parent: rootNode,
});
renderer.createNode({
x: 10,
y: 10,
w: 80,
h: 60,
color: 0xff0000ff,
parent: test1Parent,
});
renderer.createNode({
x: 100,
y: 80,
w: 70,
h: 50,
color: 0x0000ffff,
parent: test1Parent,
});

// Test 2: Autosize parent with 1 child, later added child
createLabel('2: add 2nd', 300, 50);
const test2Parent = renderer.createNode({
x: 300,
y: 80,
color: 0x00ff0088,
autosize: true,
parent: rootNode,
});
renderer.createNode({
x: 20,
y: 20,
w: 60,
h: 50,
color: 0xff0000ff,
parent: test2Parent,
});

// Test 3: Autosize parent with 2 children, child 1 position updated
createLabel('3: Update position', 550, 50);
const test3Parent = renderer.createNode({
x: 550,
y: 80,
color: 0x00ff0088,
autosize: true,
parent: rootNode,
});
const test3Child1 = renderer.createNode({
x: 20,
y: 20,
w: 60,
h: 50,
color: 0xff0000ff,
parent: test3Parent,
});
renderer.createNode({
x: 50,
y: 80,
w: 70,
h: 40,
color: 0x0000ffff,
parent: test3Parent,
});

// Test 4: Autosize parent with 2 children, 1 child alpha 0
createLabel('4: child alpha=0', 800, 50);
const test4Parent = renderer.createNode({
x: 800,
y: 80,
color: 0x00ff0088,
autosize: true,
parent: rootNode,
});
renderer.createNode({
x: 20,
y: 20,
w: 60,
h: 50,
color: 0xff0000ff,
alpha: 1,
parent: test4Parent,
});
renderer.createNode({
x: 90,
y: 70,
w: 80,
h: 60,
alpha: 0,
color: 0x0000ffff,
parent: test4Parent,
});

// Test 5: Autosize parent with 2 children, off screen then moved into screen
createLabel('5: Off-screen then on', 1050, 50);
const test5Parent = renderer.createNode({
x: -500,
y: -500,
color: 0x00ff0088,
autosize: true,
parent: rootNode,
});
renderer.createNode({
x: 20,
y: 20,
w: 60,
h: 50,
color: 0xff0000ff,
parent: test5Parent,
});
renderer.createNode({
x: 90,
y: 70,
w: 80,
h: 60,
color: 0x0000ffff,
parent: test5Parent,
});

// Test 6: Autosize parent with 2 children, later removed child
createLabel('6: Remove child later', 1300, 50);
const test6Parent = renderer.createNode({
x: 1300,
y: 80,
color: 0x00ff0088,
autosize: true,
parent: rootNode,
});
renderer.createNode({
x: 20,
y: 20,
w: 60,
h: 50,
color: 0xff0000ff,
parent: test6Parent,
});
const test6Child2 = renderer.createNode({
x: 90,
y: 70,
w: 80,
h: 60,
color: 0x0000ffff,
parent: test6Parent,
});

// Test 7: Autosize OFF, parent with 2 children
createLabel('7: Autosize=false', 50, 350);
const test7Parent = renderer.createNode({
x: 50,
y: 380,
w: 100,
h: 100,
color: 0x00ff0088,
autosize: false,
parent: rootNode,
});
renderer.createNode({
x: 20,
y: 20,
w: 60,
h: 50,
color: 0xff0000ff,
parent: test7Parent,
});
renderer.createNode({
x: 90,
y: 70,
w: 80,
h: 60,
color: 0x0000ffff,
parent: test7Parent,
});

// Test 8a: Texture with autosize true
createLabel('8a: Texture autosize=true', 300, 350);
renderer.createNode({
x: 300,
y: 380,
color: 0xff00ff88,
autosize: true,
src: rockoImg,
parent: rootNode,
});

// Test 8b: Texture with autosize false
createLabel('8b: Texture autosize=false', 550, 350);
renderer.createNode({
x: 550,
y: 380,
w: 100,
h: 100,
color: 0xff00ff88,
autosize: false,
src: rockoImg,
parent: rootNode,
});
console.log('All autosize nodes created.');

await snapshot();

await new Promise((resolve) =>
setTimeout(() => {
console.log('Making updates to autosize nodes...');
// add node to test 2
renderer.createNode({
x: 90,
y: 70,
w: 80,
h: 60,
color: 0x0000ffff,
parent: test2Parent,
});

// move child in test 3
test3Child1.x = 100;
test3Child1.y = 100;

// Move into screen test 5
test5Parent.x = 1050;
test5Parent.y = 80;

// remove child from test 6
test6Child2.parent = null;
resolve(true);
}, 200),
);

await snapshot();
}
Loading