decide it's better to leave them separate
This commit is contained in:
@@ -149,7 +149,6 @@ pub trait SensorCtx: UiCtx {
|
|||||||
impl<Ctx: UiCtx + 'static> SensorCtx for Ctx {
|
impl<Ctx: UiCtx + 'static> SensorCtx for Ctx {
|
||||||
fn run_sensors(&mut self, cursor: &CursorState, window_size: Vec2) {
|
fn run_sensors(&mut self, cursor: &CursorState, window_size: Vec2) {
|
||||||
SensorModule::<Ctx>::run(self, cursor, window_size);
|
SensorModule::<Ctx>::run(self, cursor, window_size);
|
||||||
SensorModule::<Ui>::run(self.ui(), cursor, window_size);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -172,17 +172,7 @@ impl<E: Event + 'static, Ctx: 'static> Default for DefaultEventModule<E, Ctx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Ui {
|
impl Ui {
|
||||||
pub fn run_event<E: Event + Clone, Ctx: UiCtx + 'static, W>(
|
pub fn run_event<E: Event, Ctx: UiCtx + 'static, W>(
|
||||||
ctx: &mut Ctx,
|
|
||||||
id: &WidgetId<W>,
|
|
||||||
event: E,
|
|
||||||
data: E::Data,
|
|
||||||
) {
|
|
||||||
Self::run_event_inner(ctx, id, event.clone(), data.clone());
|
|
||||||
Self::run_event_inner(ctx.ui(), id, event, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn run_event_inner<E: Event, Ctx: UiCtx + 'static, W>(
|
|
||||||
ctx: &mut Ctx,
|
ctx: &mut Ctx,
|
||||||
id: &WidgetId<W>,
|
id: &WidgetId<W>,
|
||||||
event: E,
|
event: E,
|
||||||
@@ -205,7 +195,6 @@ pub trait EventCtx: UiCtx {
|
|||||||
|
|
||||||
impl<Ctx: UiCtx + 'static> EventCtx for Ctx {
|
impl<Ctx: UiCtx + 'static> EventCtx for Ctx {
|
||||||
fn run_event<E: Event + Clone, W>(&mut self, id: &WidgetId<W>, event: E, data: E::Data) {
|
fn run_event<E: Event + Clone, W>(&mut self, id: &WidgetId<W>, event: E, data: E::Data) {
|
||||||
Ui::run_event_inner(self, id, event.clone(), data.clone());
|
Ui::run_event(self, id, event.clone(), data.clone());
|
||||||
Ui::run_event_inner(self.ui(), id, event, data);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -222,6 +222,7 @@ impl Client {
|
|||||||
if input_changed {
|
if input_changed {
|
||||||
let window_size = self.window_size();
|
let window_size = self.window_size();
|
||||||
self.run_sensors(&cursor_state, window_size);
|
self.run_sensors(&cursor_state, window_size);
|
||||||
|
self.ui.run_sensors(&cursor_state, window_size);
|
||||||
}
|
}
|
||||||
match event {
|
match event {
|
||||||
WindowEvent::CloseRequested => event_loop.exit(),
|
WindowEvent::CloseRequested => event_loop.exit(),
|
||||||
|
|||||||
Reference in New Issue
Block a user