diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-09-28 12:52:02 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-09-28 12:52:02 +0400 |
commit | ea187e54a8cd4456dbbfb474ba652b2aab69756f (patch) | |
tree | 99d8749a615dc43e708a4762b578fe5ef9189a47 /source | |
parent | 92ee7ca94659783230ae1d10ab63ab7684718e8f (diff) |
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.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/interface/view2d.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_image/space_image.c | 14 |
2 files changed, 10 insertions, 8 deletions
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index be58a78ca85..2da491e488d 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -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); diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index f041cb00ee4..55b910cf6b4 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -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 */ |