Skip to content

Commit

Permalink
Merge pull request #1024 from GMOD/fix_hide_tracklabels_toggle
Browse files Browse the repository at this point in the history
Fix hide track labels logic for toggling
  • Loading branch information
rbuels authored Mar 15, 2018
2 parents bb8a209 + 9df497f commit 2f22a28
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions plugins/HideTrackLabels/js/main.js
Original file line number Diff line number Diff line change
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 2f22a28

Please sign in to comment.