Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make text cursor always appear on click (#5420)
<!-- Please read the "Making a PR" section of [`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md) before opening a Pull Request! * Keep your PR:s small and focused. * The PR title is what ends up in the changelog, so make it descriptive! * If applicable, add a screenshot or gif. * If it is a non-trivial addition, consider adding a demo for it to `egui_demo_lib`, or a new example. * Do NOT open PR:s from your `master` branch, as that makes it hard for maintainers to test and add commits to your PR. * Remember to run `cargo fmt` and `cargo clippy`. * Open the PR as a draft until you have self-reviewed it and run `./scripts/check.sh`. * When you have addressed a PR comment, mark it as resolved. Please be patient! I will review your PR, but my time is limited! --> * [x] I have followed the instructions in the PR template ### Problem When clicking on a TextEdit sometimes the cursor doesn't appear immediately which makes it feel like the click was not registered for a second. This is because the start time for the blinking animation is only reset on keyboard input, but not on mouse interaction. It's hard to tell on the video but the cursor doesn't show immediately after clicking if the blink timer happens to be off. https://github.com/user-attachments/assets/9f049bd0-0375-4291-b2ef-697777fb854d ### Solution Reset the click timer every time a `TextEdit` is clicked. Additionally, the cursor is now correctly painted on the pixel boundary. IMO we should default to 1px cursor (instead of 2px) but that's not included in this PR. Happy to make that change too. https://github.com/user-attachments/assets/6c489414-f2c4-4dc6-85dd-f8bc457edad0
- Loading branch information