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:
authorClément Foucault <foucault.clem@gmail.com>2018-11-10 20:40:59 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-11-12 15:50:22 +0300
commit150218e58b24e2e1d61d9f7321d6148b54a54be7 (patch)
treec124504ba82d81ef8d4fccdbee62fa6f83150889 /source/blender/editors/space_view3d/view3d_gizmo_ruler.c
parentb44ea9f8bb10dd6550c9c147cf71605542b0747c (diff)
Ruler Tool: Fix non readable text
The ruler tool is using a hard coded background color. Invert it if the text color is bright. In the future we should maybe use a theme color instead of guessing as it does not work well with middle gray colors.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_gizmo_ruler.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_ruler.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
index f35b88950d7..34709e434ac 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
@@ -507,7 +507,6 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz)
RegionView3D *rv3d = ar->regiondata;
const float cap_size = 4.0f;
const float bg_margin = 4.0f * U.pixelsize;
- const float bg_radius = 4.0f * U.pixelsize;
const float arc_size = 64.0f * U.pixelsize;
#define ARC_STEPS 24
const int arc_steps = ARC_STEPS;
@@ -528,6 +527,11 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz)
UI_GetThemeColor3ubv(TH_TEXT, color_text);
UI_GetThemeColor3ubv(TH_WIRE, color_wire);
+ /* Avoid white on white text. (TODO Fix by using theme) */
+ if ((int)color_text[0] + (int)color_text[1] + (int)color_text[2] > 127 * 3 * 0.6f) {
+ copy_v3_fl(color_back, 0.0f);
+ }
+
const bool is_act = (gz->flag & WM_GIZMO_DRAW_HOVER);
float dir_ruler[2];
float co_ss[3][2];