From 46f097c5719eb9e313ab7a06b78d0905ab0e3744 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mart=C3=ADn?= <mmendez5163@gmail.com>
Date: Fri, 3 Nov 2017 21:52:48 -0300
Subject: [PATCH] Fix en overlap de animaciones

---
 .../src/app/layout/canvas/canvas.component.ts              | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

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 9fdd2de..ec12f72 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){
-- 
GitLab