diff --git a/hui/src/instance.rs b/hui/src/instance.rs index b23ed6c..c70f723 100644 --- a/hui/src/instance.rs +++ b/hui/src/instance.rs @@ -153,6 +153,9 @@ impl UiInstance { //first, drain and process the event queue self.input.update_state(&mut self.events); + //then, reset the (remaining) signals + self.signal.clear(); + //then, reset the draw commands std::mem::swap(&mut self.prev_draw_commands, &mut self.draw_commands); self.draw_commands.commands.clear(); diff --git a/hui/src/signal.rs b/hui/src/signal.rs index 238655a..89b7eb0 100644 --- a/hui/src/signal.rs +++ b/hui/src/signal.rs @@ -46,4 +46,10 @@ impl SignalStore { .drain(..) .map(|x| *x.downcast::().unwrap()) //unchecked? } + + /// Clear all signals + pub(crate) fn clear(&mut self) { + //XXX: should we clear the vecs instead? + self.sig.clear(); + } }