diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2014-08-13 17:11:19 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2014-08-13 17:11:19 +0400 |
commit | eca7c96a2887e1ebbf982abbd37be2522a5495ff (patch) | |
tree | 76eba2b2704b0ac55dfadd9754e603aea58c5883 /source/blender/editors/interface/interface_layout.c | |
parent | b30ac75f8c9ec5ab9889708374b3a80456512dad (diff) |
Maybe slightly controversial pie commit:
Make pie menu item placement touch the radius from the internal side of
the buttons rather than placing on the center on the cirtcle. This
allows us to get rid of the separate visual angle property, also allows
for tighter placement of pies with a smaller radius without easily
overlapping.
Also pie menu title now always appears above the threshold indicator.
Diffstat (limited to 'source/blender/editors/interface/interface_layout.c')
-rw-r--r-- | source/blender/editors/interface/interface_layout.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index a2d8ce06e5f..ac9110873ff 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -2121,7 +2121,7 @@ static RadialDirection ui_get_radialbut_vec(float vec[2], short itemnum) BLI_assert(itemnum < 8); dir = ui_radial_dir_order[itemnum]; - ui_but_pie_dir_visual(dir, vec); + ui_but_pie_dir(dir, vec); return dir; } @@ -2179,8 +2179,11 @@ static void ui_litem_layout_radial(uiLayout *litem) if (ui_item_is_radial_displayable(item)) { RadialDirection dir; float vec[2]; + float factor[2]; dir = ui_get_radialbut_vec(vec, itemnum); + factor[0] = (vec[0] > 0.01f) ? 0.0f : ((vec[0] < -0.01f) ? -1.0f : -0.5f); + factor[1] = (vec[1] > 0.99f) ? 0.0f : ((vec[1] < -0.99f) ? -1.0f : -0.5f); itemnum++; @@ -2199,7 +2202,7 @@ static void ui_litem_layout_radial(uiLayout *litem) ui_item_size(item, &itemw, &itemh); - ui_item_position(item, x + vec[0] * pie_radius - itemw / 2, y + vec[1] * pie_radius - itemh / 2, itemw, itemh); + ui_item_position(item, x + vec[0] * pie_radius + factor[0] * itemw, y + vec[1] * pie_radius + factor[1] * itemh, itemw, itemh); minx = min_ii(minx, x + vec[0] * pie_radius - itemw / 2); maxx = max_ii(maxx, x + vec[0] * pie_radius + itemw / 2); @@ -2232,7 +2235,7 @@ static void ui_litem_layout_root_radial(uiLayout *litem) ui_item_size(item, &itemw, &itemh); - ui_item_position(item, x - itemw / 2, y + 2 * UI_UNIT_Y, itemw, itemh); + ui_item_position(item, x - itemw / 2, y + U.pixelsize * (U.pie_menu_threshold + 9.0f), itemw, itemh); } } |