Skip to content

Commit

Permalink
Add a funtion to get image id (vladbat00#80)
Browse files Browse the repository at this point in the history
* Add a funtion to get image id

* Add missing dot

Co-authored-by: Vladyslav Batyrenko <mvlabat@gmail.com>

Co-authored-by: Vladyslav Batyrenko <mvlabat@gmail.com>
  • Loading branch information
2 people authored and HackerFoo committed Jul 16, 2022
1 parent 8011eae commit beec146
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,14 @@ impl EguiContext {
log::debug!("Remove image (id: {:?}, handle: {:?})", id, image);
id
}

/// Returns associated Egui texture id.
#[must_use]
pub fn image_id(&self, image: &Handle<Image>) -> Option<egui::TextureId> {
self.user_textures
.get(&image.id)
.map(|&id| egui::TextureId::User(id))
}
}

#[doc(hidden)]
Expand Down

0 comments on commit beec146

Please sign in to comment.