mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 04:41:11 +00:00
Bug 1932425 - When dragging tabs, move other tabs over when hitting 70% instead of 50% of their width. r=sthompson,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D229756
This commit is contained in:
parent
a00b5c2ed7
commit
3c1ba17303
@ -2286,9 +2286,6 @@
|
||||
// as single tab dragging.
|
||||
|
||||
tabs = tabs.filter(t => !movingTabs.includes(t) || t == draggedTab);
|
||||
let firstTabCenter = firstMovingTabScreen + translate + tabSize / 2;
|
||||
let lastTabCenter = lastMovingTabScreen + translate + tabSize / 2;
|
||||
let tabCenter = directionForward ? lastTabCenter : firstTabCenter;
|
||||
let getTabShift = (tab, dropIndex) => {
|
||||
if (tab._tPos < draggedTab._tPos && tab._tPos >= dropIndex) {
|
||||
return this.#rtlMode ? -shiftSize : shiftSize;
|
||||
@ -2302,7 +2299,12 @@
|
||||
// We're doing a binary search in order to reduce the amount of
|
||||
// tabs we need to check.
|
||||
let oldIndex = dragData.animDropIndex ?? movingTabs[0]._tPos;
|
||||
let tabDropIndexFromPoint = point => {
|
||||
let getDragOverIndex = tabSizeDragOverThreshold => {
|
||||
let point =
|
||||
(directionForward
|
||||
? lastMovingTabScreen + tabSize * (1 - tabSizeDragOverThreshold)
|
||||
: firstMovingTabScreen + tabSize * tabSizeDragOverThreshold) +
|
||||
translate;
|
||||
let index = -1;
|
||||
let low = 0;
|
||||
let high = tabs.length - 1;
|
||||
@ -2322,12 +2324,13 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index >= oldIndex) {
|
||||
index++;
|
||||
}
|
||||
return index;
|
||||
};
|
||||
let newIndex = tabDropIndexFromPoint(tabCenter);
|
||||
let moveOverThreshold = gBrowser._tabGroupsEnabled ? 0.7 : 0.5;
|
||||
let newIndex = getDragOverIndex(moveOverThreshold);
|
||||
if (newIndex >= oldIndex) {
|
||||
newIndex++;
|
||||
}
|
||||
if (newIndex < 0) {
|
||||
newIndex = oldIndex;
|
||||
}
|
||||
@ -2340,15 +2343,7 @@
|
||||
) / 100;
|
||||
dragOverGroupingThreshold = Math.max(0, dragOverGroupingThreshold);
|
||||
dragOverGroupingThreshold = Math.min(0.5, dragOverGroupingThreshold);
|
||||
let groupPoint =
|
||||
(directionForward
|
||||
? lastMovingTabScreen + tabSize * (1 - dragOverGroupingThreshold)
|
||||
: firstMovingTabScreen + tabSize * dragOverGroupingThreshold) +
|
||||
translate;
|
||||
let groupDropIndex = tabDropIndexFromPoint(groupPoint);
|
||||
if (directionForward) {
|
||||
groupDropIndex--;
|
||||
}
|
||||
let groupDropIndex = getDragOverIndex(dragOverGroupingThreshold);
|
||||
if (
|
||||
"groupDropIndex" in dragData &&
|
||||
dragData.groupDropIndex != groupDropIndex
|
||||
|
Loading…
Reference in New Issue
Block a user