@Override protected void onDrag(Touch t) { camera.target = null; if (pinching) { float curSpan = PointF.distance(touch.current, another.current); camera.zoom( GameMath.gate(PixelScene.minZoom, startZoom * curSpan / startSpan, PixelScene.maxZoom)); } else { if (!dragging && PointF.distance(t.current, t.start) > dragThreshold) { dragging = true; lastPos.set(t.current); } else if (dragging) { camera.scroll.offset(PointF.diff(lastPos, t.current).invScale(camera.zoom)); lastPos.set(t.current); } } }