mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 08:28:25 +00:00
less crude MathXArray::x2pos for preciser cursor positioning using the mouse
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2325 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c1bd906202
commit
c1364850c0
@ -10,6 +10,9 @@
|
|||||||
|
|
||||||
* math_cursor.C: ^ now copies selection into new srriptinset
|
* math_cursor.C: ^ now copies selection into new srriptinset
|
||||||
|
|
||||||
|
* xarray.C: less crude MathXArray::x2pos for preciser cursor positioning
|
||||||
|
using the mouse
|
||||||
|
|
||||||
2001-07-22 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
2001-07-22 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||||
|
|
||||||
* formula.C (insetAllowed): allow insertion of label
|
* formula.C (insetAllowed): allow insertion of label
|
||||||
|
@ -97,8 +97,15 @@ int MathXArray::pos2x(int targetpos) const
|
|||||||
int MathXArray::x2pos(int targetx) const
|
int MathXArray::x2pos(int targetx) const
|
||||||
{
|
{
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
for (int x = 0; x < targetx && pos < data_.size(); data_.next(pos))
|
int lastx = 0;
|
||||||
x += width(pos);
|
int currx = 0;
|
||||||
|
while (currx < targetx && pos < data_.size()) {
|
||||||
|
lastx = currx;
|
||||||
|
currx += width(pos);
|
||||||
|
data_.next(pos);
|
||||||
|
}
|
||||||
|
if (abs(lastx - targetx) < abs(currx - targetx))
|
||||||
|
data_.prev(pos);
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user