diff --git a/lib/components/simulation_component.dart b/lib/components/simulation_component.dart index 99b3f02..312eef4 100644 --- a/lib/components/simulation_component.dart +++ b/lib/components/simulation_component.dart @@ -1,7 +1,7 @@ import 'dart:html' as html; import 'package:angular/angular.dart'; -import 'package:rules_of_living/service/control_service.dart'; +import 'package:rules_of_living/service/configuration_service.dart'; @Component( selector: 'gol-simulation', @@ -10,9 +10,9 @@ import 'package:rules_of_living/service/control_service.dart'; providers: [], ) class SimulationComponent implements OnInit { - final ControlService ctrl; + final ConfigurationService config; - SimulationComponent(this.ctrl); + SimulationComponent(this.config); @override void ngOnInit() { @@ -29,6 +29,6 @@ class SimulationComponent implements OnInit { the canvas did not load correctly :( ''', canvas.width / 2 - 50, canvas.height / 2); - ctrl.canvas = canvas; + config.canvas = canvas; } } diff --git a/lib/service/configuration_service.dart b/lib/service/configuration_service.dart index edee10c..880cf45 100644 --- a/lib/service/configuration_service.dart +++ b/lib/service/configuration_service.dart @@ -1,3 +1,4 @@ +import 'dart:html' as html; import 'dart:math'; import 'package:rules_of_living/service/engine_service.dart'; @@ -9,6 +10,11 @@ class ConfigurationService { int _simSpeed; + ConfigurationService(this._es) { + showGrid = false; + simSpeed = 5; + } + /// Simulation Speed /// /// Sets the number of updates the simulation takes per second. Can range from @@ -20,10 +26,8 @@ class ConfigurationService { _es.engine.stepsPerSecond = simSpeed; } - ConfigurationService(this._es) { - showGrid = false; - simSpeed = 5; - } + void set canvas(html.CanvasElement canvas) => _es.engine.canvas = canvas; + html.CanvasElement get canvas => _es.engine.canvas; void toggleGrid() { showGrid = !showGrid; diff --git a/lib/service/control_service.dart b/lib/service/control_service.dart index abc1f57..0066106 100644 --- a/lib/service/control_service.dart +++ b/lib/service/control_service.dart @@ -1,5 +1,3 @@ -import 'dart:html' as html; - import 'package:rules_of_living/service/engine_service.dart'; class ControlService { @@ -7,9 +5,6 @@ class ControlService { ControlService(this._es); - void set canvas(html.CanvasElement canvas) => _es.engine.canvas = canvas; - html.CanvasElement get canvas => _es.engine.canvas; - void run() { _es.engine.running = true; }