diff --git a/Frontend Angular 4/src/app/layout/canvas/canvas.component.ts b/Frontend Angular 4/src/app/layout/canvas/canvas.component.ts index 9fdd2de0780e7f49a8ddb2e8e53d6b5b53f14c7a..ec12f721d870ce2ec76ee29a74ec488bbcf2580f 100644 --- a/Frontend Angular 4/src/app/layout/canvas/canvas.component.ts +++ b/Frontend Angular 4/src/app/layout/canvas/canvas.component.ts @@ -51,7 +51,7 @@ export class CanvasComponent { //Todo, abscisa y ordenada tipoZoom = "Todo"; tipoZoomDesc = "Zoom en ambos ejes"; - + timeOutRef:number; @ViewChild('canvasElement') canvasRef: ElementRef; @@ -161,7 +161,8 @@ export class CanvasComponent { } public limpiarCanvas = function(){ - this.animar_ = false; + this.animar_ = false; + clearTimeout(this.timeOutRef); this.objetos = []; this.context.clearRect(0, 0, this.canvasRef.nativeElement.width, this.canvasRef.nativeElement.height); if(this.mostrarEjes || this.mostrarGrilla){ @@ -307,7 +308,7 @@ private animar = function(){ this.objetos = this.elementosAnimacion[this.frameAnimacion]; this.dibujarObjetos(); if(this.animando){ - setTimeout(function(){ + this.timeOutRef = setTimeout(function(){ if(this.animando){ this.frameAnimacion ++; if(this.frameAnimacion>=this.elementosAnimacion.length){