mirror of
https://github.com/zen-browser/desktop.git
synced 2025-07-09 19:05:29 +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;
|
||||
for (const container of document.querySelectorAll(selector)) {
|
||||
container.style.transform = `translateX(${newTransform + offsetPixels / 2}%)`;
|
||||
container.style.opacity = offsetPixels ? 1 : !newTransform;
|
||||
if (!offsetPixels && !container.hasAttribute('active')) {
|
||||
container.setAttribute('hidden', 'true');
|
||||
} else {
|
||||
|
@ -1550,16 +1549,11 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
|||
const isCurrent = offset === 0;
|
||||
if (shouldAnimate) {
|
||||
element.removeAttribute('hidden');
|
||||
if (isCurrent) {
|
||||
element.style.opacity = 1;
|
||||
}
|
||||
animations.push(
|
||||
gZenUIManager.motion.animate(
|
||||
element,
|
||||
{
|
||||
transform: existingTransform ? [existingTransform, newTransform] : newTransform,
|
||||
// -0 to convert to number
|
||||
opacity: !isCurrent ? [!!offset - 0, !offset - 0] : [1, 1],
|
||||
},
|
||||
{
|
||||
type: 'spring',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue