osudroid / osu-droid

http://osudroid.moe
Apache License 2.0
498 stars 74 forks source link

Add block area to prevent accidental touch on edge #350

Open DeltaFlyerW opened 3 weeks ago

DeltaFlyerW commented 3 weeks ago

Description

Add an anti-accidental touch feature, which allow user to select some area on screen that the touch inside will not be a valid input event for game.

Justification

As screen-to-body ratio grows in decent mobile devices, accidental touch has been a problem for many play styles. During play, accidental touch causes unexpected drop as your palm or finger touch screen edge.

Rian8337 commented 1 week ago

The core logic of the block area now works as intended in custom playfield sizes. However, after more intensive testing, I think the UI of the block area manager can still use a bunch of work. There are weird irks that may hinder UX:

Despite the above, I received an information from @Reco1I that he may try to make a native Android UI for this rather than using a WebView, but I would like to confirm with you if you are okay with it.

Additionally, here is a video demonstrating the issues:

https://github.com/osudroid/osu-droid/assets/52914632/aebada9f-9e75-455b-96eb-9e7aeb46074d

Reco1I commented 1 week ago

As Rian says I would offer myself to contribute.

DeltaFlyerW commented 1 week ago
  • Maybe a block area should have a minimum width and height? It is quite tricky to manage very small areas, and I doubt many players will try to hyper-optimize blocking small areas.

the current implementation does enforce a minimum dimension of 5px for both width and height. This can be observed in the video at the 00:26 mark, as detailed

https://github.com/osudroid/osu-droid/blob/86afc145e9706406ead3c7ed7b0a4b0b17d6b7ae/assets/html/blockAreaSetting.html#L317-L320


  • Is there a specific reason for a347d04? It is not guaranteed that the WebView loads instantly in slow devices. In such cases, showing a loading indicator is more user-friendly than having them stare at a blank screen.

An issue occurs that re-entering the configuration page was causing the loading animation to persist indefinitely.


Despite the above, I received an information from @Reco1I that he may try to make a native Android UI for this rather than using a WebView, but I would like to confirm with you if you are okay with it.

I would be glad to have a contributor take part in this feature. Should @Reco1I decide to proceed with creating a native Android UI rather than using a WebView, I will hold off on making further commits to this PR. If any assistance is needed, please do not hesitate to reach out—I am willing to help in any way I can.

Rian8337 commented 1 week ago

the current implementation does enforce a minimum dimension of 5px for both width and height

Aha. It was noticeable that the red squares don't perfectly align when the block area was made as small as possible, although I'm not sure if it's enough to not confuse the user on which corner was pressed. The CSS does have a cursor property for each corner, but this is irrelevant due to touchscreen.

Nonetheless, there's no need to work on the current UI for now. The core logic can be reused by the Android native UI if it's made.