Pratyush101 commited on
Commit
8e34b0e
·
verified ·
1 Parent(s): 61868a9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -4
app.py CHANGED
@@ -151,14 +151,11 @@ def video_frame_callback(frame: av.VideoFrame) -> av.VideoFrame:
151
  button.is_hover=False
152
  button.is_pressed=False
153
  if x < x8 < x + bw and y < y8 < y + bh:
154
- button.is_hover = True
155
- button.is_pressed = False
156
  cv2.rectangle(img, (x, y), (x + bw, y + bh), color, -1, cv2.LINE_AA)
157
  cv2.putText(img, button.text, (x + int(0.2 * bw), y + int(0.7 * bh)), cv2.FONT_HERSHEY_PLAIN, font_scale, text_color, font_thickness)
158
 
159
  if distance < click_threshold:
160
- button.is_pressed = True # Mark as pressed
161
- button.is_hover = False
162
  cv2.rectangle(img, (x, y), (x + bw, y + bh), color, -1, cv2.LINE_AA)
163
  cv2.putText(img, button.text, (x + int(0.2 * bw), y + int(0.7 * bh)), cv2.FONT_HERSHEY_PLAIN, font_scale, text_color, font_thickness)
164
  if time.time() - prev_key_time[0] > 2:
 
151
  button.is_hover=False
152
  button.is_pressed=False
153
  if x < x8 < x + bw and y < y8 < y + bh:
 
 
154
  cv2.rectangle(img, (x, y), (x + bw, y + bh), color, -1, cv2.LINE_AA)
155
  cv2.putText(img, button.text, (x + int(0.2 * bw), y + int(0.7 * bh)), cv2.FONT_HERSHEY_PLAIN, font_scale, text_color, font_thickness)
156
 
157
  if distance < click_threshold:
158
+ button.is_pressed = True # Mark as pressed
 
159
  cv2.rectangle(img, (x, y), (x + bw, y + bh), color, -1, cv2.LINE_AA)
160
  cv2.putText(img, button.text, (x + int(0.2 * bw), y + int(0.7 * bh)), cv2.FONT_HERSHEY_PLAIN, font_scale, text_color, font_thickness)
161
  if time.time() - prev_key_time[0] > 2: