stop drawing traffic signal box when some plugins are active

This commit is contained in:
Dustin Carlino 2018-12-04 10:26:35 -08:00
parent 43fa67177d
commit d4006d3e93
5 changed files with 8 additions and 2 deletions

View File

@ -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.

View File

@ -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;

View File

@ -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;
}
_ => {

View File

@ -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 {

View File

@ -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