aboutsummaryrefslogtreecommitdiff
path: root/lib/oui/oui.odin
diff options
context:
space:
mode:
Diffstat (limited to 'lib/oui/oui.odin')
-rw-r--r--lib/oui/oui.odin7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/oui/oui.odin b/lib/oui/oui.odin
index a1fbbf8..a0098ca 100644
--- a/lib/oui/oui.odin
+++ b/lib/oui/oui.odin
@@ -146,6 +146,7 @@ Layout :: enum {
Cut,
Absolute,
Relative,
+ Fractional,
// Custom,
}
@@ -883,6 +884,9 @@ compute_size :: proc(item: ^Item) #no_bounds_check {
kid := item.first_item
for kid != nil {
compute_size(kid)
+ if kid.layout == .Fractional {
+ kid.bounds.r = item.layout_size.x * kid.bounds.r
+ }
kid = kid.next_item
}
}
@@ -932,6 +936,9 @@ arrange :: proc(item: ^Item, layout: ^RectI, gap: int) #no_bounds_check {
case .Relative:
rect.sized(&item.bounds, [2]int { layout.l, layout.t } + item.layout_offset, item.layout_size)
+
+ case .Fractional:
+ rect.sized(&item.bounds, item.layout_offset, item.layout_size)
}
// layout children with this resultant rect for LAYOUT_CUT