From e55cd9652e7c7aea4dc2c6ccb83769246d1a808e Mon Sep 17 00:00:00 2001
From: Héctor Ramón Jiménez <hector0193@gmail.com>
Date: Thu, 30 Apr 2020 04:53:15 +0200
Subject: Split `Input` mouse event by `ButtonState`

---
 examples/game_of_life/src/main.rs | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

(limited to 'examples/game_of_life/src')

diff --git a/examples/game_of_life/src/main.rs b/examples/game_of_life/src/main.rs
index 983d6cb4..9fb4c3e7 100644
--- a/examples/game_of_life/src/main.rs
+++ b/examples/game_of_life/src/main.rs
@@ -158,8 +158,8 @@ impl Application for GameOfLife {
 mod grid {
     use iced::{
         canvas::{self, Canvas, Cursor, Event, Frame, Geometry, Path},
-        mouse, ButtonState, Color, Element, Length, MouseCursor, Point,
-        Rectangle, Size, Vector,
+        mouse, Color, Element, Length, MouseCursor, Point, Rectangle, Size,
+        Vector,
     };
     use std::collections::{HashMap, HashSet};
 
@@ -268,11 +268,7 @@ mod grid {
             bounds: Rectangle,
             cursor: Cursor,
         ) -> Option<Message> {
-            if let Event::Mouse(mouse::Event::Input {
-                state: ButtonState::Released,
-                ..
-            }) = event
-            {
+            if let Event::Mouse(mouse::Event::ButtonReleased(_)) = event {
                 self.interaction = None;
             }
 
@@ -287,10 +283,7 @@ mod grid {
 
             match event {
                 Event::Mouse(mouse_event) => match mouse_event {
-                    mouse::Event::Input {
-                        button,
-                        state: ButtonState::Pressed,
-                    } => match button {
+                    mouse::Event::ButtonPressed(button) => match button {
                         mouse::Button::Left => {
                             self.interaction = Some(Interaction::Drawing);
 
-- 
cgit