mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-09 05:50:08 +00:00
fixed #7081 - laggy tab open/close animation
This commit is contained in:
parent
8d10bc1a78
commit
856c042bb8
@ -25,7 +25,7 @@ title-bar(
|
|||||||
[index]='idx',
|
[index]='idx',
|
||||||
[tab]='tab',
|
[tab]='tab',
|
||||||
[active]='tab == app.activeTab',
|
[active]='tab == app.activeTab',
|
||||||
@animateTab,
|
[@animateTab]='{value: "in", params: {size: targetTabSize}}',
|
||||||
[@.disabled]='hasVerticalTabs() || !config.store.accessibility.animations',
|
[@.disabled]='hasVerticalTabs() || !config.store.accessibility.animations',
|
||||||
(click)='app.selectTab(tab)',
|
(click)='app.selectTab(tab)',
|
||||||
[class.fully-draggable]='hostApp.platform != Platform.macOS',
|
[class.fully-draggable]='hostApp.platform != Platform.macOS',
|
||||||
|
@ -17,38 +17,47 @@ import { TabBodyComponent } from './tabBody.component'
|
|||||||
import { SplitTabComponent } from './splitTab.component'
|
import { SplitTabComponent } from './splitTab.component'
|
||||||
import { AppService, FileTransfer, HostWindowService, PlatformService, ToolbarButton, ToolbarButtonProvider } from '../api'
|
import { AppService, FileTransfer, HostWindowService, PlatformService, ToolbarButton, ToolbarButtonProvider } from '../api'
|
||||||
|
|
||||||
|
function makeTabAnimation (dimension: string, size: number) {
|
||||||
|
return [
|
||||||
|
state('in', style({
|
||||||
|
'flex-basis': '{{size}}',
|
||||||
|
[dimension]: '{{size}}',
|
||||||
|
}), {
|
||||||
|
params: { size: `${size}px` },
|
||||||
|
}),
|
||||||
|
transition(':enter', [
|
||||||
|
style({
|
||||||
|
'flex-basis': '1px',
|
||||||
|
[dimension]: '1px',
|
||||||
|
}),
|
||||||
|
animate('250ms ease-out', style({
|
||||||
|
'flex-basis': '{{size}}',
|
||||||
|
[dimension]: '{{size}}',
|
||||||
|
})),
|
||||||
|
]),
|
||||||
|
transition(':leave', [
|
||||||
|
style({
|
||||||
|
'flex-basis': 'auto',
|
||||||
|
'padding-left': '*',
|
||||||
|
'padding-right': '*',
|
||||||
|
[dimension]: '*',
|
||||||
|
}),
|
||||||
|
animate('250ms ease-in-out', style({
|
||||||
|
'padding-left': 0,
|
||||||
|
'padding-right': 0,
|
||||||
|
[dimension]: '0',
|
||||||
|
})),
|
||||||
|
]),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
/** @hidden */
|
/** @hidden */
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
template: require('./appRoot.component.pug'),
|
template: require('./appRoot.component.pug'),
|
||||||
styles: [require('./appRoot.component.scss')],
|
styles: [require('./appRoot.component.scss')],
|
||||||
animations: [
|
animations: [
|
||||||
trigger('animateTab', [
|
trigger('animateTab', makeTabAnimation('width', 200)),
|
||||||
state('in', style({
|
|
||||||
'flex-basis': 'auto',
|
|
||||||
width: 'auto',
|
|
||||||
})),
|
|
||||||
transition(':enter', [
|
|
||||||
style({
|
|
||||||
'flex-basis': '1px',
|
|
||||||
width: '1px',
|
|
||||||
}),
|
|
||||||
animate('250ms ease-in-out', style({
|
|
||||||
'flex-basis': 'auto',
|
|
||||||
width: 'auto',
|
|
||||||
})),
|
|
||||||
]),
|
|
||||||
transition(':leave', [
|
|
||||||
style({
|
|
||||||
'flex-basis': 'auto',
|
|
||||||
width: 'auto',
|
|
||||||
}),
|
|
||||||
animate('250ms ease-in-out', style({
|
|
||||||
'flex-basis': '1px',
|
|
||||||
width: '1px',
|
|
||||||
})),
|
|
||||||
]),
|
|
||||||
]),
|
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class AppRootComponent {
|
export class AppRootComponent {
|
||||||
@ -196,6 +205,13 @@ export class AppRootComponent {
|
|||||||
return this.config.store.appearance.tabsLocation === 'left' || this.config.store.appearance.tabsLocation === 'right'
|
return this.config.store.appearance.tabsLocation === 'left' || this.config.store.appearance.tabsLocation === 'right'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get targetTabSize (): any {
|
||||||
|
if (this.hasVerticalTabs()) {
|
||||||
|
return '*'
|
||||||
|
}
|
||||||
|
return this.config.store.appearance.flexTabs ? '*' : '200px'
|
||||||
|
}
|
||||||
|
|
||||||
async generateButtonSubmenu (button: ToolbarButton) {
|
async generateButtonSubmenu (button: ToolbarButton) {
|
||||||
if (button.submenu) {
|
if (button.submenu) {
|
||||||
button.submenuItems = await button.submenu()
|
button.submenuItems = await button.submenu()
|
||||||
|
@ -3,17 +3,15 @@ $tabs-height: 38px;
|
|||||||
:host {
|
:host {
|
||||||
position: relative;
|
position: relative;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
box-sizing: content-box;
|
||||||
|
|
||||||
> * { cursor: pointer; }
|
> * { cursor: pointer; }
|
||||||
|
|
||||||
flex: 1000 1 200px;
|
flex: 1000 1 200px;
|
||||||
width: 200px;
|
width: 200px;
|
||||||
padding: 0 10px;
|
// flex-basis and width are also set through animation on AppRoot
|
||||||
|
|
||||||
&.flex-width {
|
padding: 0 10px;
|
||||||
flex: 1000 1 auto;
|
|
||||||
width: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
@ -21,6 +19,11 @@ $tabs-height: 38px;
|
|||||||
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
|
&.flex-width {
|
||||||
|
flex: 1000 1 auto;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
&.vertical {
|
&.vertical {
|
||||||
flex: none;
|
flex: none;
|
||||||
height: $tabs-height;
|
height: $tabs-height;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user