def get_handle_for_mouse(self, pos):
for n, handle in enumerate(self.model.all_handles()):
if handle is None:
continue
# get the pix-wise BBOX of the handle
p = self.im2V(handle)
r = QtCore.QRect(p[0], p[1], 0, 0)
r.adjust(-HANDLE_HALF_SIZE, -HANDLE_HALF_SIZE, HANDLE_HALF_SIZE, HANDLE_HALF_SIZE)
# If event inside the bbox
if r.contains(pos):
return n
return None
评论列表
文章目录