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

Add something akin to an item_focused(index : int) signal for individual items in an ItemList node #10025

Open
abmarnie opened this issue Jun 24, 2024 · 4 comments

Comments

@abmarnie
Copy link

abmarnie commented Jun 24, 2024

Describe the project you are working on

A 2D sim game with quest log and inventory systems

Describe the problem or limitation you are having in your project

Using ItemList for quest logs and inventories doesn't allow for as nice polish as I'd like. I want to add sound effects when an item is focused over (but not selected) via mouse or gamepad controls.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

ItemList class would have it's own signal, which gets emitted when an item is "focused". "Focus" should work as you'd expect on both gamepad and mouse + keyboard.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

my_item_list.item_focused.connect(func(index : int) -> void: my_sound.play())

If this enhancement will not be used often, can it be worked around with a few lines of script?

To the best of my ability, no. The closest useful thing I could find that would help solve this issue is maybe doing crazy stuff with my_item_list.get_item_at_position(my_pos) inside a _process call, and it would be troublesome getting it to work with both mouse and gamepad. You could instantiate new Button under a vertical ScrollContainer, but then you lose out on the search functionality of ItemList.

Is there a reason why this should be core and not an add-on in the asset library?

This greatly improves the ItemList experience right out of the box. It is a nice node since it comes with searching.

@AThousandShips
Copy link
Member

As far as I can tell navigating with keyboard to an item selects it, the signal for activating it is separate, so this would probably break compatibility if the suggestion is to make it no longer send the item_selected signal when using keyboard

@abmarnie
Copy link
Author

Truthfully, I only tested with mouse. I guess what I really want is an item_hovered signal?

@AThousandShips
Copy link
Member

AThousandShips commented Jun 24, 2024

Probably yes, there's no current distinction between "focus" and "selected", there is one for hovering though, but hover is not the same as focus

@surreal6
Copy link

Hi. I am working in an accesible UI with text to speech and head selection (gaze pointer for XR interfaces) and found that there is no mouse_entered and mouse_exited signals for optionButton items. There is a item_focused, so i can implement text to speech when using key input, but i need a item_mouse_entered to detect gaze selection of each item, as it works by moving the mouse over the ui.

I already have boolean inputs. integer and float sliders, and buttons working with both focus and mouse, godot just lack of this signal to have a complete set of ui interactions.

So, +1 to add "item_hovered", or "item_mouse_entered" and "item_mouse_exited" signals, This would be a great feature to complete the ui set and to help build accesible interfaces

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

No branches or pull requests

3 participants