3df0f0e83b9b27988863a88b53b79829bbbfbe02 tdreszer Thu Nov 3 15:55:42 2011 -0700 Took care of some of the matrix hilite ghosting. Is it enough? diff --git src/hg/js/hui.js src/hg/js/hui.js index 61d9c83..f7e63b9 100644 --- src/hg/js/hui.js +++ src/hg/js/hui.js @@ -1193,70 +1193,91 @@ $(sel).addClass('normalText'); superT.topVis(true); } if (val == undefined) { // onchange event only var cb = $('input#'+sel.name); if (cb != undefined && cb.length == 1) { cb = cb[0]; $(cb).attr('checked',(selIx > 0)); } } } } var mat = { // Beginings of matrix object + matrix: undefined, dimensions: 0, + cellInFocus: undefined, - cellHover: function (obj,on) + cellHover: function (cell,on) { - var classList = $( obj ).attr("class").split(" "); + if (on) { + if (mat.cellInFocus != undefined) + mat.clearGhostHilites(); // Necessary to clear ghosts + mat.cellInFocus = cell; + } else + mat.cellInFocus = undefined; + + var classList = $( cell ).attr("class").split(" "); classList = aryRemove(classList,["matCell"]); + var color = (on ? "#FCECC0" : "");// "#FFF9D2"); setting to "" removes the hilite for (var ix=0;ix < classList.length;ix++) { if (classList[ix] == 'all') continue; - var cells = $(".matCell."+classList[ix]); - if (on) - $(cells).css({backgroundColor:"#FCECC0"}); - else - $(cells).css({backgroundColor:"#FFF9D2"}); + if (ix == 0) { + $(".matCell."+classList[ix]).css({backgroundColor: color }); + } else { + $(cell).closest('tr').css({backgroundColor: color }) // faster? + } } - if (on && obj.title.length == 0) { + if (on && cell.title.length == 0) { for (var ix=0;ix < classList.length;ix++) { if (classList[ix] == 'all') { // on a label already - obj.title = ""; + cell.title = ""; break; } - if (obj.title.length > 0) - obj.title += " and "; - obj.title += $("th."+classList[ix]).first().text(); + if (cell.title.length > 0) + cell.title += " and "; + cell.title += $("th."+classList[ix]).first().text(); } } }, + clearGhostHilites: function () + { + $('.matCell').css({backgroundColor:""}); + $(mat.matrix).find('tr').css({backgroundColor:""}); + }, + init: function () { + mat.matrix = normed($('table.matrix')); + if (mat.matrix != undefined) { var cells = $('td.matCell'); if (cells != undefined && cells.length > 0) { var classList = $( cells[0] ).attr("class").split(" "); classList = aryRemove(classList,["matCell"]); mat.dimensions = classList.length; if (mat.dimensions > 1) { // No need unless this is a 2D matrix $('.matCell').hover( function (e) {mat.cellHover(this,true)}, function (e) {mat.cellHover(this,false)} ); + $(mat.matrix).blur(mat.clearGhostHilites()); + $(window).bind('focus',function (e) {mat.clearGhostHilites();}); // blur doesn't work because the screen isn't repainted + } } } } } // The following js depends upon the jQuery library $(document).ready(function() { mat.init(); if (normed($('table.subtracks')) != undefined) { matInitializeMatrix(); // If divs with class 'subCfg' then initialize the subtrack cfg code // NOTE: must be before any ddcl setup