def drag_pan(self, button, key, x, y):
def format_deltas(key, dx, dy):<EOL><INDENT>if key=='<STR_LIT>':<EOL><INDENT>if(abs(dx)>abs(dy)):<EOL><INDENT>dy = dx<EOL><DEDENT>else:<EOL><INDENT>dx = dy<EOL><DEDENT><DEDENT>elif key=='<STR_LIT:x>':<EOL><INDENT>dy = <NUM_LIT:0><EOL><DEDENT>elif key=='<STR_LIT:y>':<EOL><INDENT>dx = <NUM_LIT:0><EOL><DEDENT>elif key=='<STR_LIT>':<EOL><INDENT>if <NUM_LIT:2>*abs(dx) < abs(dy):<EOL><INDENT>dx=<NUM_LIT:0><EOL><DEDENT>elif <NUM_LIT:2>*abs(dy) < abs(dx):<EOL><INDENT>dy=<NUM_LIT:0><EOL><DEDENT>elif(abs(dx)>abs(dy)):<EOL><INDENT>dy=dy/abs(dy)*abs(dx)<EOL><DEDENT>else:<EOL><INDENT>dx=dx/abs(dx)*abs(dy)<EOL><DEDENT><DEDENT>return (dx,dy)<EOL><DEDENT>p = self._pan_start<EOL>dx = x - p.x<EOL>dy = y - p.y<EOL>if dx == <NUM_LIT:0> and dy == <NUM_LIT:0>:<EOL><INDENT>return<EOL><DEDENT>if button == <NUM_LIT:1>:<EOL><INDENT>dx, dy = format_deltas(key, dx, dy)<EOL>result = p.bbox.translated(-dx, -dy).transformed(p.trans_inverse)<EOL><DEDENT>elif button == <NUM_LIT:3>:<EOL><INDENT>try:<EOL><INDENT>dx = -dx / float(self.bbox.width)<EOL>dy = -dy / float(self.bbox.height)<EOL>dx, dy = format_deltas(key, dx, dy)<EOL>if self.get_aspect() != '<STR_LIT>':<EOL><INDENT>dx = <NUM_LIT:0.5> * (dx + dy)<EOL>dy = dx<EOL><DEDENT>alpha = np.power(<NUM_LIT>, (dx, dy))<EOL>start = p.trans_inverse.transform_point((p.x, p.y))<EOL>lim_points = p.lim.get_points()<EOL>result = start + alpha * (lim_points - start)<EOL>result = mtransforms.Bbox(result)<EOL><DEDENT>except OverflowError:<EOL><INDENT>warnings.warn('<STR_LIT>')<EOL>return<EOL><DEDENT><DEDENT>self.set_xlim(*result.intervalx)<EOL>self.set_ylim(*result.intervaly)<EOL>
Called when the mouse moves during a pan operation.

*button* is the mouse button number:

* 1: LEFT
* 2: MIDDLE
* 3: RIGHT

*key* is a "shift" key

*x*, *y* are the mouse coordinates in display coords.

.. note::
    Intended to be overridden by new projection types.