Set tabWidth to begin with

To avoid having a gap after closing all tabs
Also removed thisWidth, moved this value into tabWidth value
This commit is contained in:
Matt Pass
2013-02-08 13:56:55 +00:00
parent 43223d1677
commit 1520828dff

View File

@@ -1829,17 +1829,17 @@ var ICEcoder = {
// Set the tabs width
setTabWidths: function() {
var availWidth, avgWidth, lastLeft, lastWidth, thisWidth, tabWidth;
var availWidth, avgWidth, lastLeft, lastWidth, tabWidth;
availWidth = parseInt(top.ICEcoder.content.style.width,10)-41-24-10; // - left margin - new tab - right margin
avgWidth = (availWidth/top.ICEcoder.openFiles.length)-18;
tabWidth = -18; // Incl 18px offset
lastLeft = 41;
lastWidth = 0;
top.ICEcoder.tabLeftPos = [];
for (var i=0;i<top.ICEcoder.openFiles.length;i++) {
thisWidth = parseInt(avgWidth*i,10) - parseInt(avgWidth*(i-1),10);
tabWidth = top.ICEcoder.openFiles.length*(150+18) > availWidth ? thisWidth : 150;
tabWidth = top.ICEcoder.openFiles.length*(150+18) > availWidth ? parseInt(avgWidth*i,10) - parseInt(avgWidth*(i-1),10) : 150;
lastLeft = i==0 ? 41 : parseInt(top.document.getElementById('tab'+(i)).style.left,10);
lastWidth = i==0 ? 0 : parseInt(top.document.getElementById('tab'+(i)).style.width,10)+18;
top.document.getElementById('tab'+(i+1)).style.left = (lastLeft+lastWidth) + "px";