'Callback for mouse button press in pan/zoom mode.'

def press_pan(self, event):

    if (event.button == 1):
        self._button_pressed = 1
    elif (event.button == 3):
        self._button_pressed = 3
    else:
        self._button_pressed = None
        return
    (x, y) = (event.x, event.y)
    if self._views.empty():
        self.push_current()
    self._xypress = []
    for (i, a) in enumerate(self.canvas.figure.get_axes()):
        if ((x is not None) and (y is not None) and a.in_axes(event) and a.get_navigate() and a.can_pan()):
            a.start_pan(x, y, event.button)
            self._xypress.append((a, i))
            self.canvas.mpl_disconnect(self._idDrag)
            self._idDrag = self.canvas.mpl_connect(u'motion_notify_event', self.drag_pan)
    self.press(event)
