cellular-automata/lib/components/controls_component.dart

41 lines
803 B
Dart

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",
directives: [
coreDirectives,
MaterialButtonComponent,
MaterialIconComponent,
MaterialTooltipDirective
],
providers: [],
styleUrls: const ["controls_component.css"],
)
class ControlsComponent {
final EngineService engine;
ControlsComponent(this.engine);
void onStartClicked() {
engine.toggleRunning();
}
void onStepClicked() {
engine.step();
}
void onResetClicked() {
engine.reset();
}
void onRandomClicked() {
engine.addRandomPattern();
}
void onClearClicked() {
engine.clear();
}
}