From 58c1718d01e438aab503837d12d110954edc9696 Mon Sep 17 00:00:00 2001 From: Joshua Fan Date: Sat, 5 Dec 2020 22:07:09 -0800 Subject: [PATCH] Detect double-tap --- core/assets/contributors | 1 + core/src/mindustry/ui/dialogs/PlanetDialog.java | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/core/assets/contributors b/core/assets/contributors index ae608ab089..61b6bc135b 100644 --- a/core/assets/contributors +++ b/core/assets/contributors @@ -84,6 +84,7 @@ amrsoll ねらひかだ Draco Quezler +killall -q Alicila Daniel Dusek DeltaNedas diff --git a/core/src/mindustry/ui/dialogs/PlanetDialog.java b/core/src/mindustry/ui/dialogs/PlanetDialog.java index 84fd58cc51..2e84352f57 100644 --- a/core/src/mindustry/ui/dialogs/PlanetDialog.java +++ b/core/src/mindustry/ui/dialogs/PlanetDialog.java @@ -405,6 +405,8 @@ 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(){ @@ -412,12 +414,13 @@ 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){ + if(selected == hovered && Time.timeSinceMillis(tapMillis) < 500){ playSelected(); } if(hovered != null && (canSelect(hovered) || debugSelect)){ selected = hovered; + tapMillis = Time.millis(); } if(selected != null){