From 5e3eb6fc9e9bf7d9640c165b2127803821e79989 Mon Sep 17 00:00:00 2001 From: Tristan Strathearn Date: Fri, 6 May 2022 16:13:32 +1000 Subject: [PATCH] feat: add enter & space key presses as additional operator finalisation events --- lib/events.py | 4 ++-- sketching/geo_lift.py | 6 +++--- sketching/view_align.py | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/events.py b/lib/events.py index 65e2805..a12c07c 100644 --- a/lib/events.py +++ b/lib/events.py @@ -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')) diff --git a/sketching/geo_lift.py b/sketching/geo_lift.py index 5fd7d2e..927319b 100644 --- a/sketching/geo_lift.py +++ b/sketching/geo_lift.py @@ -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'} @@ -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'} diff --git a/sketching/view_align.py b/sketching/view_align.py index 55f7319..a95cf7c 100644 --- a/sketching/view_align.py +++ b/sketching/view_align.py @@ -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'}