Skip to content

Commit

Permalink
hyperfocal: ui.py: Fixed bug when dragging buttons
Browse files Browse the repository at this point in the history
Fixed a bug when drag was not processed properly by CanvasObjects
  • Loading branch information
okawo80085 committed Aug 25, 2021
1 parent 787112d commit 7b58eb0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions hyperfocal/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
def mouse_cb_global(*args):
global CV_VISIBLE_OBJECTS, CV_VISIBLE_LAYER

# print(np.array(args[1:3]) / [720, 1280])
print(np.array(args[1:3]) / [720, 1280])

for obj in CV_VISIBLE_OBJECTS:
if obj.layer == CV_VISIBLE_LAYER:
Expand Down Expand Up @@ -61,7 +61,7 @@ def _mouse_cb(self, event: int, x: int, y: int, *rest):

elif event == cv2.EVENT_MOUSEMOVE:
if self._mouse_hold:
pass # for now
self._mouse_pos = (x, y)

elif event == cv2.EVENT_LBUTTONUP:
# this indentation crime to humanity is PEP8 compliant btw
Expand Down Expand Up @@ -108,7 +108,7 @@ def draw_objects(
global CV_VISIBLE_LAYER

# draw frame
# print(canvas.shape, frame.shape)
# this indentation crime to humanity is brought to you by PEP8
if frame is not None:
canvas_center = np.array(canvas.shape[:2]) // 2
canvas_topleft = (
Expand All @@ -127,6 +127,7 @@ def draw_objects(
:
] = frame

# draw objects
for i in objects:
if i.layer != CV_VISIBLE_LAYER:
continue
Expand All @@ -148,7 +149,7 @@ def draw_transparent_objects(
global CV_VISIBLE_LAYER

# draw frame
# print(canvas.shape, frame.shape)
# this indentation crime to humanity is brought to you by PEP8
if frame is not None:
canvas_center = np.array(canvas.shape[:2]) // 2
canvas_topleft = (
Expand All @@ -167,6 +168,7 @@ def draw_transparent_objects(
:
] = frame

# draw objects
for i in objects:
if i.layer != CV_VISIBLE_LAYER:
continue
Expand Down

0 comments on commit 7b58eb0

Please sign in to comment.