From a378668ac2c0220863311df4bc5e1aa8114e6bd2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 9 Oct 2011 01:11:07 +0000 Subject: [PATCH] text edit: selecting zoomed in text with the mouse had an incorrect offset. --- source/blender/editors/interface/interface_handlers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 8855bbd8e64..9ad828f91c1 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1307,12 +1307,12 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho } /* mouse inside the widget */ else if (x >= startx) { - float aspect= (but->block->aspect); + const float aspect_sqrt= sqrtf(but->block->aspect); but->pos= strlen(origstr)-but->ofs; /* XXX does not take zoom level into account */ - while (startx + aspect*BLF_width(fstyle->uifont_id, origstr+but->ofs) > x) { + while (startx + aspect_sqrt * BLF_width(fstyle->uifont_id, origstr+but->ofs) > x) { if (but->pos <= 0) break; but->pos--; origstr[but->pos+but->ofs] = 0;