diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-04-22 14:19:58 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-04-22 14:19:58 +0300 |
commit | 1044dfd965a8a0b85095ce51b34eb3876701d967 (patch) | |
tree | 6dbcdbc82c21bb79be523e453339969dd67272ff /source/blender/editors/screen/area.c | |
parent | a069b8d5d8195b9eb517c604f151366b51578d1e (diff) |
Fix and simplify vertical positioning and calculation of metadata
display more.
Diffstat (limited to 'source/blender/editors/screen/area.c')
-rw-r--r-- | source/blender/editors/screen/area.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index c6de4e5df88..8844f344a6b 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -2097,7 +2097,8 @@ static void metadata_draw_imbuf(ImBuf *ibuf, rcti rect, int fontid, const bool i else { len = BLI_snprintf_rlen(temp_str, MAX_METADATA_STR, "%s: ", meta_data_list[i + 1]); if (metadata_is_valid(ibuf, temp_str, i + 1, len)) { - BLF_position(fontid, rect.xmax + (0.2f * U.widget_unit), + line_width = BLF_width(fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX); + BLF_position(fontid, rect.xmax - line_width - (0.2f * U.widget_unit), rect.ymax - factor * (1.5f * U.widget_unit - UI_UNIT_Y) - ofs_y, 0.0f); BLF_draw(fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX); ofs_y += (height + (0.2f * U.widget_unit)); @@ -2112,7 +2113,7 @@ static void metadata_draw_imbuf(ImBuf *ibuf, rcti rect, int fontid, const bool i if (metadata_is_valid(ibuf, temp_str, i, len)) { const int line_height = height; BLF_position(fontid, rect.xmin + (0.2f * U.widget_unit) + ofs_x, - rect.ymin - line_height + factor * (1.5f * U.widget_unit), 0.0f); + rect.ymin - line_height + factor * (U.widget_unit), 0.0f); BLF_draw(fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX); ofs_x += BLF_width(fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX) + UI_UNIT_X; @@ -2124,26 +2125,29 @@ static void metadata_draw_imbuf(ImBuf *ibuf, rcti rect, int fontid, const bool i static float metadata_box_height_get(ImBuf *ibuf, int fontid, const bool is_top) { char str[MAX_METADATA_STR]; - float height = 0; - short i; + short i, count = 0; + const float height = BLF_height_max(fontid) + 0.2f * U.widget_unit; if (is_top) { - for (i = 0; i < 5 ; i++) { + if (metadata_is_valid(ibuf, str, 0, 0) || metadata_is_valid(ibuf, str, 1, 0)) { + count++; + } + for (i = 2; i < 5; i++) { if (metadata_is_valid(ibuf, str, i, 0)) { - height += BLF_height(fontid, str, strlen(str)); + count++; } } } else { for (i = 5; i < 10; i++) { if (metadata_is_valid(ibuf, str, i, 0)) { - height += BLF_height(fontid, str, strlen(str)); + count = 1; } } } - if (height) { - return (height + (0.2f * U.widget_unit)); + if (count) { + return (height * count + (0.2f * U.widget_unit)); } return 0; |