diff --git a/content/treestyletab/res/tabsDragUtils.js b/content/treestyletab/res/tabsDragUtils.js index 54161d79..ef8bcaf2 100644 --- a/content/treestyletab/res/tabsDragUtils.js +++ b/content/treestyletab/res/tabsDragUtils.js @@ -173,8 +173,8 @@ '$&' ).replace( 'let tabCenter = ', - 'TDUContext.tabScreenX = tabScreenX;\n' + - 'TDUContext.translateX = translateX;\n' + + 'TDUContext.tabScreenPosition = tabScreenX;\n' + + 'TDUContext.translateDelta = translateX;\n' + 'TDUContext.utils.updateDraggedTabsTransform(TDUContext);\n' + 'tabs = TDUContext.utils.extractNotDraggedTabs(tabs, TDUContext);\n' + '$&' @@ -185,7 +185,7 @@ 'newIndex = tabs[mid]._tPos;', '$&\n' + 'TDUContext.tabCenter = tabCenter;\n' + - 'TDUContext.screenX = screenX;\n' + + 'TDUContext.dropTargetTabScreenPosition = screenX;\n' + 'TDUContext.utils.updateDontMove(boxObject, TDUContext);\n' ).replace( 'if (newIndex >= oldIndex)', @@ -194,10 +194,10 @@ '$&' ).replace( '-tabWidth : tabWidth', - '/* $& */ -TDUContext.tabsWidth : TDUContext.tabsWidth' + '/* $& */ -TDUContext.tabsSize : TDUContext.tabsSize' ).replace( 'tabWidth : -tabWidth', - '/* $& */ TDUContext.tabsWidth : -TDUContext.tabsWidth' + '/* $& */ TDUContext.tabsSize : -TDUContext.tabsSize' ).replace( /(\}\)?)$/, 'TDUContext.destroy(); $1' @@ -274,8 +274,8 @@ // // * We're doing a binary search in order to reduce the amount of // // tabs we need to check. // -// TDUContext.tabScreenX = tabScreenX; -// TDUContext.translateX = translateX; +// TDUContext.tabScreenPosition = tabScreenX; +// TDUContext.translateDelta = translateX; // TDUContext.utils.updateDraggedTabsTransform(TDUContext); // tabs = TDUContext.utils.extractNotDraggedTabs(tabs, TDUContext); // let tabCenter = Math.round(tabScreenX + translateX + tabWidth / 2); @@ -299,7 +299,7 @@ // } else { // newIndex = tabs[mid]._tPos; // TDUContext.tabCenter = tabCenter; -// TDUContext.screenX = screenX; +// TDUContext.dropTargetTabScreenPosition = screenX; // TDUContext.utils.updateDontMove(boxObject, TDUContext); // break; // } @@ -325,10 +325,10 @@ // function getTabShift(tab, dropIndex) { // if (tab._tPos < draggedTab._tPos && tab._tPos >= dropIndex) // // return rtl ? -tabWidth : tabWidth; -// return rtl ? -TDUContext.tabsWidth : TDUContext.tabsWidth; +// return rtl ? -TDUContext.tabsSize : TDUContext.tabsSize; // if (tab._tPos > draggedTab._tPos && tab._tPos < dropIndex) // // return rtl ? tabWidth : -tabWidth; -// return rtl ? TDUContext.tabsWidth : -TDUContext.tabsWidth; +// return rtl ? TDUContext.tabsSize : -TDUContext.tabsSize; // return 0; // } // TDUContext.destroy(); @@ -373,8 +373,8 @@ context.onPinnedArea = context.currentAlignCoordinate < firstNormalTab.boxObject[context.align]; context.tabbarIsVertical = tabbarIsVertical; - context.tabWidth = context.draggedTab.getBoundingClientRect()[context.size]; - context.tabCenterOffset = context.tabWidth / (context.options.canDropOnSelf ? 3 : 2 ); + context.tabSize = context.draggedTab.getBoundingClientRect()[context.size]; + context.tabCenterOffset = context.tabSize / (context.options.canDropOnSelf ? 3 : 2 ); context.utils = this; @@ -388,11 +388,11 @@ }, setupDraggedTabs : function TDU_setupDraggedTabs(context) { - context.tabsWidth = 0; + context.tabsSize = 0; context.draggedTabs.forEach(function(draggedTab) { let style = window.getComputedStyle(draggedTab, null); if (style.visibility != 'collapse' && style.display != 'none') - context.tabsWidth += draggedTab.boxObject[context.size]; + context.tabsSize += draggedTab.boxObject[context.size]; if (!draggedTab._dragData) draggedTab._dragData = {}; @@ -440,7 +440,7 @@ }, updateRightBound : function TDU_updateRightBound(rightBound, context) { - rightBound -= context.tabsWidth - context.tabWidth; + rightBound -= context.tabsSize - context.tabSize; if (context.options.canDropOnSelf) rightBound += context.tabCenterOffset; return rightBound; @@ -451,7 +451,7 @@ tab.style.transform = context.draggedTab.style.transform; }, this); context.dontMove = false; - context.lastTabCenter = Math.round(context.tabScreenX + context.translateX + context.tabsWidth - context.tabWidth / 2); + context.lastTabCenter = Math.round(context.tabScreenPosition + context.translateDelta + context.tabsSize - context.tabSize / 2); }, updateDontMove : function TDU_updateDontMove(boxObject, context) { @@ -459,9 +459,9 @@ context.options.canDropOnSelf && ( (context.draggedTab._dragData.previousPosition > context.currentPositionCoordinate && - context.screenX + context.tabCenterOffset < context.tabCenter) || + context.dropTargetTabScreenPosition + context.tabCenterOffset < context.tabCenter) || (context.draggedTab._dragData.previousPosition < context.currentPositionCoordinate && - context.screenX + boxObject[context.size] - context.tabCenterOffset > context.lastTabCenter) + context.dropTargetTabScreenPosition + boxObject[context.size] - context.tabCenterOffset > context.lastTabCenter) ) ); },