Skip to content

Commit ddc5c5a

Browse files
committed
Simpler coord conversions
1 parent 0a966f6 commit ddc5c5a

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

widgets/src/switch.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ struct UiButton {
2525

2626
impl UiButton {
2727
fn contains(&self, mouse_position: Coord) -> bool {
28-
self.rect
29-
.contains_point((mouse_position.x, mouse_position.y))
28+
self.rect.contains_point(mouse_position)
3029
}
3130

3231
fn render(
@@ -38,10 +37,7 @@ impl UiButton {
3837
let background = match background {
3938
Some(background) => background,
4039
None => {
41-
let x = if self
42-
.rect
43-
.contains_point((mouse_position.x, mouse_position.y))
44-
{
40+
let x = if self.rect.contains_point(mouse_position) {
4541
128
4642
} else {
4743
64

0 commit comments

Comments
 (0)