chaco.tools.range_selection_2d module

Defines the RangeSelection controller class.

class chaco.tools.range_selection_2d.RangeSelection2D(component, *args, **kw)

Bases: chaco.tools.range_selection.RangeSelection

Selects a range along the index or value axis for plots on 2D data,

such as image plots

The user right-click-drags to select a region, which stays selected until the user left-clicks to deselect.

moving_mouse_move(event)

Handles the mouse moving when the tool is in the ‘moving’ state.

Moves the selection range by an amount corresponding to the amount that the mouse has moved since its button was pressed. If the new selection range overlaps the endpoints of the data, it is truncated to that endpoint.

normal_right_down(event)

Handles the right mouse button being pressed when the tool is in the ‘normal’ state.

Puts the tool into ‘selecting’ mode, changes the cursor to show that it is selecting, and starts defining the selection.

selected_left_down(event)

Handles the left mouse button being pressed when the tool is in the ‘selected’ state.

If the user is allowed to resize the selection, and the event occurred within the resize margin of an endpoint, then the tool switches to the ‘selecting’ state so that the user can resize the selection.

If the event is within the bounds of the selection region, then the tool switches to the ‘moving’ states.

Otherwise, the selection becomes deselected.

selected_mouse_move(event)

Handles the mouse moving when the tool is in the ‘selected’ state.

If the user is allowed to resize the selection, and the event occurred within the resize margin of an endpoint, then the cursor changes to indicate that the selection could be resized.

Otherwise, the cursor is set to an arrow.

selected_right_down(event)

Handles the right mouse button being pressed when the tool is in the ‘selected’ state.

If the user is allowed to resize the selection, and the event occurred within the resize margin of an endpoint, then the tool switches to the ‘selecting’ state so that the user can resize the selection.

Otherwise, the selection becomes deselected, and a new selection is started..

selecting_mouse_leave(event)

Handles the mouse leaving the plot when the tool is in the ‘selecting’ state.

Determines whether the event’s position is outside the component’s bounds, and if so, clips the selection. Sets the cursor to an arrow.

selecting_mouse_move(event)

Handles the mouse being moved when the tool is in the ‘selecting’ state.

Expands the selection range at the appropriate end, based on the new mouse position.