Skip to content

Commit

Permalink
Switch Size::from_px constructor to f32
Browse files Browse the repository at this point in the history
1f8e5db changed the `Size::as_px` method to return a floating point
value instead of an integer. This patch ensures the constructor is
consistent with that.
  • Loading branch information
chrisduerr committed Dec 9, 2023
1 parent 1f8e5db commit 3dd63dc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ impl Size {
/// Create a new `Size` from px.
///
/// The value will be clamped to the pt range of [`Size::new`].
pub fn from_px(size: u16) -> Self {
let pt = size as f32 * 72. / 96.;
pub fn from_px(size: f32) -> Self {
let pt = size * 72. / 96.;
Size::new(pt)
}

Expand Down

0 comments on commit 3dd63dc

Please sign in to comment.