mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-28 03:35:51 +03:00
When the lasso tool is active, change the panel to explain the interaction
This commit is contained in:
parent
bf6c5a75e9
commit
82dff217a5
@ -271,12 +271,9 @@ impl RoadSelector {
|
||||
Mode::Erase => Some("system/assets/tools/eraser.svg"),
|
||||
Mode::Route { .. } => Some("system/assets/tools/pin.svg"),
|
||||
} {
|
||||
let mut batch = GeomBatch::new();
|
||||
batch.append(
|
||||
GeomBatch::load_svg(g, cursor)
|
||||
.centered_on(g.canvas.get_cursor().to_pt())
|
||||
.color(RewriteColor::ChangeAll(Color::GREEN)),
|
||||
);
|
||||
let batch = GeomBatch::load_svg(g, cursor)
|
||||
.centered_on(g.canvas.get_cursor().to_pt())
|
||||
.color(RewriteColor::ChangeAll(Color::GREEN));
|
||||
g.fork_screenspace();
|
||||
batch.draw(g);
|
||||
g.unfork();
|
||||
|
@ -246,7 +246,6 @@ impl SelectBoundary {
|
||||
self.add_block(ctx, app, id);
|
||||
}
|
||||
self.redraw_outline(ctx, app.session.partitioning.neighborhood_block(self.id));
|
||||
self.panel = make_panel(ctx, app);
|
||||
}
|
||||
}
|
||||
|
||||
@ -256,6 +255,7 @@ impl State<App> for SelectBoundary {
|
||||
if let Some(polygon) = lasso.event(ctx) {
|
||||
self.lasso = None;
|
||||
self.add_blocks_freehand(ctx, app, polygon);
|
||||
self.panel = make_panel(ctx, app);
|
||||
}
|
||||
return Transition::Keep;
|
||||
}
|
||||
@ -277,9 +277,8 @@ impl State<App> for SelectBoundary {
|
||||
));
|
||||
}
|
||||
"Select freehand" => {
|
||||
// TODO Focus on the button in the panel, make it clear everything else is
|
||||
// inactive
|
||||
self.lasso = Some(Lasso::new());
|
||||
self.panel = make_panel_for_lasso(ctx, app);
|
||||
}
|
||||
x => {
|
||||
return crate::handle_app_header_click(ctx, app, x).unwrap();
|
||||
@ -369,3 +368,19 @@ fn make_panel(ctx: &mut EventCtx, app: &App) -> Panel {
|
||||
.aligned(HorizontalAlignment::Left, VerticalAlignment::Top)
|
||||
.build(ctx)
|
||||
}
|
||||
|
||||
fn make_panel_for_lasso(ctx: &mut EventCtx, app: &App) -> Panel {
|
||||
Panel::new_builder(Widget::col(vec![
|
||||
crate::app_header(ctx, app),
|
||||
"Draw a custom boundary for a neighborhood"
|
||||
.text_widget(ctx)
|
||||
.centered_vert(),
|
||||
Text::from_all(vec![
|
||||
Line("Click and drag").fg(ctx.style().text_hotkey_color),
|
||||
Line(" to select the blocks to add to this neighborhood"),
|
||||
])
|
||||
.into_widget(ctx),
|
||||
]))
|
||||
.aligned(HorizontalAlignment::Left, VerticalAlignment::Top)
|
||||
.build(ctx)
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ use geom::{Polygon, Pt2D, Ring};
|
||||
use crate::{CommonEndpoint, Direction, LaneID, Map, RoadID, RoadSideID, SideOfRoad};
|
||||
|
||||
// See https://github.com/a-b-street/abstreet/issues/841. Slow but correct when enabled.
|
||||
const LOSSLESS_BLOCKFINDING: bool = false; // TODO do not push
|
||||
const LOSSLESS_BLOCKFINDING: bool = true;
|
||||
|
||||
/// A block is defined by a perimeter that traces along the sides of roads. Inside the perimeter,
|
||||
/// the block may contain buildings and interior roads. In the simple case, a block represents a
|
||||
|
Loading…
Reference in New Issue
Block a user