Page MenuHome

UV/Image Editor's Zoom rate is not properly calculated.
Closed, ArchivedPublicPATCH

Description

I noticed UV/Image Editor's Image size is a little smaller than grid size.
I think it is because zoomx, zoomy value is not calculated properly.
Please check this patch.

Event Timeline

And a little more information.

xoomx, xoomy is calculated in ED_space_image_zoom() like this way.

*zoomx= (float)(ar->winrct.xmax - ar->winrct.xmin)/(float)((ar->v2d.cur.xmax - ar->v2d.cur.xmin)*width);
*zoomy= (float)(ar->winrct.ymax - ar->winrct.ymin)/(float)((ar->v2d.cur.ymax - ar->v2d.cur.ymin)*height);

And ar->v2d.cur.xmax, ar->v2d.cur.ymax is calculated in image_main_area_set_view2d() like this.

ar->v2d.cur.xmax= ar->v2d.cur.xmin + ((float)winx/sima->zoom);
ar->v2d.cur.ymax= ar->v2d.cur.ymin + ((float)winy/sima->zoom);

And winx, winy is calculated like this way.
winx= ar->winrct.xmax - ar->winrct.xmin + 1;
winy= ar->winrct.ymax - ar->winrct.ymin + 1;

So, I think calculation of zoomx, zoomy need "+ 1".

Thanks for the patch, committed to svn.

Brecht Van Lommel (brecht) changed the task status from Unknown Status to Unknown Status.Jan 26 2010, 12:37 PM