diff --git a/tabby-core/src/components/splitTabDropZone.component.ts b/tabby-core/src/components/splitTabDropZone.component.ts index 138825e9..a8efdeba 100644 --- a/tabby-core/src/components/splitTabDropZone.component.ts +++ b/tabby-core/src/components/splitTabDropZone.component.ts @@ -4,6 +4,7 @@ import { AppService } from '../services/app.service' import { BaseTabComponent } from './baseTab.component' import { SelfPositioningComponent } from './selfPositioning.component' import { SplitDropZoneInfo } from './splitTab.component' +import { SplitTabComponent } from './splitTab.component' /** @hidden */ @Component({ @@ -22,7 +23,7 @@ import { SplitDropZoneInfo } from './splitTab.component' }) export class SplitTabDropZoneComponent extends SelfPositioningComponent { @Input() dropZone: SplitDropZoneInfo - @Input() parent: BaseTabComponent + @Input() parent: SplitTabComponent @Output() tabDropped = new EventEmitter() @HostBinding('class.active') isActive = false @HostBinding('class.highlighted') isHighlighted = false @@ -34,11 +35,21 @@ export class SplitTabDropZoneComponent extends SelfPositioningComponent { ) { super(element) this.subscribeUntilDestroyed(app.tabDragActive$, tab => { - this.isActive = !!tab && tab !== this.parent && (this.dropZone.type === 'relative' || tab !== this.dropZone.container.children[this.dropZone.position]) + this.isActive = !!tab && this.canActivateFor(tab) this.layout() }) } + canActivateFor (tab: BaseTabComponent): boolean { + const allTabs = this.parent.getAllTabs() + return !( + tab === this.parent || + allTabs.length === 1 && allTabs.includes(tab) || + this.dropZone.type === 'relative' && tab === this.dropZone.relativeTo || + this.dropZone.type === 'absolute' && tab === this.dropZone.container.children[this.dropZone.position] + ) + } + ngOnChanges () { this.layout() }