Increase window size on enable min size

This commit is contained in:
Vendicated 2023-04-10 01:55:48 +02:00
parent 0c77dbec92
commit 60759c142e
No known key found for this signature in database
GPG key ID: A1DC0CFB5615D905

View file

@ -214,7 +214,18 @@ function initWindowBoundsListeners(win: BrowserWindow) {
function initSettingsListeners(win: BrowserWindow) {
Settings.addChangeListener("disableMinSize", disable => {
win.setMinimumSize(disable ? 1 : MIN_WIDTH, disable ? 1 : MIN_HEIGHT);
if (disable) {
// 0 no work
win.setMinimumSize(1, 1);
} else {
win.setMinimumSize(MIN_WIDTH, MIN_HEIGHT);
const { width, height } = win.getBounds();
win.setBounds({
width: Math.max(width, MIN_WIDTH),
height: Math.max(height, MIN_HEIGHT)
});
}
});
}