def METHOD_NAME(self, event):
    """ Handles the mouse being moved when the tool is in the 'panning'
    state.
    """
    if self._auto_constrain and self.constrain_direction is None:
        # Determine the constraint direction
        if (abs(event.x - self._original_xy[0])
                > abs(event.y - self._original_xy[1])):
            self.constrain_direction = "x"
        else:
            self.constrain_direction = "y"
    new_position = self.component.view_position[:]
    for direction, ndx in [("x", 0), ("y", 1)]:
        if self.constrain and self.constrain_direction != direction:
            continue
        origpos = self._original_xy[ndx]
        eventpos = getattr(event, direction)
        delta = self.speed * (eventpos - origpos)
        if self.component.enable_zoom:
            delta /= self.component.zoom
        new_position[ndx] -= delta
    if self.constrain:
        _dir = self.constrain_direction
        self.component.view_position[_dir] = new_position[_dir]
    else:
        self.component.view_position = new_position
    event.handled = True
    self._original_xy = (event.x, event.y)
    self.component.request_redraw()