diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/bezier_tool/src/main.rs | 6 | ||||
-rw-r--r-- | examples/game_of_life/src/main.rs | 11 | ||||
-rw-r--r-- | examples/geometry/src/main.rs | 2 | ||||
-rw-r--r-- | examples/modal/src/main.rs | 2 | ||||
-rw-r--r-- | examples/sierpinski_triangle/src/main.rs | 12 |
5 files changed, 16 insertions, 17 deletions
diff --git a/examples/bezier_tool/src/main.rs b/examples/bezier_tool/src/main.rs index b4568cbf..310be28f 100644 --- a/examples/bezier_tool/src/main.rs +++ b/examples/bezier_tool/src/main.rs @@ -101,7 +101,7 @@ mod bezier { cursor: mouse::Cursor, ) -> (event::Status, Option<Curve>) { let cursor_position = - if let Some(position) = cursor.position_in(&bounds) { + if let Some(position) = cursor.position_in(bounds) { position } else { return (event::Status::Ignored, None); @@ -183,7 +183,7 @@ mod bezier { bounds: Rectangle, cursor: mouse::Cursor, ) -> mouse::Interaction { - if cursor.is_over(&bounds) { + if cursor.is_over(bounds) { mouse::Interaction::Crosshair } else { mouse::Interaction::default() @@ -226,7 +226,7 @@ mod bezier { ) -> Geometry { let mut frame = Frame::new(renderer, bounds.size()); - if let Some(cursor_position) = cursor.position_in(&bounds) { + if let Some(cursor_position) = cursor.position_in(bounds) { match *self { Pending::One { from } => { let line = Path::line(from, cursor_position); diff --git a/examples/game_of_life/src/main.rs b/examples/game_of_life/src/main.rs index aaa8efd1..e951d734 100644 --- a/examples/game_of_life/src/main.rs +++ b/examples/game_of_life/src/main.rs @@ -407,7 +407,7 @@ mod grid { } let cursor_position = - if let Some(position) = cursor.position_in(&bounds) { + if let Some(position) = cursor.position_in(bounds) { position } else { return (event::Status::Ignored, None); @@ -567,10 +567,9 @@ mod grid { let overlay = { let mut frame = Frame::new(renderer, bounds.size()); - let hovered_cell = - cursor.position_in(&bounds).map(|position| { - Cell::at(self.project(position, frame.size())) - }); + let hovered_cell = cursor.position_in(bounds).map(|position| { + Cell::at(self.project(position, frame.size())) + }); if let Some(cell) = hovered_cell { frame.with_save(|frame| { @@ -675,7 +674,7 @@ mod grid { Interaction::Drawing => mouse::Interaction::Crosshair, Interaction::Erasing => mouse::Interaction::Crosshair, Interaction::Panning { .. } => mouse::Interaction::Grabbing, - Interaction::None if cursor.is_over(&bounds) => { + Interaction::None if cursor.is_over(bounds) => { mouse::Interaction::Crosshair } _ => mouse::Interaction::default(), diff --git a/examples/geometry/src/main.rs b/examples/geometry/src/main.rs index 1f949d10..29f78ea1 100644 --- a/examples/geometry/src/main.rs +++ b/examples/geometry/src/main.rs @@ -62,7 +62,7 @@ mod rainbow { let color_v = [0.75, 0.0, 0.5, 1.0]; let posn_center = { - if let Some(cursor_position) = cursor.position_in(&bounds) { + if let Some(cursor_position) = cursor.position_in(bounds) { [cursor_position.x, cursor_position.y] } else { [bounds.width / 2.0, bounds.height / 2.0] diff --git a/examples/modal/src/main.rs b/examples/modal/src/main.rs index 82ed05d2..5c43c203 100644 --- a/examples/modal/src/main.rs +++ b/examples/modal/src/main.rs @@ -390,7 +390,7 @@ mod modal { mouse::Button::Left, )) = &event { - if !cursor.is_over(&content_bounds) { + if !cursor.is_over(content_bounds) { shell.publish(message.clone()); return event::Status::Captured; } diff --git a/examples/sierpinski_triangle/src/main.rs b/examples/sierpinski_triangle/src/main.rs index ad681a91..885d3c63 100644 --- a/examples/sierpinski_triangle/src/main.rs +++ b/examples/sierpinski_triangle/src/main.rs @@ -108,12 +108,12 @@ impl canvas::Program<Message> for SierpinskiGraph { bounds: Rectangle, cursor: mouse::Cursor, ) -> (event::Status, Option<Message>) { - let cursor_position = - if let Some(position) = cursor.position_in(&bounds) { - position - } else { - return (event::Status::Ignored, None); - }; + let cursor_position = if let Some(position) = cursor.position_in(bounds) + { + position + } else { + return (event::Status::Ignored, None); + }; match event { Event::Mouse(mouse_event) => { |