botcity-dev / botcity-framework-core-python

BotCity Framework - Python
https://documentation.botcity.dev/frameworks/desktop/
Apache License 2.0
119 stars 21 forks source link

Find Coordinates are wrong for MacOS when using a resolution other than default. #51

Open hhslepicka opened 5 months ago

hhslepicka commented 5 months ago

Describe the bug On MacOS, if using a resolution different than default the find command works properly but the coordinates are wrong as they are calculated based on the default screen resolution and not the one currently in use.

Expected behavior Find works and the coordinates are adjusted to the user's selected monitor resolution.

Steps to Reproduce

Possible Solution

My Platform

Additional context

$ system_profiler SPDisplaysDataType
Graphics/Displays:

    Apple M2 Pro:

      Chipset Model: Apple M2 Pro
      Type: GPU
      Bus: Built-In
      Total Number of Cores: 19
      Vendor: Apple (0x106b)
      Metal Support: Metal 3
      Displays:
        DELL P2715Q:
          Resolution: 3840 x 2160 (2160p/4K UHD 1 - Ultra High Definition)
          UI Looks like: 1920 x 1080 @ 30.00Hz
          Main Display: Yes
          Mirror: Off
          Online: Yes
          Rotation: Supported
(temp) $ python -c "from botcity.core import DesktopBot; bot = DesktopBot(); print(bot.get_screenshot().size)"
(3840, 2160)
hhslepicka commented 5 months ago

Note: be careful when fix this to not make the bot.display_size() wrong.