From 5d0aaea98b16264f83f0beb1218771e3b49c629c Mon Sep 17 00:00:00 2001 From: Maxim Stewart Date: Sun, 22 Nov 2020 22:46:55 -0600 Subject: [PATCH] Fix method --- src/core/routes/Sockets.py | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/core/routes/Sockets.py b/src/core/routes/Sockets.py index bbd19e8..2e9ba4a 100644 --- a/src/core/routes/Sockets.py +++ b/src/core/routes/Sockets.py @@ -65,17 +65,25 @@ def pressBack(eve = None): return "" -@app.route('/update-coords/xy//') +@app.route('/update-coords/xy//') @socketio.on('update_coords', namespace='/socket.io') -def updateCoords(message = None, message2 = None): - try: - parts = message.split(",") - x = float( parts[0] ) - y = float( parts[1] ) - # print(str(x) + "," + str(y)) - pyautogui.moveRel(x, y); - return "" - except Exception as e: - pass +def updateCoords(m1 = None, m2 = None): + if not m2: + try: + parts = m1.split(",") + x = float( parts[0] ) + y = float( parts[1] ) + # print(str(x) + "," + str(y)) + pyautogui.moveRel(x, y); + except Exception as e: + pass + else: + try: + x = float( m1 ) + y = float( m2 ) + # print(str(x) + "," + str(y)) + pyautogui.moveRel(x, y); + except Exception as e: + pass return ""