diff options
Diffstat (limited to 'source/blender/windowmanager/intern/wm_event_query.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_query.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_query.c b/source/blender/windowmanager/intern/wm_event_query.c index 381c06983a8..a996796104b 100644 --- a/source/blender/windowmanager/intern/wm_event_query.c +++ b/source/blender/windowmanager/intern/wm_event_query.c @@ -222,7 +222,7 @@ bool WM_event_is_modal_tweak_exit(const wmEvent *event, int tweak_event) } else { /* if the initial event wasn't a tweak event then - * ignore USER_RELEASECONFIRM setting: see [#26756] */ + * ignore USER_RELEASECONFIRM setting: see T26756. */ if (ELEM(tweak_event, EVT_TWEAK_L, EVT_TWEAK_M, EVT_TWEAK_R) == 0) { return 1; } @@ -423,6 +423,38 @@ bool WM_event_is_tablet(const struct wmEvent *event) /** \} */ /* -------------------------------------------------------------------- */ +/** \name Event Scroll's Absolute Deltas + * + * User may change the scroll behavior, and the deltas are automatically inverted. + * These functions return the absolute direction, swipe up/right gives positive values. + * + * \{ */ + +int WM_event_absolute_delta_x(const struct wmEvent *event) +{ + int dx = event->x - event->prevx; + + if (!event->is_direction_inverted) { + dx = -dx; + } + + return dx; +} + +int WM_event_absolute_delta_y(const struct wmEvent *event) +{ + int dy = event->y - event->prevy; + + if (!event->is_direction_inverted) { + dy = -dy; + } + + return dy; +} + +/** \} */ + +/* -------------------------------------------------------------------- */ /** \name Event IME Input Access * \{ */ |