diff options
author | San Jacobs | 2024-02-05 15:36:44 +0100 |
---|---|---|
committer | San Jacobs | 2024-02-05 15:36:44 +0100 |
commit | 0c4cc3f052608b2410bf71787b14c2149e14c72b (patch) | |
tree | 048ebb29c2045b6f08b2bb5d10d070d733f29021 /lib/oui | |
parent | 5f685eaabf4c57606c3b86791a33d5cdce46ec67 (diff) | |
download | satscalc-0c4cc3f052608b2410bf71787b14c2149e14c72b.tar.gz satscalc-0c4cc3f052608b2410bf71787b14c2149e14c72b.tar.bz2 satscalc-0c4cc3f052608b2410bf71787b14c2149e14c72b.zip |
Adding custom layout stuff to OUI for the timeline display
Diffstat (limited to 'lib/oui')
-rw-r--r-- | lib/oui/oui.odin | 7 |
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 |