From 7fb4e97f9ee97ba4e4fab8ad7545e440702c124f Mon Sep 17 00:00:00 2001 From: hippoz Date: Sat, 30 Oct 2021 19:20:27 +0300 Subject: [PATCH] improve design and add right click support --- capybara | 7 +++ public/index.html | 111 ++++++++++++++++++++++++++++++++++++---------- 2 files changed, 94 insertions(+), 24 deletions(-) diff --git a/capybara b/capybara index 52c99c5..fa968f3 100755 --- a/capybara +++ b/capybara @@ -69,6 +69,10 @@ class InputController(): self.parser.add_handler("u", { "button": "int" }) + # Mouse button click + self.parser.add_handler("c", { + "button": "int" + }) def button_code_to_object(self, button_code: int): # HACK obj = None @@ -92,6 +96,9 @@ class InputController(): elif code == "u": print("u", args["button"]) self.mouse_controller.release(self.button_code_to_object(args["button"])) + elif code == "c": + print("c", args["button"]) + self.mouse_controller.click(self.button_code_to_object(args["button"])) elif code == "s": print("s", args["x"], args["y"]) self.mouse_controller.scroll(args["x"], args["y"]) diff --git a/public/index.html b/public/index.html index b1236e6..5854851 100644 --- a/public/index.html +++ b/public/index.html @@ -6,8 +6,13 @@ Document