From 5d1ca4ff5ea90afa790fd0b95f849acfe82a95d0 Mon Sep 17 00:00:00 2001 From: Marcus Fedarko Date: Fri, 17 Jul 2020 19:25:35 -0700 Subject: [PATCH] BUG: fix bug i just introduced in lw corner case 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 #142 accordingly.) --- empress/support_files/js/empress.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/empress/support_files/js/empress.js b/empress/support_files/js/empress.js index 194dd1352..8334a4859 100644 --- a/empress/support_files/js/empress.js +++ b/empress/support_files/js/empress.js @@ -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;