Skip to content
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

Mouse: Add support for tracking multiple clicks more than just double #3229

Closed
wants to merge 1 commit into from

Conversation

kudaba
Copy link
Contributor

@kudaba kudaba commented May 14, 2020

A question came up on the Discord about supporting triple click line select in text boxes. This change is the first step in that direction, giving imgui the ability to detect multiple clicks in a row.

I have a follow up change that affects the text editing functionality. I'm trying to recruit some people to check how it feels on Mac/Linux unless you want to just add it to this PR.

kudaba@6ab9896

One issues I didn't address here is that by tracking with a char it will wrap after 127 consecutive clicks, but won't register as a new click until a full 256.

@ocornut ocornut added the inputs label May 15, 2020
@ocornut
Copy link
Owner

ocornut commented May 15, 2020

Thanks! This looks useful and will investigate/review it.
(Follow up change can wait and make it into a separate PR. Also note #2244)

@ocornut
Copy link
Owner

ocornut commented Jun 22, 2021

I'll work on merging this soon.
I noticed you changed the comments in imgui.h to e.g. a double-click returns false in IsMouseClicked(). whereas it actually does return true in those cases. (whereas we want to alter this behavior is a tricky question, maybe better not)

One of my aim is to also provide the data to easily detect double-click (or triple-click etc.) on the mouse-release event (rather than just down). I'm likely going to rework the user facing API but using this PR as a base.

@ocornut
Copy link
Owner

ocornut commented Oct 25, 2021

Now merged 2318c76 + 9c78fc9
Thank you!

@ocornut ocornut closed this Oct 25, 2021
actondev pushed a commit to actondev/imgui that referenced this pull request Nov 26, 2021
ocornut added a commit that referenced this pull request Dec 3, 2021
…(during 1.86 WIP), replaced with GetMouseClickedCount(). (#3229)
@ocornut
Copy link
Owner

ocornut commented Dec 3, 2021

@kudaba I have decided to rework this API (technically now breaking API but this was never in a tagged release)
78c6435

Removed
bool IsMouseTripleClicked(ImGuiMouseButton button)

Added
int GetMouseClickedCount(ImGuiMouseButton button)

Feels less arbitrary and exposing the real, general purpose data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants