PanZoom implements View.OnTouchListener { protected RectF fingerDistance(float firstFingerX, float firstFingerY, float secondFingerX, float secondFingerY) { final float left = firstFingerX > secondFingerX ? secondFingerX : firstFingerX; final float right = firstFingerX > secondFingerX ? firstFingerX : secondFingerX; final float top = firstFingerY > secondFingerY ? secondFingerY : firstFingerY; final float bottom = firstFingerY > secondFingerY ? firstFingerY : secondFingerY; return new RectF(left, top, right, bottom); } protected  PanZoom(@NonNull XYPlot plot, Pan pan, Zoom zoom); protected  PanZoom(@NonNull XYPlot plot, Pan pan, Zoom zoom, ZoomLimit limit); State getState(); void setState(@NonNull State state); static PanZoom attach(@NonNull XYPlot plot); static PanZoom attach(@NonNull XYPlot plot, @NonNull Pan pan, @NonNull Zoom zoom); static PanZoom attach(@NonNull XYPlot plot, @NonNull Pan pan, @NonNull Zoom zoom, @NonNull ZoomLimit limit); boolean isEnabled(); void setEnabled(boolean enabled); @Override boolean onTouch(final View view, final MotionEvent event); Pan getPan(); void setPan(Pan pan); Zoom getZoom(); void setZoom(Zoom zoom); ZoomLimit getZoomLimit(); void setZoomLimit(ZoomLimit zoomLimit); View.OnTouchListener getDelegate(); void setDelegate(View.OnTouchListener delegate); void reset();  }
@Test public void testFingerDistance() { PanZoom panZoom = spy(new PanZoom(xyPlot, PanZoom.Pan.BOTH, PanZoom.Zoom.SCALE)); RectF distance = panZoom.fingerDistance(TestUtils.newPointerDownEvent(0, 0, 10, 10)); assertEquals(0f, distance.left); assertEquals(0f, distance.top); assertEquals(10f, distance.right); assertEquals(10f, distance.bottom); distance = panZoom.fingerDistance(10, 10, 0, 0); assertEquals(0f, distance.left); assertEquals(0f, distance.top); assertEquals(10f, distance.right); assertEquals(10f, distance.bottom); }