fix endless running loops in anim mode
This commit is contained in:
		| @@ -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) { | ||||||
|   | |||||||
| @@ -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 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user