Extract EngineService into separate service
This commit is contained in:
parent
04d61bfa02
commit
a92b864dfa
8 changed files with 86 additions and 67 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import 'package:angular/angular.dart';
|
||||
import 'package:angular_components/angular_components.dart';
|
||||
import 'package:rules_of_living/service/engine_service.dart';
|
||||
import 'package:rules_of_living/service/control_service.dart';
|
||||
|
||||
@Component(
|
||||
selector: 'sim-controls',
|
||||
|
|
@ -15,27 +15,27 @@ import 'package:rules_of_living/service/engine_service.dart';
|
|||
styleUrls: const ["controls_component.css"],
|
||||
)
|
||||
class ControlsComponent {
|
||||
final EngineService engine;
|
||||
final ControlService ctrl;
|
||||
|
||||
ControlsComponent(this.engine);
|
||||
ControlsComponent(this.ctrl);
|
||||
|
||||
void onStartClicked() {
|
||||
engine.toggleRunning();
|
||||
ctrl.toggleRunning();
|
||||
}
|
||||
|
||||
void onStepClicked() {
|
||||
engine.step();
|
||||
ctrl.step();
|
||||
}
|
||||
|
||||
void onResetClicked() {
|
||||
engine.reset();
|
||||
ctrl.reset();
|
||||
}
|
||||
|
||||
void onRandomClicked() {
|
||||
engine.addRandomPattern();
|
||||
ctrl.addRandomPattern();
|
||||
}
|
||||
|
||||
void onClearClicked() {
|
||||
engine.clear();
|
||||
ctrl.clear();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue