diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-03-12 10:25:06 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-03-12 10:25:06 +0400 |
commit | 763d4b2394d499ad48e0649a006396d47a78d464 (patch) | |
tree | a1677be2a02385d4b587758c2e804435e2797760 /source/blender/editors/space_view3d/view3d_ruler.c | |
parent | 8661e820f903ea734dcd45b84b4dbc83294d7419 (diff) |
ruler: disable rotate with ruler drawing, was drawing too pixelated and hard to read.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_ruler.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_ruler.c | 38 |
1 files changed, 7 insertions, 31 deletions
diff --git a/source/blender/editors/space_view3d/view3d_ruler.c b/source/blender/editors/space_view3d/view3d_ruler.c index e986077471e..e263d0347bc 100644 --- a/source/blender/editors/space_view3d/view3d_ruler.c +++ b/source/blender/editors/space_view3d/view3d_ruler.c @@ -412,6 +412,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a BLF_enable(blf_mono_font, BLF_ROTATION); BLF_size(blf_mono_font, 14 * U.pixelsize, U.dpi); + BLF_rotation(blf_mono_font, 0.0f); UI_GetThemeColor3ubv(TH_TEXT, color_text); UI_GetThemeColor3ubv(TH_WIRE, color_wire); @@ -506,8 +507,8 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a /* draw text (bg) */ glColor4ubv(color_back); uiSetRoundBox(UI_CNR_ALL); - uiRoundBox(pos[0] - bg_margin, pos[1] - bg_margin, - pos[0] + numstr_size[0] + bg_margin, pos[1] + numstr_size[1] + bg_margin, + uiRoundBox(pos[0] - bg_margin, pos[1] - bg_margin, + pos[0] + bg_margin + numstr_size[0], pos[1] + bg_margin + numstr_size[1], bg_radius); /* draw text */ glColor3ubv(color_text); @@ -580,27 +581,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a char numstr[256]; float numstr_size[2]; const int prec = 6; /* XXX, todo, make optional */ - const float dir_default_x[2] = {1, 0}; float pos[2]; - float numstr_angle; - bool flip_text; - - - /* angle for text */ - numstr_angle = angle_signed_v2v2(dir_ruler, dir_default_x); - - /* keep text upright */ - if (numstr_angle >= (float)(M_PI / 2.0)) { - numstr_angle -= (float)M_PI; - flip_text = true; - } - else if (numstr_angle <= -(float)(M_PI / 2.0)) { - numstr_angle += (float)M_PI; - flip_text = true; - } - else { - flip_text = false; - } ruler_item_as_string(ruler_item, unit, numstr, sizeof(numstr), prec); @@ -609,23 +590,18 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a mid_v2_v2v2(pos, co_ss[0], co_ss[2]); /* center text */ - normalize_v2(dir_ruler); - madd_v2_v2fl(pos, dir_ruler, numstr_size[0] / (flip_text ? 2.0f : -2.0f)); + pos[0] -= numstr_size[0] / 2.0f; + pos[1] -= numstr_size[1] / 2.0f; /* draw text (bg) */ - glTranslatef(pos[0], pos[1], 0.0f); - glRotatef(RAD2DEGF(numstr_angle), 0.0f, 0.0f, 1.0f); glColor4ubv(color_back); uiSetRoundBox(UI_CNR_ALL); - uiRoundBox(-bg_margin, -bg_margin, - numstr_size[0] + bg_margin, numstr_size[1] + bg_margin, + uiRoundBox(pos[0] - bg_margin, pos[1] - bg_margin, + pos[0] + bg_margin + numstr_size[0], pos[1] + bg_margin + numstr_size[1], bg_radius); - glRotatef(-RAD2DEGF(numstr_angle), 0.0f, 0.0f, 1.0f); - glTranslatef(-pos[0], -pos[1], 0.0f); /* draw text */ glColor3ubv(color_text); BLF_position(blf_mono_font, pos[0], pos[1], 0.0f); - BLF_rotation(blf_mono_font, numstr_angle); BLF_draw(blf_mono_font, numstr, sizeof(numstr)); } |