Skip to content
Snippets Groups Projects
Commit 46f097c5 authored by Martín's avatar Martín
Browse files

Fix en overlap de animaciones

parent 83f8a607
No related branches found
No related tags found
No related merge requests found
...@@ -51,7 +51,7 @@ export class CanvasComponent { ...@@ -51,7 +51,7 @@ export class CanvasComponent {
//Todo, abscisa y ordenada //Todo, abscisa y ordenada
tipoZoom = "Todo"; tipoZoom = "Todo";
tipoZoomDesc = "Zoom en ambos ejes"; tipoZoomDesc = "Zoom en ambos ejes";
timeOutRef:number;
@ViewChild('canvasElement') canvasRef: ElementRef; @ViewChild('canvasElement') canvasRef: ElementRef;
...@@ -162,6 +162,7 @@ export class CanvasComponent { ...@@ -162,6 +162,7 @@ export class CanvasComponent {
public limpiarCanvas = function(){ public limpiarCanvas = function(){
this.animar_ = false; this.animar_ = false;
clearTimeout(this.timeOutRef);
this.objetos = []; this.objetos = [];
this.context.clearRect(0, 0, this.canvasRef.nativeElement.width, this.canvasRef.nativeElement.height); this.context.clearRect(0, 0, this.canvasRef.nativeElement.width, this.canvasRef.nativeElement.height);
if(this.mostrarEjes || this.mostrarGrilla){ if(this.mostrarEjes || this.mostrarGrilla){
...@@ -307,7 +308,7 @@ private animar = function(){ ...@@ -307,7 +308,7 @@ private animar = function(){
this.objetos = this.elementosAnimacion[this.frameAnimacion]; this.objetos = this.elementosAnimacion[this.frameAnimacion];
this.dibujarObjetos(); this.dibujarObjetos();
if(this.animando){ if(this.animando){
setTimeout(function(){ this.timeOutRef = setTimeout(function(){
if(this.animando){ if(this.animando){
this.frameAnimacion ++; this.frameAnimacion ++;
if(this.frameAnimacion>=this.elementosAnimacion.length){ if(this.frameAnimacion>=this.elementosAnimacion.length){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment