Reintroduce support for custom primitives in iced_wgpu
This commit is contained in:
parent
6ea763c2a7
commit
d922b47815
11 changed files with 220 additions and 173 deletions
|
|
@ -147,13 +147,20 @@ impl Rectangle<f32> {
|
|||
}
|
||||
|
||||
/// Snaps the [`Rectangle`] to __unsigned__ integer coordinates.
|
||||
pub fn snap(self) -> Rectangle<u32> {
|
||||
Rectangle {
|
||||
pub fn snap(self) -> Option<Rectangle<u32>> {
|
||||
let width = self.width as u32;
|
||||
let height = self.height as u32;
|
||||
|
||||
if width < 1 || height < 1 {
|
||||
return None;
|
||||
}
|
||||
|
||||
Some(Rectangle {
|
||||
x: self.x as u32,
|
||||
y: self.y as u32,
|
||||
width: self.width as u32,
|
||||
height: self.height as u32,
|
||||
}
|
||||
width,
|
||||
height,
|
||||
})
|
||||
}
|
||||
|
||||
/// Expands the [`Rectangle`] a given amount.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue