From 33edb4dbc56b88aa08ebe9fc80d4b6c222870fd3 Mon Sep 17 00:00:00 2001
From: Leonel Rosano <leonel.rosano@fing.edu.uy>
Date: Tue, 2 Oct 2018 19:39:44 -0300
Subject: [PATCH] Soluciona problemas con enumerados, ahora se borra cache si
 se grafica un enumerado

---
 .../plotter/graph2D/graph2D.component.ts      | 73 +++++++++++--------
 1 file changed, 44 insertions(+), 29 deletions(-)

diff --git a/Frontend Angular 4/src/app/layout/plotter/graph2D/graph2D.component.ts b/Frontend Angular 4/src/app/layout/plotter/graph2D/graph2D.component.ts
index f969c45..938b6ff 100755
--- a/Frontend Angular 4/src/app/layout/plotter/graph2D/graph2D.component.ts	
+++ b/Frontend Angular 4/src/app/layout/plotter/graph2D/graph2D.component.ts	
@@ -121,36 +121,51 @@ export class Graph2DComponent {
                         }
 
                         if(this.animation.boton && obj.conj.cod != 'Numer' && obj.conj.dom != 'Numer'){
-                            if(this.conjunto.length == 1){
-                                this.id = 1;
-                                this.conjunto.unshift({radio: 2, dom:this.conjunto[0].baseDom, cod:this.conjunto[0].baseCod, baseCod:this.conjunto[0].baseCod, baseDom:this.conjunto[0].baseDom, sets:{fdom:this.conjunto[0].baseDom,fcod:this.conjunto[0].baseCod}});
-                                this.funciones[0].id = this.id;
-                                
-                            }
-                            if (this.conjunto.length != 0){ 
-                                if (obj.conj.baseDom == 'R'){
-                                    this.conjunto[0].baseDom = 'R';
-                                    this.conjunto[0].dom = 'R';
-                                    this.conjunto[0].sets.fdom = 'R';
-                                }
-                                if (obj.conj.baseCod == 'R'){
-                                    this.conjunto[0].baseCod = 'R';
-                                    this.conjunto[0].cod = 'R';
-                                    this.conjunto[0].sets.fcod = 'R';
+                            if(this.conjunto.length == 1 && (this.conjunto[0].cod == 'Numer' || this.conjunto[0].dom == 'Numer')){
+                                this.conjunto = [];
+                                this.conjunto.push(obj.conj);
+                                this.id = 0;
+                                this.funciones = [];
+                                this.funciones.push({
+                                    id: this.funciones.length,
+                                    sampler: 'builtIn',
+                                    fn: function(scope) {
+                                      return fun(scope.x)
+                                    },
+                                    graphType: tipoGraf,
+                                    color: color
+                                })
+                            }else{
+                                if(this.conjunto.length == 1){
+                                    this.id = 1;
+                                    this.conjunto.unshift({radio: 2, dom:this.conjunto[0].baseDom, cod:this.conjunto[0].baseCod, baseCod:this.conjunto[0].baseCod, baseDom:this.conjunto[0].baseDom, sets:{fdom:this.conjunto[0].baseDom,fcod:this.conjunto[0].baseCod}});
+                                    this.funciones[0].id = this.id;
+                                    
                                 }
-                            }    
-                            this.conjunto.push(obj.conj);
-
-                            this.funciones.push({
-                                id: this.funciones.length + this.id,
-                                sampler: 'builtIn',
-                                fn: function(scope) {
-                                  return fun(scope.x)
-                                },
-                                graphType: tipoGraf,
-                                color: color
-                            });
-
+                                if (this.conjunto.length != 0){ 
+                                    if (obj.conj.baseDom == 'R'){
+                                        this.conjunto[0].baseDom = 'R';
+                                        this.conjunto[0].dom = 'R';
+                                        this.conjunto[0].sets.fdom = 'R';
+                                    }
+                                    if (obj.conj.baseCod == 'R'){
+                                        this.conjunto[0].baseCod = 'R';
+                                        this.conjunto[0].cod = 'R';
+                                        this.conjunto[0].sets.fcod = 'R';
+                                    }
+                                }    
+                                this.conjunto.push(obj.conj);
+
+                                this.funciones.push({
+                                    id: this.funciones.length + this.id,
+                                    sampler: 'builtIn',
+                                    fn: function(scope) {
+                                    return fun(scope.x)
+                                    },
+                                    graphType: tipoGraf,
+                                    color: color
+                                });
+                            }        
                         }else{ 
                             this.conjunto = [];
                             this.conjunto.push(obj.conj);
-- 
GitLab