Skip to content

Commit

Permalink
Fix mouse position
Browse files Browse the repository at this point in the history
  • Loading branch information
UmSenhorQualquer committed Mar 14, 2019
1 parent 8a7bda0 commit 332f3e4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pyforms_gui/controls/control_player/AbstractGLWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,10 +540,17 @@ def _get_current_mouse_point(self):
return self._get_current_x(), self._get_current_y()

def _get_current_x(self):
return (self._glX - self._x) * float(self.img_width)
if self.img_width>self.img_height:
return (self._glX - self._x) * float(self.img_width)
else:
return (self._glX - self._x) * float(self.img_height)

def _get_current_y(self):
return (self._height - self._glY + self._y) * float(self.img_width) - self.img_height / 2.0
if self.img_width > self.img_height:
return (self._height - self._glY + self._y) * float(self.img_width) - self.img_height / 2.0
else:
return (self._height - self._glY + self._y) * float(self.img_height) - self.img_height / 2.0


@property
def point(self): return self._point
Expand Down

0 comments on commit 332f3e4

Please sign in to comment.