Skip to content

Commit

Permalink
BUG: fix bug i just introduced in lw corner case
Browse files Browse the repository at this point in the history
If thickening *was* done previously, but wasn't currently being
done, then Empress._currentLineWidth wasn't being updated to 0.
This meant that, when redrawing the tree after updating the layout,
an old line width was being used.

Now things are good! yay. (This is the sort of case we should probs
add a test for. tagging biocore#142 accordingly.)
  • Loading branch information
fedarko committed Jul 18, 2020
1 parent 2f1f639 commit 5d1ca4f
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions empress/support_files/js/empress.js
Original file line number Diff line number Diff line change
Expand Up @@ -571,8 +571,22 @@ define([
Empress.prototype.thickenSameSampleLines = function (level) {
// If level isn't > 0, then we don't thicken colored lines at all --
// we just leave them at their default width.
if (level <= 0) {
return;
if (level < 0) {
// should never happen because util.parseAndValidateLineWidth()
// should've been called in order to obtain "level", but in case
// this gets messed up in the future we'll catch it
throw "Line width passed to thickenSameSampleLines() is < 0.";
} else {
// Make sure that, even if level is 0 (i.e. we don't need to
// thicken the lines), we still set the current line width
// accordingly. This way, when doing things like updating the
// layout that'll require re-drawing the tree based on the most
// recent settings, we'll have access to the correct line width.
this._currentLineWidth = level;
if (level === 0) {
// But, yeah, if level is 0 we can just return early.
return;
}
}
this._currentLineWidth = level;
var tree = this._tree;
Expand Down

0 comments on commit 5d1ca4f

Please sign in to comment.