mini2Dx/mini2Dx

Disable/enable hovering for UiElements

Opened this issue · 0 comments

I've noticed that certain UI elements (RadioButton, Checkbox, Slider) that work fine in a Desktop setting, are erratic or difficult to use on a mobile device or touchscreen. There also seems to be a clear pattern of having to touch Buttons twice before onActionBegin gets triggered. I suspected this has something to do with the Hover node state, specifically that mouseDown events that should have resulted in the nodestate being moved ACTIVE, or mouseUp events that should have returned to NORMAL, instead go to HOVER. I created methods isHoverEnabled/setHoverEnabled in the base UiElement class and made the appropriate changes in the RenderNode classes, and this seems to have cleared the problems right up - the responsiveness is now as good on mobile (Android) as it is on Desktop.

I would like to submit these changes, however if anyone else on the project can shed more light on the topic that would be great, there could be something I'm missing. I have not tested on a variety of mobile devices, and in particular I don't have an iOS device I can test with right now. The change I am proposing would have no effect by default, you would need to setHoverEnabled to false for each element explicitly. I can submit the changes for review.