mirror of
https://github.com/zen-browser/desktop
synced 2026-04-25 17:15:00 +02:00
no-bug: Improve tab drag calculations (gh-12867)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user