]> git.lyx.org Git - lyx.git/commitdiff
don't draw invisible things...
authorAndré Pönitz <poenitz@gmx.net>
Wed, 13 Mar 2002 11:17:21 +0000 (11:17 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Wed, 13 Mar 2002 11:17:21 +0000 (11:17 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3737 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/math_cursor.C
src/mathed/math_xdata.C

index c2a82d12220817dad777b8680e04c91155f8625a..c3ee8d0996e124c1b3c95b83a645ae192544f258 100644 (file)
@@ -1224,8 +1224,9 @@ bool MathCursor::bruteFind(int x, int y, int xlow, int xhigh, int ylow, int yhig
        while (1) {
                // avoid invalid nesting when selecting
                if (!selection_ || positionable(it.cursor(), Anchor_)) {
-                       int xo = it.position().xpos();
-                       int yo = it.position().ypos();
+                       MathCursorPos const & top = it.position();
+                       int xo = top.xpos();
+                       int yo = top.ypos();
                        if (xlow - 2 <= xo && xo <= xhigh + 2 &&
                                        ylow - 2 <= yo && yo <= yhigh + 2)
                        {
index 914844d9e6cf8f116ef5704980189600a27355b6..1bc7bb0242c3720578de94a571252035a7a0cc89 100644 (file)
@@ -74,10 +74,21 @@ void MathXArray::draw(Painter & pain, int x, int y) const
        //if (drawn_ && x == xo_ && y == yo_)
        //      return;
 
+       //lyxerr << "x: " << x << " y: " << y << " " << pain.workAreaHeight() << endl;
+
        xo_    = x;
        yo_    = y;
        drawn_ = true;
 
+       if (y + descent_ <= 0)                   // don't draw above the workarea
+               return;
+       if (y - ascent_ >= pain.paperHeight())   // don't draw below the workarea
+               return;
+       if (x + width_ <= 0)                     // don't draw left of workarea
+               return;
+       if (x >= pain.paperWidth())              // don't draw right of workarea
+               return;
+
        const_iterator it = begin(), et = end();
 
        if (it == et) {