Commit d6b6a1d5 authored by Martín's avatar Martín
Browse files

- Fix Focus luego de graficar algo en el canvas (grafica, figura o animacion)

- Fix. Luego de una animación, si se graficaba algo, cuando se ejecutaba el callback del setimeout, borraba el gráfico y la animación continuaba. Quedó solucionado.
parent 8a840bfa
......@@ -40,7 +40,7 @@ export class CanvasComponent {
this.objetos = [];
})
}
animar_:boolean = true;
objetos:any = [];
evaluacionVertical:boolean = true;
elementosAnimacion:any = [];
......@@ -161,6 +161,7 @@ export class CanvasComponent {
}
public limpiarCanvas = function(){
this.animar_ = false;
this.objetos = [];
this.context.clearRect(0, 0, this.canvasRef.nativeElement.width, this.canvasRef.nativeElement.height);
if(this.mostrarEjes || this.mostrarGrilla){
......@@ -288,11 +289,21 @@ private generarExpresion = function(exp:any){
}
private animar = function(){
this.animar_ = true;
if(this.mostrarEjes || this.mostrarGrilla){
this.drawXAxis(this.context);
this.drawYAxis(this.context);
}
this.limpiarCanvas();
//limpio canvas.
this.objetos = [];
this.context.clearRect(0, 0, this.canvasRef.nativeElement.width, this.canvasRef.nativeElement.height);
if(this.mostrarEjes || this.mostrarGrilla){
this.drawXAxis(this.context);
this.drawYAxis(this.context);
}
this.objetos = this.elementosAnimacion[this.frameAnimacion];
this.dibujarObjetos();
if(this.animando){
......@@ -302,7 +313,9 @@ private animar = function(){
if(this.frameAnimacion>=this.elementosAnimacion.length){
this.frameAnimacion = 0;
}
this.animar();
if(this.animar_){
this.animar();
}
}
}.bind(this),1000);
}
......
......@@ -295,6 +295,8 @@ hayError(text){
this.startPrompt();
// console.log(x);
}else if (json_server_message.tipo == 'canvas' || json_server_message.tipo == 'animacion' || json_server_message.tipo == 'graph'){
document.getElementById("FigurasBtn").click()
this.focusConsole();
this.messages.next(json_server_message);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment