added docking space adjustment - fixes #3524

This commit is contained in:
Eugene Pankov 2021-03-02 22:53:26 +01:00
parent e07c5db0a8
commit 1c81baa6f2
No known key found for this signature in database
GPG key ID: 5896FCBBDD1CF4F4
3 changed files with 26 additions and 8 deletions

View file

@ -2,6 +2,7 @@ appearance:
dock: off
dockScreen: current
dockFill: 0.5
dockSpace: 1
dockHideOnBlur: false
dockAlwaysOnTop: true
flexTabs: false

View file

@ -34,25 +34,30 @@ export class DockingService {
const newBounds: Bounds = { x: 0, y: 0, width: 0, height: 0 }
const fill = this.config.store.appearance.dockFill <= 1 ? this.config.store.appearance.dockFill : 1
const space = this.config.store.appearance.dockSpace <= 1 ? this.config.store.appearance.dockSpace : 1
const [minWidth, minHeight] = this.hostApp.getWindow().getMinimumSize()
if (dockSide === 'left' || dockSide === 'right') {
newBounds.width = Math.max(minWidth, Math.round(fill * display.bounds.width))
newBounds.height = display.bounds.height
newBounds.height = Math.round(display.bounds.height * space)
}
if (dockSide === 'top' || dockSide === 'bottom') {
newBounds.width = display.bounds.width
newBounds.width = Math.round(display.bounds.width * space)
newBounds.height = Math.max(minHeight, Math.round(fill * display.bounds.height))
}
if (dockSide === 'right') {
newBounds.x = display.bounds.x + display.bounds.width - newBounds.width
} else {
} else if (dockSide === 'left') {
newBounds.x = display.bounds.x
} else {
newBounds.x = display.bounds.x + Math.round(display.bounds.width / 2 * (1 - space))
}
if (dockSide === 'bottom') {
newBounds.y = display.bounds.y + display.bounds.height - newBounds.height
} else {
} else if (dockSide === 'top') {
newBounds.y = display.bounds.y
} else {
newBounds.y = display.bounds.y + Math.round(display.bounds.height / 2 * (1 - space))
}
const alwaysOnTop = this.config.store.appearance.dockAlwaysOnTop

View file

@ -220,7 +220,7 @@ ngb-tabset.vertical(type='pills', [activeId]='activeTab')
)
| Bottom
.form-line(*ngIf='config.store.appearance.dock != "off"')
.ml-5.form-line(*ngIf='config.store.appearance.dock != "off"')
.header
.title Display on
.description Snaps the window to a side of the screen
@ -245,7 +245,7 @@ ngb-tabset.vertical(type='pills', [activeId]='activeTab')
)
| {{screen.name}}
.form-line(*ngIf='config.store.appearance.dock != "off"')
.ml-5.form-line(*ngIf='config.store.appearance.dock != "off"')
.header
.title Dock always on top
.description Keep docked terminal always on top
@ -254,7 +254,7 @@ ngb-tabset.vertical(type='pills', [activeId]='activeTab')
(ngModelChange)='saveConfiguration(); docking.dock()',
)
.form-line(*ngIf='config.store.appearance.dock != "off"')
.ml-5.form-line(*ngIf='config.store.appearance.dock != "off"')
.header
.title Docked terminal size
input(
@ -266,7 +266,19 @@ ngb-tabset.vertical(type='pills', [activeId]='activeTab')
step='0.01'
)
.form-line(*ngIf='config.store.appearance.dock != "off"')
.ml-5.form-line(*ngIf='config.store.appearance.dock != "off"')
.header
.title Docked terminal space
input(
type='range',
[(ngModel)]='config.store.appearance.dockSpace',
(mouseup)='saveConfiguration(); docking.dock()',
min='0.2',
max='1',
step='0.01'
)
.ml-5.form-line(*ngIf='config.store.appearance.dock != "off"')
.header
.title Hide dock on blur
.description Hides the docked terminal when you click away.