Fix T44432: Zoom to mouse fails /w FCurve editor

This commit is contained in:
Campbell Barton 2015-04-21 13:10:32 +10:00
parent 62e149881a
commit 912397756a
Notes: blender-bot 2023-04-19 22:54:54 +02:00
Referenced by issue #44432, Graph Editor Zoom to Mouse Position Does not Work
2 changed files with 7 additions and 3 deletions

View 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);

View 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 */