Skip to content

Commit

Permalink
mouse interactions in buffer seem more precise
Browse files Browse the repository at this point in the history
  • Loading branch information
Kl4rry committed Dec 4, 2024
1 parent accb7fa commit ea0c12b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/ferrite-gui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,15 +396,15 @@ impl GuiApp {
self.mouse_position = position;

if self.primary_mouse_button_pressed {
let column = (self.mouse_position.x / backend.cell_width as f64) as u16;
let column = (self.mouse_position.x / backend.cell_width as f64).round() as u16;
let line = (self.mouse_position.y / backend.cell_height as f64) as u16;
self.handle_drag(column, line);
}
}
WindowEvent::MouseInput { state, button, .. } => {
let backend = self.tui_app.terminal.backend();

let column = (self.mouse_position.x / backend.cell_width as f64) as u16;
let column = (self.mouse_position.x / backend.cell_width as f64).round() as u16;
let line = (self.mouse_position.y / backend.cell_height as f64) as u16;
self.handle_click(column, line, state, button);
}
Expand Down

0 comments on commit ea0c12b

Please sign in to comment.