diff options
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 11 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_regions.c | 5 |
2 files changed, 11 insertions, 5 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 2af034cde4d..2f9734f790f 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -8687,7 +8687,7 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle mul_v2_fl(vec, pie_radius); add_v2_v2(vec, center); - mul_v2_fl(vec, fac); + mul_v2_fl(vec, fac); add_v2_v2(vec, block->pie_data.pie_center_spawned); BLI_rctf_recenter(&but->rect, vec[0], vec[1]); @@ -8718,7 +8718,7 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle return WM_UI_HANDLER_BREAK; } - if (event->type == block->pie_data.event) { + if (event->type == block->pie_data.event && !is_click_style) { if (event->val != KM_RELEASE) { ui_handle_menu_button(C, event, menu); @@ -8734,7 +8734,7 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle if (!(block->pie_data.flags & UI_PIE_DRAG_STYLE)) { block->pie_data.flags |= UI_PIE_CLICK_STYLE; } - else if (!is_click_style) { + else { uiBut *but = ui_but_find_activated(menu->region); retval = ui_but_pie_menu_apply(C, menu, but, true, is_click_style); @@ -8747,7 +8747,8 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle switch (event->type) { case MOUSEMOVE: - if (len_squared_v2v2(event_xy, block->pie_data.pie_center_init) > PIE_CLICK_THRESHOLD_SQ) { + if (len_squared_v2v2(event_xy, block->pie_data.pie_center_init) > PIE_CLICK_THRESHOLD_SQ && + !is_click_style) { block->pie_data.flags |= UI_PIE_DRAG_STYLE; } ui_handle_menu_button(C, event, menu); @@ -8757,7 +8758,7 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle break; case LEFTMOUSE: - if (event->val == KM_PRESS) { + if (event->val == KM_RELEASE) { uiBut *but = ui_but_find_activated(menu->region); retval = ui_but_pie_menu_apply(C, menu, but, false, is_click_style); } diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 9b450b8fdf4..5739ebebe64 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -2720,6 +2720,11 @@ uiPieMenu *uiPieMenuBegin(struct bContext *C, const char *title, int icon, const pie->block_radial->flag |= UI_BLOCK_RADIAL; pie->block_radial->pie_data.event = event->type; + /* if pie is spawned by a left click, it is always assumed to be click style */ + if (event->type == LEFTMOUSE) { + pie->block_radial->flag |= UI_PIE_CLICK_STYLE; + } + pie->layout = uiBlockLayout(pie->block_radial, UI_LAYOUT_VERTICAL, UI_LAYOUT_PIEMENU, 0, 0, 200, 0, 0, style); pie->mx = event->x; pie->my = event->y; |