update image ui widget to return a bool with its clicked state
This commit is contained in:
parent
d903ca59b3
commit
d80720f772
|
@ -72,7 +72,7 @@ pub trait UiSupport {
|
|||
fn display_height(&self) -> f32;
|
||||
fn is_any_hovered(&self) -> bool;
|
||||
fn is_any_focused(&self) -> bool;
|
||||
fn image(&self, id: impl AsRef<str>, texture_id: imgui::TextureId, size: [f32; 2]);
|
||||
fn image(&self, id: impl AsRef<str>, texture_id: imgui::TextureId, size: [f32; 2]) -> bool;
|
||||
}
|
||||
|
||||
impl UiSupport for imgui::Ui {
|
||||
|
@ -92,9 +92,10 @@ impl UiSupport for imgui::Ui {
|
|||
self.is_window_focused_with_flags(imgui::WindowFocusedFlags::ANY_WINDOW)
|
||||
}
|
||||
|
||||
fn image(&self, id: impl AsRef<str>, texture_id: imgui::TextureId, size: [f32; 2]) {
|
||||
self.invisible_button(id, size);
|
||||
fn image(&self, id: impl AsRef<str>, texture_id: imgui::TextureId, size: [f32; 2]) -> bool {
|
||||
let clicked = self.invisible_button(id, size);
|
||||
let draw_list = self.get_window_draw_list();
|
||||
draw_list.add_image(texture_id, self.item_rect_min(), self.item_rect_max()).build();
|
||||
clicked
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue