Drag vs Click detection

Hi
I want to be able to drag an object and drop it, but also to click on the object to change the angle.
I have the drag working fine, but how do I differentiate between drag and move, and just a click?
thanks

Define a distance and/or time threshold with pointerdown/pointerup to differentiate between a drag and a click.

Yes, thank you. I don’t know how to do that.

getDistance, getDuration.

Drag has built-in distance and time thresholds you can use:

    var image = this.add.sprite(200, 300, 'eye').setInteractive();

    this.input.setDraggable(image);

    //  The pointer has to move 16 pixels before it's considered as a drag
    this.input.dragDistanceThreshold = 16;
1 Like