diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-10-28 21:46:31 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-10-28 21:46:31 +0400 |
commit | 651efb37630ed7a017870e0ab61d268af9716478 (patch) | |
tree | 469a44df5b8e4a4e1fa884cb61ba8aed5b3edfd3 /source/blender/editors/screen | |
parent | 905c5f794866d63a1fe0183eef327184548fd85e (diff) |
bugfix [#24428] Interface Regions will not keep relative proportions
screen verts were being rounded so resizing a window would end up moving the border in one direction.
for this to work properly we should store floats internally but for now compensate for this.
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r-- | source/blender/editors/screen/screen_edit.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 2cd6dafa167..cd2e1d030ff 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -608,6 +608,10 @@ void select_connected_scredge(bScreen *sc, ScrEdge *edge) } /* test if screen vertices should be scaled */ + +/* needed to alternate AREAGRID snapping else it shifts one way + * to avoid this we should use floats at least during runtime [#24428]. */ +static char scale_alt_bool= 0; static void screen_test_scale(bScreen *sc, int winsizex, int winsizey) { ScrVert *sv=NULL; @@ -643,20 +647,26 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey) /* make sure it fits! */ for(sv= sc->vertbase.first; sv; sv= sv->next) { + /* 0.1519 was 0.5f, but tweaked so resizing the window doesnt favor one direction + * also note scale_alt_bool */ tempf= ((float)sv->vec.x)*facx; - sv->vec.x= (short)(tempf+0.5); - sv->vec.x+= AREAGRID-1; + sv->vec.x= (short)(tempf+0.1519); + sv->vec.x+= AREAGRID-2; + sv->vec.x-= scale_alt_bool; sv->vec.x-= (sv->vec.x % AREAGRID); CLAMP(sv->vec.x, 0, winsizex); tempf= ((float)sv->vec.y )*facy; - sv->vec.y= (short)(tempf+0.5); - sv->vec.y+= AREAGRID-1; + sv->vec.y= (short)(tempf+0.1519); + sv->vec.y+= AREAGRID-2; + sv->vec.y-= scale_alt_bool; sv->vec.y-= (sv->vec.y % AREAGRID); CLAMP(sv->vec.y, 0, winsizey); } + + scale_alt_bool= scale_alt_bool ? 0:1; } /* test for collapsed areas. This could happen in some blender version... */ |