Skip to content

Commit 98dc355

Browse files
committed
bugfix with focus_bar in case of too few bars
1 parent e94cc3d commit 98dc355

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

crates/notation_bevy/src/settings/layout_settings.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,11 @@ impl LayoutSettings {
133133
) -> f32 {
134134
let (row, col) = grid_data.calc_row_col(pos_data.bar_position.bar_ordinal - 1);
135135
let mut y = pos_data.bar_layout.offset.y;
136-
if row > 0 {
137-
let grid_size = layout.size;
138-
let content_size = grid_data.content_size;
136+
let grid_size = layout.size;
137+
let content_size = grid_data.content_size;
138+
if grid_size.height > content_size.height {
139+
y = -(grid_size.height - content_size.height);
140+
} else if row > 0 {
139141
let last_row_height = grid_data.calc_cell_size(row - 1, col).height;
140142
if last_row_height + pos_data.bar_layout.size.height <= grid_size.height / 2.0 {
141143
y = grid_data.calc_cell_offset(row - 1, col).y;

0 commit comments

Comments
 (0)