diff options
author | Ton Roosendaal <ton@blender.org> | 2004-11-18 17:34:30 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2004-11-18 17:34:30 +0300 |
commit | a0de0d084e1531cd828e47bbc3ee74cae6dd607e (patch) | |
tree | e57791596df6483894ee84f9de3e58aa8752c03c /source/blender/src/view.c | |
parent | b0db81b0df8ca72dc259df863e48dee62d7a44c6 (diff) |
Made view3d "home" and "local view" and "zoom to selection" (dot key) doing
all the same. The latter two didnt take aspect ratio of windows into account
Diffstat (limited to 'source/blender/src/view.c')
-rw-r--r-- | source/blender/src/view.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/source/blender/src/view.c b/source/blender/src/view.c index 462d838ea99..2cec1433986 100644 --- a/source/blender/src/view.c +++ b/source/blender/src/view.c @@ -932,7 +932,7 @@ void initlocalview() afm[0]= (max[0]-min[0]); afm[1]= (max[1]-min[1]); afm[2]= (max[2]-min[2]); - size= MAX3(afm[0], afm[1], afm[2]); + size= 0.7*MAX3(afm[0], afm[1], afm[2]); if(size<=0.01) size= 0.01; } @@ -946,6 +946,13 @@ void initlocalview() G.vd->dist= size; + // correction for window aspect ratio + if(curarea->winy>2 && curarea->winx>2) { + size= (float)curarea->winx/(float)curarea->winy; + if(size<1.0) size= 1.0/size; + G.vd->dist*= size; + } + if(G.vd->persp>1) { G.vd->persp= 1; @@ -1009,21 +1016,25 @@ void centreview() /* like a localview without local! */ afm[0]= (max[0]-min[0]); afm[1]= (max[1]-min[1]); afm[2]= (max[2]-min[2]); - size= MAX3(afm[0], afm[1], afm[2]); + size= 0.7*MAX3(afm[0], afm[1], afm[2]); if(size<=0.01) size= 0.01; - - G.vd->ofs[0]= -(min[0]+max[0])/2.0; G.vd->ofs[1]= -(min[1]+max[1])/2.0; G.vd->ofs[2]= -(min[2]+max[2])/2.0; G.vd->dist= size; + // correction for window aspect ratio + if(curarea->winy>2 && curarea->winx>2) { + size= (float)curarea->winx/(float)curarea->winy; + if(size<1.0) size= 1.0/size; + G.vd->dist*= size; + } + if(G.vd->persp>1) { G.vd->persp= 1; - } G.vd->cursor[0]= -G.vd->ofs[0]; @@ -1121,7 +1132,7 @@ void view3d_home(int centre) afm[0]= (max[0]-min[0]); afm[1]= (max[1]-min[1]); afm[2]= (max[2]-min[2]); - size= MAX3(afm[0], afm[1], afm[2]); + size= 0.7*MAX3(afm[0], afm[1], afm[2]); if(size==0.0) ok= 0; if(ok) { |