Small enhancement to grab-resize of uiLists, suggested by plasmasolutions: do not effectively apply auto-size until we stop grabbing, avoid size of uiLists to switch between rows and maxrows while dragging.
This commit is contained in:
@@ -3424,10 +3424,12 @@ static int ui_do_but_LISTBOX(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
|
|||||||
data->escapecancel = true;
|
data->escapecancel = true;
|
||||||
*size = (int)data->origvalue;
|
*size = (int)data->origvalue;
|
||||||
button_activate_state(C, but, BUTTON_STATE_EXIT);
|
button_activate_state(C, but, BUTTON_STATE_EXIT);
|
||||||
|
ui_list->flag &= ~UILST_RESIZING;
|
||||||
ED_region_tag_redraw(data->region);
|
ED_region_tag_redraw(data->region);
|
||||||
}
|
}
|
||||||
else if (event->type == LEFTMOUSE && event->val != KM_PRESS) {
|
else if (event->type == LEFTMOUSE && event->val != KM_PRESS) {
|
||||||
button_activate_state(C, but, BUTTON_STATE_EXIT);
|
button_activate_state(C, but, BUTTON_STATE_EXIT);
|
||||||
|
ui_list->flag &= ~UILST_RESIZING;
|
||||||
ED_region_tag_redraw(data->region);
|
ED_region_tag_redraw(data->region);
|
||||||
}
|
}
|
||||||
else if (event->type == MOUSEMOVE) {
|
else if (event->type == MOUSEMOVE) {
|
||||||
@@ -6552,6 +6554,7 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar)
|
|||||||
|
|
||||||
/* Again, have to override values set by ui_numedit_begin, because our listbox button also has a rnapoin... */
|
/* Again, have to override values set by ui_numedit_begin, because our listbox button also has a rnapoin... */
|
||||||
*size = data->origvalue = (double)dyn_data->visual_height;
|
*size = data->origvalue = (double)dyn_data->visual_height;
|
||||||
|
ui_list->flag |= UILST_RESIZING;
|
||||||
|
|
||||||
retval = WM_UI_HANDLER_BREAK;
|
retval = WM_UI_HANDLER_BREAK;
|
||||||
}
|
}
|
||||||
|
@@ -2517,10 +2517,17 @@ static void prepare_list(uiList *ui_list, int len, int activei, int rows, int ma
|
|||||||
maxrows = 5;
|
maxrows = 5;
|
||||||
if (columns == 0)
|
if (columns == 0)
|
||||||
columns = 9;
|
columns = 9;
|
||||||
if (ui_list->list_grip >= rows)
|
|
||||||
|
if (ui_list->list_grip >= rows) {
|
||||||
maxrows = rows = ui_list->list_grip;
|
maxrows = rows = ui_list->list_grip;
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
ui_list->list_grip = 0; /* Reset to auto-size mode. */
|
ui_list->list_grip = 0; /* Reset to auto-size mode. */
|
||||||
|
/* Prevent auto-size mode to take effect while grab-resizing! */
|
||||||
|
if (ui_list->flag & UILST_RESIZING) {
|
||||||
|
maxrows = rows;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (columns > 1) {
|
if (columns > 1) {
|
||||||
dyn_data->height = (int)ceil((double)len / (double)columns);
|
dyn_data->height = (int)ceil((double)len / (double)columns);
|
||||||
|
@@ -256,6 +256,7 @@ enum {
|
|||||||
/* uiList flag */
|
/* uiList flag */
|
||||||
enum {
|
enum {
|
||||||
UILST_SCROLL_TO_ACTIVE_ITEM = 1 << 0, /* Scroll list to make active item visible. */
|
UILST_SCROLL_TO_ACTIVE_ITEM = 1 << 0, /* Scroll list to make active item visible. */
|
||||||
|
UILST_RESIZING = 1 << 1, /* We are currently resizing, deactivate autosize! */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* regiontype, first two are the default set */
|
/* regiontype, first two are the default set */
|
||||||
|
Reference in New Issue
Block a user