finetune presets selection for long lists #18103
Open
+26
−12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Tries to address the issue mentioned here #17987 (comment) (@todd-prior) and also fixes #18080 which, if I understand correctly, is the same issue.
If you click-and-hold the mouse button on the presets button, you can move the mouse to your desired preset which then gets selected immediately upon releasing the mouse button. This creates a problem if the preset list is so long that it doesn't fit above or below the preset button; it will then be placed on top of the button and some preset will be under the mouse when you release it, even if you intended it to be a "normal" (quick, non-hold) click that should have just opened the list and not selected anything.
This PR first checks if the mouse has been moved, before acting when the mouse-button is released.
It also fixes a (totally) unrelated bug that would disable the "long right-click on preset copies the lua code to activate the preset to the clipboard" functionality for modules that cannot have multiple instances (and where therefore a short right-click does not create a new instance).
I cannot reproduce #18064 but maybe someone can check if this PR changes anything for that issue?