From c5ed18f0adab03948df3f3ed43c43e7a6fb0a347 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Sat, 7 Jul 2018 22:02:04 +0200 Subject: [PATCH] Add Random Button Functionality Adds random pattern toward the center of the canvas. Does not delete anything. --- lib/app_component.dart | 5 ++++- lib/src/Grid.dart | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/app_component.dart b/lib/app_component.dart index afce95f..c23443e 100644 --- a/lib/app_component.dart +++ b/lib/app_component.dart @@ -48,5 +48,8 @@ class AppComponent implements OnInit { engine.reset(); } - void onRandomClicked() {} + void onRandomClicked() { + engine.running = false; + engine.grid.addPattern(); + } } diff --git a/lib/src/Grid.dart b/lib/src/Grid.dart index 5730461..062a78c 100644 --- a/lib/src/Grid.dart +++ b/lib/src/Grid.dart @@ -83,6 +83,7 @@ class Grid { } break; } + _dirty = true; } void setCellState(int x, int y, bool state) {