|
|
|
|
@ -110,6 +110,16 @@ function renderUI(ui: UIValue, ctx: CanvasRenderingContext2D, x: number, y: numb
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case 'clip': {
|
|
|
|
|
ctx.save();
|
|
|
|
|
ctx.beginPath();
|
|
|
|
|
ctx.rect(x, y, ui.w, ui.h);
|
|
|
|
|
ctx.clip();
|
|
|
|
|
renderUI(ui.child, ctx, x, y);
|
|
|
|
|
ctx.restore();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case 'stack': {
|
|
|
|
|
for (const child of ui.children) {
|
|
|
|
|
renderUI(child, ctx, x, y);
|
|
|
|
|
@ -184,6 +194,12 @@ function measure(ui: UIValue): { width: number, height: number } {
|
|
|
|
|
case 'clickable':
|
|
|
|
|
return measure(ui.child);
|
|
|
|
|
|
|
|
|
|
case 'opacity':
|
|
|
|
|
return measure(ui.child);
|
|
|
|
|
|
|
|
|
|
case 'clip':
|
|
|
|
|
return { width: ui.w, height: ui.h };
|
|
|
|
|
|
|
|
|
|
case 'padding': {
|
|
|
|
|
const childSize = measure(ui.child);
|
|
|
|
|
return {
|
|
|
|
|
|