529e79249d1caddbac43d5f39744ef27e4016ea3 tdreszer Mon Jan 27 12:58:02 2014 -0800 Fixed user reported error when refreshing image that has 'ruler' track on hide. Redmine #12553. Also cleaned up 2 cases where user action may leave the highlight outside the image boundaries. Redmine #709. diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index 9dc5658..d42add2 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -525,30 +525,31 @@ return false; }, initForAjax: function() { // To better support the back-button, it is good to eliminate extraneous form puts // Towards that end, we support visBoxes making ajax calls to update cart. var sels = $('select.normalText,select.hiddenText'); $(sels).change(function() { var track = $(this).attr('name'); if ($(this).val() == 'hide') { var rec = hgTracks.trackDb[track]; if(rec) rec.visibility = 0; // else Would be nice to hide subtracks as well but that may be overkill $(document.getElementById('tr_' + track)).remove(); + imageV2.highlightRegion(); $(this).attr('class', 'hiddenText'); } else $(this).attr('class', 'normalText'); setCartVar(track,$(this).val()); return false; }); // Now we can rid the submt of the burden of all those vis boxes var form = $('form#TrackForm'); $(form).submit(function () { $('select.normalText,select.hiddenText').attr('disabled',true); }); $(form).attr('method','get'); } @@ -2886,30 +2887,32 @@ } } return false; }, updateImgForAllIds: function (response, oldJson, newJson) { // update all rows in imgTbl based upon navigateInPlace response. var imgTbl = $('#imgTbl'); // We update rows one at a time // (b/c updating the whole imgTbl at one time doesn't work in IE). for (var id in newJson.trackDb) { var newJsonRec = newJson.trackDb[id]; var oldJsonRec = oldJson.trackDb[id]; + if (newJsonRec.visibility == 0) // hidden 'ruler' is in newJson.trackDb! + continue; if (newJsonRec.type == "remote") continue; if (oldJsonRec != undefined && oldJsonRec.visibility != 0) { // New track replacing old: if (!imageV2.updateImgForId(response, id, true, newJsonRec)) warn("Couldn't parse out new image for id: " + id); } else { //if (oldJsonRec == undefined || oldJsonRec.visibility == 0) // New track seen for the first time if (imageV2.backSupport) { $(imgTbl).append("