Skip to content

Commit

Permalink
Add 'color' property to Image
Browse files Browse the repository at this point in the history
  • Loading branch information
LPGhatguy committed Dec 3, 2023
1 parent 958e2ca commit 15af8f5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/yakui-widgets/src/widgets/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Responds with [ImageResponse].
pub struct Image {
pub image: Option<TextureId>,
pub size: Vec2,
pub color: Color,
}

impl Image {
Expand All @@ -25,6 +26,7 @@ impl Image {
Self {
image: Some(image.into()),
size,
color: Color::WHITE,
}
}

Expand All @@ -49,6 +51,7 @@ impl Widget for ImageWidget {
props: Image {
image: None,
size: Vec2::ZERO,
color: Color::WHITE,
},
}
}
Expand All @@ -66,7 +69,7 @@ impl Widget for ImageWidget {

if let Some(image) = self.props.image {
let mut rect = PaintRect::new(layout_node.rect);
rect.color = Color::WHITE;
rect.color = self.props.color;
rect.texture = Some((image, Rect::ONE));
rect.add(ctx.paint);
}
Expand Down

0 comments on commit 15af8f5

Please sign in to comment.