From 72aefd4730b3e3e817d3eb63e83b03ee810533cf Mon Sep 17 00:00:00 2001 From: Keith Simmons Date: Thu, 16 Jan 2020 15:10:55 -0800 Subject: [PATCH] fix mouse location --- src/ui_commands.rs | 6 +++--- src/window.rs | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ui_commands.rs b/src/ui_commands.rs index 9646a3b..f5d6a9a 100644 --- a/src/ui_commands.rs +++ b/src/ui_commands.rs @@ -22,13 +22,13 @@ impl UiCommand { .expect("Input failed"); }, UiCommand::MouseButton { action, position: (grid_x, grid_y) } => - nvim.input_mouse("left", action, "", 0, *grid_y, *grid_x).await + nvim.input_mouse("left", action, "", 0, *grid_x, *grid_y).await .expect("Mouse Input Failed"), UiCommand::Scroll { direction, position: (grid_x, grid_y) } => - nvim.input_mouse("wheel", direction, "", 0, *grid_y, *grid_x).await + nvim.input_mouse("wheel", direction, "", 0, *grid_x, *grid_y).await .expect("Mouse Scroll Failed"), UiCommand::Drag(grid_x, grid_y) => - nvim.input_mouse("left", "drag", "", 0, *grid_y, *grid_x).await + nvim.input_mouse("left", "drag", "", 0, *grid_x, *grid_y).await .expect("Mouse Drag Failed") } } diff --git a/src/window.rs b/src/window.rs index 09c4237..6da9bbf 100644 --- a/src/window.rs +++ b/src/window.rs @@ -117,11 +117,11 @@ pub fn ui_loop(editor: Arc>, mut command_channel: Sender { - let grid_x = (position.x as f32 / renderer.font_width) as i64; - let grid_y = (position.y as f32 / renderer.font_height) as i64; + let grid_y = (position.x as f32 / renderer.font_width) as i64; + let grid_x = (position.y as f32 / renderer.font_height) as i64; mouse_pos = (grid_x, grid_y); if mouse_down { - command_channel.send(UiCommand::Drag(grid_y, grid_x)); + command_channel.send(UiCommand::Drag(grid_x, grid_y)); } } @@ -162,7 +162,7 @@ pub fn ui_loop(editor: Arc>, mut command_channel: Sender>, mut command_channel: Sender