[Bf-blender-cvs] [b6e66a66c29] blender2.8: Fix number button sides exiting continuous grab
Campbell Barton
noreply at git.blender.org
Sat Apr 28 15:39:24 CEST 2018
Commit: b6e66a66c29d0f4f85d8e0686c80d9c51501ed7b
Author: Campbell Barton
Date: Sat Apr 28 15:28:07 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBb6e66a66c29d0f4f85d8e0686c80d9c51501ed7b
Fix number button sides exiting continuous grab
===================================================================
M source/blender/editors/interface/interface_handlers.c
===================================================================
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index c08c981b77a..3214bd8bb38 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -4175,31 +4175,36 @@ static void ui_numedit_set_active(uiBut *but)
return;
}
- /* we can click on the side arrows to increment/decrement,
- * or click inside to edit the value directly */
- int mx = data->window->eventstate->x;
- int my = data->window->eventstate->x;
- ui_window_to_block(data->region, but->block, &mx, &my);
-
- float handle_width = min_ff(BLI_rctf_size_x(&but->rect) / 3, BLI_rctf_size_y(&but->rect) * 0.7f);
+ /* Ignore once we start dragging. */
+ if (data->dragchange == false) {
+ const float handle_width = min_ff(BLI_rctf_size_x(&but->rect) / 3, BLI_rctf_size_y(&but->rect) * 0.7f);
+ /* we can click on the side arrows to increment/decrement,
+ * or click inside to edit the value directly */
+ int mx = data->window->eventstate->x;
+ int my = data->window->eventstate->x;
+ ui_window_to_block(data->region, but->block, &mx, &my);
- if (mx < (but->rect.xmin + handle_width)) {
- but->drawflag |= UI_BUT_ACTIVE_LEFT;
- }
- else if (mx > (but->rect.xmax - handle_width)) {
- but->drawflag |= UI_BUT_ACTIVE_RIGHT;
+ if (mx < (but->rect.xmin + handle_width)) {
+ but->drawflag |= UI_BUT_ACTIVE_LEFT;
+ }
+ else if (mx > (but->rect.xmax - handle_width)) {
+ but->drawflag |= UI_BUT_ACTIVE_RIGHT;
+ }
}
- if ((but->drawflag & (UI_BUT_ACTIVE_LEFT)) || (but->drawflag & (UI_BUT_ACTIVE_RIGHT))) {
- if (data->changed_cursor) {
- WM_cursor_modal_restore(data->window);
- data->changed_cursor = false;
+ /* Don't change the cursor once pressed. */
+ if ((but->flag & UI_SELECT) == 0) {
+ if ((but->drawflag & (UI_BUT_ACTIVE_LEFT)) || (but->drawflag & (UI_BUT_ACTIVE_RIGHT))) {
+ if (data->changed_cursor) {
+ WM_cursor_modal_restore(data->window);
+ data->changed_cursor = false;
+ }
}
- }
- else {
- if (data->changed_cursor == false) {
- WM_cursor_modal_set(data->window, CURSOR_X_MOVE);
- data->changed_cursor = true;
+ else {
+ if (data->changed_cursor == false) {
+ WM_cursor_modal_set(data->window, CURSOR_X_MOVE);
+ data->changed_cursor = true;
+ }
}
}
More information about the Bf-blender-cvs
mailing list