From 3c710c2e8abaadfda37572ee6bfcd67e32c7ee54 Mon Sep 17 00:00:00 2001 From: Dustin Carlino Date: Wed, 12 Dec 2018 10:43:06 -0800 Subject: [PATCH] fix the sim score plugin --- editor/src/ui.rs | 8 +++++++- ezgui/src/log_scroller.rs | 2 +- ezgui/src/text.rs | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/editor/src/ui.rs b/editor/src/ui.rs index 4f69f8de01..72c3fa2907 100644 --- a/editor/src/ui.rs +++ b/editor/src/ui.rs @@ -105,8 +105,10 @@ impl GUI for UI { if let Some(p) = self.get_active_plugin() { p.draw(g, &mut ctx); } else { - // If no other mode was active, give the ambient plugins in ViewMode a chance. + // If no other mode was active, give the ambient plugins in ViewMode and SimMode a + // chance. self.primary_plugins.view_mode().draw(g, &mut ctx); + self.plugins.sim_mode().draw(g, &mut ctx); } self.canvas.draw_text(g, hints.osd, BOTTOM_LEFT); @@ -216,6 +218,10 @@ impl PluginsPerUI { fn edit_mode(&self) -> &EditMode { self.list[0].downcast_ref::().unwrap() } + + fn sim_mode(&self) -> &Box { + &self.list[1] + } } impl UI { diff --git a/ezgui/src/log_scroller.rs b/ezgui/src/log_scroller.rs index 22766d4813..fa7b4af30d 100644 --- a/ezgui/src/log_scroller.rs +++ b/ezgui/src/log_scroller.rs @@ -40,7 +40,7 @@ impl LogScroller { pub fn event(&mut self, input: &mut UserInput) -> bool { let ev = input.use_event_directly().clone(); - if let Some(Button::Keyboard(Key::Escape)) = ev.press_args() { + if let Some(Button::Keyboard(Key::Return)) = ev.press_args() { return true; } diff --git a/ezgui/src/text.rs b/ezgui/src/text.rs index 8746047afc..1fc7ef2912 100644 --- a/ezgui/src/text.rs +++ b/ezgui/src/text.rs @@ -15,7 +15,7 @@ pub const LINE_HEIGHT: f64 = 22.0; // TODO Totally made up. Should query the font or something. const MAX_CHAR_WIDTH: f64 = 25.0; -#[derive(Clone)] +#[derive(Debug, Clone)] struct TextSpan { text: String, fg_color: Color, @@ -35,7 +35,7 @@ impl TextSpan { } // TODO parse style from markup tags -#[derive(Clone)] +#[derive(Debug, Clone)] pub struct Text { lines: Vec>, bg_color: Color,