fix for drag-toggle, bit-buttons weren't handled which made drag toggle fail for buttons in the graph editor for eg.

This commit is contained in:
Campbell Barton
2013-03-01 00:35:01 +00:00
parent 3d63b2308a
commit 2de8dfd784
2 changed files with 3 additions and 3 deletions

View File

@@ -776,12 +776,12 @@ static int ui_but_start_drag(bContext *C, uiBut *but, uiHandleButtonData *data,
#ifdef USE_DRAG_TOGGLE
if (ui_is_but_bool(but)) {
/* assumes button has already been pressed */
const bool is_set = (ui_get_but_val(but) == 0.0);
const bool is_set = ui_is_but_push(but);
PointerRNA ptr;
/* auto-key is typically called on mouse-up, but we'r leaving the button so call here */
ui_apply_autokey(C, but);
WM_operator_properties_create(&ptr, "UI_OT_drag_toggle");
RNA_boolean_set(&ptr, "state", !is_set);
RNA_boolean_set(&ptr, "state", is_set);
RNA_int_set(&ptr, "last_x", data->dragstartx);
RNA_int_set(&ptr, "last_y", data->dragstarty);
WM_operator_name_call(C, "UI_OT_drag_toggle", WM_OP_INVOKE_DEFAULT, &ptr);

View File

@@ -1103,7 +1103,7 @@ static bool ui_but_set_xy_xy(bContext *C, ARegion *ar, const bool is_set, const
/* execute the button */
if (ui_is_but_bool(but) && but->type == but_type_start) {
/* is it pressed? */
bool is_set_but = (ui_get_but_val(but) != 0.0);
bool is_set_but = ui_is_but_push(but);
BLI_assert(ui_is_but_bool(but) == true);
if (is_set_but != is_set) {
uiButExecute(C, but);