fix: drag-resize working now

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-04-26 06:55:18 +02:00
parent 82ba43c7ba
commit 3556ab45b3
7 changed files with 257 additions and 1 deletions

View File

@@ -24,10 +24,18 @@ defmodule BDS.Desktop.Automation do
GenServer.call(session, {:click, selector}, @request_timeout)
end
def drag(session, selector, delta_x) when is_binary(selector) and is_integer(delta_x) do
GenServer.call(session, {:drag, selector, delta_x}, @request_timeout)
end
def press(session, shortcut) when is_binary(shortcut) do
GenServer.call(session, {:press, shortcut}, @request_timeout)
end
def reload(session) do
GenServer.call(session, :reload, @request_timeout)
end
def capture_screenshot(session, destination) when is_binary(destination) do
GenServer.call(session, {:capture_screenshot, destination}, @request_timeout)
end
@@ -82,11 +90,23 @@ defmodule BDS.Desktop.Automation do
{:reply, normalize_simple_reply(reply), state}
end
def handle_call({:drag, selector, delta_x}, _from, state) do
{reply, state} =
driver_request(state, %{"command" => "drag", "selector" => selector, "deltaX" => delta_x})
{:reply, normalize_simple_reply(reply), state}
end
def handle_call({:press, shortcut}, _from, state) do
{reply, state} = driver_request(state, %{"command" => "press", "shortcut" => shortcut})
{:reply, normalize_simple_reply(reply), state}
end
def handle_call(:reload, _from, state) do
{reply, state} = driver_request(state, %{"command" => "reload"})
{:reply, normalize_simple_reply(reply), state}
end
def handle_call({:capture_screenshot, destination}, _from, state) do
File.mkdir_p!(Path.dirname(destination))