Skip to content

Commit

Permalink
Fix hide track labels logic for toggling
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Mar 15, 2018
1 parent 2f52e30 commit 9df497f
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions plugins/HideTrackLabels/js/main.js
Expand Up @@ -70,7 +70,6 @@ return declare( JBrowsePlugin,
thisB.showTrackLabels("hide");
});
}

dojo.subscribe("/jbrowse/v1/n/tracks/redraw", function(data){
thisB.showTrackLabels("hide-if");
});
Expand All @@ -84,7 +83,7 @@ return declare( JBrowsePlugin,
*/
showTrackLabels: function(fn) {
var direction = 1;
var button = dom.byId("hidetitled-btn");
var button = dom.byId("hidetitles-btn");

if (fn=="show") {
if(button) dojo.removeAttr(button,"hidden-titles");
Expand All @@ -100,13 +99,15 @@ return declare( JBrowsePlugin,
}

if (fn=="toggle"){
if (button && dojo.hasAttr(button,"hidden-titles")) { // if hidden, show
dojo.removeAttr(button,"hidden-titles");
direction = 1;
}
else {
if(button) dojo.attr(button,"hidden-titles",""); // if shown, hide
direction = -1;
if (button) {
if(dojo.hasAttr(button,"hidden-titles")) { // if hidden, show
dojo.removeAttr(button,"hidden-titles");
direction = 1;
}
else {
dojo.attr(button,"hidden-titles",""); // if shown, hide
direction = -1;
}
}
}
// protect Hide button from clicks during animation
Expand Down

0 comments on commit 9df497f

Please sign in to comment.