VectorPath
ui.path벡터 경로 기하: 선, 채우기, 히트 테스트.
BEHAVIOR CONTRACT
경로는 GPU에서 렌더링되고, 히트 테스트도 같은 기하를 사용합니다.
RECORDED INTERACTION
여러 경로를 훑습니다.
pub fn buildVectorPath(scope: *ui.Scope, cx: *ui.Cx) anyerror!*ui.Node {
_ = scope;
const a = cx.allocator;
const c = try col(cx, 16);
// 相邻多 path 节点:encoder 侧应合并为少数 draw(polygon 组 + triangles 组)
try c.appendChild(a, try label(cx, "Batched fill_path — adjacent stars (polygon mode)"));
const stars = try row(cx, 12);
const star_colors = [_]ui.Color{
ui.Color.rgb(235, 87, 87),
ui.Color.rgb(242, 153, 74),
ui.Color.rgb(39, 174, 96),
ui.Color.rgb(45, 156, 219),
};
for (star_colors) |color| {
const n = try ui.box(cx, .{
.width = .{ .px = 64 },
.height = .{ .px = 64 },
.background = color,
}, .{});
try setStarGeometry(n, a, 64);
try stars.appendChild(a, n);
}
try c.appendChild(a, stars);
try c.appendChild(a, try label(cx, "Bursts 40-pt (earclip triangles mode)"));
const bursts = try row(cx, 12);
const burst_colors = [_]ui.Color{
ui.Color.rgb(155, 81, 224),
ui.Color.rgb(47, 128, 237),
ui.Color.rgb(33, 150, 83),
};
for (burst_colors) |color| {
const n = try ui.box(cx, .{
.width = .{ .px = 64 },
.height = .{ .px = 64 },
.background = color,
}, .{});
try setBurstGeometry(n, a, 64);
try bursts.appendChild(a, n);
}
try c.appendChild(a, bursts);
return c;
}Storybook에 있는 이 story의 원본 코드입니다(zenit 5f9add5+wip 2026-09-30). W는 ui.widgets이며, col / row / label은 Storybook 내부의 작은 레이아웃 헬퍼입니다.