Hide layers panel by default, but also make it more easily toggleable. #743

This commit is contained in:
Dustin Carlino 2021-09-21 10:26:58 -07:00
parent 0d01906b08
commit 4782dac84b
2 changed files with 19 additions and 19 deletions

View File

@ -137,7 +137,7 @@ impl State<App> for ExploreMap {
}
fn make_top_panel(ctx: &mut EventCtx, app: &App) -> Panel {
let mut file_management = Vec::new();
let mut col = Vec::new();
let edits = app.primary.map.get_edits();
let total_mileage = {
@ -165,21 +165,19 @@ fn make_top_panel(ctx: &mut EventCtx, app: &App) -> Panel {
total
};
if edits.commands.is_empty() {
file_management.push("Today's network".text_widget(ctx));
col.push("Today's network".text_widget(ctx));
} else {
file_management.push(Line(&edits.edits_name).into_widget(ctx));
col.push(Line(&edits.edits_name).into_widget(ctx));
}
if false {
file_management.push(
Line(format!(
"{:.1} miles of new bike lanes",
total_mileage.to_miles()
))
.secondary()
.into_widget(ctx),
);
}
file_management.push(Widget::row(vec![
col.push(
Line(format!(
"{:.1} miles of new bike lanes",
total_mileage.to_miles()
))
.secondary()
.into_widget(ctx),
);
col.push(Widget::row(vec![
ctx.style()
.btn_outline
.text("Open a proposal")
@ -194,7 +192,7 @@ fn make_top_panel(ctx: &mut EventCtx, app: &App) -> Panel {
]));
if false {
// TODO Rethink UI of this, probably fold into save dialog
file_management.push(
col.push(
ctx.style()
.btn_outline
.text("Share proposal")
@ -204,5 +202,5 @@ fn make_top_panel(ctx: &mut EventCtx, app: &App) -> Panel {
}
// TODO Should undo/redo, save, share functionality also live here?
Tab::Explore.make_left_panel(ctx, app, Widget::col(file_management))
Tab::Explore.make_left_panel(ctx, app, Widget::col(col))
}

View File

@ -34,7 +34,7 @@ impl Layers {
pub fn new(ctx: &mut EventCtx, app: &App) -> Layers {
let mut l = Layers {
panel: Panel::empty(ctx),
minimized: false,
minimized: true,
bike_network: Some(DrawNetworkLayer::new()),
labels: Some(DrawRoadLabels::new()),
elevation: false,
@ -245,7 +245,8 @@ impl Layers {
return ctx
.style()
.btn_plain
.icon("system/assets/tools/maximize.svg")
.icon("system/assets/tools/layers.svg")
.hotkey(Key::L)
.build_widget(ctx, "show panel");
}
@ -269,6 +270,7 @@ impl Layers {
ctx.style()
.btn_plain
.icon("system/assets/tools/minimize.svg")
.hotkey(Key::L)
.build_widget(ctx, "hide panel")
.align_right(),
]),
@ -296,7 +298,7 @@ impl Layers {
// TODO Distinguish door-zone bike lanes?
// TODO Call out bike turning boxes?
// TODO Call out bike signals?
Toggle::checkbox(ctx, "road labels", Key::L, self.labels.is_some()),
Toggle::checkbox(ctx, "road labels", None, self.labels.is_some()),
Widget::row(vec![
Toggle::checkbox(ctx, "elevation", Key::E, self.elevation),
ctx.style()