Apply Transformation::scale_factor to Quad styling

This commit is contained in:
Héctor Ramón Jiménez 2025-08-17 09:11:19 +02:00
parent d3a0d0b512
commit ab04751bc4
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
2 changed files with 20 additions and 4 deletions

View file

@ -263,3 +263,16 @@ impl From<Radius> for [f32; 4] {
]
}
}
impl std::ops::Mul<f32> for Radius {
type Output = Self;
fn mul(self, scale: f32) -> Self::Output {
Self {
top_left: self.top_left * scale,
top_right: self.top_right * scale,
bottom_right: self.bottom_right * scale,
bottom_left: self.bottom_left * scale,
}
}
}

View file

@ -49,11 +49,14 @@ impl Layer {
position: [bounds.x, bounds.y],
size: [bounds.width, bounds.height],
border_color: color::pack(quad.border.color),
border_radius: quad.border.radius.into(),
border_width: quad.border.width,
border_radius: (quad.border.radius * transformation.scale_factor())
.into(),
border_width: quad.border.width * transformation.scale_factor(),
shadow_color: color::pack(quad.shadow.color),
shadow_offset: quad.shadow.offset.into(),
shadow_blur_radius: quad.shadow.blur_radius,
shadow_offset: (quad.shadow.offset * transformation.scale_factor())
.into(),
shadow_blur_radius: quad.shadow.blur_radius
* transformation.scale_factor(),
snap: quad.snap as u32,
};