6d7237baf9ecee276a4fcc0a3ed10dd5a7d3e0c9 tdreszer Mon Nov 28 15:18:57 2011 -0800 Moved calculating of squeezed matrix label heights to js, since it is so browser dependent. diff --git src/hg/js/hui.js src/hg/js/hui.js index be97fe7..3e2085c 100644 --- src/hg/js/hui.js +++ src/hg/js/hui.js @@ -1272,56 +1272,83 @@ break; } 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:""}); }, + resizeAngleLabels: function () + { // Sets the height on the angled matrix labels + var longest = ""; + var up45 = $('div.up45'); + $(up45).each(function (i) { + if (longest.length < $(this).text().length) + longest = $(this).text(); + }); + if (longest.length > 5) { + $(mat.matrix).append("<span id='noShow' style='color:#FFF9D2;'>"+longest+"</span>"); + var noShow = $('span#noShow'); + var newHeight = ($(noShow).width() * 0.9) + 10; + if (newHeight < 20) + newHeight = longest.length * 7; + $(up45).first().parent('th').css('height',newHeight + 'px'); + $(up45).show(); + var dn45 = $('div.dn45'); + if (dn45 != undefined && dn45.length > 0) { + $(dn45).first().parent('th').css('height',newHeight + 'px'); + $(dn45).show(); + } + $(noShow).remove(); + } + }, + init: function () { mat.matrix = $('table.matrix'); if (mat.matrix != undefined && mat.matrix.length == 1) { + mat.resizeAngleLabels(); + if (!$.browser.msie) { // IE can't handle the hover! 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() { - if (!$.browser.msie) // IE can't handle the hover mat.init(); // Initialize sortable tables $('table.sortable').each(function (ix) { sortTableInitialize(this,true,true); }); // Register tables with drag and drop $("table.tableWithDragAndDrop").each(function (ix) { tableDragAndDropRegister(this); }); $('.halfVis').css('opacity', '0.5'); // The 1/2 opacity just doesn't get set from cgi! $('.filterComp').each( function(i) { // Do this by 'each' to set noneIsAll individually