def getNewZoom(current, move, xmax, ymax, ymin=0):
    """
        Get new zoom location (x, and y ranges) by given current zoom, move vector and x,y maximum ranges
        :param current: current zoom location
        :param move: moving vector
        :param xmax: maximum x
        :param ymax: maximum y
        :param ymin: minimum y
        :return:
        """
    x1 = current[0][0] + move[0]
    x2 = current[0][1] + move[0]
    if x1 < 0:
        x1 = 0
        x2 = current[0][1] - current[0][0]
    if x2 >= xmax:
        x2 = xmax - 1
        x1 = x2 - (current[0][1] - current[0][0])
    y1 = current[1][0] + move[1]
    y2 = current[1][1] + move[1]
    if y1 < ymin:
        y1 = ymin
        y2 = y1 + (current[1][1] - current[1][0])
    if y2 > ymax:
        y2 = ymax
        y1 = y2 - (current[1][1] - current[1][0])
    return [(x1, x2), (y1, y2)]
