diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-01-16 03:14:54 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-01-16 03:16:50 +0300 |
commit | 6f45dea6eeb32b55d422e4dce33ae9b1521871b1 (patch) | |
tree | 5751e0357818ea6008c09200959a5ae457a5d843 /source | |
parent | 75e2ae72c7771a89f3fe4e988d4deb30c9367313 (diff) |
UI: support canceling color ramp drag
D2997 by @oktomus
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 85cc05962c8..06cdef0c441 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -5983,6 +5983,7 @@ static int ui_do_but_COLORBAND( } data->dragcbd = coba->data + coba->cur; + data->dragfstart = data->dragcbd->pos; button_activate_state(C, but, BUTTON_STATE_NUM_EDITING); } @@ -5999,7 +6000,15 @@ static int ui_do_but_COLORBAND( else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_EXIT); } - + else if (ELEM(event->type, ESCKEY, RIGHTMOUSE)) { + if (event->val == KM_PRESS) { + data->dragcbd->pos = data->dragfstart; + BKE_colorband_update_sort(data->coba); + data->cancel = true; + data->escapecancel = true; + button_activate_state(C, but, BUTTON_STATE_EXIT); + } + } return WM_UI_HANDLER_BREAK; } |