Hello,
I'm making a simple Android app using Control Nodes and I'm having a rough time with ScrollContainers. I actually have 2 ScrollContainers in my project, with this script attached to them:
extends ScrollContainer
export(float) var ratio = 1
func _input(event):
if !self.get_rect().has_point(get_local_mouse_position()) or !get_parent().visible:
return
elif event is InputEventScreenDrag:
print(event.relative.y)
if scroll_horizontal_enabled:
self.scroll_horizontal -= event.relative.x * ratio
if scroll_vertical_enabled:
self.scroll_vertical -= event.relative.y * ratio
This script allows a simple scrolling by screen dragging. It works well on a horizontal ScrollContainer, however the things get a little bit weird with vertical ones:
Scrolling toward the top of the container (= sliding the finger from top to bottom, just to be clear) works as intended.
Scroll toward the bottom of the container (= sliding the finger from bottom to top) is glitchy: sometimes the ScrollContainer will jump to the top or the bottom and have random positions overall.
I've checked if the event was the cause of all of this. event.relative.y
returns completely normal values. Neither self.scroll_vertical
nor ratio
are updated by a different script.
I need to precise that this problem only occurs when running the app on a mobile device. Running it on PC with touch emulated from mouse causes no problems at all.
Sorry if I was not really clear, thank you in advance for your help.