Skip to content

Commit

Permalink
Clip only x1 and y1 for intersectingEdges
Browse files Browse the repository at this point in the history
  • Loading branch information
wkentaro committed Aug 28, 2019
1 parent 765ff9d commit 854f039
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions labelme/widgets/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,12 +560,9 @@ def intersectionPoint(self, p1, p2):
(size.width() - 1, 0),
(size.width() - 1, size.height() - 1),
(0, size.height() - 1)]
# FIXME: below clipping is unnecessary on Linux and Mac,
# but required on Windows to avoid error in intersectingEdges
# x1, y1 should be in the pixmap, x2, y2 should be out of the pixmap
x1 = min(max(p1.x(), 0), size.width() - 1)
x2 = min(max(p2.x(), 0), size.width() - 1)
y1 = min(max(p1.y(), 0), size.height() - 1)
y2 = min(max(p2.y(), 0), size.height() - 1)
d, i, (x, y) = min(self.intersectingEdges((x1, y1), (x2, y2), points))
x3, y3 = points[i]
x4, y4 = points[(i + 1) % 4]
Expand Down

0 comments on commit 854f039

Please sign in to comment.