move ctx in event to be on module so run event and stuff can be used easily
This commit is contained in:
@@ -24,7 +24,7 @@ pub struct Client {
|
||||
focus: Option<WidgetId<TextEdit>>,
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Hash)]
|
||||
#[derive(Eq, PartialEq, Hash, Clone)]
|
||||
struct Submit;
|
||||
|
||||
impl DefaultEvent for Submit {
|
||||
@@ -153,7 +153,7 @@ impl Client {
|
||||
add_text.clone(),
|
||||
Rect::new(Color::GREEN)
|
||||
.on(Sense::click(), move |client: &mut Client, _| {
|
||||
Ui::run_event(client, &add_text, Submit, ());
|
||||
client.run_event(&add_text, Submit, ());
|
||||
})
|
||||
.size(40),
|
||||
)
|
||||
@@ -221,8 +221,7 @@ impl Client {
|
||||
}
|
||||
if input_changed {
|
||||
let window_size = self.window_size();
|
||||
SensorModule::run(&mut self.ui, &cursor_state, window_size);
|
||||
SensorModule::run(self, &cursor_state, window_size);
|
||||
self.run_sensors(&cursor_state, window_size);
|
||||
}
|
||||
match event {
|
||||
WindowEvent::CloseRequested => event_loop.exit(),
|
||||
@@ -244,7 +243,7 @@ impl Client {
|
||||
self.focus = None;
|
||||
}
|
||||
TextInputResult::Submit => {
|
||||
Ui::run_event(self, &sel.clone(), Submit, ());
|
||||
self.run_event(&sel.clone(), Submit, ());
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user