conrod
conrod copied to clipboard
Provide `Ui` methods that indicate whether or not user input is currently being captured.
The method would return None if the input is not captured, otherwise returning Some(widget::Index) with the index of the widget currently capturing the input. I.e.
if ui.is_mouse_captured().is_none() {
// Do stuff with mouse
}
if ui.is_keyboard_captured().is_none() {
// Do stuff with keyboard
}
I'm currently hitting this issue as a blocker for my editor.
Nevermind it seems that the following is what I needed:
let widget = self.ui.global_input().current.widget_under_mouse;
/// Which widget, if any, is currently capturing the keyboard
pub widget_capturing_keyboard: Option<widget::Id>,
/// Which widget, if any, is currently capturing the mouse
pub widget_capturing_mouse: Option<widget::Id>,
/// The widget that is currently under the mouse cursor.
///
/// If the mouse is currently over multiple widgets, this index will represent the top-most,
/// non-graphic-child widget.
pub widget_under_mouse: Option<widget::Id>,
We have all of these fields on the struct ui.global_input() returns. Can this issue be closed?