Examples - Show only working controls for examples
This commit is contained in:
parent
b7a6f67d24
commit
7a87ad3749
1 changed files with 19 additions and 1 deletions
|
@ -114,7 +114,8 @@ void activate(MouseEvent e) {
|
|||
}
|
||||
|
||||
void addControls(Example ex) {
|
||||
querySelector(ex.query).append(new DivElement()
|
||||
DivElement group = new DivElement();
|
||||
querySelector(ex.query).append(group
|
||||
..append(new ButtonElement()
|
||||
..text = "Start"
|
||||
..onClick.listen((e) {
|
||||
|
@ -126,6 +127,23 @@ void addControls(Example ex) {
|
|||
..onClick.listen((e) {
|
||||
ex.loop.stop();
|
||||
})));
|
||||
|
||||
// Don't add controls which don't work anyways (for simple examples)
|
||||
if(examples.indexOf(ex) <= 1) return;
|
||||
|
||||
group
|
||||
..append(new LabelElement()
|
||||
..htmlFor = "update_speed"
|
||||
..innerHtml = "Updates per Second:")
|
||||
..append(new InputElement(type: "range")
|
||||
..id = "update_speed"
|
||||
..min = "1"
|
||||
..max = "20"
|
||||
..value = "3"
|
||||
..step = "1"
|
||||
..onInput.listen((Event e) {
|
||||
ex.loop;
|
||||
}));
|
||||
// querySelector('#reset').onClick.listen((e) => ex.loop.game.reset());
|
||||
// querySelector('#plus').onClick.listen((e) => _changeGrid(-5));
|
||||
// querySelector('#minus').onClick.listen((e) => _changeGrid(5));
|
||||
|
|
Loading…
Reference in a new issue