summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-06-02 04:38:55 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-06-02 04:38:55 +0200
commit94af34884667e78e231fb1904ae3e9fa785c9a7a (patch)
tree71114ed1cc30f6de74b2a1e16b0f7f42adb5b80d /core
parentb96d87ff6917e7dc75178e4c623d20d577ef583f (diff)
downloadiced-94af34884667e78e231fb1904ae3e9fa785c9a7a.tar.gz
iced-94af34884667e78e231fb1904ae3e9fa785c9a7a.tar.bz2
iced-94af34884667e78e231fb1904ae3e9fa785c9a7a.zip
Rename `Rectangle::round` to `snap`
Also use `ceil` instead of `round`. Closes #380.
Diffstat (limited to 'core')
-rw-r--r--core/src/rectangle.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/src/rectangle.rs b/core/src/rectangle.rs
index aa23372e..ce80c661 100644
--- a/core/src/rectangle.rs
+++ b/core/src/rectangle.rs
@@ -126,15 +126,15 @@ impl Rectangle<f32> {
}
}
- /// Rounds the [`Rectangle`] to __unsigned__ integer coordinates.
+ /// Snaps the [`Rectangle`] to __unsigned__ integer coordinates.
///
/// [`Rectangle`]: struct.Rectangle.html
- pub fn round(self) -> Rectangle<u32> {
+ pub fn snap(self) -> Rectangle<u32> {
Rectangle {
x: self.x as u32,
y: self.y as u32,
- width: (self.width + 0.5).round() as u32,
- height: (self.height + 0.5).round() as u32,
+ width: self.width.ceil() as u32,
+ height: self.height.ceil() as u32,
}
}
}