ui.image
now takes impl Into<Vec2>
as a size
argument
This commit is contained in:
parent
09aa905f7c
commit
7710308e09
3 changed files with 8 additions and 3 deletions
|
@ -8,6 +8,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
### Changed 🔧
|
||||||
|
|
||||||
|
* `ui.image` now takes `impl Into<Vec2>` as a `size` argument
|
||||||
|
|
||||||
|
|
||||||
## 0.5.0 - 2020-12-13
|
## 0.5.0 - 2020-12-13
|
||||||
|
|
||||||
### Added ⭐
|
### Added ⭐
|
||||||
|
|
|
@ -689,7 +689,7 @@ impl Ui {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Show an image here with the given size
|
/// 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))
|
self.add(Image::new(texture_id, desired_size))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,11 +10,11 @@ pub struct Image {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl 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 {
|
Self {
|
||||||
texture_id,
|
texture_id,
|
||||||
uv: Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)),
|
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(),
|
bg_fill: Default::default(),
|
||||||
tint: color::WHITE,
|
tint: color::WHITE,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue