Skip to content

Commit

Permalink
Take into account erasers of stylus pens on graphics tablets
Browse files Browse the repository at this point in the history
  • Loading branch information
Cimbali committed Jun 5, 2023
1 parent 6e25da8 commit ca339cc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pympress/scribble.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,9 @@ def toggle_scribble(self, widget, event):
return False

if event.get_event_type() == Gdk.EventType.BUTTON_PRESS:
if any(mod & event.get_state() == mod for mod in self.toggle_erase_modifiers) and self.active_preset \
and self.toggle_erase_source is None:
eraser_button = event.get_source_device().get_source() == Gdk.InputSource.ERASER
eraser_modifier = any(mod & event.get_state() == mod for mod in self.toggle_erase_modifiers)
if (eraser_button or eraser_modifier) and self.active_preset and self.toggle_erase_source is None:
self.previous_preset = self.active_preset
self.toggle_erase_source = 'modifier'
self.load_preset(target=0)
Expand Down

0 comments on commit ca339cc

Please sign in to comment.