Fix number button sides exiting continuous grab
This commit is contained in:
@@ -4175,31 +4175,36 @@ static void ui_numedit_set_active(uiBut *but)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we can click on the side arrows to increment/decrement,
|
/* Ignore once we start dragging. */
|
||||||
* or click inside to edit the value directly */
|
if (data->dragchange == false) {
|
||||||
int mx = data->window->eventstate->x;
|
const float handle_width = min_ff(BLI_rctf_size_x(&but->rect) / 3, BLI_rctf_size_y(&but->rect) * 0.7f);
|
||||||
int my = data->window->eventstate->x;
|
/* we can click on the side arrows to increment/decrement,
|
||||||
ui_window_to_block(data->region, but->block, &mx, &my);
|
* 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);
|
if (mx < (but->rect.xmin + handle_width)) {
|
||||||
|
but->drawflag |= UI_BUT_ACTIVE_LEFT;
|
||||||
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;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
if (data->changed_cursor == false) {
|
/* Don't change the cursor once pressed. */
|
||||||
WM_cursor_modal_set(data->window, CURSOR_X_MOVE);
|
if ((but->flag & UI_SELECT) == 0) {
|
||||||
data->changed_cursor = true;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user