diff options
author | Diego Borghetti <bdiego@gmail.com> | 2010-07-20 02:47:15 +0400 |
---|---|---|
committer | Diego Borghetti <bdiego@gmail.com> | 2010-07-20 02:47:15 +0400 |
commit | 1033b60824c291089e568e1b20b8b1a734cb28e1 (patch) | |
tree | 6c34ddce07e618b67899c4c3aaa29b7b0cf41cab /source/blender/editors | |
parent | c7ce37471d8f7858735695ad92db1731fa2c1ae3 (diff) |
Fix #22911
[#22911] Node editors: pressing home doesn't zoom properly
Was using the incorrect value to calculate the new area
(also a typo in the ymax/xmax).
The bug can be found on the 2.4x version too, not really
sure how old is it.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_node/node_state.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/editors/space_node/node_state.c b/source/blender/editors/space_node/node_state.c index 6b3cfd11135..e12730f4317 100644 --- a/source/blender/editors/space_node/node_state.c +++ b/source/blender/editors/space_node/node_state.c @@ -243,7 +243,7 @@ static void snode_home(ScrArea *sa, ARegion *ar, SpaceNode* snode) cur->xmin= cur->ymin= 0.0f; cur->xmax=ar->winx; - cur->xmax= ar->winy; + cur->ymax=ar->winy; if(snode->edittree) { for(node= snode->edittree->nodes.first; node; node= node->next) { @@ -261,19 +261,20 @@ static void snode_home(ScrArea *sa, ARegion *ar, SpaceNode* snode) snode->yof= 0; width= cur->xmax - cur->xmin; height= cur->ymax- cur->ymin; + if(width > height) { float newheight; newheight= oldheight * width/oldwidth; cur->ymin= cur->ymin - newheight/4; - cur->ymax= cur->ymin + newheight; + cur->ymax= cur->ymax + newheight/4; } else { float newwidth; newwidth= oldwidth * height/oldheight; cur->xmin= cur->xmin - newwidth/4; - cur->xmax= cur->xmin + newwidth; + cur->xmax= cur->xmax + newwidth/4; } - + ar->v2d.tot= ar->v2d.cur; UI_view2d_curRect_validate(&ar->v2d); } |