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:
authorGermano <germano.costa@ig.com.br>2018-06-02 09:17:51 +0300
committerGermano <germano.costa@ig.com.br>2018-06-02 18:19:49 +0300
commit58efa7d686351d31c8eefe77464ef606369e939c (patch)
tree27f2d7ee35b5397c5e10412b3041bb32001ab017 /source/blender/editors/screen/screen_edit.c
parent0de0cee9a28185bf0d8ac31a15920f93537a16f3 (diff)
Fix inaccuracy of SCREEN_OT_area_split when snap to midpoint and adjacent.
By default when moving a edge of the screen it always snaps to an invisible grid with unit of 4 pixels. This was also affecting the snap to the midpoint and adjacent. The solution was to make the snap to areagrid optional and use values of `origmin` and `origsize` that match the transformations in screen_edit.c.
Diffstat (limited to 'source/blender/editors/screen/screen_edit.c')
-rw-r--r--source/blender/editors/screen/screen_edit.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index da7bc9359dc..06f45fa0d00 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -226,25 +226,25 @@ static short testsplitpoint(ScrArea *sa, char dir, float fac)
CLAMP(fac, 0.0f, 1.0f);
if (dir == 'h') {
- y = sa->v1->vec.y + fac * (sa->v2->vec.y - sa->v1->vec.y);
-
+ y = sa->v1->vec.y +
+ round_fl_to_short(fac * (float)(sa->v2->vec.y - sa->v1->vec.y));
+
if (y - sa->v1->vec.y < area_min_y)
y = sa->v1->vec.y + area_min_y;
else if (sa->v2->vec.y - y < area_min_y)
y = sa->v2->vec.y - area_min_y;
- else y -= (y % AREAGRID);
-
+
return y;
}
else {
- x = sa->v1->vec.x + fac * (sa->v4->vec.x - sa->v1->vec.x);
-
+ x = sa->v1->vec.x +
+ round_fl_to_short(fac * (float)(sa->v4->vec.x - sa->v1->vec.x));
+
if (x - sa->v1->vec.x < area_min_x)
x = sa->v1->vec.x + area_min_x;
else if (sa->v4->vec.x - x < area_min_x)
x = sa->v4->vec.x - area_min_x;
- else x -= (x % AREAGRID);
-
+
return x;
}
}
@@ -609,7 +609,7 @@ static void screen_vertices_scale(
if (screen_size_x_prev != screen_size_x || screen_size_y_prev != screen_size_y) {
const float facx = ((float)screen_size_x - 1) / ((float)screen_size_x_prev - 1);
- const float facy = ((float)screen_size_y) / ((float)screen_size_y_prev);
+ const float facy = ((float)screen_size_y - 1) / ((float)screen_size_y_prev - 1);
/* make sure it fits! */
for (sv = sc->vertbase.first; sv; sv = sv->next) {
@@ -617,7 +617,7 @@ static void screen_vertices_scale(
CLAMP(sv->vec.x, screen_rect->xmin, screen_rect->xmax - 1);
sv->vec.y = screen_rect->ymin + round_fl_to_short((sv->vec.y - min[1]) * facy);
- CLAMP(sv->vec.y, screen_rect->ymin, screen_rect->ymax);
+ CLAMP(sv->vec.y, screen_rect->ymin, screen_rect->ymax - 1);
}
}