T-vK / ESP32-BLE-Mouse

Bluetooth LE Mouse library for the ESP32 (Arduino IDE compatible)
724 stars 139 forks source link

Add Abs Mouse project #29

Closed sobrinho closed 2 years ago

sobrinho commented 2 years ago

@T-vK ping

T-vK commented 2 years ago

Sorry for the late reply. I appreciate your work, my understanding is that your library moves the mouse relative to 0|0 rather than relative to the current mouse position. Some of the people in the linked issues may have been seeking that feature, but others were looking for a way to actually specify pixel-accurate coordinates which I think your lib doesn't do (correct me if I'm wrong), so I'd rather not close these issues for now. But since you explicitly wrote

Closes #19 Closes #18 Closes #5

I think that Github will close them automatically if I accept the Pull Request.

If you can make a good enough argument for why the afore-mentioned issues should in fact be closed or if you simply remove that comment, I'll accept your Pull Request.

sobrinho commented 2 years ago

To have pixel accurate precision, the user would need to calculate the percentage (pseudo-code in ruby):

# to click at 1280,800 (center of the screen) using the percentage way
mouse.move(5000, 5000)

# to click at 1280,800 (center of the screen) using pixel, you need to know the resolution and calculate
width = 2560
height = 1600

targetX = 1280 * 100 / width * 100 #=> 5000
targetY = 800 * 100 / height * 100 #=> 5000

It might not be pixel precise but close enough, for instance:

# to click at 1280,800 (center of the screen) using the percentage way
mouse.move(5000, 5000)

# to click at 1280,800 (center of the screen) using pixel, you need to know the resolution and calculate
width = 2560
height = 1600

targetX = 1279 * 100 / width * 100 #=> 4996
targetY = 799 * 100 / height * 100 #=> 4993

In general if we are off by a pixel or two, everything should still work (like clicking a button).

Not sure how the driver is going to react but in my scenario I'm emulating a touch screen, so, I have the physical percentage from left to right, top to bottom, where the human actually clicked.

I tried different HIDs for touch screen on Android but they do not seem to work, using this HID as absolute mouse works perfectly.

sobrinho commented 2 years ago

@T-vK comment removed, feel free to merge!

sobrinho commented 2 years ago

@HassanSardar1 you can probably open a ticket on my project instead but I would need at least a working HID and since I don't have a Windows machine, would be probably easier for you to test all the ones you find and submit a PR there :)

sobrinho commented 2 years ago

@HassanSardar1 ops! enabled it!