class, **traits)


An implementation of a pan tool based on the DragTool instead of a bare BaseTool

constrain = Bool(False)

Constrain the panning to one direction?

constrain_direction = Enum(None, "x", "y")

The direction of constrained draw. A value of None means that the user has initiated the drag and pressed the constrain_key, but hasn’t moved the mouse yet; the magnitude of the components of the next mouse_move event will determine the constrain_direction.

constrain_key = Enum(None, "shift", "control", "alt")

The modifier key that, if depressed when the drag is initiated, constrains the panning to happen in the only direction of largest initial motion. It is possible to permanently restrict this tool to always drag along one direction. To do so, set constrain=True, constrain_key=None, and constrain_direction to the desired direction.


Called when the drag is cancelled.

A drag is usually cancelled by receiving a mouse_leave event when end_drag_on_leave is True, or on_drag_leave is ‘cancel’, or by the user pressing any of the cancel_keys.


Called when a mouse event causes the drag operation to end.

A drag is ended when a user releases the mouse, or by receiving a mouse_leave event when on_drag_leave is ‘end’.

drag_pointer = Pointer("hand")

The cursor to use when panning.


Called when the drag operation starts


This method is called for every mouse_move event that the tool receives while the user is dragging the mouse.

It is recommended that subclasses do most of their work in this method.

draw_mode = "none"

The tool does not have a visual representation (overrides BaseTool).

restrict_to_data = Bool(False)

Restrict to the bounds of the plot data

speed = Float(1.0)

Scaling factor on the panning “speed”.

visible = False

The tool is not visible (overrides BaseTool).