Internal event handler to draw the cursor when the mouse moves.
(self, event)
| 2110 | |
| 2111 | @_call_with_reparented_event |
| 2112 | def onmove(self, event): |
| 2113 | """Internal event handler to draw the cursor when the mouse moves.""" |
| 2114 | if self.ignore(event): |
| 2115 | return |
| 2116 | if not self.canvas.widgetlock.available(self): |
| 2117 | return |
| 2118 | if not self.ax.contains(event)[0]: |
| 2119 | self.linev.set_visible(False) |
| 2120 | self.lineh.set_visible(False) |
| 2121 | if self.needclear: |
| 2122 | background = self._load_blit_background() |
| 2123 | if self.useblit and background is not None: |
| 2124 | self.canvas.restore_region(background) |
| 2125 | self.canvas.blit(self.ax.bbox) |
| 2126 | else: |
| 2127 | self.canvas.draw() |
| 2128 | self.needclear = False |
| 2129 | return |
| 2130 | self.needclear = True |
| 2131 | self.linev.set_xdata((event.xdata, event.xdata)) |
| 2132 | self.linev.set_visible(self.visible and self.vertOn) |
| 2133 | self.lineh.set_ydata((event.ydata, event.ydata)) |
| 2134 | self.lineh.set_visible(self.visible and self.horizOn) |
| 2135 | if not (self.visible and (self.vertOn or self.horizOn)): |
| 2136 | return |
| 2137 | # Redraw. |
| 2138 | if self.useblit: |
| 2139 | background = self._load_blit_background() |
| 2140 | if background is not None: |
| 2141 | self.canvas.restore_region(background) |
| 2142 | self.ax.draw_artist(self.linev) |
| 2143 | self.ax.draw_artist(self.lineh) |
| 2144 | self.canvas.blit(self.ax.bbox) |
| 2145 | else: |
| 2146 | self.canvas.draw_idle() |
| 2147 | |
| 2148 | |
| 2149 | class MultiCursor(Widget): |
nothing calls this directly
no test coverage detected