move mouse move-scroll exclusivity to hid module
This commit is contained in:
@@ -370,18 +370,13 @@ where
|
||||
);
|
||||
}
|
||||
|
||||
let scroll_threshold = 0.1;
|
||||
let mut haptics: Option<Haptics> = None;
|
||||
|
||||
// Pass mouse motion events only if not scrolling
|
||||
// (allows scrolling on all Chromium-based applications)
|
||||
if app.input_state.pointers[idx].now.scroll.abs() <= scroll_threshold {
|
||||
haptics = hovered.backend.on_hover(app, &hit);
|
||||
}
|
||||
let haptics = hovered.backend.on_hover(app, &hit);
|
||||
|
||||
pointer = &mut app.input_state.pointers[idx];
|
||||
|
||||
if pointer.now.scroll.abs() > scroll_threshold {
|
||||
if pointer.now.scroll.abs() > 0.1 {
|
||||
let scroll = pointer.now.scroll;
|
||||
if app.input_state.pointers[1 - idx]
|
||||
.interaction
|
||||
|
||||
@@ -242,7 +242,7 @@ impl HidProvider for UInputProvider {
|
||||
self.desktop_origin = origin;
|
||||
}
|
||||
fn mouse_move(&mut self, pos: Vec2) {
|
||||
if self.current_action.pos.is_none() {
|
||||
if self.current_action.pos.is_none() && self.current_action.scroll.is_none() {
|
||||
self.current_action.pos = Some(pos);
|
||||
}
|
||||
self.current_action.last_requested_pos = Some(pos);
|
||||
@@ -256,6 +256,9 @@ impl HidProvider for UInputProvider {
|
||||
fn wheel(&mut self, delta: i32) {
|
||||
if self.current_action.scroll.is_none() {
|
||||
self.current_action.scroll = Some(delta);
|
||||
// Pass mouse motion events only if not scrolling
|
||||
// (allows scrolling on all Chromium-based applications)
|
||||
self.current_action.pos = None;
|
||||
}
|
||||
}
|
||||
fn commit(&mut self) {
|
||||
|
||||
Reference in New Issue
Block a user