def METHOD_NAME(self, view_size):
    if self.selection_valid():
        before_selection = view_size // 2
        self.view.start = max(0, self.selection - before_selection)
        self.view.end = self.view.start
        self.max_view_size = view_size
        self._expand_view()
    else:
        self.max_view_size = view_size
        self._reset_view()