/** * Handles a {@link MotionEvent#ACTION_DOWN} event. * * @param x the x-coordinate of the down action * @param y the y-coordinate of the down action */ private void OnActionDown(float x, float y) { float left = EdgeManager.LEFT.coordinate; float top = EdgeManager.TOP.coordinate; float right = EdgeManager.RIGHT.coordinate; float bottom = EdgeManager.BOTTOM.coordinate; mPressedHandle = HandleUtil.getPressedHandle(x, y, left, top, right, bottom, mHandleRadius); if (mPressedHandle == null) { return; } // Calculate the offset of the touch point from the precise location // of the handle. Save these values in a member variable since we want // to maintain this offset as we drag the handle. mTouchOffset = HandleUtil.getOffset(mPressedHandle, x, y, left, top, right, bottom); Invalidate(); }