Support => NGUI 3 Support => Topic started by: TypoStraw on August 27, 2014, 04:50:24 AM
Title: Proposed change to sprite hover state
Post by: TypoStraw on August 27, 2014, 04:50:24 AM
I use the built in sprite switching system when clicking on buttons - however, I currently do not use the hoversprite.
The setup is attached to this post.
The problem occurs when the user presses on a button and leaves the mouse over the button. The state goes from Normal -> Hover -> Pressed -> Hover, but since the hoversprite has not been set, it will stay at the Pressed sprite until the user moves the mouse away from the button.
It could be fixed by setting the hoversprite to be equal to the normal sprite, but then I would need to update 2 values every time I would want to change 1 sprite.
To fix this, there's one line that needs to be changed in UIButton - line 266:
Current:
case State.Hover: SetSprite(hoverSprite);break;
Proposed fix (default to normal sprite if hoverSprite was not set):
case State.Hover: SetSprite(string.IsNullOrEmpty(hoverSprite)? mNormalSprite : hoverSprite);break;
Title: Re: Proposed change to sprite hover state
Post by: Nicki on August 27, 2014, 04:58:26 AM