Skip to content

Commit bf46862

Browse files
committed
Refactor drawDebugInfo
1 parent 286160e commit bf46862

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

demo/demo.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,7 @@ function GraphSearch($graph, options, implementation) {
101101
}
102102
GraphSearch.prototype.setOption = function(opt) {
103103
this.opts = $.extend(this.opts, opt);
104-
if(opt["debug"]||opt["debug"]==false) {
105-
this.drawDebugInfo(opt["debug"]);
106-
}
104+
this.drawDebugInfo();
107105
};
108106
GraphSearch.prototype.initialize = function() {
109107
this.grid = [];
@@ -190,16 +188,14 @@ GraphSearch.prototype.cellClicked = function($end) {
190188
}
191189
else {
192190
$("#message").text("search took " + duration + "ms.");
193-
if(this.opts.debug) {
194-
this.drawDebugInfo(this.opts.debug);
195-
}
191+
this.drawDebugInfo();
196192
this.animatePath(path);
197193
}
198194
};
199-
GraphSearch.prototype.drawDebugInfo = function(show) {
195+
GraphSearch.prototype.drawDebugInfo = function() {
200196
this.$cells.html(" ");
201197
var that = this;
202-
if(show) {
198+
if(this.opts.debug) {
203199
that.$cells.each(function(i) {
204200
var node = that.nodeFromElement($(this)),
205201
debug = false;

0 commit comments

Comments
 (0)