mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-24 23:15:24 +03:00
UX feedback on the quick-sketch tool:
- name it more clearly - don't show the "finalize" button until it's possible to use it
This commit is contained in:
parent
c3e35a9a3f
commit
cb2617ce1e
@ -168,11 +168,15 @@ impl RouteSketcher {
|
||||
"Click and drag to adjust the route"
|
||||
}
|
||||
.text_widget(ctx),
|
||||
format!(
|
||||
"{} road segments selected",
|
||||
self.route.full_path.len().max(1) - 1
|
||||
)
|
||||
.text_widget(ctx),
|
||||
if self.route.waypoints.len() > 1 {
|
||||
format!(
|
||||
"{} road segments selected",
|
||||
self.route.full_path.len().max(1) - 1
|
||||
)
|
||||
.text_widget(ctx)
|
||||
} else {
|
||||
Widget::nothing()
|
||||
},
|
||||
])
|
||||
}
|
||||
|
||||
|
@ -226,7 +226,7 @@ impl State<App> for ExploreMap {
|
||||
"Share proposal" => {
|
||||
return Transition::Push(share::upload_proposal(ctx, app));
|
||||
}
|
||||
"Sketch a route" => {
|
||||
"Create new bike lanes" => {
|
||||
app.primary.current_selection = None;
|
||||
return Transition::Push(crate::ungap::quick_sketch::QuickSketch::new_state(
|
||||
ctx, app,
|
||||
@ -437,7 +437,7 @@ fn make_top_panel(ctx: &mut EventCtx, app: &App) -> Panel {
|
||||
Widget::col(file_management).bg(ctx.style().section_bg),
|
||||
ctx.style()
|
||||
.btn_solid_primary
|
||||
.text("Sketch a route")
|
||||
.icon_text("system/assets/tools/pencil.svg", "Create new bike lanes")
|
||||
.hotkey(Key::S)
|
||||
.build_def(ctx),
|
||||
]))
|
||||
|
@ -34,16 +34,16 @@ impl QuickSketch {
|
||||
}
|
||||
|
||||
fn update_top_panel(&mut self, ctx: &mut EventCtx) {
|
||||
// We're usually replacing an existing panel, except the very first time.
|
||||
let default_buffer = if self.top_panel.has_widget("buffer type") {
|
||||
self.top_panel.dropdown_value("buffer type")
|
||||
} else {
|
||||
Some(BufferType::FlexPosts)
|
||||
};
|
||||
let mut col = vec![self.route_sketcher.get_widget_to_describe(ctx)];
|
||||
|
||||
self.top_panel = Panel::new_builder(Widget::col(vec![
|
||||
self.route_sketcher.get_widget_to_describe(ctx),
|
||||
Widget::row(vec![
|
||||
if self.route_sketcher.is_route_started() {
|
||||
// We're usually replacing an existing panel, except the very first time.
|
||||
let default_buffer = if self.top_panel.has_widget("buffer type") {
|
||||
self.top_panel.dropdown_value("buffer type")
|
||||
} else {
|
||||
Some(BufferType::FlexPosts)
|
||||
};
|
||||
col.push(Widget::row(vec![
|
||||
"Protect the new bike lanes?"
|
||||
.text_widget(ctx)
|
||||
.centered_vert(),
|
||||
@ -60,24 +60,35 @@ impl QuickSketch {
|
||||
Choice::new("no -- just paint", None),
|
||||
],
|
||||
),
|
||||
]),
|
||||
Widget::custom_row(vec![
|
||||
ctx.style()
|
||||
.btn_solid_primary
|
||||
.text("Add bike lanes")
|
||||
.hotkey(Key::Enter)
|
||||
.disabled(!self.route_sketcher.is_route_started())
|
||||
.build_def(ctx),
|
||||
]));
|
||||
col.push(
|
||||
Widget::custom_row(vec![
|
||||
ctx.style()
|
||||
.btn_solid_primary
|
||||
.text("Add bike lanes")
|
||||
.hotkey(Key::Enter)
|
||||
.disabled(!self.route_sketcher.is_route_started())
|
||||
.build_def(ctx),
|
||||
ctx.style()
|
||||
.btn_solid_destructive
|
||||
.text("Cancel")
|
||||
.hotkey(Key::Escape)
|
||||
.build_def(ctx),
|
||||
])
|
||||
.evenly_spaced(),
|
||||
);
|
||||
} else {
|
||||
col.push(
|
||||
ctx.style()
|
||||
.btn_solid_destructive
|
||||
.text("Cancel")
|
||||
.hotkey(Key::Escape)
|
||||
.build_def(ctx),
|
||||
])
|
||||
.evenly_spaced(),
|
||||
]))
|
||||
.aligned(HorizontalAlignment::Center, VerticalAlignment::Top)
|
||||
.build(ctx);
|
||||
);
|
||||
}
|
||||
self.top_panel = Panel::new_builder(Widget::col(col))
|
||||
.aligned(HorizontalAlignment::Center, VerticalAlignment::Top)
|
||||
.build(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user