mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-29 01:13:53 +03:00
debug areas in debug mode; flags are silly
This commit is contained in:
parent
aaff183402
commit
6207540dc0
@ -27,6 +27,7 @@ impl ABTestMode {
|
||||
None,
|
||||
&state.ui.state.primary.sim,
|
||||
&ShowEverything::new(),
|
||||
false,
|
||||
);
|
||||
|
||||
ctx.input.set_mode("A/B Test Mode", ctx.canvas);
|
||||
|
@ -51,10 +51,13 @@ impl DebugMode {
|
||||
match mode.state {
|
||||
State::Exploring => {
|
||||
ctx.canvas.handle_event(ctx.input);
|
||||
state.ui.state.primary.current_selection =
|
||||
state
|
||||
.ui
|
||||
.handle_mouseover(ctx, None, &state.ui.state.primary.sim, mode);
|
||||
state.ui.state.primary.current_selection = state.ui.handle_mouseover(
|
||||
ctx,
|
||||
None,
|
||||
&state.ui.state.primary.sim,
|
||||
mode,
|
||||
true,
|
||||
);
|
||||
|
||||
let mut txt = Text::new();
|
||||
txt.add_styled_line(
|
||||
|
@ -66,6 +66,7 @@ impl EditMode {
|
||||
None,
|
||||
&state.ui.state.primary.sim,
|
||||
&ShowEverything::new(),
|
||||
false,
|
||||
);
|
||||
|
||||
if let Some(ID::Lane(id)) = state.ui.state.primary.current_selection {
|
||||
@ -139,6 +140,7 @@ impl EditMode {
|
||||
Some(i),
|
||||
&state.ui.state.primary.sim,
|
||||
&ShowEverything::new(),
|
||||
false,
|
||||
);
|
||||
|
||||
ctx.input.set_mode_with_prompt(
|
||||
|
@ -51,6 +51,7 @@ impl TrafficSignalEditor {
|
||||
Some(self.i),
|
||||
&ui.state.primary.sim,
|
||||
&ShowEverything::new(),
|
||||
false,
|
||||
);
|
||||
|
||||
ctx.input.set_mode_with_prompt(
|
||||
|
@ -32,6 +32,7 @@ impl MissionEditMode {
|
||||
None,
|
||||
&state.ui.state.primary.sim,
|
||||
&ShowEverything::new(),
|
||||
false,
|
||||
);
|
||||
|
||||
ctx.input.set_mode("Mission Edit Mode", ctx.canvas);
|
||||
|
@ -55,6 +55,7 @@ impl SandboxMode {
|
||||
None,
|
||||
&state.ui.state.primary.sim,
|
||||
&ShowEverything::new(),
|
||||
false,
|
||||
);
|
||||
|
||||
if let State::Spawning(ref mut spawner) = mode.state {
|
||||
|
@ -26,10 +26,6 @@ pub struct Flags {
|
||||
#[structopt(long = "dont_draw_lane_markings")]
|
||||
pub dont_draw_lane_markings: bool,
|
||||
|
||||
/// Allow areas to be moused over?
|
||||
#[structopt(long = "debug_areas")]
|
||||
pub debug_areas: bool,
|
||||
|
||||
/// Enable cpuprofiler?
|
||||
#[structopt(long = "enable_profiler")]
|
||||
pub enable_profiler: bool,
|
||||
|
@ -268,8 +268,13 @@ impl UI {
|
||||
ctx.canvas.handle_event(ctx.input);
|
||||
|
||||
// Always handle mouseover
|
||||
self.state.primary.current_selection =
|
||||
self.handle_mouseover(ctx, None, &self.state.primary.sim, &ShowEverything::new());
|
||||
self.state.primary.current_selection = self.handle_mouseover(
|
||||
ctx,
|
||||
None,
|
||||
&self.state.primary.sim,
|
||||
&ShowEverything::new(),
|
||||
false,
|
||||
);
|
||||
|
||||
let mut recalculate_current_selection = false;
|
||||
self.state
|
||||
@ -280,6 +285,7 @@ impl UI {
|
||||
None,
|
||||
&self.state.primary.sim,
|
||||
&ShowEverything::new(),
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
@ -335,13 +341,11 @@ impl UI {
|
||||
}
|
||||
|
||||
// Still show area selection when zoomed out.
|
||||
if self.state.primary.current_flags.debug_areas {
|
||||
if let Some(ID::Area(id)) = self.state.primary.current_selection {
|
||||
g.draw_polygon(
|
||||
self.state.cs.get("selected"),
|
||||
&fill_to_boundary_polygon(ctx.draw_map.get_a(id).get_outline(&ctx.map)),
|
||||
);
|
||||
}
|
||||
if let Some(ID::Area(id)) = self.state.primary.current_selection {
|
||||
g.draw_polygon(
|
||||
self.state.cs.get("selected"),
|
||||
&fill_to_boundary_polygon(ctx.draw_map.get_a(id).get_outline(&ctx.map)),
|
||||
);
|
||||
}
|
||||
|
||||
self.state
|
||||
@ -431,9 +435,16 @@ impl UI {
|
||||
show_turn_icons_for: Option<IntersectionID>,
|
||||
source: &GetDrawAgents,
|
||||
show_objs: &ShowObject,
|
||||
debug_areas: bool,
|
||||
) -> Option<ID> {
|
||||
if !ctx.canvas.is_dragging() && ctx.input.get_moved_mouse().is_some() {
|
||||
return self.mouseover_something(&ctx, show_turn_icons_for, source, show_objs);
|
||||
return self.mouseover_something(
|
||||
&ctx,
|
||||
show_turn_icons_for,
|
||||
source,
|
||||
show_objs,
|
||||
debug_areas,
|
||||
);
|
||||
}
|
||||
if ctx.input.window_lost_cursor() {
|
||||
return None;
|
||||
@ -447,11 +458,10 @@ impl UI {
|
||||
show_turn_icons_for: Option<IntersectionID>,
|
||||
source: &GetDrawAgents,
|
||||
show_objs: &ShowObject,
|
||||
debug_areas: bool,
|
||||
) -> Option<ID> {
|
||||
// Unzoomed mode. Ignore when debugging areas.
|
||||
if ctx.canvas.cam_zoom < MIN_ZOOM_FOR_DETAIL
|
||||
&& !self.state.primary.current_flags.debug_areas
|
||||
{
|
||||
if ctx.canvas.cam_zoom < MIN_ZOOM_FOR_DETAIL && !debug_areas {
|
||||
return None;
|
||||
}
|
||||
|
||||
@ -468,7 +478,6 @@ impl UI {
|
||||
);
|
||||
objects.reverse();
|
||||
|
||||
let debug_areas = self.state.primary.current_flags.debug_areas;
|
||||
for obj in objects {
|
||||
// Don't mouseover areas.
|
||||
// TODO Might get fancier rules in the future, so we can't mouseover irrelevant things
|
||||
|
Loading…
Reference in New Issue
Block a user