mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-30 08:19:54 +00:00
fixed #6741
changed spanner to emit event to splitTab and tell its mousedown state disabled tab focus on hover when spanner is being dragged by the mouse
This commit is contained in:
parent
49ccda70ea
commit
2d3234fe1d
@ -169,6 +169,7 @@ export type SplitDropZoneInfo = {
|
||||
[container]='spanner.container'
|
||||
[index]='spanner.index'
|
||||
(change)='onSpannerAdjusted(spanner)'
|
||||
(resizing)='onSpannerResizing($event)'
|
||||
></split-tab-spanner>
|
||||
<split-tab-drop-zone
|
||||
*ngFor='let dropZone of _dropZones'
|
||||
@ -211,6 +212,9 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit
|
||||
/** @hidden */
|
||||
_allFocusMode = false
|
||||
|
||||
/** @hidden */
|
||||
_spannerResizing = false
|
||||
|
||||
/**
|
||||
* Disables display of dynamic window/tab title provided by the shell
|
||||
*/
|
||||
@ -737,6 +741,11 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit
|
||||
this.splitAdjusted.next(spanner)
|
||||
}
|
||||
|
||||
/** @hidden */
|
||||
onSpannerResizing (state: boolean): void {
|
||||
this._spannerResizing = state
|
||||
}
|
||||
|
||||
/** @hidden */
|
||||
onTabDropped (tab: BaseTabComponent, zone: SplitDropZoneInfo) { // eslint-disable-line @typescript-eslint/explicit-module-boundary-types
|
||||
if (tab === this) {
|
||||
@ -809,7 +818,12 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit
|
||||
this.viewRefs.set(tab, ref)
|
||||
tab.addEventListenerUntilDestroyed(ref.rootNodes[0], 'click', () => this.focus(tab))
|
||||
if (this.config.store.terminal.focusFollowsMouse) {
|
||||
tab.addEventListenerUntilDestroyed(ref.rootNodes[0], 'mousemove', () => this.focus(tab))
|
||||
tab.addEventListenerUntilDestroyed(ref.rootNodes[0], 'mousemove', () => {
|
||||
if (this._spannerResizing) {
|
||||
return
|
||||
}
|
||||
this.focus(tab)
|
||||
})
|
||||
}
|
||||
|
||||
tab.subscribeUntilDestroyed(tab.titleChange$, () => this.updateTitle())
|
||||
|
@ -12,6 +12,7 @@ import { SplitContainer } from './splitTab.component'
|
||||
export class SplitTabSpannerComponent extends SelfPositioningComponent {
|
||||
@Input() container: SplitContainer
|
||||
@Input() index: number
|
||||
@Output() resizing = new EventEmitter<boolean>()
|
||||
@Output() change = new EventEmitter<void>()
|
||||
@HostBinding('class.active') isActive = false
|
||||
@HostBinding('class.h') isHorizontal = false
|
||||
@ -30,6 +31,7 @@ export class SplitTabSpannerComponent extends SelfPositioningComponent {
|
||||
|
||||
this.element.nativeElement.addEventListener('mousedown', (e: MouseEvent) => {
|
||||
this.isActive = true
|
||||
this.resizing.emit(true)
|
||||
const start = this.isVertical ? e.pageY : e.pageX
|
||||
let current = start
|
||||
const oldPosition: number = this.isVertical ? this.element.nativeElement.offsetTop : this.element.nativeElement.offsetLeft
|
||||
@ -46,6 +48,7 @@ export class SplitTabSpannerComponent extends SelfPositioningComponent {
|
||||
|
||||
const offHandler = () => {
|
||||
this.isActive = false
|
||||
this.resizing.emit(false)
|
||||
document.removeEventListener('mouseup', offHandler)
|
||||
this.element.nativeElement.parentElement.removeEventListener('mousemove', dragHandler)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user