mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-29 12:43:38 +03:00
stop drawing traffic signal box when some plugins are active
This commit is contained in:
parent
43fa67177d
commit
d4006d3e93
@ -100,6 +100,9 @@ impl ID {
|
||||
pub struct RenderingHints {
|
||||
pub mode: EventLoopMode,
|
||||
pub osd: Text,
|
||||
|
||||
// Miscellaneous cases where a plugin needs to control rendering.
|
||||
pub suppress_traffic_signal_icon: Option<IntersectionID>,
|
||||
}
|
||||
|
||||
// For plugins and rendering. Not sure what module this should live in, here seems fine.
|
||||
|
@ -53,6 +53,8 @@ impl Plugin for TrafficSignalEditor {
|
||||
if input.key_pressed(Key::Return, "quit the editor") {
|
||||
new_state = Some(TrafficSignalEditor::Inactive);
|
||||
} else {
|
||||
ctx.hints.suppress_traffic_signal_icon = Some(*i);
|
||||
|
||||
// Change cycles
|
||||
{
|
||||
let cycles = &map.get_traffic_signal(*i).cycles;
|
||||
|
@ -27,6 +27,7 @@ impl Plugin for TurnCyclerState {
|
||||
Some(ID::Lane(id)) => id,
|
||||
Some(ID::Intersection(id)) => {
|
||||
*self = TurnCyclerState::Intersection(id);
|
||||
ctx.hints.suppress_traffic_signal_icon = Some(id);
|
||||
return false;
|
||||
}
|
||||
_ => {
|
||||
|
@ -106,8 +106,7 @@ impl Renderable for DrawIntersection {
|
||||
}
|
||||
|
||||
if self.intersection_type == IntersectionType::TrafficSignal {
|
||||
// TODO Also don't do this in editor mode!
|
||||
if ctx.current_selection != Some(ID::Intersection(self.id)) {
|
||||
if ctx.hints.suppress_traffic_signal_icon != Some(self.id) {
|
||||
self.draw_traffic_signal(g, ctx);
|
||||
}
|
||||
} else if self.should_draw_stop_sign {
|
||||
|
@ -340,6 +340,7 @@ impl UI {
|
||||
let mut hints = RenderingHints {
|
||||
mode: EventLoopMode::InputOnly,
|
||||
osd: Text::new(),
|
||||
suppress_traffic_signal_icon: None,
|
||||
};
|
||||
|
||||
// First update the camera and handle zoom
|
||||
|
Loading…
Reference in New Issue
Block a user