Proper default button size constraints
This commit is contained in:
parent
ec422cf48d
commit
33256b6549
1 changed files with 13 additions and 1 deletions
|
|
@ -53,7 +53,19 @@ namespace psemek::ui
|
|||
|
||||
geom::box<float, 2> size_constraints() const override
|
||||
{
|
||||
return {{{100.f, 200.f}, {50.f, 100.f}}};
|
||||
auto sc = element::size_constraints();
|
||||
|
||||
if (label())
|
||||
sc = label()->size_constraints();
|
||||
|
||||
if (auto st = style())
|
||||
{
|
||||
float extra = 2.f * (st->border_width + st->inner_margin);
|
||||
sc[0] += extra;
|
||||
sc[1] += extra;
|
||||
}
|
||||
|
||||
return sc;
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue