mirror of
https://github.com/Eugeny/tabby.git
synced 2025-09-09 18:11:50 +00:00
fixed split attachment - fixes #4374
This commit is contained in:
@@ -121,3 +121,7 @@ rules:
|
|||||||
'@typescript-eslint/no-unsafe-argument': off
|
'@typescript-eslint/no-unsafe-argument': off
|
||||||
'@typescript-eslint/restrict-plus-operands': off
|
'@typescript-eslint/restrict-plus-operands': off
|
||||||
'@typescript-eslint/space-infix-ops': off
|
'@typescript-eslint/space-infix-ops': off
|
||||||
|
'@typescript-eslint/no-type-alias':
|
||||||
|
- error
|
||||||
|
- allowAliases: in-unions-and-intersections
|
||||||
|
allowLiterals: always
|
||||||
|
@@ -6,8 +6,8 @@ import { TabsService, NewTabParameters } from '../services/tabs.service'
|
|||||||
import { HotkeysService } from '../services/hotkeys.service'
|
import { HotkeysService } from '../services/hotkeys.service'
|
||||||
import { TabRecoveryService } from '../services/tabRecovery.service'
|
import { TabRecoveryService } from '../services/tabRecovery.service'
|
||||||
|
|
||||||
export type SplitOrientation = 'v' | 'h' // eslint-disable-line @typescript-eslint/no-type-alias
|
export type SplitOrientation = 'v' | 'h'
|
||||||
export type SplitDirection = 'r' | 't' | 'b' | 'l' // eslint-disable-line @typescript-eslint/no-type-alias
|
export type SplitDirection = 'r' | 't' | 'b' | 'l'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes a horizontal or vertical split row or column
|
* Describes a horizontal or vertical split row or column
|
||||||
@@ -126,16 +126,21 @@ export interface SplitSpannerInfo {
|
|||||||
/**
|
/**
|
||||||
* Represents a tab drop zone
|
* Represents a tab drop zone
|
||||||
*/
|
*/
|
||||||
export interface SplitDropZoneInfo {
|
export type SplitDropZoneInfo = {
|
||||||
container?: SplitContainer
|
|
||||||
position?: number
|
|
||||||
relativeTo?: BaseTabComponent|SplitContainer
|
|
||||||
side?: SplitDirection
|
|
||||||
x: number
|
x: number
|
||||||
y: number
|
y: number
|
||||||
w: number
|
w: number
|
||||||
h: number
|
h: number
|
||||||
}
|
} & ({
|
||||||
|
type: 'absolute'
|
||||||
|
container: SplitContainer
|
||||||
|
position: number
|
||||||
|
} | {
|
||||||
|
type: 'relative'
|
||||||
|
relativeTo?: BaseTabComponent|SplitContainer
|
||||||
|
side: SplitDirection
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Split tab is a tab that contains other tabs and allows further splitting them
|
* Split tab is a tab that contains other tabs and allows further splitting them
|
||||||
@@ -585,10 +590,10 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zone.container) {
|
if (zone.type === 'relative') {
|
||||||
this.add(tab, zone.container.children[zone.position!], zone.container.orientation === 'h' ? 'r' : 'b')
|
this.add(tab, zone.relativeTo ?? null, zone.side)
|
||||||
} else {
|
} else if (zone.container) {
|
||||||
this.add(tab, null, zone.side!)
|
this.add(tab, zone.container.children[zone.position], zone.container.orientation === 'h' ? 'r' : 'b')
|
||||||
}
|
}
|
||||||
this.tabAdopted.next(tab)
|
this.tabAdopted.next(tab)
|
||||||
}
|
}
|
||||||
@@ -649,6 +654,7 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit
|
|||||||
y: y + thickness,
|
y: y + thickness,
|
||||||
w: thickness,
|
w: thickness,
|
||||||
h: h - thickness * 2,
|
h: h - thickness * 2,
|
||||||
|
type: 'relative',
|
||||||
side: 'l',
|
side: 'l',
|
||||||
})
|
})
|
||||||
this._dropZones.push({
|
this._dropZones.push({
|
||||||
@@ -656,6 +662,7 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit
|
|||||||
y: y - thickness / 2,
|
y: y - thickness / 2,
|
||||||
w,
|
w,
|
||||||
h: thickness,
|
h: thickness,
|
||||||
|
type: 'relative',
|
||||||
side: 't',
|
side: 't',
|
||||||
})
|
})
|
||||||
this._dropZones.push({
|
this._dropZones.push({
|
||||||
@@ -663,6 +670,7 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit
|
|||||||
y: y + thickness,
|
y: y + thickness,
|
||||||
w: thickness,
|
w: thickness,
|
||||||
h: h - thickness * 2,
|
h: h - thickness * 2,
|
||||||
|
type: 'relative',
|
||||||
side: 'r',
|
side: 'r',
|
||||||
})
|
})
|
||||||
this._dropZones.push({
|
this._dropZones.push({
|
||||||
@@ -670,6 +678,7 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit
|
|||||||
y: y + h - thickness / 2,
|
y: y + h - thickness / 2,
|
||||||
w,
|
w,
|
||||||
h: thickness,
|
h: thickness,
|
||||||
|
type: 'relative',
|
||||||
side: 'b',
|
side: 'b',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -714,6 +723,7 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit
|
|||||||
if (i !== root.ratios.length - 1) {
|
if (i !== root.ratios.length - 1) {
|
||||||
// Spanner area
|
// Spanner area
|
||||||
this._dropZones.push({
|
this._dropZones.push({
|
||||||
|
type: 'relative',
|
||||||
relativeTo: root.children[i],
|
relativeTo: root.children[i],
|
||||||
side: root.orientation === 'v' ? 'b': 'r',
|
side: root.orientation === 'v' ? 'b': 'r',
|
||||||
x: root.orientation === 'v' ? childX + thickness : childX + offset - thickness / 2,
|
x: root.orientation === 'v' ? childX + thickness : childX + offset - thickness / 2,
|
||||||
@@ -730,6 +740,7 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit
|
|||||||
y: childY + thickness,
|
y: childY + thickness,
|
||||||
w: thickness,
|
w: thickness,
|
||||||
h: childH - thickness * 2,
|
h: childH - thickness * 2,
|
||||||
|
type: 'relative',
|
||||||
relativeTo: child,
|
relativeTo: child,
|
||||||
side: 'l',
|
side: 'l',
|
||||||
})
|
})
|
||||||
@@ -738,6 +749,7 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit
|
|||||||
y: childY + thickness,
|
y: childY + thickness,
|
||||||
w: thickness,
|
w: thickness,
|
||||||
h: childH - thickness * 2,
|
h: childH - thickness * 2,
|
||||||
|
type: 'relative',
|
||||||
relativeTo: child,
|
relativeTo: child,
|
||||||
side: 'r',
|
side: 'r',
|
||||||
})
|
})
|
||||||
@@ -747,6 +759,7 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit
|
|||||||
y: childY,
|
y: childY,
|
||||||
w: childW - thickness * 2,
|
w: childW - thickness * 2,
|
||||||
h: thickness,
|
h: thickness,
|
||||||
|
type: 'relative',
|
||||||
relativeTo: child,
|
relativeTo: child,
|
||||||
side: 't',
|
side: 't',
|
||||||
})
|
})
|
||||||
@@ -755,6 +768,7 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit
|
|||||||
y: childY + childH - thickness,
|
y: childY + childH - thickness,
|
||||||
w: childW - thickness * 2,
|
w: childW - thickness * 2,
|
||||||
h: thickness,
|
h: thickness,
|
||||||
|
type: 'relative',
|
||||||
relativeTo: child,
|
relativeTo: child,
|
||||||
side: 'b',
|
side: 'b',
|
||||||
})
|
})
|
||||||
|
@@ -34,7 +34,7 @@ export class SplitTabDropZoneComponent extends SelfPositioningComponent {
|
|||||||
) {
|
) {
|
||||||
super(element)
|
super(element)
|
||||||
this.subscribeUntilDestroyed(app.tabDragActive$, tab => {
|
this.subscribeUntilDestroyed(app.tabDragActive$, tab => {
|
||||||
this.isActive = !!tab && tab !== this.parent && tab !== this.dropZone.container?.children[this.dropZone.position!]
|
this.isActive = !!tab && tab !== this.parent && (this.dropZone.type === 'relative' || tab !== this.dropZone.container?.children[this.dropZone.position])
|
||||||
this.layout()
|
this.layout()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user