summaryrefslogtreecommitdiffstats
path: root/examples/game_of_life/src
diff options
context:
space:
mode:
authorLibravatar Bingus <shankern@protonmail.com>2022-10-07 16:58:45 -0700
committerLibravatar GitHub <noreply@github.com>2022-10-07 16:58:45 -0700
commitaabc4e87b51af8025910681dc427260254877e4c (patch)
tree44dc50e04e58c15871cc56d22221dc43685d1d58 /examples/game_of_life/src
parent7a124476b1f609019bb0fdfa1254236af2d2a49e (diff)
parent77c838011fe6f8f567389d5994584a1a1b8420c5 (diff)
downloadiced-aabc4e87b51af8025910681dc427260254877e4c.tar.gz
iced-aabc4e87b51af8025910681dc427260254877e4c.tar.bz2
iced-aabc4e87b51af8025910681dc427260254877e4c.zip
Merge branch 'master' into fear/linear-gradients
Diffstat (limited to 'examples/game_of_life/src')
-rw-r--r--examples/game_of_life/src/main.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/examples/game_of_life/src/main.rs b/examples/game_of_life/src/main.rs
index a2030275..2a8b3721 100644
--- a/examples/game_of_life/src/main.rs
+++ b/examples/game_of_life/src/main.rs
@@ -204,6 +204,7 @@ fn view_controls<'a>(
mod grid {
use crate::Preset;
+ use iced::touch;
use iced::widget::canvas;
use iced::widget::canvas::event::{self, Event};
use iced::widget::canvas::{
@@ -423,6 +424,19 @@ mod grid {
};
match event {
+ Event::Touch(touch::Event::FingerMoved { .. }) => {
+ let message = {
+ *interaction = if is_populated {
+ Interaction::Erasing
+ } else {
+ Interaction::Drawing
+ };
+
+ populate.or(unpopulate)
+ };
+
+ (event::Status::Captured, message)
+ }
Event::Mouse(mouse_event) => match mouse_event {
mouse::Event::ButtonPressed(button) => {
let message = match button {