window: fix build for examples post mouse coords changes

This commit is contained in:
Wez Furlong committed 2019-11-23 16:46:46 -08:00
1 parent bbe9c6e14b
commit 10a0006eaf
2 files changed
+7 -7

No files matched your search

+3 -3
View File
@@ -4,7 +4,7 @@ use std::any::Any;
struct MyWindow {
allow_close: bool,
cursor_pos: (u16, u16),
cursor_pos: Point,
}
impl Drop for MyWindow {
@@ -45,7 +45,7 @@ impl WindowCallbacks for MyWindow {
}
fn mouse_event(&mut self, event: &MouseEvent, ctx: &dyn WindowOps) {
self.cursor_pos = (event.x, event.y);
self.cursor_pos = event.coords;
ctx.invalidate();
ctx.set_cursor(Some(MouseCursor::Arrow));
@@ -67,7 +67,7 @@ async fn spawn_window() -> Result<(), Box<dyn std::error::Error>> {
600,
Box::new(MyWindow {
allow_close: false,
cursor_pos: (100, 200),
cursor_pos: Point::new(100, 200),
}),
)?;
+4 -4
View File
@@ -4,7 +4,7 @@ use std::any::Any;
struct MyWindow {
allow_close: bool,
cursor_pos: (u16, u16),
cursor_pos: Point,
}
impl Drop for MyWindow {
@@ -51,7 +51,7 @@ impl WindowCallbacks for MyWindow {
context.draw_line(
Point::new(0, 0),
Point::new(self.cursor_pos.0 as isize, self.cursor_pos.1 as isize),
self.cursor_pos,
Color::rgb(0xff, 0xff, 0x80),
Operator::Over,
);
@@ -69,7 +69,7 @@ impl WindowCallbacks for MyWindow {
fn mouse_event(&mut self, event: &MouseEvent, ctx: &dyn WindowOps) {
eprintln!("{:?}", event);
self.cursor_pos = (event.x, event.y);
self.cursor_pos = event.coords;
ctx.invalidate();
ctx.set_cursor(Some(MouseCursor::Arrow));
@@ -91,7 +91,7 @@ fn spawn_window() -> Fallible<()> {
600,
Box::new(MyWindow {
allow_close: false,
cursor_pos: (100, 200),
cursor_pos: Point::new(100, 200),
}),
)?;