Calculate required size for a tree more smartly
This commit is contained in:
parent
a173ed4e66
commit
c42e2415d8
@ -543,8 +543,8 @@ FullTooltipManager.prototype = inherit(TreeStyleTabBase, {
|
||||
{
|
||||
log('expandTooltip');
|
||||
var tooltip = this.tabFullTooltip;
|
||||
var tree = this.tree;
|
||||
{
|
||||
let tree = this.tree;
|
||||
let basePosition = this.windowBasePosition;
|
||||
let tooltipBox = tooltip.boxObject;
|
||||
log(' => initial dimension: ', {
|
||||
@ -563,13 +563,12 @@ FullTooltipManager.prototype = inherit(TreeStyleTabBase, {
|
||||
|
||||
this.lastScreen = this.getCurrentScreen(tooltip.boxObject);
|
||||
|
||||
var header = this.tree.previousSibling;
|
||||
var extraHeight = header && header.boxObject.height || 0;
|
||||
|
||||
var treeBox = {
|
||||
width : tree.clientWidth,
|
||||
height : tree.clientHeight
|
||||
};
|
||||
this.determineTreeSize();
|
||||
this.expandTooltipInternal();
|
||||
},
|
||||
determineTreeSize : function FTM_determineTreeSize()
|
||||
{
|
||||
var tree = this.tree;
|
||||
|
||||
var columnize = utils.getTreePref('tooltip.columnize');
|
||||
if (columnize) {
|
||||
@ -583,20 +582,22 @@ FullTooltipManager.prototype = inherit(TreeStyleTabBase, {
|
||||
});
|
||||
}
|
||||
|
||||
this.window.setTimeout((function() {
|
||||
if (!columnize || tree.columnCount != 1)
|
||||
treeBox = tree.boxObject;
|
||||
var range = this.document.createRange();
|
||||
range.selectNodeContents(tree);
|
||||
if (tree.previousSibling)
|
||||
range.setStartBefore(tree.previousSibling);
|
||||
var rect = range.getBoundingClientRect();
|
||||
range.detach();
|
||||
|
||||
var container = this.container;
|
||||
var containerStyle = container.style;
|
||||
|
||||
var arrowScrollBox = container.parentNode;
|
||||
var scrollButtonsMargin = (arrowScrollBox.boxObject.width - arrowScrollBox._scrollbox.boxObject.width);
|
||||
scrollButtonsMargin *= 2; // enough width to deactivate scroll buttons.
|
||||
containerStyle.width = (container.width = treeBox.width + scrollButtonsMargin)+'px';
|
||||
containerStyle.height = (container.height = (treeBox.height + extraHeight))+'px';
|
||||
|
||||
this.expandTooltipInternal();
|
||||
}).bind(this), 0);
|
||||
var containerStyle = container.style;
|
||||
containerStyle.width = (container.width = rect.width + scrollButtonsMargin)+'px';
|
||||
containerStyle.height = (container.height = rect.height)+'px';
|
||||
},
|
||||
expandTooltipInternal : function FTM_expandTooltipInternal()
|
||||
{
|
||||
|
@ -172,22 +172,12 @@ var PseudoTreeBuilder = {
|
||||
style.height = style.maxHeight =
|
||||
Math.floor(containerBox.height * 0.9) + 'px';
|
||||
|
||||
aTree.columnCount = 0;
|
||||
aTree.ownerDocument.defaultView.setTimeout((function() {
|
||||
aTree.columnCount = this.getActualColumnCount(aTree);
|
||||
if (aTree.columnCount == 1)
|
||||
style.columnWidth = style.MozColumnWidth = '';
|
||||
if (aOptions.calculateCount) {
|
||||
// This is required to expand the size of the box.
|
||||
style.columnCount =
|
||||
style.MozColumnCount =
|
||||
aTree.columnCount;
|
||||
}
|
||||
}).bind(this), 0);
|
||||
}
|
||||
else {
|
||||
style.height = style.maxHeight = '';
|
||||
aTree.columnCount = 1;
|
||||
}
|
||||
},
|
||||
getActualColumnCount : function TB_getActualColumnCount(aTree)
|
||||
|
Loading…
x
Reference in New Issue
Block a user