Fix scrollbar length proportional to total menu items (#2860)
The scrollbar length used to increase with more entries in the menu, which was counter-intuitive to how scrollbars worked in most applications. Turns out there was a typo in the floor division implementation :)
This commit is contained in:
parent
b365f2d614
commit
301065fe4d
1 changed files with 1 additions and 1 deletions
|
@ -288,7 +288,7 @@ impl<T: Item + 'static> Component for Menu<T> {
|
|||
let win_height = area.height as usize;
|
||||
|
||||
const fn div_ceil(a: usize, b: usize) -> usize {
|
||||
(a + b - 1) / a
|
||||
(a + b - 1) / b
|
||||
}
|
||||
|
||||
let scroll_height = std::cmp::min(div_ceil(win_height.pow(2), len), win_height as usize);
|
||||
|
|
Loading…
Reference in a new issue