chaco.tools.drag_zoom module¶
Defines a the DragZoom tool class
-
class
chaco.tools.drag_zoom.
DragZoom
(component=None, *args, **kw)¶ Bases:
enable.tools.drag_tool.DragTool
,chaco.tools.better_zoom.BetterZoom
A zoom tool that zooms continuously with a mouse drag movement, instead of using a zoom box or range.
By default, the tool maintains aspect ratio and zooms the plot’s X and Y axes by the same amount as the user drags up and down. (In this default configuration, the horizontal position of the drag motion has no effect.)
By setting maintain_aspect_ratio to False, this tool will separably zoom the X and Y axis ranges by the (possibly different) horizontal and vertical drag motions. This is similar to the drag zoom interaction in Matplotlib.
By setting single_axis to True, dragging will only zoom in the axis specified by the axis attribute.
By setting restrict_domain to True, the zoom will be limited to the domain of the axis mappers.
The mouse button that initiates the drag
-
drag_end
(event)¶ 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
= 'magnifier'¶ The pointer to use when we’re in the act of zooming
-
drag_start
(event, capture_mouse=True)¶ Called when the drag operation starts.
The event parameter is the mouse event that established the drag operation; its x and y attributes correspond to the current location of the mouse, and not to the position of the mouse when the initial left_down or right_down event happened.
-
dragging
(event)¶ 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.
-
maintain_aspect_ratio
= Bool(True)¶ Whether or not to preserve the aspect ratio of X to Y while zooming in. (See class docstring for more info.)
-
restrict_domain
= Bool(False)¶ Whether to restrict zoom to the domain of the mappers
-
single_axis
= Bool(False)¶ Whether or not to zoom in one axis only
-
speed
= Float(1.0)¶ Scaling factor on the zoom “speed”. A speed of 1.0 implies a zoom rate of 5% for every 10 pixels.