Skip to content

Commit

Permalink
Remove rounding from new LTN panels. [rebuild] [release]
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreegster committed Mar 13, 2022
1 parent a266d91 commit 0e04a29
Showing 1 changed file with 40 additions and 24 deletions.
64 changes: 40 additions & 24 deletions apps/ltn/src/common/mod.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
use geom::CornerRadii;
use widgetry::{
lctrl, EventCtx, HorizontalAlignment, Key, Line, Outcome, Panel, PanelBuilder, PanelDims,
VerticalAlignment, Widget,
lctrl, CornerRounding, EventCtx, HorizontalAlignment, Key, Line, Outcome, Panel, PanelBuilder,
PanelDims, VerticalAlignment, Widget,
};

use crate::{App, BrowseNeighborhoods, Transition};

pub fn app_top_panel(ctx: &mut EventCtx, app: &App) -> Panel {
Panel::new_builder(Widget::row(vec![
map_gui::tools::home_btn(ctx),
Line("Low traffic neighborhoods")
.small_heading()
.into_widget(ctx)
.centered_vert(),
map_gui::tools::change_map_btn(ctx, app).centered_vert(),
ctx.style()
.btn_plain
.icon("system/assets/tools/search.svg")
.hotkey(lctrl(Key::F))
.build_widget(ctx, "search")
.centered_vert(),
]))
Panel::new_builder(
Widget::row(vec![
map_gui::tools::home_btn(ctx),
Line("Low traffic neighborhoods")
.small_heading()
.into_widget(ctx)
.centered_vert(),
map_gui::tools::change_map_btn(ctx, app).centered_vert(),
ctx.style()
.btn_plain
.icon("system/assets/tools/search.svg")
.hotkey(lctrl(Key::F))
.build_widget(ctx, "search")
.centered_vert(),
])
.corner_rounding(CornerRounding::CornerRadii(CornerRadii {
top_left: 0.0,
bottom_left: 0.0,
bottom_right: 0.0,
top_right: 0.0,
})),
)
.aligned(HorizontalAlignment::Left, VerticalAlignment::Top)
.dims_width(PanelDims::ExactPercent(1.0))
.build(ctx)
Expand Down Expand Up @@ -53,12 +62,19 @@ pub fn handle_top_panel(ctx: &mut EventCtx, app: &App, panel: &mut Panel) -> Opt

pub fn left_panel_builder(ctx: &EventCtx, top_panel: &Panel, contents: Widget) -> PanelBuilder {
let top_height = top_panel.panel_dims().height;
Panel::new_builder(contents)
.aligned(
HorizontalAlignment::Percent(0.0),
VerticalAlignment::Below(top_height),
)
.dims_height(PanelDims::ExactPixels(
ctx.canvas.window_height - top_height,
))
Panel::new_builder(
contents.corner_rounding(CornerRounding::CornerRadii(CornerRadii {
top_left: 0.0,
bottom_left: 0.0,
bottom_right: 0.0,
top_right: 0.0,
})),
)
.aligned(
HorizontalAlignment::Percent(0.0),
VerticalAlignment::Below(top_height),
)
.dims_height(PanelDims::ExactPixels(
ctx.canvas.window_height - top_height,
))
}

0 comments on commit 0e04a29

Please sign in to comment.