Fix T44432: Zoom to mouse fails /w FCurve editor
authorCampbell Barton <ideasman42@gmail.com>
Tue, 21 Apr 2015 03:10:32 +0000 (13:10 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 21 Apr 2015 03:10:32 +0000 (13:10 +1000)
source/blender/editors/interface/view2d_ops.c
source/blender/makesdna/DNA_view2d_types.h

index 5730c9678800adf5b7f7b71be16e7f2b509fe7ce..58b51ef8e2899c6dc332f553340e1903c40a4729 100644 (file)
@@ -661,7 +661,9 @@ static void view_zoomstep_apply_ex(bContext *C, v2dViewZoomData *vzd, const bool
                                const float zoomx = (float)(BLI_rcti_size_x(&v2d->mask) + 1) / BLI_rctf_size_x(&v2d->cur);
 
                                /* only move view to mouse if zoom fac is inside minzoom/maxzoom */
-                               if (IN_RANGE_INCL(zoomx, v2d->minzoom, v2d->maxzoom)) {
+                               if (((v2d->keepzoom & V2D_LIMITZOOM) == 0) ||
+                                   IN_RANGE_INCL(zoomx, v2d->minzoom, v2d->maxzoom))
+                               {
                                        float mval_fac = (vzd->mx_2d - cur_old.xmin) / BLI_rctf_size_x(&cur_old);
                                        float mval_faci = 1.0f - mval_fac;
                                        float ofs = (mval_fac * dx) - (mval_faci * dx);
@@ -692,7 +694,9 @@ static void view_zoomstep_apply_ex(bContext *C, v2dViewZoomData *vzd, const bool
                                const float zoomy = (float)(BLI_rcti_size_y(&v2d->mask) + 1) / BLI_rctf_size_y(&v2d->cur);
 
                                /* only move view to mouse if zoom fac is inside minzoom/maxzoom */
-                               if (IN_RANGE_INCL(zoomy, v2d->minzoom, v2d->maxzoom)) {
+                               if (((v2d->keepzoom & V2D_LIMITZOOM) == 0) ||
+                                   IN_RANGE_INCL(zoomy, v2d->minzoom, v2d->maxzoom))
+                               {
                                        float mval_fac = (vzd->my_2d - cur_old.ymin) / BLI_rctf_size_y(&cur_old);
                                        float mval_faci = 1.0f - mval_fac;
                                        float ofs = (mval_fac * dy) - (mval_faci * dy);
index a7921be44d54a2416271bf0ffef395fa06411b31..6f2e347c84d65cbeee7160ef4c1394aa1e81dd1e 100644 (file)
@@ -43,7 +43,7 @@ typedef struct View2D {
        rcti mask;                                              /* mask - region (in screenspace) within which 'cur' can be viewed */
        
        float min[2], max[2];                   /* min/max sizes of 'cur' rect (only when keepzoom not set) */
-       float minzoom, maxzoom;                 /* self explanatory. allowable zoom factor range (only when keepzoom set) */
+       float minzoom, maxzoom;                 /* allowable zoom factor range (only when (keepzoom & V2D_LIMITZOOM)) is set */
        
        short scroll;                                   /* scroll - scrollbars to display (bitflag) */
        short scroll_ui;                                /* scroll_ui - temp settings used for UI drawing of scrollers */