diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-10-09 05:11:07 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-10-09 05:11:07 +0400 |
commit | a378668ac2c0220863311df4bc5e1aa8114e6bd2 (patch) | |
tree | e31ab129ebdb7c489a3a9856dc876c78d75540e6 /source | |
parent | e50a4858367cbd51be7e4ed0f4f6e9756bf684d9 (diff) |
text edit: selecting zoomed in text with the mouse had an incorrect offset.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 4 |
1 files 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; |