mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-28 13:38:11 +08:00
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:
@@ -89,7 +89,7 @@ impl ToolColorOptions {
|
||||
]
|
||||
.into_iter()
|
||||
.map(|(icon, tooltip, color_type)| {
|
||||
let mut entry = RadioEntryData::new("").tooltip(tooltip).icon(icon);
|
||||
let mut entry = RadioEntryData::new(format!("{color_type:?}")).tooltip(tooltip).icon(icon);
|
||||
entry.on_update = radio_callback(color_type);
|
||||
entry
|
||||
})
|
||||
|
||||
@@ -167,8 +167,8 @@ impl LayoutHolder for BrushTool {
|
||||
group
|
||||
.iter()
|
||||
.map(|blend_mode| {
|
||||
MenuListEntry::new(format!("{blend_mode}"))
|
||||
.value(format!("{blend_mode:?}"))
|
||||
MenuListEntry::new(format!("{blend_mode:?}"))
|
||||
.label(blend_mode.to_string())
|
||||
.on_update(|_| BrushToolMessage::UpdateOptions(BrushToolMessageOptionsUpdate::BlendMode(*blend_mode)).into())
|
||||
})
|
||||
.collect()
|
||||
|
||||
@@ -88,12 +88,12 @@ impl<'a> MessageHandler<ToolMessage, &mut ToolActionHandlerData<'a>> for Gradien
|
||||
impl LayoutHolder for GradientTool {
|
||||
fn layout(&self) -> Layout {
|
||||
let gradient_type = RadioInput::new(vec![
|
||||
RadioEntryData::new("Linear")
|
||||
.value("linear")
|
||||
RadioEntryData::new("linear")
|
||||
.label("Linear")
|
||||
.tooltip("Linear Gradient")
|
||||
.on_update(move |_| GradientToolMessage::UpdateOptions(GradientOptionsUpdate::Type(GradientType::Linear)).into()),
|
||||
RadioEntryData::new("Radial")
|
||||
.value("radial")
|
||||
RadioEntryData::new("radial")
|
||||
.label("Radial")
|
||||
.tooltip("Radial Gradient")
|
||||
.on_update(move |_| GradientToolMessage::UpdateOptions(GradientOptionsUpdate::Type(GradientType::Radial)).into()),
|
||||
])
|
||||
|
||||
@@ -125,8 +125,8 @@ impl LayoutHolder for PathTool {
|
||||
let unrelated_seperator = Separator::new(SeparatorType::Unrelated).widget_holder();
|
||||
|
||||
let manipulator_angle_options = vec![
|
||||
RadioEntryData::new("Smooth").on_update(|_| PathToolMessage::ManipulatorAngleMakeSmooth.into()),
|
||||
RadioEntryData::new("Sharp").on_update(|_| PathToolMessage::ManipulatorAngleMakeSharp.into()),
|
||||
RadioEntryData::new("smooth").label("Smooth").on_update(|_| PathToolMessage::ManipulatorAngleMakeSmooth.into()),
|
||||
RadioEntryData::new("sharp").label("Sharp").on_update(|_| PathToolMessage::ManipulatorAngleMakeSharp.into()),
|
||||
];
|
||||
let manipulator_angle_index = manipulator_angle.and_then(|angle| match angle {
|
||||
ManipulatorAngle::Smooth => Some(0),
|
||||
|
||||
@@ -103,8 +103,12 @@ fn create_sides_widget(vertices: u32) -> WidgetHolder {
|
||||
|
||||
fn create_star_option_widget(primitive_shape_type: PrimitiveShapeType) -> WidgetHolder {
|
||||
let entries = vec![
|
||||
RadioEntryData::new("Polygon").on_update(move |_| PolygonToolMessage::UpdateOptions(PolygonOptionsUpdate::PrimitiveShapeType(PrimitiveShapeType::Polygon)).into()),
|
||||
RadioEntryData::new("Star").on_update(move |_| PolygonToolMessage::UpdateOptions(PolygonOptionsUpdate::PrimitiveShapeType(PrimitiveShapeType::Star)).into()),
|
||||
RadioEntryData::new("polygon")
|
||||
.label("Polygon")
|
||||
.on_update(move |_| PolygonToolMessage::UpdateOptions(PolygonOptionsUpdate::PrimitiveShapeType(PrimitiveShapeType::Polygon)).into()),
|
||||
RadioEntryData::new("star")
|
||||
.label("Star")
|
||||
.on_update(move |_| PolygonToolMessage::UpdateOptions(PolygonOptionsUpdate::PrimitiveShapeType(PrimitiveShapeType::Star)).into()),
|
||||
];
|
||||
RadioInput::new(entries).selected_index(Some(primitive_shape_type as u32)).widget_holder()
|
||||
}
|
||||
|
||||
@@ -106,8 +106,8 @@ impl SelectTool {
|
||||
let layer_selection_behavior_entries = [NestedSelectionBehavior::Deepest, NestedSelectionBehavior::Shallowest]
|
||||
.iter()
|
||||
.map(|mode| {
|
||||
MenuListEntry::new(mode.to_string())
|
||||
.value(mode.to_string())
|
||||
MenuListEntry::new(format!("{mode:?}"))
|
||||
.label(mode.to_string())
|
||||
.on_update(move |_| SelectToolMessage::SelectOptions(SelectOptionsUpdate::NestedSelectionBehavior(*mode)).into())
|
||||
})
|
||||
.collect();
|
||||
|
||||
Reference in New Issue
Block a user