You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to track what the mouse is on top off, but only for a subset of elements. I've found the mouseenter/mouseleave HTML events handle this quite nicely, so it would be nice if Rml had this too.
Also, having had a look into how this library handles events in the past, I was able to implement this into RmlUi 5.1 with just a few lines of code, by duplicating the corresponding mouseover / mouseout events but with bubbling set to false. It's a simple approach but seems to be working fine for me so far.
The text was updated successfully, but these errors were encountered:
Hey, thanks for the suggestion. Can you elaborate a bit more about your use case. And particularly, how is it that these events work better than mouseover and mouseout in this situation?
Looking at some documentation, it actually looks like our mouseover and mouseout events operate more like web mouseenter/mouseleave, except that we also bubble them, hmm.
As you move the mouse inside the outer div, a mouseover event is triggered each time you enter a new child of the div.
Conversely, the mouseenter event only fires when the mouse enters the outer div, and does not fire while the mouse is moving about inside the outer div.
For my particular use case, I need the mouseenter behaviour because I want to play a sound when the mouse moves over an element. And since this an element with multiple children, if I listen for mouseover events the sound plays multiple times which isn't desired.
Right, I see. So I believe what you could do here is to check if target == current_element in the event, and you should effectively get that behavior.
I am tempted though to change things up a bit, so that we follow the behavior of the web DOM events. Effectively rename the current behavior of mouseover and mouseout into mouseenter and mouseleave, just remove their bubbling effect. And add new events taking the the place of mouseover and mouseout, which is only submitted once and bubbles. This would be a change in behavior though, and I am not sure if users rely on that.
I need to track what the mouse is on top off, but only for a subset of elements. I've found the mouseenter/mouseleave HTML events handle this quite nicely, so it would be nice if Rml had this too.
Also, having had a look into how this library handles events in the past, I was able to implement this into RmlUi 5.1 with just a few lines of code, by duplicating the corresponding mouseover / mouseout events but with bubbling set to false. It's a simple approach but seems to be working fine for me so far.
The text was updated successfully, but these errors were encountered: