So I posted this a few months ago https://godotforums.org/discussion/27785/help-with-panel-node-type-and-input-issues/p1
and got no help, so I just got rid of the panel indicator idea and continued on without that feature.
However, I've rebuilt my (card/image) carousel to change a few features and I've run into the same problem again, but in a different way.
I'm experiencing intermittent misses of the left mouse button up, resulting in the carousel sticking to the 'dragging' state when it should be released.
Sometimes it sticks no matter what I do for several clicks, sometimes if I just click once it 'unsticks,' sometimes it sticks, unsticks after I click, and then I can't get ANY input to register for several tries(either clicks or click ups). It's really busting up the whole thing.
here is the logic for the input:
func _gui_input(event):
if event is InputEventMouseButton && event.button_index == BUTTON_LEFT:
if event.button_index == BUTTON_LEFT && event.pressed:
pressed = true
click_down_position = event.global_position
animation_state = "inactive"
carousel_inertia_initial = 0
elif event.button_index == BUTTON_LEFT && !event.pressed:
click_up_position = event.global_position
pressed = false
animation_end_position = stepify(carousel_position, card_zone) + stepify(carousel_inertia_initial*20.0*1.8939,card_zone)
animation_end_position = clamp(animation_end_position, 0, (last_card_in_carousel * card_zone))
animation_state = "released"
if event is InputEventMouseMotion:
if pressed == true:
animation_state = "dragging"
carousel_position += event.relative.x
carousel_position = clamp(carousel_position, 0, (last_card_in_carousel * card_zone))
_carousel_card_position_manager(carousel_position)
carousel_inertia_initial = event.relative.x
elif pressed == false:
pass
which includes the logic where the carousel position is clamped to the endpoints.
The purpose of that was to make it so when you are dragging the carousel beyond it's beginning or end limits, that the carousel stops moving.
There's also this little bit for adding inertia after the user drags the carousel and releases with sufficient momentum:
func _process(delta):
if animation_state == "released":
carousel_position = lerp(carousel_position, animation_end_position, 4.0*delta)
_carousel_card_position_manager(carousel_position)
if abs(animation_end_position - carousel_position) < 0.001:
animation_state = "inactive"
This input issue ONLY happens when the carousel is at either endpoint, when I am dragging past the end. It would seem to me then that this must be related to clamping values, but I tested console printouts and the input event just isn't registering through _input(event). Where is the input going to then? Is there another method of clamping that might solve this?
This is a really important component of the app I've been building for a while now, so please, any suggestions are welcome, I am desperate to solve this issue.