diff options
author | Severin <eiseljulian@gmail.com> | 2018-06-29 22:22:27 +0300 |
---|---|---|
committer | Severin <eiseljulian@gmail.com> | 2018-06-29 22:29:06 +0300 |
commit | 48ad67ef8201f8fcd5efdf748c5fea86e2c61d7d (patch) | |
tree | 7ea1d3f862bc5ea54b4b7134be07ab416ea9df04 /source/blender/editors/screen/screen_ops.c | |
parent | ac2e10d47b38e944efab66781ed0a4f4d4c41588 (diff) |
Cleanup: Add/use function to get area width/height from area vertices
This used to be rather cryptic and it was easy to forget the `+ 1` which in fact
is needed to get the correct width/height, see e626998a262ebe4f. This should
also fix some minor off-by-one errors.
Diffstat (limited to 'source/blender/editors/screen/screen_ops.c')
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 35608a1f303..e4de87e0b46 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -1282,7 +1282,7 @@ static void area_move_set_limits( if (sa->v2->vec.y < (window_rect.ymax - 1)) areamin += U.pixelsize; - y1 = sa->v2->vec.y - sa->v1->vec.y + 1 - areamin; + y1 = area_geometry_height(sa) - areamin; /* if top or down edge selected, test height */ if (sa->v1->editflag && sa->v4->editflag) @@ -1299,7 +1299,7 @@ static void area_move_set_limits( if (sa->v4->vec.x < (window_rect.xmax - 1)) areamin += U.pixelsize; - x1 = sa->v4->vec.x - sa->v1->vec.x + 1 - areamin; + x1 = area_geometry_width(sa) - areamin; /* if left or right edge selected, test width */ if (sa->v1->editflag && sa->v2->editflag) @@ -1460,7 +1460,7 @@ static void area_move_apply_do( ED_screen_areas_iter(win, sc, sa) { if (sa->v1->editflag || sa->v2->editflag || sa->v3->editflag || sa->v4->editflag) { if (ED_area_is_global(sa)) { - sa->global->cur_fixed_height = round_fl_to_int((sa->v2->vec.y - sa->v1->vec.y) / UI_DPI_FAC); + sa->global->cur_fixed_height = round_fl_to_int(area_geometry_height(sa) / UI_DPI_FAC); sc->do_refresh = true; redraw_all = true; } |