rxi / microui

A tiny immediate-mode UI library
MIT License
3.29k stars 239 forks source link

How do I know if microui consumed an event? #18

Closed prideout closed 4 years ago

prideout commented 4 years ago

If the user drags a microui slider in a window, I don't want the drag to affect the content underneath the window. imgui has WantCaptureKeyboard, WantCaptureMouse, etc for this purpose but I can't find the corollary mechanism in microui.

By the way thanks for this library, it's truly beautiful.

prideout commented 4 years ago

I think this can be achieved by checking the nullness of hover_root after defining the UI?

rxi commented 4 years ago

If ctx->focus is non-zero you can assume microui is capturing keyboard events, if ctx->hover_root is non-zero you can assume microui is capturing mouse events. If you process the events for the underlying content after the call to mu_end() you should be able to use ctx->focus for both keyboard and mouse. Thanks for the kind words!