From f6f7505b9d5f4c562cb856dea388d08745be27a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Tue, 23 Jul 2019 10:53:19 +0200 Subject: [PATCH] Track `cursor_position` in `Runtime` --- src/runtime.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/runtime.rs b/src/runtime.rs index f8a5aaa3..1b9dcca9 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -1,4 +1,4 @@ -use crate::{Column, Element, Event, Layout, MouseCursor, Point}; +use crate::{input::mouse, Column, Element, Event, Layout, MouseCursor, Point}; use std::hash::Hasher; use stretch::result; @@ -30,6 +30,13 @@ impl Runtime { } pub fn on_event(&mut self, event: Event) { + match event { + Event::Mouse(mouse::Event::CursorMoved { x, y }) => { + self.cursor_position = Point::new(x, y); + } + _ => {} + } + self.events.push(event); }