2018-08-22 18:16:31 +00:00
|
|
|
import 'package:angular/angular.dart';
|
|
|
|
import 'package:angular_components/angular_components.dart';
|
|
|
|
import 'package:rules_of_living/service/engine_service.dart';
|
|
|
|
|
|
|
|
@Component(
|
|
|
|
selector: 'sim-controls',
|
|
|
|
templateUrl: "controls_component.html",
|
2018-08-23 10:38:34 +00:00
|
|
|
directives: [
|
|
|
|
coreDirectives,
|
|
|
|
MaterialButtonComponent,
|
|
|
|
MaterialIconComponent,
|
|
|
|
MaterialTooltipDirective
|
|
|
|
],
|
2018-08-22 18:16:31 +00:00
|
|
|
providers: [],
|
|
|
|
styleUrls: const ["controls_component.css"],
|
|
|
|
)
|
|
|
|
class ControlsComponent {
|
2018-08-25 07:33:15 +00:00
|
|
|
final EngineService engine;
|
2018-08-23 07:33:15 +00:00
|
|
|
|
2018-08-25 07:33:15 +00:00
|
|
|
ControlsComponent(this.engine);
|
2018-08-22 18:16:31 +00:00
|
|
|
|
|
|
|
void onStartClicked() {
|
2018-08-25 07:33:15 +00:00
|
|
|
engine.toggleRunning();
|
2018-08-22 18:16:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void onStepClicked() {
|
|
|
|
engine.step();
|
|
|
|
}
|
|
|
|
|
|
|
|
void onResetClicked() {
|
|
|
|
engine.reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
void onRandomClicked() {
|
2018-08-25 07:33:15 +00:00
|
|
|
engine.addRandomPattern();
|
2018-08-22 18:16:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void onClearClicked() {
|
|
|
|
engine.clear();
|
|
|
|
}
|
|
|
|
}
|