]> git.lyx.org Git - features.git/commitdiff
Improve test in Geometry::covers
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 9 Jun 2021 13:59:28 +0000 (15:59 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 14 Jun 2021 16:01:35 +0000 (18:01 +0200)
Horizontally, the old code would count an extra pixel on the right.

The vertical test is not changed, and should be eventually audited.

Fixes bug #10468.

src/CoordCache.h

index 38842be83cb0fa6f2ad81e5920912abf2a170f8e..d1c0fa341723c3976da9b9581babdf29445fadc3 100644 (file)
@@ -31,10 +31,8 @@ struct Geometry {
 
        bool covers(int x, int y) const
        {
-               return x >= pos.x_
-                       && x <= pos.x_ + dim.wid
-                       && y >= pos.y_ - dim.asc
-                       && y <= pos.y_ + dim.des;
+               return x >= pos.x_ && x < pos.x_ + dim.wid
+                      && y >= pos.y_ - dim.asc && y <= pos.y_ + dim.des;
        }
 
        int squareDistance(int x, int y) const