Fix #19482: setting cursor position in uv editor was not correct

zoomed in, needed to make view2d offset for pixel rounding dependent
on zoom level.
This commit is contained in:
Brecht Van Lommel
2009-09-28 08:52:02 +00:00
parent 92ee7ca946
commit ea187e54a8
2 changed files with 10 additions and 8 deletions

View File

@@ -973,8 +973,8 @@ void UI_view2d_view_ortho(const bContext *C, View2D *v2d)
/* XXX brecht: instead of zero at least use a tiny offset, otherwise
* pixel rounding is effectively random due to float inaccuracy */
xofs= 0.001f;
yofs= 0.001f;
xofs= 0.001f*(v2d->cur.xmax - v2d->cur.xmin)/(v2d->mask.xmax - v2d->mask.xmin);
yofs= 0.001f*(v2d->cur.ymax - v2d->cur.ymin)/(v2d->mask.ymax - v2d->mask.ymin);
/* apply mask-based adjustments to cur rect (due to scrollers), to eliminate scaling artifacts */
view2d_map_cur_using_mask(v2d, &curmasked);

View File

@@ -374,8 +374,8 @@ static void image_main_area_set_view2d(SpaceImage *sima, ARegion *ar, Scene *sce
ar->v2d.mask.ymax= winy;
/* which part of the image space do we see? */
x1= ar->winrct.xmin+(winx-sima->zoom*w)/2;
y1= ar->winrct.ymin+(winy-sima->zoom*h)/2;
x1= ar->winrct.xmin+(winx-sima->zoom*w)/2.0f;
y1= ar->winrct.ymin+(winy-sima->zoom*h)/2.0f;
x1-= sima->zoom*sima->xof;
y1-= sima->zoom*sima->yof;
@@ -440,11 +440,13 @@ static void image_main_area_draw(const bContext *C, ARegion *ar)
/* and uvs in 0.0-1.0 space */
UI_view2d_view_ortho(C, v2d);
draw_uvedit_main(sima, ar, scene, obedit);
ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST);
draw_uvedit_main(sima, ar, scene, obedit);
ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST);
/* Grease Pencil too (in addition to UV's) */
draw_image_grease_pencil((bContext *)C, 1);
/* Grease Pencil too (in addition to UV's) */
draw_image_grease_pencil((bContext *)C, 1);
UI_view2d_view_restore(C);
/* draw Grease Pencil - screen space only */