Tab dragging working with variable widths

Not working to the 150px default, now working to the possibly smaller
tab widths
This commit is contained in:
Matt Pass
2013-02-03 17:24:21 +00:00
parent 7887f0e7a1
commit b01218958f

View File

@@ -1465,25 +1465,28 @@ var ICEcoder = {
// Tab dragging
tabDragMove: function() {
var thisLeft;
var thisLeft, tabWidth, lastTabWidth;
lastTabWidth = parseInt(top.document.getElementById('newTab').style.left,10) - parseInt(top.document.getElementById('tab'+top.ICEcoder.openFiles.length).style.left,10);
thisLeft = top.ICEcoder.tabDragMouseX >= 41
? top.ICEcoder.tabDragMouseX <= parseInt(top.document.getElementById('newTab').style.left,10) - 150 - 18
? top.ICEcoder.tabDragMouseX : (parseInt(top.document.getElementById('newTab').style.left,10) - 150 - 18) : 41;
? top.ICEcoder.tabDragMouseX <= parseInt(top.document.getElementById('newTab').style.left,10) - lastTabWidth
? top.ICEcoder.tabDragMouseX : (parseInt(top.document.getElementById('newTab').style.left,10) - lastTabWidth) : 41;
top.document.getElementById('tab'+top.ICEcoder.draggingTab).style.left = thisLeft + "px";
swapWith = top.ICEcoder.draggingTab;
for (var i=1; i<=top.ICEcoder.openFiles.length; i++) {
top.document.getElementById('tab'+i).style.opacity = i == top.ICEcoder.draggingTab ? 1 : 0.5;
tabWidth = top.ICEcoder.tabLeftPos[i] - top.ICEcoder.tabLeftPos[i-1];
if (i!=top.ICEcoder.draggingTab) {
if (i < top.ICEcoder.draggingTab) {
top.document.getElementById('tab'+i).style.left = thisLeft <= top.ICEcoder.tabLeftPos[i-1]
? top.ICEcoder.tabLeftPos[i-1]+150+18
? top.ICEcoder.tabLeftPos[i-1]+tabWidth
: top.ICEcoder.tabLeftPos[i-1];
} else {
top.document.getElementById('tab'+i).style.left = thisLeft >= top.ICEcoder.tabLeftPos[i-1]
? top.ICEcoder.tabLeftPos[i-1]-150-18
? top.ICEcoder.tabLeftPos[i-1]-tabWidth
: top.ICEcoder.tabLeftPos[i-1];
}
}
@@ -1491,7 +1494,6 @@ var ICEcoder = {
//swapWith = parseInt(((parseInt(top.document.getElementById('tab'+top.ICEcoder.draggingTab).style.left,10) - 41 - 18)/(parseInt(top.document.getElementById('tab1').style.width,10)+18)),10);
if (top.ICEcoder.cMInstances.indexOf(top.ICEcoder.draggingTab) != swapWith) {
//console.log(top.ICEcoder.draggingTab + " swap with " + swapWith);
//top.document.getElementById('tab'+(swapWith+1)).style.left = (top.ICEcoder.tabLeftPos[swapWith] + 150 + 18) + "px";
thisArrayPos = top.ICEcoder.cMInstances.indexOf(top.ICEcoder.draggingTab);
b = thisArrayPos;