fe730bc377150b3a281a331091ddf586d546675e tdreszer Mon Jan 23 16:25:10 2012 -0800 Add resizing of subtrack cfg box based upon the sizes of its contents. This fixes redmine 6655. diff --git src/hg/js/subCfg.js src/hg/js/subCfg.js index 3d8bc6f..97637ce 100644 --- src/hg/js/subCfg.js +++ src/hg/js/subCfg.js @@ -573,30 +573,55 @@ if (subCfg.visIndependent) { shiftLeft *= ($(cfg).position().left - 125); var subVis = normed($('div#' + subCfg.currentSub+'_faux')); if (subVis != undefined) subCfg.replaceWithVis(subVis,subCfg.currentSub,false); } else shiftLeft *= ($(cfg).position().left - 40); $(cfg).css({ width: myWidth+'px',position: 'relative', left: shiftLeft + 'px' }); // Setting up filterBys must follow show because sizing requires visibility $(cfg).find('.filterBy').each( function(i) { // Should never be filterComp this.id = this.name.replace(/\./g,'_-'); // Must have id unique to page! ddcl.setup(this, 'noneIsAll'); }); + + // Adjust cfg box size? + // Especially needed for filterBys, but generic in case some other overrun occurs + var curRight = $(cfg).offset().left + $(cfg).width(); + var calcRight = curRight; + $(cfg).find(':visible').each( function(i) { // All visible, including labels, etc. + var childRight = $(this).offset().left + $(this).width(); + if (calcRight < childRight) + calcRight = childRight; + }); + if (curRight < calcRight) { + var cfgWidth = calcRight - $(cfg).offset().left + 16; // clip offset but add some for border + $(cfg).css({ width: cfgWidth + 'px' }); + + // Now containing tables may need adjustment + var tables = $(cfg).parents('table'); + var maxWidth = 0; + $(tables).each(function(i) { + var myWidth = $(this).width(); + if (maxWidth < myWidth) + maxWidth = myWidth; + else if (maxWidth > myWidth) + $(this).css('width',maxWidth + 'px'); + }); + } }, cfgPopulate: function (cfg,subtrack) { // Populates a subtrack cfg dialog via ajax and update from composite/view parents subCfg.currentCfg = cfg; subCfg.currentSub = subtrack; $.ajax({ type: "GET", url: "../cgi-bin/hgTrackUi?ajax=1&g="+subtrack+"&hgsid="+getHgsid()+"&db="+getDb(), dataType: "html", trueSuccess: subCfg.cfgFill, success: catchErrorOrDispatch, error: errorHandler, cmd: "cfg",