Introduce mouse_interaction method to Widget trait
This commit is contained in:
parent
7a876c8b29
commit
be97a5d502
10 changed files with 152 additions and 21 deletions
|
|
@ -5,6 +5,7 @@ pub use state::State;
|
|||
|
||||
use crate::clipboard::{self, Clipboard};
|
||||
use crate::conversion;
|
||||
use crate::mouse;
|
||||
use crate::{
|
||||
Color, Command, Debug, Error, Executor, Mode, Proxy, Runtime, Settings,
|
||||
Size, Subscription,
|
||||
|
|
@ -252,9 +253,7 @@ async fn run_instance<A, E, C>(
|
|||
&mut debug,
|
||||
));
|
||||
|
||||
// TODO
|
||||
// let mut mouse_interaction = mouse::Interaction::default();
|
||||
|
||||
let mut mouse_interaction = mouse::Interaction::default();
|
||||
let mut events = Vec::new();
|
||||
let mut messages = Vec::new();
|
||||
|
||||
|
|
@ -317,9 +316,18 @@ async fn run_instance<A, E, C>(
|
|||
}
|
||||
|
||||
debug.draw_started();
|
||||
user_interface.draw(&mut renderer, state.cursor_position());
|
||||
let new_mouse_interaction =
|
||||
user_interface.draw(&mut renderer, state.cursor_position());
|
||||
debug.draw_finished();
|
||||
|
||||
if new_mouse_interaction != mouse_interaction {
|
||||
window.set_cursor_icon(conversion::mouse_interaction(
|
||||
new_mouse_interaction,
|
||||
));
|
||||
|
||||
mouse_interaction = new_mouse_interaction;
|
||||
}
|
||||
|
||||
window.request_redraw();
|
||||
}
|
||||
event::Event::PlatformSpecific(event::PlatformSpecific::MacOS(
|
||||
|
|
@ -356,7 +364,16 @@ async fn run_instance<A, E, C>(
|
|||
debug.layout_finished();
|
||||
|
||||
debug.draw_started();
|
||||
user_interface.draw(&mut renderer, state.cursor_position());
|
||||
let new_mouse_interaction = user_interface
|
||||
.draw(&mut renderer, state.cursor_position());
|
||||
|
||||
if new_mouse_interaction != mouse_interaction {
|
||||
window.set_cursor_icon(conversion::mouse_interaction(
|
||||
new_mouse_interaction,
|
||||
));
|
||||
|
||||
mouse_interaction = new_mouse_interaction;
|
||||
}
|
||||
debug.draw_finished();
|
||||
|
||||
compositor.configure_surface(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue