@@ -48,7 +48,7 @@ pub fn ColumnLayout(peer: Callbacks, widgets: []*Widget) void {
48
48
const config = peer .getLayoutConfig (ColumnRowConfig );
49
49
const spacing : f32 = @floatFromInt (config .spacing );
50
50
51
- const totalAvailableHeight = peer .getSize (peer .userdata ).height - @as (f32 , @floatFromInt ((widgets .len - | 1 ) * config .spacing ));
51
+ const totalAvailableHeight : f32 = @max ( 0 , peer .getSize (peer .userdata ).height - @as (f32 , @floatFromInt ((widgets .len - | 1 ) * config .spacing ) ));
52
52
53
53
var childHeight = if (expandedCount == 0 ) 0 else totalAvailableHeight / @as (f32 , @floatFromInt (expandedCount ));
54
54
for (widgets ) | widget | {
@@ -81,7 +81,7 @@ pub fn ColumnLayout(peer: Callbacks, widgets: []*Widget) void {
81
81
82
82
const available = Size {
83
83
.width = peer .getSize (peer .userdata ).width ,
84
- .height = if (widget .container_expanded ) childHeight else peer .getSize (peer .userdata ).height - childY ,
84
+ .height = if (widget .container_expanded ) childHeight else @max ( 0 , peer .getSize (peer .userdata ).height - childY ) ,
85
85
};
86
86
const preferred = widget .getPreferredSize (available );
87
87
const size = blk : {
@@ -124,7 +124,7 @@ pub fn RowLayout(peer: Callbacks, widgets: []*Widget) void {
124
124
const config = peer .getLayoutConfig (ColumnRowConfig );
125
125
const spacing : f32 = @floatFromInt (config .spacing );
126
126
127
- const totalAvailableWidth = peer .getSize (peer .userdata ).width - @as (f32 , @floatFromInt ((widgets .len - | 1 ) * config .spacing ));
127
+ const totalAvailableWidth : f32 = @max ( 0 , peer .getSize (peer .userdata ).width - @as (f32 , @floatFromInt ((widgets .len - | 1 ) * config .spacing ) ));
128
128
129
129
var childWidth = if (expandedCount == 0 ) 0 else totalAvailableWidth / @as (f32 , @floatFromInt (expandedCount ));
130
130
for (widgets ) | widget | {
@@ -156,7 +156,7 @@ pub fn RowLayout(peer: Callbacks, widgets: []*Widget) void {
156
156
}
157
157
158
158
const available = Size {
159
- .width = if (widget .container_expanded ) childWidth else peer .getSize (peer .userdata ).width - childX ,
159
+ .width = if (widget .container_expanded ) childWidth else @max ( 0 , peer .getSize (peer .userdata ).width - childX ) ,
160
160
.height = peer .getSize (peer .userdata ).height ,
161
161
};
162
162
const preferred = widget .getPreferredSize (available );
0 commit comments