mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-27 01:11:13 -06:00
enforce min width and height for windows (#88)
This commit is contained in:
parent
c2d8d8ea70
commit
515ee36fe1
@ -144,7 +144,7 @@
|
||||
|
||||
var openWinButton = document.getElementById('open-win');
|
||||
openWinButton.addEventListener('click', function() {
|
||||
win = window.open('win.html?x=100&y=100', 'test-window', 'height=100,width=100');
|
||||
win = window.open('win.html?x=100&y=100', 'test-window', 'height=800,width=400');
|
||||
});
|
||||
|
||||
var front = document.getElementById('bring-to-front');
|
||||
|
@ -37,6 +37,9 @@ let boundsChangeWindow;
|
||||
// note: this file is built using browserify in prebuild step.
|
||||
const preloadMainScript = path.join(__dirname, 'preload/_preloadMain.js');
|
||||
|
||||
const MIN_WIDTH = 300;
|
||||
const MIN_HEIGHT = 600;
|
||||
|
||||
function addWindowKey(key, browserWin) {
|
||||
windows[key] = browserWin;
|
||||
}
|
||||
@ -69,6 +72,8 @@ function doCreateMainWindow(initialUrl, initialBounds) {
|
||||
let newWinOpts = {
|
||||
title: 'Symphony',
|
||||
show: true,
|
||||
minWidth: MIN_WIDTH,
|
||||
minHeight: MIN_HEIGHT,
|
||||
webPreferences: {
|
||||
sandbox: true,
|
||||
nodeIntegration: false,
|
||||
@ -198,8 +203,8 @@ function doCreateMainWindow(initialUrl, initialBounds) {
|
||||
let x = 0;
|
||||
let y = 0;
|
||||
|
||||
let width = newWinOptions.width || 300;
|
||||
let height = newWinOptions.height || 600;
|
||||
let width = newWinOptions.width || MIN_WIDTH;
|
||||
let height = newWinOptions.height || MIN_HEIGHT;
|
||||
|
||||
// try getting x and y position from query parameters
|
||||
var query = newWinParsedUrl && querystring.parse(newWinParsedUrl.query);
|
||||
@ -228,8 +233,10 @@ function doCreateMainWindow(initialUrl, initialBounds) {
|
||||
/* eslint-disable no-param-reassign */
|
||||
newWinOptions.x = x;
|
||||
newWinOptions.y = y;
|
||||
newWinOptions.width = width;
|
||||
newWinOptions.height = height;
|
||||
newWinOptions.width = Math.max(width, MIN_WIDTH);
|
||||
newWinOptions.height = Math.max(height, MIN_HEIGHT);
|
||||
newWinOptions.minWidth = MIN_WIDTH;
|
||||
newWinOptions.minHeight = MIN_HEIGHT;
|
||||
|
||||
let newWinKey = getGuid();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user