def mouseMotion(self, evt, x, y): """ Completely overrides base class functionality. """ view = self.getView() if self.selectedAxes is None: axes, xdata, ydata = self.find_axes(view, x, y) else: axes = self.selectedAxes xdata, ydata = get_data(axes, x, y) if self.leftButtonPoint is not None: self.selectionMouseMotion(evt, x, y, axes, xdata, ydata) else: if axes is None: self.canvasMouseMotion(evt, x, y) elif wxmpl.is_polar(axes): self.polarAxesMouseMotion(evt, x, y, axes, xdata, ydata) else: self.axesMouseMotion(evt, x, y, axes, xdata, ydata) if self.IsPanMode() and self.leftButtonPoint: if len(self.find_all_axes(view, x, y)) > 1: self.panTool.panAll(x, y, self.find_all_axes(view, x, y)) elif self.getActiveSubplot() is not None: self.panTool.pan(x, y, self.getActiveSubplot()) if len(self.find_all_axes(self.view, x, y)) > 1: self.UpdateLocationStr(x, y)
def leftButtonUp(self, evt, x, y): """ Completely overrides base class functionality. """ if self.leftButtonPoint is None: return view = self.getView() if self.selectedAxes is None: axes, xdata, ydata = self.find_axes(view, x, y) else: axes = self.selectedAxes xdata, ydata = get_data(axes, x, y) self.setActiveSubplot(axes) self.end_x = x self.end_y = y if self.IsInfoMode() and axes is not None: self.SelectAxes(axes) x0, y0 = self.leftButtonPoint self.leftButtonPoint = None view.rubberband.clear() if x0 == x: if y0 == y and axes is not None: view.notify_point(axes, x, y) view.crosshairs.set(x, y) return elif y0 == y: return xdata = ydata = None xrange, yrange = get_selected_data(axes, x0, y0, x, y) if axes is not None: xdata, ydata = axes.transData.inverse_xy_tup((x, y)) if self.zoomEnabled: for ax in self.find_all_axes(view, x, y): xrange, yrange = get_selected_data(ax, x0, y0, x, y) if xrange is not None and yrange is not None: if self.limits.set(ax, xrange, yrange): FigureCanvasWxAgg.draw(view) else: self.getView().notify_selection(axes, x0, y0, x, y) if axes is None: view.cursor.setNormal() elif wxmpl.is_polar(axes): view.cursor.setNormal() view.location.set(wxmpl.format_coord(axes, xdata, ydata)) else: view.crosshairs.set(x, y) view.location.set(wxmpl.format_coord(axes, xdata, ydata)) if len(self.find_all_axes(self.view, x, y)) > 1: self.UpdateLocationStr(x, y)
def leftButtonDown(self, evt, x, y): """ Completely overrides base class functionality. """ self.leftButtonPoint = (x, y) view = self.getView() if self.selectedAxes is None: axes, xdata, ydata = self.find_axes(view, x, y) else: axes = self.selectedAxes xdata, ydata = get_data(axes, x, y) self.setActiveSubplot(axes) self.panTool.setX(x) self.panTool.setY(y) if self.selectionEnabled and not wxmpl.is_polar(axes): view.cursor.setCross() view.crosshairs.clear()