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

Expose a way to get the topmost Control node under the mouse #84909

Closed
wants to merge 1 commit into from

Conversation

cdoise-vbg
Copy link

I've exposed a way to get Viewport::gui.mouse_over and call Viewport::gui_find_control to GDScript to facilitate being able to implement the following features:

  • Gamepad control of mouse where speed of mouse should slow down when the cursor is over certain types of controls
  • Allowing for a generic service that can provide contextual help based on the Control under the mouse cursor

From GDScript, the following can now be done to get the control under the mouse cursor (or possibly at another location):

var mouse_over_control = get_viewport().gui_get_mouse_over()
var found_control = get_viewport().gui_find_control(get_global_mouse_position())

@cdoise-vbg cdoise-vbg requested a review from a team as a code owner November 14, 2023 20:20
@kleonc
Copy link
Member

kleonc commented Nov 15, 2023

You'd also need to add documentation for these methods (in Viewport.xml, you can run with --doctool option to regenerate docs taking new bindings into account).

@kleonc kleonc added this to the 4.x milestone Nov 15, 2023
@cdoise-vbg
Copy link
Author

Thanks, I'll go back and do that.

@cdoise-vbg cdoise-vbg requested review from a team as code owners November 15, 2023 05:39
@cdoise-vbg
Copy link
Author

I seem to have messed up the set of files changed here when I tried to rebase and push the updated Viewport,xml file. The only files I changed and committed were viewport.h, viewport.cpp, and Viewport.xml. I seem to have somehow pulled in some other changes into my branch when I did the rebase and amended commit, and I'm not really sure how to unwind that. Can I just recreate my set of changes on a new, clean pull request and then close this one with a comment pointing to the new one?

@AThousandShips
Copy link
Member

You've indeed included several fixes, to fix this use git rebase -i master and remove the unwanted commits by following the instructions in the rebase

@kleonc
Copy link
Member

kleonc commented Nov 15, 2023

I seem to have messed up the set of files changed here when I tried to rebase and push the updated Viewport,xml file. The only files I changed and committed were viewport.h, viewport.cpp, and Viewport.xml. I seem to have somehow pulled in some other changes into my branch when I did the rebase and amended commit, and I'm not really sure how to unwind that. Can I just recreate my set of changes on a new, clean pull request and then close this one with a comment pointing to the new one?

No need to open a new PR, you can fix it in here. See the docs for how to rebase (I suggest reading the whole page if you haven't already). Note that a single commit is preferred per PR anyway. Looking at the current commits you'd just need to drop these 8 unneeded commits when rebasing.

@YuriSizov YuriSizov changed the title GDScript access to Control under mouse cursor or at specific point Expose a way to get the topmost Control node under the mouse Nov 15, 2023
@AThousandShips
Copy link
Member

You've erased existing changes, please remove unrelated reverting commits

@cdoise-vbg
Copy link
Author

Sorry, I obviously need to go back and learn how to do git rebases properly. I believe I have my local branch fixed up properly now and will attempt to push that back up. If this doesn't do it right, I believe we should probably close this current pull request until I go back and learn to use git properly.

… mouse cursor or at a specific point by adding binding for gui_find_control and adding a new method for gui_get_mouse_over.
@cdoise-vbg
Copy link
Author

Alright, I think everything is in order now. It's now showing up as a single commit with only my changes, and I ran --doctool and updated the documentation entries in Viewport.xml.

@cdoise-vbg
Copy link
Author

It looks like another change has now been merged in that exposes a method to get the mouse_over control. That was the main purpose of this pull request, so I'm going to withdraw this pull request and reconsider submitting the remaining changes to get a control at specific coordinates.

@cdoise-vbg cdoise-vbg closed this Dec 19, 2023
@AThousandShips AThousandShips removed this from the 4.x milestone Dec 19, 2023
@YuriSizov
Copy link
Contributor

Ah, sorry about that. Indeed, your PR was accidentally superseded by #85966. Thanks for your contribution nevertheless!

@cdoise-vbg
Copy link
Author

cdoise-vbg commented Dec 20, 2023 via email

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

Successfully merging this pull request may close these issues.

4 participants