actually sane sensor handling
This commit is contained in:
@@ -84,17 +84,18 @@ impl Client {
|
||||
let main = main.clone();
|
||||
let to = to.clone().erase_type();
|
||||
Rect::new(color)
|
||||
.sense(Sense::Press, move |ui, _| {
|
||||
.id_on(Sense::PressStart, move |id, ui, _| {
|
||||
ui[&main].inner = to.clone();
|
||||
ui[id].color = color.add_rgb(-0.2);
|
||||
})
|
||||
.sense_and_edit(Sense::Hover, move |r, _| {
|
||||
.edit_on(Sense::HoverStart, move |r, _| {
|
||||
r.color = color.add_rgb(0.1);
|
||||
})
|
||||
.sense_and_edit(Sense::NoHover, move |r, _| {
|
||||
r.color = color;
|
||||
.edit_on(Sense::PressEnd, move |r, _| {
|
||||
r.color = color.add_rgb(0.1);
|
||||
})
|
||||
.sense_and_edit(Sense::Held, move |r, _| {
|
||||
r.color = color.add_rgb(-0.1);
|
||||
.edit_on(Sense::HoverEnd, move |r, _| {
|
||||
r.color = color;
|
||||
})
|
||||
}
|
||||
|
||||
@@ -135,7 +136,9 @@ impl Client {
|
||||
|
||||
pub fn event(&mut self, event: WindowEvent, event_loop: &ActiveEventLoop, ui: &mut Ui<Self>) {
|
||||
self.input.event(&event);
|
||||
ui.run_sensors(self);
|
||||
let cursor_state = self.cursor_state();
|
||||
let window_size = self.window_size();
|
||||
ui.run_sensors(self, &cursor_state, window_size);
|
||||
match event {
|
||||
WindowEvent::CloseRequested => event_loop.exit(),
|
||||
WindowEvent::RedrawRequested => {
|
||||
|
||||
Reference in New Issue
Block a user