Durian Request/Bugfixes: Graph Editor Zooming doesn't go far enough

Pushed limits for Graph Editor view extents to proper limits, and fixed clamping used in View2D code which was preventing height of View2D viewports from getting below 1.0
This commit is contained in:
2010-01-25 11:06:55 +00:00
parent 7eb5504d79
commit 3b446ed4e4
3 changed files with 21 additions and 11 deletions

View File

@@ -4632,7 +4632,7 @@ static void lib_link_screen(FileData *fd, Main *main)
for (sl= sa->spacedata.first; sl; sl= sl->next) {
if(sl->spacetype==SPACE_VIEW3D) {
View3D *v3d= (View3D*) sl;
BGpic *bgpic;
BGpic *bgpic = NULL;
v3d->camera= newlibadr(fd, sc->id.lib, v3d->camera);
v3d->ob_centre= newlibadr(fd, sc->id.lib, v3d->ob_centre);
@@ -6184,7 +6184,13 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
/* init mainarea view2d */
ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_VERTICAL);
ar->v2d.min[0]= FLT_MIN;
ar->v2d.min[1]= FLT_MIN;
ar->v2d.max[0]= MAXFRAMEF;
ar->v2d.max[1]= FLT_MAX;
//ar->v2d.flag |= V2D_IS_INITIALISED;
break;
}

View File

@@ -25,6 +25,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
#include <float.h>
#include <limits.h>
#include <math.h>
#include <string.h>
@@ -347,11 +348,14 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
if (v2d->keepzoom & V2D_LOCKZOOM_Y)
height= winy;
/* values used to divide, so make it safe */
if(width<1) width= 1;
if(height<1) height= 1;
if(winx<1) winx= 1;
if(winy<1) winy= 1;
/* values used to divide, so make it safe
* NOTE: width and height must use FLT_MIN instead of 1, otherwise it is impossible to
* get enough resolution in Graph Editor for editing some curves
*/
if(width < FLT_MIN) width= 1;
if(height < FLT_MIN) height= 1;
if(winx < 1) winx= 1;
if(winy < 1) winy= 1;
/* V2D_LIMITZOOM indicates that zoom level should be preserved when the window size changes */
if (resize && (v2d->keepzoom & V2D_KEEPZOOM)) {

View File

@@ -151,11 +151,11 @@ static SpaceLink *graph_new(const bContext *C)
ar->v2d.cur= ar->v2d.tot;
ar->v2d.min[0]= 0.00001f;
ar->v2d.min[1]= 0.00001f;
ar->v2d.min[0]= FLT_MIN;
ar->v2d.min[1]= FLT_MIN;
ar->v2d.max[0]= MAXFRAMEF;
ar->v2d.max[1]= 50000.0f;
ar->v2d.max[1]= FLT_MAX;
ar->v2d.scroll= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_VERTICAL);