Invert value calculation for percentages it makes more sense that way
authorAntony Riakiotakis <kalast@gmail.com>
Thu, 14 May 2015 12:16:28 +0000 (14:16 +0200)
committerAntony Riakiotakis <kalast@gmail.com>
Thu, 14 May 2015 12:22:57 +0000 (14:22 +0200)
source/blender/windowmanager/intern/wm_operators.c

index e8782a744bf60ebab9e5bd6615c5eb6b2c5cd89a..6820493132be883a9c62deb83611c615f9706c26 100644 (file)
@@ -3900,7 +3900,7 @@ static void radial_control_set_initial_mouse(RadialControl *rc, const wmEvent *e
                        d[0] = rc->initial_value * U.pixelsize;
                        break;
                case PROP_PERCENTAGE:
-                       d[0] = (100.0f - rc->initial_value) / 100.0f * WM_RADIAL_CONTROL_DISPLAY_WIDTH + WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE;
+                       d[0] = (rc->initial_value) / 100.0f * WM_RADIAL_CONTROL_DISPLAY_WIDTH + WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE;
                        break;
                case PROP_FACTOR:
                        d[0] = (1 - rc->initial_value) * WM_RADIAL_CONTROL_DISPLAY_WIDTH + WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE;
@@ -4014,7 +4014,7 @@ static void radial_control_paint_cursor(bContext *C, int x, int y, void *customd
                        alpha = 0.75;
                        break;
                case PROP_PERCENTAGE:
-                       r1 = (100.0f - rc->current_value) / 100.0f * WM_RADIAL_CONTROL_DISPLAY_WIDTH + WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE;
+                       r1 = rc->current_value / 100.0f * WM_RADIAL_CONTROL_DISPLAY_WIDTH + WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE;
                        r2 = tex_radius = WM_RADIAL_CONTROL_DISPLAY_SIZE;
                        rmin = WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE;
                        BLI_snprintf(str, WM_RADIAL_MAX_STR, "%3.1f%%", rc->current_value);
@@ -4462,7 +4462,7 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even
                                                        new_value /= U.pixelsize;
                                                        break;
                                                case PROP_PERCENTAGE:
-                                                       new_value = ((WM_RADIAL_CONTROL_DISPLAY_SIZE - dist) / WM_RADIAL_CONTROL_DISPLAY_WIDTH) * 100.0f;
+                                                       new_value = ((dist - WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE) / WM_RADIAL_CONTROL_DISPLAY_WIDTH) * 100.0f;
                                                        if (snap) new_value = ((int)(new_value + 2.5)) / 5 * 5;
                                                        break;
                                                case PROP_FACTOR: