summaryrefslogtreecommitdiffstats
path: root/examples/game_of_life
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-04-30 04:53:15 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-04-30 04:53:15 +0200
commite55cd9652e7c7aea4dc2c6ccb83769246d1a808e (patch)
tree6383563bab65b5feed50873c447a40da929d90bf /examples/game_of_life
parente139aae1439d362ada017a05c9554eaae0883888 (diff)
downloadiced-e55cd9652e7c7aea4dc2c6ccb83769246d1a808e.tar.gz
iced-e55cd9652e7c7aea4dc2c6ccb83769246d1a808e.tar.bz2
iced-e55cd9652e7c7aea4dc2c6ccb83769246d1a808e.zip
Split `Input` mouse event by `ButtonState`
Diffstat (limited to 'examples/game_of_life')
-rw-r--r--examples/game_of_life/src/main.rs15
1 files changed, 4 insertions, 11 deletions
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);