|
1 | | -var s = null, graph = null, graphMode = null, sigmaCanvas = null; |
| 1 | +var s = null, graph = null, sigmaCanvas = null; |
2 | 2 |
|
3 | 3 | function GraphTracer(module) { |
4 | | - Tracer.call(this, module || GraphTracer); |
5 | | - return initGraph(this.module); |
| 4 | + if (Tracer.call(this, module || WeightedGraphTracer)) { |
| 5 | + initGraph(); |
| 6 | + return true; |
| 7 | + } |
| 8 | + return false; |
6 | 9 | } |
7 | 10 |
|
8 | | -GraphTracer.graphMode = "default"; |
9 | 11 | GraphTracer.prototype = Object.create(Tracer.prototype); |
10 | 12 | GraphTracer.prototype.constructor = GraphTracer; |
11 | 13 |
|
@@ -59,7 +61,6 @@ GraphTracer.prototype.setTreeData = function (G, root) { |
59 | 61 | if (this.setData(G, root)) return true; |
60 | 62 |
|
61 | 63 | var place = function (node, x, y) { |
62 | | - console.log(node); |
63 | 64 | var temp = graph.nodes(n(node)); |
64 | 65 | temp.x = x; |
65 | 66 | temp.y = y; |
@@ -190,10 +191,7 @@ GraphTracer.prototype.prevStep = function () { |
190 | 191 | this.step(finalIndex); |
191 | 192 | }; |
192 | 193 |
|
193 | | -var initGraph = function (module) { |
194 | | - if (s && graph && graphMode == module.graphMode) return false; |
195 | | - graphMode = module.graphMode; |
196 | | - |
| 194 | +var initGraph = function () { |
197 | 195 | $('.visualize_container').empty(); |
198 | 196 | if (sigmaCanvas == null) { |
199 | 197 | sigmaCanvas = $.extend(true, {}, sigma.canvas); |
@@ -232,8 +230,6 @@ var initGraph = function (module) { |
232 | 230 | drawArrow(edge, source, target, color, context, settings); |
233 | 231 | }; |
234 | 232 | sigma.plugins.dragNodes(s, s.renderers[0]); |
235 | | - |
236 | | - return true; |
237 | 233 | }; |
238 | 234 |
|
239 | 235 | var graphColor = { |
|
0 commit comments