def METHOD_NAME(self, touch):
    if touch.grab_current != self:
        return
    p = self.page
    border = self.border
    half_border = border / 2.
    page = self.children[-p - 1]
    if touch.ud['page'] == 'previous':
        # move next page up to right edge
        if p < len(self.children) - 1:
            self.children[-p - 2].x = min(
                self.right - self.border * (1 - (touch.sx - touch.osx)),
                self.right)
        # move current page until edge hits the right border
        if p >= 1:
            b_right = half_border if p > 1 else border
            b_left = half_border if p < len(self.children) - 1 else border
            self.children[-p - 1].x = max(min(
                self.x + b_left + (touch.x - touch.ox),
                self.right - b_right),
                self.x + b_left)
        # move previous page left edge up to left border
        if p > 1:
            self.children[-p].x = min(
                self.x + half_border * (touch.sx - touch.osx),
                self.x + half_border)
    elif touch.ud['page'] == 'next':
        # move current page up to left edge
        if p >= 1:
            self.children[-p - 1].x = max(
                self.x + half_border * (1 - (touch.osx - touch.sx)),
                self.x)
        # move next page until its edge hit the left border
        if p < len(self.children) - 1:
            b_right = half_border if p >= 1 else border
            b_left = half_border if p < len(self.children) - 2 else border
            self.children[-p - 2].x = min(max(
                self.right - b_right + (touch.x - touch.ox),
                self.x + b_left),
                self.right - b_right)
        # move second next page up to right border
        if p < len(self.children) - 2:
            self.children[-p - 3].x = max(
                self.right + half_border * (touch.sx - touch.osx),
                self.right - half_border)
    return page.METHOD_NAME(touch)