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:
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user