scissoring fixes and scroll offset of grow elements
This commit is contained in:
parent
e193109570
commit
bafadae1e0
@ -214,4 +214,3 @@ fn void? Ctx.push_update_atlas(&ctx, Atlas* atlas)
|
|||||||
}
|
}
|
||||||
|
|
||||||
macro Ctx.dbg_rect(&ctx, Rect r, uint c = 0xff000042u) => ctx.push_rect(r, int.max, &&(Style){.bg=c.to_rgba()})!!;
|
macro Ctx.dbg_rect(&ctx, Rect r, uint c = 0xff000042u) => ctx.push_rect(r, int.max, &&(Style){.bg=c.to_rgba()})!!;
|
||||||
|
|
||||||
|
|||||||
@ -179,7 +179,7 @@ fn void resolve_grow_elements(Elem* e, Elem* p)
|
|||||||
p.layout.grow_children--;
|
p.layout.grow_children--;
|
||||||
p.layout.occupied += slot;
|
p.layout.occupied += slot;
|
||||||
} else if (p.layout.dir == COLUMN) { // grow across the layout axis, inherit width of the parent
|
} else if (p.layout.dir == COLUMN) { // grow across the layout axis, inherit width of the parent
|
||||||
e.bounds.w = p.content_space().x;
|
e.bounds.w = p.content_space().x + p.layout.scroll_offset.x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ fn void resolve_grow_elements(Elem* e, Elem* p)
|
|||||||
p.layout.grow_children--;
|
p.layout.grow_children--;
|
||||||
p.layout.occupied += slot;
|
p.layout.occupied += slot;
|
||||||
} else if (p.layout.dir == ROW) { // grow across the layout axis, inherit width of the parent
|
} else if (p.layout.dir == ROW) { // grow across the layout axis, inherit width of the parent
|
||||||
e.bounds.h = p.content_space().y;
|
e.bounds.h = p.content_space().y + p.layout.scroll_offset.y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -308,7 +308,6 @@ fn void? Ctx.layout_string(&ctx, String text, Rect bounds, Anchor anchor, int z_
|
|||||||
{
|
{
|
||||||
if (text == "") return;
|
if (text == "") return;
|
||||||
if (bounds.w <= 0 || bounds.h <= 0) return;
|
if (bounds.w <= 0 || bounds.h <= 0) return;
|
||||||
ctx.push_scissor(bounds, z_index)!;
|
|
||||||
|
|
||||||
Font* font = &ctx.font;
|
Font* font = &ctx.font;
|
||||||
Id texture_id = font.id;
|
Id texture_id = font.id;
|
||||||
@ -320,9 +319,6 @@ fn void? Ctx.layout_string(&ctx, String text, Rect bounds, Anchor anchor, int z_
|
|||||||
Rect uv = gi.gp.uv();
|
Rect uv = gi.gp.uv();
|
||||||
ctx.push_sprite(b, uv, texture_id, z_index, hue)!;
|
ctx.push_sprite(b, uv, texture_id, z_index, hue)!;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.reset_scissor(z_index)!;
|
|
||||||
// ctx.dbg_rect(str_bounds.off(bounds.position()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -584,5 +580,3 @@ fn TextSize? Ctx.measure_string(&ctx, String text)
|
|||||||
|
|
||||||
return ts;
|
return ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -124,8 +124,9 @@ fn void? Ctx.div_begin_id(&ctx,
|
|||||||
ctx.push_rect(elem.bounds.pad(style.margin), elem.z_index, style)!;
|
ctx.push_rect(elem.bounds.pad(style.margin), elem.z_index, style)!;
|
||||||
|
|
||||||
// update the ctx scissor, it HAS to be after drawing the background
|
// update the ctx scissor, it HAS to be after drawing the background
|
||||||
ctx.div_scissor = elem.bounds.pad(elem.layout.content_offset).max({0,0,0,0});
|
Rect scissor = elem.bounds.pad(elem.layout.content_offset).max({0,0,0,0});
|
||||||
ctx.push_scissor(ctx.div_scissor, elem.z_index)!;
|
ctx.push_scissor(scissor, elem.z_index)!;
|
||||||
|
ctx.div_scissor = scissor;
|
||||||
|
|
||||||
//elem.events = ctx.get_elem_events(elem);
|
//elem.events = ctx.get_elem_events(elem);
|
||||||
|
|
||||||
@ -234,7 +235,6 @@ fn Id? Ctx.div_end(&ctx)
|
|||||||
elem.div.resized.y = true;
|
elem.div.resized.y = true;
|
||||||
elem.div.resize_size.y = content_bounds.h - (elem.bounds.y - m.y);
|
elem.div.resize_size.y = content_bounds.h - (elem.bounds.y - m.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// the active_div returns to the parent of the current one
|
// the active_div returns to the parent of the current one
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user