void256/nifty-gui — pull request #165 by 3xp0n3nt (2013-11-08 21:52:57+00:00)
Title: Add support for two imageMode's with ChangeImage.

The ChangeImage effect is not very, ahem, effective because it requires
you to use the same imageMode value for both active and inactive images.

This is a ridiculous constraint because one of the most common - and
useful - applications of ChangeImage is to modify a button's state using
a sprite sheet. For example, it can be combined with onHover or onClick,
etc, and the button sprite sheet can contain a "normal" (inactive)
sprite, a "hover" sprite, and a "clicked" sprite.

Unfortunately this setup requires the active imageMode and inactive
imageMode's to be separate. How to solve this problem?

It's elementary, my dear Watson.

Check for two new keys in the getImageModeProperty method of
ChangeImage, imageModeActive and imageModeInactive. If they are not
present we simply revert to the old behavior and check for the imageMode
key. This preserves backwards-compatibility because their use is
optional.

I've already tested it and it works fine.