diff --git a/clusterview/opengl_widget.py b/clusterview/opengl_widget.py index 56b5c56..23f011c 100644 --- a/clusterview/opengl_widget.py +++ b/clusterview/opengl_widget.py @@ -261,6 +261,21 @@ def box_hit(tx, ty, x1, y1, x2, y2): ty <= y1 and ty >= y2) + # The box in this case started from the top right + if x1 > x2 and y1 < y2: + return (tx <= x1 and + tx >= x2 and + ty >= y1 and + ty <= y2) + + # The box in this case started from the bottom left + if x1 < x2 and y1 > y2: + return (tx >= x1 and + tx <= x2 and + ty <= y1 and + ty >= y2) + + # Normal condition: Box starts from the top left return (tx >= x1 and tx <= x2 and ty >= y1 and