How to detect when the mouse leaves an element?


I’m trying to detect events when the mouse enters and leaves a certain element using Nifty. There is a “mouse move” event, which we can (kind of) use to detect when a mouse enters something, but how can we detect when the mouse leaves? The only way I have found to do this is to make a onEndHover effect with a custom “onEndEffect” callback and a 0-millisecond duration, but that is not practical because I have multiple instances of these items, thus it’d be nice if the event was passed back to the instance that was hovered, which can be done (for other types of events) through the use of NiftyMethodInvoker.

Is there any better way?

there is no other way besides using onEndHover like you’ve described.