More zoom fixes

This commit is contained in:
Anuken 2019-01-04 12:18:26 -05:00
parent f61f3af687
commit 3b41ded045

View File

@ -47,6 +47,7 @@ public class MobileInput extends InputHandler implements GestureListener{
//gesture data //gesture data
private Vector2 vector = new Vector2(); private Vector2 vector = new Vector2();
private float lastDistance = -1f;
private boolean canPan; private boolean canPan;
/** Set of completed guides. */ /** Set of completed guides. */
private ObjectSet<String> guides = new ObjectSet<>(); private ObjectSet<String> guides = new ObjectSet<>();
@ -691,8 +692,11 @@ public class MobileInput extends InputHandler implements GestureListener{
@Override @Override
public boolean zoom(float initialDistance, float distance){ 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)); renderer.scaleCamera(io.anuke.arc.scene.ui.layout.Unit.dp.scl(amount));
lastDistance = distance;
return true; return true;
} }