Commit: b42b0554eae0e89b737ec55d642d0fc831b954d1
Author: Antony Riakiotakis
Date:   Thu Aug 14 14:17:39 2014 +0200
Branches: master
https://developer.blender.org/rBb42b0554eae0e89b737ec55d642d0fc831b954d1

Pie menus:

If user drags away from initial position, menu changes to drag style and
returning to that position won't remake the menu click-style. Allows to
use the threshold indicator to cancel the pie.

===================================================================

M       source/blender/editors/interface/interface_handlers.c
M       source/blender/editors/interface/interface_intern.h
M       source/blender/editors/interface/interface_layout.c

===================================================================

diff --git a/source/blender/editors/interface/interface_handlers.c 
b/source/blender/editors/interface/interface_handlers.c
index 765a27a..ac4da00 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -8704,13 +8704,16 @@ static int ui_handler_pie(bContext *C, const wmEvent 
*event, uiPopupBlockHandle
                if (event->val != KM_RELEASE) {
                        ui_handle_menu_button(C, event, menu);
 
+                       if (len_squared_v2v2(event_xy, 
block->pie_data.pie_center_init) > PIE_CLICK_THRESHOLD_SQ) {
+                               block->pie_data.flags |= UI_PIE_DRAG_STYLE;
+                       }
                        /* why redraw here? It's simple, we are getting many 
double click events here.
                         * Those operate like mouse move events almost */
                        ED_region_tag_redraw(ar);
                }
                else {
                        /* distance from initial point */
-                       if (len_squared_v2v2(event_xy, 
block->pie_data.pie_center_init) < PIE_CLICK_THRESHOLD_SQ) {
+                       if (!(block->pie_data.flags & UI_PIE_DRAG_STYLE)) {
                                block->pie_data.flags |= UI_PIE_CLICK_STYLE;
                        }
                        else if (!is_click_style) {
@@ -8726,8 +8729,12 @@ static int ui_handler_pie(bContext *C, const wmEvent 
*event, uiPopupBlockHandle
 
                switch (event->type) {
                        case MOUSEMOVE:
-                               /* mouse move should always refresh the area 
for pie menus */
+                               if (len_squared_v2v2(event_xy, 
block->pie_data.pie_center_init) > PIE_CLICK_THRESHOLD_SQ) {
+                                       block->pie_data.flags |= 
UI_PIE_DRAG_STYLE;
+                               }
                                ui_handle_menu_button(C, event, menu);
+                               
+                               /* mouse move should always refresh the area 
for pie menus */
                                ED_region_tag_redraw(ar);
                                break;
 
diff --git a/source/blender/editors/interface/interface_intern.h 
b/source/blender/editors/interface/interface_intern.h
index 15cf14a..cdc611a 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -166,7 +166,7 @@ extern const short ui_radial_dir_to_angle[8];
 enum {
        UI_PIE_DEGREES_RANGE_LARGE  = (1 << 0),  /* pie menu item collision is 
detected at 90 degrees */
        UI_PIE_INITIAL_DIRECTION    = (1 << 1),  /* use initial center of pie 
menu to calculate direction */
-       UI_PIE_3_ITEMS              = (1 << 2),  /* pie menu has only 3 items, 
careful when centering */
+       UI_PIE_DRAG_STYLE           = (1 << 2),  /* pie menu is drag style */
        UI_PIE_INVALID_DIR          = (1 << 3),  /* mouse not far enough from 
center position  */
        UI_PIE_FINISHED             = (1 << 4),  /* pie menu finished but we 
still wait for a release event  */
        UI_PIE_CLICK_STYLE          = (1 << 5),  /* pie menu changed to click 
style, click to confirm  */
diff --git a/source/blender/editors/interface/interface_layout.c 
b/source/blender/editors/interface/interface_layout.c
index ac91108..27af550 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -2171,9 +2171,6 @@ static void ui_litem_layout_radial(uiLayout *litem)
        if (totitems < 5)
                litem->root->block->pie_data.flags |= 
UI_PIE_DEGREES_RANGE_LARGE;
 
-       if (totitems == 3)
-               litem->root->block->pie_data.flags |= UI_PIE_3_ITEMS;
-
        for (item = litem->items.first; item; item = item->next) {
                /* not all button types are drawn in a radial menu, do 
filtering here */
                if (ui_item_is_radial_displayable(item)) {

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to