Skip to content

Commit a7ab02b

Browse files
committed
fix(layout, input): improve scroll layout calculation and input sizing
- layout: fix logic in `layout_heights` to correctly calculate height for horizontal scroll containers (left_to_right axis) when nested in a vertical container (top_to_bottom axis). - input: change internal rectangle sizing from `fill_fit` to `fill_fill` in `view_input.v` to ensure correct background filling.
1 parent 13eaf81 commit a7ab02b

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

layout.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ fn layout_fill_widths(mut layout Layout) {
371371
} else if layout.shape.axis == .top_to_bottom {
372372
if layout.shape.id_scroll > 0 && layout.shape.sizing.width == .fill
373373
&& layout.shape.scroll_mode != .vertical_only
374-
&& layout.parent.shape.axis != .top_to_bottom {
374+
&& layout.parent.shape.axis == .left_to_right {
375375
sibling_widths := layout.parent.children.filter(it.shape.uid != layout.shape.uid).map(it.shape.width)
376376
layout.shape.width = layout.parent.shape.width - arrays.sum(sibling_widths) or { 0 }
377377
layout.shape.width -= layout.parent.spacing()
@@ -524,7 +524,7 @@ fn layout_fill_heights(mut layout Layout) {
524524
} else if layout.shape.axis == .left_to_right {
525525
if layout.shape.id_scroll > 0 && layout.shape.sizing.height == .fill
526526
&& layout.shape.scroll_mode != .horizontal_only
527-
&& layout.parent.shape.axis != .left_to_right {
527+
&& layout.parent.shape.axis == .top_to_bottom {
528528
sibling_heights := layout.parent.children.filter(it.shape.uid != layout.shape.uid).map(it.shape.height)
529529
layout.shape.height = layout.parent.shape.height - arrays.sum(sibling_heights) or { 0 }
530530
layout.shape.height -= layout.parent.spacing()

view_input.v

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ pub fn input(cfg InputCfg) View {
174174
amend_layout: cfg.amend_layout
175175
content: [
176176
column(
177-
name: 'input interior'
177+
name: 'input scroll container'
178178
id_scroll: cfg.id_scroll
179179
scrollbar_cfg_x: cfg.scrollbar_cfg_x
180180
scrollbar_cfg_y: cfg.scrollbar_cfg_y
@@ -183,15 +183,17 @@ pub fn input(cfg InputCfg) View {
183183
padding: cfg.padding
184184
radius: cfg.radius
185185
sizing: fill_fill
186-
spacing: spacing_small
186+
spacing: 0
187187
content: [
188188
row(
189+
name: 'input interior'
189190
padding: padding_none
190191
sizing: fill_fill
191192
on_click: cfg.on_click_interior
192193
content: [
193194
text(
194195
id_focus: cfg.id_focus
196+
sizing: fill_fill
195197
text: txt
196198
text_style: txt_style
197199
mode: mode
@@ -200,7 +202,7 @@ pub fn input(cfg InputCfg) View {
200202
),
201203
rectangle(
202204
color: color_transparent
203-
sizing: fill_fit
205+
sizing: fill_fill
204206
),
205207
row(
206208
name: 'input icon'

0 commit comments

Comments
 (0)