mirror of
https://github.com/zen-browser/desktop.git
synced 2025-07-10 00:55:30 +02:00
Refactor tab movement logic and improve workspace animations
This commit is contained in:
parent
febeeb96f0
commit
cf3de23515
2 changed files with 6 additions and 22 deletions
|
@ -1501,7 +1501,6 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||||
const newTransform = -(workspaceIndex - workspaces.workspaces.indexOf(otherWorkspace)) * 100;
|
const newTransform = -(workspaceIndex - workspaces.workspaces.indexOf(otherWorkspace)) * 100;
|
||||||
for (const container of document.querySelectorAll(selector)) {
|
for (const container of document.querySelectorAll(selector)) {
|
||||||
container.style.transform = `translateX(${newTransform + offsetPixels / 2}%)`;
|
container.style.transform = `translateX(${newTransform + offsetPixels / 2}%)`;
|
||||||
container.style.opacity = offsetPixels ? 1 : !newTransform;
|
|
||||||
if (!offsetPixels && !container.hasAttribute('active')) {
|
if (!offsetPixels && !container.hasAttribute('active')) {
|
||||||
container.setAttribute('hidden', 'true');
|
container.setAttribute('hidden', 'true');
|
||||||
} else {
|
} else {
|
||||||
|
@ -1550,16 +1549,11 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||||
const isCurrent = offset === 0;
|
const isCurrent = offset === 0;
|
||||||
if (shouldAnimate) {
|
if (shouldAnimate) {
|
||||||
element.removeAttribute('hidden');
|
element.removeAttribute('hidden');
|
||||||
if (isCurrent) {
|
|
||||||
element.style.opacity = 1;
|
|
||||||
}
|
|
||||||
animations.push(
|
animations.push(
|
||||||
gZenUIManager.motion.animate(
|
gZenUIManager.motion.animate(
|
||||||
element,
|
element,
|
||||||
{
|
{
|
||||||
transform: existingTransform ? [existingTransform, newTransform] : newTransform,
|
transform: existingTransform ? [existingTransform, newTransform] : newTransform,
|
||||||
// -0 to convert to number
|
|
||||||
opacity: !isCurrent ? [!!offset - 0, !offset - 0] : [1, 1],
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'spring',
|
type: 'spring',
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
|
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
|
||||||
index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..8f2cd9ecd708e58a6b162740bb21dafeda43b085 100644
|
index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..e06b7ffb6c7769ad3f29e2c5aa05156a34fd7933 100644
|
||||||
--- a/browser/components/tabbrowser/content/tabbrowser.js
|
--- a/browser/components/tabbrowser/content/tabbrowser.js
|
||||||
+++ b/browser/components/tabbrowser/content/tabbrowser.js
|
+++ b/browser/components/tabbrowser/content/tabbrowser.js
|
||||||
@@ -406,11 +406,52 @@
|
@@ -406,11 +406,52 @@
|
||||||
|
@ -369,17 +369,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..8f2cd9ecd708e58a6b162740bb21dafe
|
||||||
if (forceStandaloneTab && neighbor.group) {
|
if (forceStandaloneTab && neighbor.group) {
|
||||||
neighbor = neighbor.group;
|
neighbor = neighbor.group;
|
||||||
}
|
}
|
||||||
@@ -5727,6 +5835,9 @@
|
@@ -5802,7 +5910,7 @@
|
||||||
this.tabContainer.insertBefore(aTab, neighbor);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
+ if (aTab.hasAttribute("glance-id")) {
|
|
||||||
+ this.moveTabTo(aTab.querySelector("tab[glance-id]"), aIndex, options);
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
moveTabToGroup(aTab, aGroup) {
|
|
||||||
@@ -5802,7 +5913,7 @@
|
|
||||||
createLazyBrowser,
|
createLazyBrowser,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -388,7 +378,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..8f2cd9ecd708e58a6b162740bb21dafe
|
||||||
if (aIndex < numPinned || (aTab.pinned && aIndex == numPinned)) {
|
if (aIndex < numPinned || (aTab.pinned && aIndex == numPinned)) {
|
||||||
params.pinned = true;
|
params.pinned = true;
|
||||||
}
|
}
|
||||||
@@ -7443,6 +7554,7 @@
|
@@ -7443,6 +7551,7 @@
|
||||||
aWebProgress.isTopLevel
|
aWebProgress.isTopLevel
|
||||||
) {
|
) {
|
||||||
this.mTab.setAttribute("busy", "true");
|
this.mTab.setAttribute("busy", "true");
|
||||||
|
@ -396,7 +386,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..8f2cd9ecd708e58a6b162740bb21dafe
|
||||||
gBrowser._tabAttrModified(this.mTab, ["busy"]);
|
gBrowser._tabAttrModified(this.mTab, ["busy"]);
|
||||||
this.mTab._notselectedsinceload = !this.mTab.selected;
|
this.mTab._notselectedsinceload = !this.mTab.selected;
|
||||||
gBrowser.syncThrobberAnimations(this.mTab);
|
gBrowser.syncThrobberAnimations(this.mTab);
|
||||||
@@ -8411,7 +8523,7 @@ var TabContextMenu = {
|
@@ -8411,7 +8520,7 @@ var TabContextMenu = {
|
||||||
);
|
);
|
||||||
contextUnpinSelectedTabs.hidden =
|
contextUnpinSelectedTabs.hidden =
|
||||||
!this.contextTab.pinned || !multiselectionContext;
|
!this.contextTab.pinned || !multiselectionContext;
|
||||||
|
@ -405,7 +395,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..8f2cd9ecd708e58a6b162740bb21dafe
|
||||||
// Move Tab items
|
// Move Tab items
|
||||||
let contextMoveTabOptions = document.getElementById(
|
let contextMoveTabOptions = document.getElementById(
|
||||||
"context_moveTabOptions"
|
"context_moveTabOptions"
|
||||||
@@ -8444,7 +8556,7 @@ var TabContextMenu = {
|
@@ -8444,7 +8553,7 @@ var TabContextMenu = {
|
||||||
let contextMoveTabToStart = document.getElementById("context_moveToStart");
|
let contextMoveTabToStart = document.getElementById("context_moveToStart");
|
||||||
let isFirstTab =
|
let isFirstTab =
|
||||||
tabsToMove[0] == visibleTabs[0] ||
|
tabsToMove[0] == visibleTabs[0] ||
|
||||||
|
@ -414,7 +404,7 @@ index ff90a70bdad6c94ec4b90027ff102972d0eb28e5..8f2cd9ecd708e58a6b162740bb21dafe
|
||||||
contextMoveTabToStart.disabled = isFirstTab && allSelectedTabsAdjacent;
|
contextMoveTabToStart.disabled = isFirstTab && allSelectedTabsAdjacent;
|
||||||
|
|
||||||
document.getElementById("context_openTabInWindow").disabled =
|
document.getElementById("context_openTabInWindow").disabled =
|
||||||
@@ -8677,6 +8789,7 @@ var TabContextMenu = {
|
@@ -8677,6 +8786,7 @@ var TabContextMenu = {
|
||||||
if (this.contextTab.multiselected) {
|
if (this.contextTab.multiselected) {
|
||||||
gBrowser.removeMultiSelectedTabs();
|
gBrowser.removeMultiSelectedTabs();
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue