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:
authorCampbell Barton <ideasman42@gmail.com>2017-09-05 17:40:20 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-09-05 17:40:20 +0300
commitbffa57e6d83d157cb81a631a92cd20e7958a69a4 (patch)
treea25d9e8d4650f4828f45ae96aa248ba6e11a35a0 /source/blender/editors/manipulator_library
parent16e5b932b7500e7e98978abbb06cd6a9a423dd9c (diff)
Manipulator: Fix arrow2d drawing outside hotspot
Diffstat (limited to 'source/blender/editors/manipulator_library')
-rw-r--r--source/blender/editors/manipulator_library/manipulator_types/arrow2d_manipulator.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/editors/manipulator_library/manipulator_types/arrow2d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/arrow2d_manipulator.c
index c789e6a13b0..44dd5698a48 100644
--- a/source/blender/editors/manipulator_library/manipulator_types/arrow2d_manipulator.c
+++ b/source/blender/editors/manipulator_library/manipulator_types/arrow2d_manipulator.c
@@ -63,8 +63,10 @@
static void arrow2d_draw_geom(wmManipulator *mpr, const float matrix[4][4], const float color[4])
{
const float size = 0.11f;
- const float size_h = size / 2.0f;
- const float arrow_length = RNA_float_get(mpr->ptr, "length");
+ const float size_breadth = size / 2.0f;
+ const float size_length = size * 1.7f;
+ /* Subtract the length so the arrow fits in the hotspot. */
+ const float arrow_length = RNA_float_get(mpr->ptr, "length") - size_length;
const float arrow_angle = RNA_float_get(mpr->ptr, "angle");
uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -83,9 +85,9 @@ static void arrow2d_draw_geom(wmManipulator *mpr, const float matrix[4][4], cons
immEnd();
immBegin(GWN_PRIM_TRIS, 3);
- immVertex2f(pos, size_h, arrow_length);
- immVertex2f(pos, -size_h, arrow_length);
- immVertex2f(pos, 0.0f, arrow_length + size * 1.7f);
+ immVertex2f(pos, size_breadth, arrow_length);
+ immVertex2f(pos, -size_breadth, arrow_length);
+ immVertex2f(pos, 0.0f, arrow_length + size_length);
immEnd();
immUnbindProgram();