feat(cli): get selected index method in grid selector state

This commit is contained in:
Lucas Colombo 2024-09-20 21:19:53 -03:00
parent b0726b1fb4
commit 33cd32ce40
Signed by: lucas
GPG Key ID: EF34786CFEFFAE35

View File

@ -91,6 +91,11 @@ impl GridSelectorState {
self.selected.map(|i| self.items[i].clone())
}
/// Get the index of the selected item.
pub fn selected_index(&self) -> Option<usize> {
self.selected
}
/// Get the hovered item.
pub fn hovered(&self) -> Option<GridItem> {
self.hovered.map(|i| self.items[i].clone())