Improve resize behavior

This commit is contained in:
Anthony
2025-07-23 11:24:30 -04:00
parent 91420c7b94
commit d251c4215c
2 changed files with 10 additions and 5 deletions

View File

@@ -1436,7 +1436,6 @@ impl Render for KeymapEditor {
DefiniteLength::Fraction(0.08),
])
.resizable_columns(
// todo! Resize doesn't fully work
[
ResizeBehavior::None,
ResizeBehavior::Resizable,

View File

@@ -605,10 +605,13 @@ impl<const COLS: usize> ColumnWidths<COLS> {
);
} else {
curr_column = col_idx;
while diff_left < 0.0 && curr_column > 0 {
// todo! When resize is none and dragging to the left this doesn't work correctly
// This could be done by making min_size equal to current size if resizable is None
let Some(min_size) = resize_behavior[curr_column].min_size() else {
// Resize behavior should be improved in the future by also seeking to the right column when there's not enough space
while diff_left < 0.0 {
let Some(min_size) = resize_behavior[curr_column.saturating_sub(1)].min_size()
else {
if curr_column == 0 {
break;
}
curr_column -= 1;
continue;
};
@@ -624,6 +627,9 @@ impl<const COLS: usize> ColumnWidths<COLS> {
}
self.widths[curr_column] = DefiniteLength::Fraction(curr_width);
if curr_column == 0 {
break;
}
curr_column -= 1;
}