0 votes

Hello, I am trying to make a draggable section of my app and am using this code

extends Control


var following = false
var start_pos = Vector2()


func _on_Titlebar_gui_input(event):
    if event is InputEventMouseButton:
        if event.get_button_index() == 1:
            following = !following
            start_pos = get_local_mouse_position()

    if following:
        OS.set_window_position(OS.window_position+get_local_mouse_position()-start_pos)

and when I run it, I have to double click the window section and then it crashes with Stack overflow 1024. If anyone could explain this, it would be greatly appreciated. Thanks!

Godot version 3.3.4
in Engine by (37 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.