def onMouseMotion(self,event):
inv = self.host.transData.inverted()
pos = inv.transform((event.x,event.y))
if self.cursorActive:
if event.button == 1:
#QtGui.QApplication.setOverrideCursor((QtGui.QCursor(Qt.CrossCursor)))
#activate Crossline Cursor
if self.cursorD is None:
self.cursorD = Cursor(self.host, useblit=False)
else:
self.cursorD.set_active(True)
if self.mpl_toolbar.cbA.isChecked():
if not self.cursorA is None: #delete static Cursorline if Cursor is active
self.cursorA.delLine()
self.cursorA = None
self.showCursorPos(pos[0], pos[1], 'A')
self.showCursorPos(math.fabs(pos[0]-self.cursorB.x), math.fabs(pos[1]-self.cursorB.y), 'C')
self.cursorD.lineh.set_color('gray')
self.cursorD.linev.set_color('gray')
else:
if not self.cursorB is None: #delete static Cursorline if Cursor is active
self.cursorB.delLine()
self.cursorB = None
self.showCursorPos(pos[0], pos[1], 'B')
self.showCursorPos(math.fabs(pos[0]-self.cursorA.x), math.fabs(pos[1]-self.cursorA.y), 'C')
self.cursorD.lineh.set_color('black')
self.cursorD.linev.set_color('black')
event.inaxes = self.host
self.cursorD.onmove(event)
else:
self.showCursorPos(pos[0],pos[1],'D')
#QtGui.QApplication.restoreOverrideCursor()
else:
self.showCursorPos(pos[0], pos[1], 'D')
评论列表
文章目录