rem: Scroll from Propierties of Container

Updated the corresponding documentation and ideas for how to realize
scrollable contents.
This commit is contained in:
2025-02-15 18:50:36 +01:00
parent 01eb14f1bd
commit d951906b2b
4 changed files with 93 additions and 27 deletions

View File

@@ -185,17 +185,6 @@ pub const Rectangle = packed struct {
}
};
/// Scroll configuration struct
pub const Scroll = packed struct {
/// Enable horizontal scrolling for this element
horizontal: bool = false,
/// Enable vertical scrolling for this element
vertical: bool = false,
// TODO: rendering enhancements:
// - render corresponding scroll-bars?
};
/// Layout configuration struct
pub const Layout = packed struct {
/// control the direction in which child elements are laid out
@@ -244,7 +233,6 @@ pub fn Container(comptime Event: type) type {
pub const Properties = packed struct {
border: Border = .{},
rectangle: Rectangle = .{},
scroll: Scroll = .{},
layout: Layout = .{},
};
@@ -328,9 +316,7 @@ pub fn Container(comptime Event: type) type {
break :blk rows - element_rows * len;
},
};
// TODO: make sure that items cannot underflow in size!
// - make their size and position still according (even if outside of the visible space!)
// - don't render them then accordingly -> avoid index out of bounce accesses!
for (this.elements.items) |*element| {
var element_size: Size = undefined;
switch (layout.direction) {