fix endless running loops in anim mode

This commit is contained in:
ngradwohl 2019-07-21 12:15:36 +02:00
parent 7a7914ddbe
commit a482000c79
2 changed files with 14 additions and 3 deletions

View File

@ -31,10 +31,21 @@ function Commander (ronin) {
this.hide() this.hide()
} }
this._current_txt = ''
this.run = (txt = this._input.value) => { this.run = (txt = this._input.value) => {
if (txt.indexOf('$') > -1) { ronin.log('Present: $'); return } if (txt.indexOf('$') > -1) { ronin.log('Present: $'); return }
ronin.interpreter.run(txt) this._current_txt = txt;
ronin.always === true && requestAnimationFrame(() => this.run(txt))
if ( ronin.always !== true ) {
ronin.interpreter.run(this._current_txt)
}
}
this.loop = () => {
ronin.interpreter.run(this._current_txt)
ronin.always === true && requestAnimationFrame(() => this.loop())
} }
this.load = function (txt) { this.load = function (txt) {

View File

@ -64,7 +64,7 @@ function Ronin () {
this.animate = (b = true) => { this.animate = (b = true) => {
if (this.always === b) { return } if (this.always === b) { return }
this.always = b this.always = b
this.commander.run() this.commander.loop()
} }
// Zoom // Zoom