Skip to content

Commit

Permalink
return in in mouse event
Browse files Browse the repository at this point in the history
  • Loading branch information
knorth55 committed Apr 27, 2023
1 parent aa40120 commit 2bbd08f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions jsk_rqt_plugins/src/jsk_rqt_plugins/image_view2_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,11 @@ def mouseMoveEvent(self, e):
msg = MouseEvent()
msg.header.stamp = rospy.Time.now()
msg.type = MouseEvent.MOUSE_MOVE
msg.x, msg.y = self.mousePosition(e)
msg.width = self.label.pixmap().width()
msg.height = self.label.pixmap().height()
x, y = self.mousePosition(e)
msg.x = int(x)
msg.y = int(y)
if self.event_pub:
self.event_pub.publish(msg)

Expand All @@ -253,7 +255,9 @@ def mousePressEvent(self, e):
msg.type = MouseEvent.MOUSE_RIGHT_DOWN
msg.width = self.label.pixmap().width()
msg.height = self.label.pixmap().height()
msg.x, msg.y = self.mousePosition(e)
x, y = self.mousePosition(e)
msg.x = int(x)
msg.y = int(y)
if self.event_pub:
self.event_pub.publish(msg)

Expand All @@ -265,7 +269,9 @@ def mouseReleaseEvent(self, e):
msg.width = self.label.pixmap().width()
msg.height = self.label.pixmap().height()
msg.type = MouseEvent.MOUSE_LEFT_UP
msg.x, msg.y = self.mousePosition(e)
x, y = self.mousePosition(e)
msg.x = int(x)
msg.y = int(y)
if self.event_pub:
self.event_pub.publish(msg)

Expand Down

0 comments on commit 2bbd08f

Please sign in to comment.