code: @Override
      public boolean onTouchEvent(MotionEvent event) {
          mScaleDetector.onTouchEvent(event);
          boolean val = mGestureDetector.onTouchEvent(event);
  
          // Check after call of mGestureDetector, so mCurrentFlingDirection and mCurrentScrollDirection are set.
          if (event.getAction() == MotionEvent.ACTION_UP && !mIsZooming && mCurrentFlingDirection == Direction.NONE) {
              if (mCurrentScrollDirection == Direction.RIGHT || mCurrentScrollDirection == Direction.LEFT) {
                  goToNearestOrigin();
              }
              mCurrentScrollDirection = Direction.NONE;
          }
  
          return val;
      }
docs: ///////////////////////////////////////////////////////////////