Start refactoring a common UI pattern: recalculate some value only when
a key changes.
It's quite verbose right now for some widgetry States to determine if
the mouse is over a particular type of object, check if that object has
changed since the last time, and calculate something based on it. This
introduces a new helper for expressing the pattern a little more
clearly.