UI: Set cursor to X_MOV when editing number button middle area
Reviewers: campbellbarton, brecht Differential Revision: https://developer.blender.org/D3184
This commit is contained in:
@@ -225,7 +225,7 @@ enum {
|
||||
UI_BUT_BOX_ITEM = (1 << 20), /* This but is "inside" a box item (currently used to change theme colors). */
|
||||
|
||||
UI_BUT_ACTIVE_LEFT = (1 << 21), /* Active left part of number button */
|
||||
UI_BUT_ACTIVE_RIGHT = (1 << 22), /* Active left part of number button */
|
||||
UI_BUT_ACTIVE_RIGHT = (1 << 22), /* Active right part of number button */
|
||||
};
|
||||
|
||||
/* scale fixed button widths by this to account for DPI */
|
||||
|
||||
@@ -276,6 +276,7 @@ typedef struct uiHandleButtonData {
|
||||
/* booleans (could be made into flags) */
|
||||
bool cancel, escapecancel;
|
||||
bool applied, applied_interactive;
|
||||
bool changed_cursor;
|
||||
wmTimer *flashtimer;
|
||||
|
||||
/* edited value */
|
||||
@@ -4192,6 +4193,19 @@ static void ui_numedit_set_active(uiBut *but)
|
||||
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;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (data->changed_cursor == false) {
|
||||
WM_cursor_modal_set(data->window, CURSOR_X_MOVE);
|
||||
data->changed_cursor = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (but->drawflag != oldflag) {
|
||||
ED_region_tag_redraw(data->region);
|
||||
}
|
||||
@@ -7918,6 +7932,10 @@ static void button_activate_exit(
|
||||
ui_selectcontext_end(but, &data->select_others);
|
||||
#endif
|
||||
|
||||
if (data->changed_cursor) {
|
||||
WM_cursor_modal_restore(data->window);
|
||||
}
|
||||
|
||||
/* redraw (data is but->active!) */
|
||||
ED_region_tag_redraw(data->region);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user