From 3b41ded04502acf1182b6d822faf342b72b8c8e5 Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 4 Jan 2019 12:18:26 -0500 Subject: [PATCH] More zoom fixes --- core/src/io/anuke/mindustry/input/MobileInput.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/io/anuke/mindustry/input/MobileInput.java b/core/src/io/anuke/mindustry/input/MobileInput.java index a1d95f6b46..4ac8d2f761 100644 --- a/core/src/io/anuke/mindustry/input/MobileInput.java +++ b/core/src/io/anuke/mindustry/input/MobileInput.java @@ -47,6 +47,7 @@ public class MobileInput extends InputHandler implements GestureListener{ //gesture data private Vector2 vector = new Vector2(); + private float lastDistance = -1f; private boolean canPan; /** Set of completed guides. */ private ObjectSet guides = new ObjectSet<>(); @@ -691,8 +692,11 @@ public class MobileInput extends InputHandler implements GestureListener{ @Override public boolean zoom(float initialDistance, float distance){ - float amount = (distance > initialDistance ? 0.1f : -0.1f); + if(lastDistance == -1) lastDistance = initialDistance; + + float amount = (distance > lastDistance ? 0.07f : -0.07f) * Time.delta(); renderer.scaleCamera(io.anuke.arc.scene.ui.layout.Unit.dp.scl(amount)); + lastDistance = distance; return true; }