Merge pull request #397 from Demonthos/tui_fix_mousemove
only trigger onmousemove if the position has changed (tui)
This commit is contained in:
1 file changed
+8
-4
@@ -232,16 +232,19 @@ impl InnerInputState {
|
||||
let old_pos = previous_mouse
|
||||
.as_ref()
|
||||
.map(|m| (m.0.screen_x, m.0.screen_y));
|
||||
let clicked =
|
||||
(!mouse.0.buttons & previous_mouse.as_ref().map(|m| m.0.buttons).unwrap_or(0)) > 0;
|
||||
// the a mouse button is pressed if a button was not down and is now down
|
||||
let pressed =
|
||||
(mouse.0.buttons & !previous_mouse.as_ref().map(|m| m.0.buttons).unwrap_or(0)) > 0;
|
||||
// the a mouse button is pressed if a button was down and is now not down
|
||||
let released =
|
||||
(mouse.0.buttons & !previous_mouse.map(|m| m.0.buttons).unwrap_or(0)) > 0;
|
||||
(!mouse.0.buttons & previous_mouse.map(|m| m.0.buttons).unwrap_or(0)) > 0;
|
||||
let wheel_delta = self.wheel.as_ref().map_or(0.0, |w| w.delta_y);
|
||||
let mouse_data = &mouse.0;
|
||||
let wheel_data = &self.wheel;
|
||||
|
||||
{
|
||||
// mousemove
|
||||
if old_pos != Some(new_pos) {
|
||||
let mut will_bubble = FxHashSet::default();
|
||||
for node in dom.get_listening_sorted("mousemove") {
|
||||
let node_layout = layout.layout(node.state.layout.node.unwrap()).unwrap();
|
||||
@@ -262,6 +265,7 @@ impl InnerInputState {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// mouseenter
|
||||
@@ -309,8 +313,8 @@ impl InnerInputState {
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// mousedown
|
||||
if pressed {
|
||||
let mut will_bubble = FxHashSet::default();
|
||||
for node in dom.get_listening_sorted("mousedown") {
|
||||
let node_layout = layout.layout(node.state.layout.node.unwrap()).unwrap();
|
||||
|
||||
Reference in new issue
Block a user