Skip to content

Make sure this button enabled thing is fixed #226

@MattRix

Description

@MattRix

I believe I've already fixed this in unstable, but it's worth checking just in case:

---below is from an email---

The next little problem with buttons is the enabled state. I made some buttons and disabled them, but they still responded to touches. The initial HandleSingleTouchBegan() has a check for the enabled state, and if the hitrect is valid but the button is disabled the button swallows the touch by returning true but doesn't process the down state etc. All good. The problem is that because of the return true to swallow that first touch event, the following touch events for movement and ended get sent to the button, but there's no further checks for the enabled state in the handlers so they just go about their business, which means they show a down state and then trigger a pressed event as normal. I added a line at the top of HandleSingleTouchMoved() and HandleSingleTouchEnded() to bail out if the button is disabled - if (!_isEnabled) return; The over handler also breaks if the button is disabled as well. I'm not using it, but I quickly edited UpdateOverState() and used the following in the hitrect check; if (_isEnabled && _hitRect.Contains(mousePos)) ... { over stuff }...

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions