Skip to content

Commit

Permalink
feat: add enter & space key presses as additional operator finalisati…
Browse files Browse the repository at this point in the history
…on events
  • Loading branch information
tristan-hm committed May 6, 2022
1 parent 2e990f8 commit 5e3eb6f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ def capture_modifier_keys(cls, event=None, mouse_x=0):
cls.key_step_up = detected(event, {'WHEELUPMOUSE'}) or pressed(event, {'UP_ARROW'}) or pressed(event, {'RIGHT_ARROW'}) or pressed(event, {'D'}) or pressed(event, {'W'})
cls.key_step_down = detected(event, {'WHEELDOWNMOUSE'}) or pressed(event, {'DOWN_ARROW'}) or pressed(event, {'LEFT_ARROW'}) or pressed(event, {'A'}) or pressed(event, {'S'})

cls.key_confirm = detected(event, {'LEFTMOUSE'})
cls.key_confirm_alternative = pressed(event, {'SPACE'})
cls.key_confirm = detected(event, {'LEFTMOUSE'}) or pressed(event, {'SPACE', 'RET'})
cls.key_confirm_alternative = pressed(event, {'SPACE', 'RET'})
cls.key_cancel = detected(event, {'RIGHTMOUSE'}) or pressed(event, {'ESC'})

cls.key_movement_passthrough = detected(event, {'MIDDLEMOUSE'}) or (has(event) and event.alt and event.type in {'LEFTMOUSE', 'RIGHTMOUSE'}) or (has(event) and event.type.startswith('NDOF'))
Expand Down
6 changes: 3 additions & 3 deletions sketching/geo_lift.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ def modal(self, context, event):

return {'PASS_THROUGH'}

elif self.key_confirm_alternative:
return self.finish(context)

elif self.key_confirm:
return {'PASS_THROUGH'}

Expand Down Expand Up @@ -66,9 +69,6 @@ def modal(self, context, event):
self.selection_type = 2
self.set_selection_mode(context)

elif self.key_confirm_alternative:
return self.finish(context)

elif self.key_movement_passthrough:
return {'PASS_THROUGH'}

Expand Down
6 changes: 3 additions & 3 deletions sketching/view_align.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ def modal(self, context, event):
self.selection_type = 2
self.set_selection_mode(context)

elif self.key_confirm:
return {'PASS_THROUGH'}

elif self.key_confirm_alternative:
return self.finish(context)

elif self.key_confirm:
return {'PASS_THROUGH'}

elif self.key_movement_passthrough:
return {'PASS_THROUGH'}

Expand Down

0 comments on commit 5e3eb6f

Please sign in to comment.