no-bug: Improve tab drag calculations (gh-12867)

This commit is contained in:
mr. m
2026-03-21 09:32:25 +01:00
committed by GitHub
parent fe19b4412a
commit 3dfc410b6a
2 changed files with 3 additions and 15 deletions

View File

@@ -579,7 +579,8 @@ window.gZenUIManager = {
this._lastTab &&
!this._lastTab.closing &&
this._lastTab.ownerGlobal &&
!this._lastTab.ownerGlobal.closed
!this._lastTab.ownerGlobal.closed &&
gBrowser.selectedTab === this._lastTab
) {
this._lastTab._visuallySelected = true;
this._lastTab = null;

View File

@@ -305,7 +305,7 @@
let lastMovingTabScreen = endEdge(lastMovingTab);
let firstMovingTabScreen = firstMovingTab[screenAxis];
let shiftSize = lastMovingTabScreen - firstMovingTabScreen;
let translate = screen - dragData[screenAxis];
let translate = screen - draggedTab[screenAxis] - tabSize / 2;
// Constrain the range over which the moving tabs can move between the edge of the tabstrip and periphery.
// Add 1 to periphery so we don't overlap it.
@@ -321,19 +321,6 @@
endBound = endEdge(lastTab) - lastMovingTabScreen;
translate = Math.min(Math.max(translate, startBound), endBound);
// Center the tab under the cursor if the tab is not under the cursor while dragging
let draggedTabScreenAxis = draggedTab[screenAxis] + translate;
if (
(screen < draggedTabScreenAxis ||
screen > draggedTabScreenAxis + tabSize) &&
draggedTabScreenAxis + tabSize < endBound &&
draggedTabScreenAxis > startBound
) {
translate = screen - draggedTab[screenAxis] - tabSize / 2;
// Ensure, after the above calculation, we are still within bounds
translate = Math.min(Math.max(translate, startBound), endBound);
}
dragData.translatePos = translate;
tabs = tabs.filter(t => !movingTabsSet.has(t) || t == draggedTab);