fix: scroll
This commit is contained in:
@@ -21,7 +21,8 @@ use xkbcommon::xkb::{Context, Keymap, FORMAT_TEXT_V1};
|
||||
struct MouseEvent {
|
||||
select: f32,
|
||||
grab: f32,
|
||||
scroll: Vec2,
|
||||
scroll_continuous: Vec2,
|
||||
scroll_discrete: Vec2,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
@@ -103,7 +104,8 @@ impl MousePointer {
|
||||
} else {
|
||||
0.0f32
|
||||
};
|
||||
self.mouse_datamap.scroll = vec2(0.0, mouse.scroll_change / 120.0);
|
||||
self.mouse_datamap.scroll_continuous = vec2(0.0, mouse.scroll_change / 120.0);
|
||||
self.mouse_datamap.scroll_discrete = vec2(0.0, mouse.scroll_change / 120.0);
|
||||
*self.pointer.datamap.lock() = self.mouse_datamap.to_datamap().ok();
|
||||
}
|
||||
self.send_keyboard_input(sk);
|
||||
|
||||
@@ -210,12 +210,12 @@ impl SurfaceInfo {
|
||||
) => {
|
||||
if let Some(axis_continuous) = axis_continuous {
|
||||
pointer.axis(0, Axis::HorizontalScroll, axis_continuous.x as f64);
|
||||
pointer.axis(0, Axis::VerticalScroll, axis_continuous.y as f64);
|
||||
pointer.axis(0, Axis::VerticalScroll, -axis_continuous.y as f64);
|
||||
}
|
||||
if pointer.version() >= wl_pointer::EVT_AXIS_DISCRETE_SINCE {
|
||||
if let Some(axis_discrete) = axis_discrete {
|
||||
pointer.axis_discrete(Axis::HorizontalScroll, axis_discrete.x as i32);
|
||||
pointer.axis_discrete(Axis::VerticalScroll, axis_discrete.y as i32);
|
||||
pointer.axis_discrete(Axis::VerticalScroll, -axis_discrete.y as i32);
|
||||
}
|
||||
}
|
||||
if pointer.version() >= wl_pointer::EVT_AXIS_STOP_SINCE
|
||||
|
||||
Reference in New Issue
Block a user