Skip to content

Commit

Permalink
Fix AttributeError in pointer mode activation
Browse files Browse the repository at this point in the history
  • Loading branch information
tnk-k authored and Cimbali committed Jul 27, 2024
1 parent 28cefa9 commit 6f48879
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pympress/pointer.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,16 @@ def activate_pointermode(self, mode=None):
if max(ww, wh) == 1:
continue

pointer_x, pointer_y = -1, -1
window = slide_widget.get_window()
pointer_coordinates = window.get_pointer() if window is not None else (-1, -1)
if window is not None:
pointer_coords = window.get_pointer()
pointer_x, pointer_y = pointer_coords.x, pointer_coords.y

if 0 < pointer_coordinates.x < ww and 0 < pointer_coordinates.y < wh \
if 0 < pointer_x < ww and 0 < pointer_y < wh \
and self.pointer_mode == PointerMode.CONTINUOUS:
# Laser activated right away
self.pointer_pos = (pointer_coordinates.x / ww, pointer_coordinates.y / wh)
self.pointer_pos = (pointer_x / ww, pointer_y / wh)
self.show_pointer = True
extras.Cursor.set_cursor(slide_widget, 'invisible')
else:
Expand Down

0 comments on commit 6f48879

Please sign in to comment.