don't attempt to resize beyond min size when docking (fixes #308)

This commit is contained in:
Eugene Pankov 2018-03-23 17:53:20 +01:00
parent bebde4799d
commit 8f2d2cbe30

View File

@ -29,18 +29,19 @@ export class DockingService {
let dockSide = this.config.store.appearance.dock let dockSide = this.config.store.appearance.dock
let newBounds: Bounds = { x: 0, y: 0, width: 0, height: 0 } let newBounds: Bounds = { x: 0, y: 0, width: 0, height: 0 }
let fill = this.config.store.appearance.dockFill let fill = this.config.store.appearance.dockFill
let [minWidth, minHeight] = this.hostApp.getWindow().getMinimumSize()
if (dockSide === 'off') { if (dockSide === 'off') {
this.hostApp.setAlwaysOnTop(false) this.hostApp.setAlwaysOnTop(false)
return return
} }
if (dockSide === 'left' || dockSide === 'right') { if (dockSide === 'left' || dockSide === 'right') {
newBounds.width = Math.round(fill * display.bounds.width) newBounds.width = Math.max(minWidth, Math.round(fill * display.bounds.width))
newBounds.height = display.bounds.height newBounds.height = display.bounds.height
} }
if (dockSide === 'top' || dockSide === 'bottom') { if (dockSide === 'top' || dockSide === 'bottom') {
newBounds.width = display.bounds.width newBounds.width = display.bounds.width
newBounds.height = Math.round(fill * display.bounds.height) newBounds.height = Math.max(minHeight, Math.round(fill * display.bounds.height))
} }
if (dockSide === 'right') { if (dockSide === 'right') {
newBounds.x = display.bounds.x + display.bounds.width - newBounds.width newBounds.x = display.bounds.x + display.bounds.width - newBounds.width