Fix dropdown keyboard movement bug (#1630)

* Add a value to all `MenuListEntry`

* cargo fmt

* Make `value` as constructor in `MenuListEntry`

* Make `value` as constructor in `RadioEntryData`
This commit is contained in:
Elbert Ronnie
2024-03-02 17:06:08 -08:00
committed by GitHub
parent 9090a0e6e9
commit 9479abe114
11 changed files with 86 additions and 51 deletions
@@ -129,8 +129,12 @@ pub fn overlay_options(grid: &GridSnapping) -> Vec<LayoutGroup> {
TextLabel::new("Type").table_align(true).widget_holder(),
Separator::new(SeparatorType::Unrelated).widget_holder(),
RadioInput::new(vec![
RadioEntryData::new("Rectangular").on_update(update_val(grid, |grid, _| grid.grid_type = GridType::RECTANGLE)),
RadioEntryData::new("Isometric").on_update(update_val(grid, |grid, _| grid.grid_type = GridType::ISOMETRIC)),
RadioEntryData::new("rectangular")
.label("Rectangular")
.on_update(update_val(grid, |grid, _| grid.grid_type = GridType::RECTANGLE)),
RadioEntryData::new("isometric")
.label("Isometric")
.on_update(update_val(grid, |grid, _| grid.grid_type = GridType::ISOMETRIC)),
])
.min_width(200)
.selected_index(Some(if matches!(grid.grid_type, GridType::Rectangle { .. }) { 0 } else { 1 }))