Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Riakiotakis <kalast@gmail.com>2014-08-14 16:17:39 +0400
committerAntony Riakiotakis <kalast@gmail.com>2014-08-14 16:17:39 +0400
commitb42b0554eae0e89b737ec55d642d0fc831b954d1 (patch)
tree89eef06fb017ed2adf04a09bd3011168794161e4 /source/blender
parent8e30db0f674d7dec11eb7479abd69bb64cc7cfd3 (diff)
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.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/interface/interface_handlers.c11
-rw-r--r--source/blender/editors/interface/interface_intern.h2
-rw-r--r--source/blender/editors/interface/interface_layout.c3
3 files changed, 10 insertions, 6 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 765a27acf40..ac4da00833f 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 15cf14ae6ef..cdc611a60f4 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 ac9110873ff..27af550b173 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)) {