Bug 591147 Let TabItem spacing used in Items.arrange be specified via CSS [r+a=dietrich]

This commit is contained in:
Michael Yoshitaka Erlewine 2010-09-06 10:42:41 -04:00
parent 664a176ac6
commit aad71dc63a
5 changed files with 12 additions and 6 deletions

View File

@ -777,7 +777,7 @@ window.GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
this.topChild = null;
var box = new Rect(this.expanded.bounds);
box.inset(8, 8);
Items.arrange(this._children, box, Utils.extend({}, options, {padding: 8, z: 99999}));
Items.arrange(this._children, box, Utils.extend({}, options, {z: 99999}));
} else {
var bb = this.getContentBounds();
var count = this._children.length;

View File

@ -915,7 +915,11 @@ window.Items = {
return rects;
var columns = 1;
var padding = options.padding || 0;
// We'll assume for the time being that all the items have the same styling
// and that the margin is the same width around.
var itemMargin = items && items.length ?
parseInt(iQ(items[0].container).css('margin-left')) : 0;
var padding = itemMargin * 2;
var yScale = 1.1; // to allow for titles
var rows;
var tabWidth;
@ -924,9 +928,9 @@ window.Items = {
function figure() {
rows = Math.ceil(count / columns);
tabWidth = (bounds.width - (padding * (columns - 1))) / columns;
tabWidth = (bounds.width - (padding * columns)) / columns;
tabHeight = tabWidth * tabAspect;
totalHeight = (tabHeight * yScale * rows) + (padding * (rows - 1));
totalHeight = (tabHeight * yScale * rows) + (padding * rows);
}
figure();
@ -937,8 +941,7 @@ window.Items = {
}
if (rows == 1) {
var maxWidth = Math.max(TabItems.tabWidth, bounds.width / 2);
tabWidth = Math.min(Math.min(maxWidth, bounds.width / count), bounds.height / tabAspect);
tabWidth = Math.min(tabWidth, (bounds.height - 2 * itemMargin) / tabAspect);
tabHeight = tabWidth * tabAspect;
}

View File

@ -24,6 +24,7 @@ body {
-moz-border-radius: 0.4em;
-moz-box-shadow: inset rgba(255, 255, 255, 0.6) 0 0 0 2px;
cursor: pointer;
margin: 4px;
}
.tab canvas,

View File

@ -24,6 +24,7 @@ body {
-moz-border-radius: 0.4em;
-moz-box-shadow: inset rgba(255, 255, 255, 0.6) 0 0 0 2px;
cursor: pointer;
margin: 4px;
}
.tab canvas,

View File

@ -24,6 +24,7 @@ body {
-moz-border-radius: 0.4em;
-moz-box-shadow: inset rgba(255, 255, 255, 0.6) 0 0 0 2px;
cursor: pointer;
margin: 4px;
}
.tab canvas,