max-kamps / jpd-breader

MIT License
102 stars 28 forks source link

Add support for touchscreen devices. #32

Closed xyaman closed 1 year ago

xyaman commented 1 year ago

This commit adds support for touchscreen devices by ignoring the "Show Popup" keybind if "Show popup on hover" is enabled in the settings.

The "mousedown" listener event had issues on touchscreen devices because tapping or hovering over a word would also trigger a click event. To address this, a "Touchscreen Support" option has been added to the settings, which changes the behavior to only hide the popup on the "onmouseleave" event.

Currently, on small screens, the popup sometimes does not fully appear on the screen.

xyaman commented 1 year ago

I found a bug in the current implementation, where clicking on a word while the popup is displayed may cause it to hide and fail to show the new word's information. This is because sometimes "onmouseleave" event is triggered after the "onmouseenter" event. (This only happens if touchscreen support is enabled)

xyaman commented 1 year ago

Current bug: If the screen is small, the popup may readjust its position (e9d6557da55694634e3f4c8f1a383b1977434932) and sometimes the mine/review buttons can be pressed accidentally because the touch position could overlap with the button position.

Some ideas I've thought of are:

Edit: It seems this only happens when fade animation is disabled