-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Synchronize mouse button events coordinates with the cursor #267
Comments
I am going to validate this, if it is different, yes then it should be synced. |
43 tasks
@TimonPost did you have a chance to validate this issue on Windows as well? Before touching it, I'd like to be sure that this isn't just some macOS/UNIX quirk or even just my computer only. |
All three types with coordinates are producing numbers starting at 1. My test code: use crossterm_input::{InputEvent, KeyEvent, MouseEvent, RawScreen, Result, TerminalInput};
fn main() -> Result<()> {
let input = TerminalInput::new();
let _raw = RawScreen::into_raw_mode()?;
let mut reader = input.read_sync();
input.enable_mouse_mode()?;
loop {
if let Some(event) = reader.next() {
match event {
InputEvent::Keyboard(KeyEvent::Esc) => break,
InputEvent::Keyboard(KeyEvent::Enter) => println!("Enter"),
InputEvent::Mouse(mouse) => {
match mouse {
MouseEvent::Press(_, x, y) => println!("Press: {}x{}", x, y),
MouseEvent::Hold(x, y) => println!("Move: {}x{}", x, y),
MouseEvent::Release(x, y) => println!("Release: {}x{}", x, y),
_ => {}
};
}
_ => {}
};
}
}
input.disable_mouse_mode()?;
Ok(())
} |
Thanks, will PR it later today ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I find it a bit weird that the cursor does use
0, 0
for the first column/row, but the mouse events do use1, 1
for the first column/row. I'd assume that everything starts from0, 0
.Not much investigation done on my side, I just noticed this when working on the documentation/examples.
The text was updated successfully, but these errors were encountered: