Detect double-tap using count

This commit is contained in:
Joshua Fan
2020-12-06 07:52:50 -08:00
parent dd6ae80817
commit 70cc6d07b0

View File

@@ -406,8 +406,6 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
stack(
new Element(){
long tapMillis;
{
//add listener to the background rect, so it doesn't get unnecessary touch input
addListener(new ElementGestureListener(){
@@ -415,13 +413,12 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
public void tap(InputEvent event, float x, float y, int count, KeyCode button){
if(showing()) return;
if(selected == hovered && Time.timeSinceMillis(tapMillis) < 500){
if(selected == hovered && count == 2){
playSelected();
}
if(hovered != null && (canSelect(hovered) || debugSelect)){
selected = hovered;
tapMillis = Time.millis();
}
if(selected != null){