问题
im using this command input tap x y
(input tap 600 500
) in a phone with a screen resolution of 720 x 1280
how do I convert the x y
so it will be same point in a phone with a resolution of 1080 x 1920
. Thanks
回答1:
This pseudo code should get you the values you're looking for:
resolution_width = 720;
resolution_height = 1280;
input_x = 600;
input_y = 500;
target_width = 1080;
target_height = 1920;
percent_width = input_x / resolution_width;
percent_height = input_y / resolution_height;
output_x = target_width * percent_width;
output_y = target_height * percent_height;
来源:https://stackoverflow.com/questions/21581265/convert-x-and-y-px-base-on-screen-size