Browse Source

Box hits now works both directions

tb-init-ui-render
Taylor Bockman 5 years ago
parent
commit
56fc5e5026
  1. 14
      clusterview/opengl_widget.py

14
clusterview/opengl_widget.py

@ -286,6 +286,16 @@ def box_hit(tx, ty, x1, y1, x2, y2):
@param x2 The bottom left x.
@param y2 The bottom left y.
"""
# The box in this case is flipped - the user started at the bottom right
# corner. Pixel-wise top left is (0, 0) and bottom right is
# (screen_x, screen_y)
if x1 > x2 and y1 > y2:
return (tx <= x1 and
tx >= x2 and
ty <= y1 and
ty >= y2)
return (tx >= x1 and
tx <= x2 and
ty >= y1 and
@ -309,10 +319,6 @@ def highlight_selection():
bottom_right[0], bottom_right[1]):
# Paint the point and draw over it.
# TODO: After the mouse drag drop these highlighted points should be
# stored in a move set. Make sure to update these in a set
# dropping each as it doesn't make the hit condition anymore.
#
#
# TODO: Demonstrating movement might be difficult... come up with a
# good way on paper. Basically once the mouse release happens

Loading…
Cancel
Save