Move Canvas setting to configuration service

Fix #39
This commit is contained in:
Marty Oehme 2018-08-27 20:55:55 +02:00
parent a92b864dfa
commit b6919cff6b
3 changed files with 12 additions and 13 deletions

View file

@ -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;

View file

@ -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;
}