1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 06:40:06 -04:00

ui.image now takes impl Into<Vec2> as a size argument

This commit is contained in:
Emil Ernerfeldt
2020-12-15 14:25:26 +01:00
parent 09aa905f7c
commit 7710308e09
3 changed files with 8 additions and 3 deletions

View File

@@ -689,7 +689,7 @@ impl Ui {
}
/// Show an image here with the given size
pub fn image(&mut self, texture_id: TextureId, desired_size: Vec2) -> Response {
pub fn image(&mut self, texture_id: TextureId, desired_size: impl Into<Vec2>) -> Response {
self.add(Image::new(texture_id, desired_size))
}
}

View File

@@ -10,11 +10,11 @@ pub struct Image {
}
impl Image {
pub fn new(texture_id: TextureId, desired_size: Vec2) -> Self {
pub fn new(texture_id: TextureId, desired_size: impl Into<Vec2>) -> Self {
Self {
texture_id,
uv: Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)),
desired_size,
desired_size: desired_size.into(),
bg_fill: Default::default(),
tint: color::WHITE,
}