added drag and hold
This commit is contained in:
@@ -137,6 +137,8 @@ def read_finger(args, remote_device):
|
||||
last_x = 0
|
||||
last_y = 0
|
||||
|
||||
t_mv_start = 0
|
||||
|
||||
while True:
|
||||
_, _, e_type, e_code, e_value = struct.unpack('2IHHi', remote_device.read(16))
|
||||
|
||||
@@ -147,8 +149,10 @@ def read_finger(args, remote_device):
|
||||
log.debug(e_value)
|
||||
|
||||
if rel_orig_x == -1:
|
||||
print("test")
|
||||
t_mv_last = t_mv_start
|
||||
t_mv_start = time.time();
|
||||
if (t_mv_start - t_mv_last) < 0.3:
|
||||
mouse.press(Button.left)
|
||||
rel_orig_x = e_value
|
||||
|
||||
x = e_value
|
||||
@@ -167,13 +171,13 @@ def read_finger(args, remote_device):
|
||||
if e_code == evcode_finger_mv_id:
|
||||
if e_value == -1:
|
||||
if rel_orig_x == x and rel_orig_y == y:
|
||||
print(time.time() - t_mv_start)
|
||||
if (time.time() - t_mv_start) < 0.5:
|
||||
mouse.press(Button.left)
|
||||
mouse.release(Button.left)
|
||||
else:
|
||||
mouse.press(Button.right)
|
||||
mouse.release(Button.right)
|
||||
mouse.release(Button.left)
|
||||
rel_orig_x = -1
|
||||
rel_orig_y = -1
|
||||
last_x = 0
|
||||
|
||||
Reference in New Issue
Block a user