code: State toggleMinMaxZoom(State state, float pivotX, float pivotY) {
          zoomBounds.set(state);
          final float minZoom = zoomBounds.getFitZoom();
          final float maxZoom = settings.getDoubleTapZoom() > 0f
                  ? settings.getDoubleTapZoom() : zoomBounds.getMaxZoom();
  
          final float middleZoom = 0.5f * (minZoom + maxZoom);
          final float targetZoom = state.getZoom() < middleZoom ? maxZoom : minZoom;
  
          final State end = state.copy();
          end.zoomTo(targetZoom, pivotX, pivotY);
          return end;
      }
docs: Maximizes zoom if it closer to min zoom or minimizes it if it closer to max zoom.
  
  @param state Current state
  @param pivotX Pivot's X coordinate
  @param pivotY Pivot's Y coordinate
  @return End state for toggle animation.