0 votes

Hello,

how can I handle click and doubleclick on the same node different?

extends Area2D

func _on_MouseClick_input_event(viewport, event, shape_idx):
    if event is InputEventMouseButton and event.doubleclick:
        print("double")
    elif event is InputEventMouseButton and event.pressed:
        print("single")

Each time I do one doubleclick on the node the output in the log is:

single 
double
asked Jul 19 in Projects by mrkaio (23 points)

1 Answer

+1 vote
Best answer

This is right. Take selecting folders as an example, the first click selects it and if the second click is within the time limit for a double click it opens, thus the log would print single, double and clicking too slowly will print single, single.

answered Jul 20 by Magso (1,041 points)
selected Aug 6 by mrkaio
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 How to use this Q&A? before posting your first questions.