Browse Source

1、删除无用代码

2、添加最小化还原后底部被系统任务栏遮挡解决代码
test
yonghang 2 years ago
parent
commit
773d1df529
  1. 2
      app/main/ipc.js
  2. 66
      app/main/windows/main.js

2
app/main/ipc.js

@ -193,6 +193,7 @@ module.exports = () => {
return window[MAIN_WINDOW_FLAG]
})
if (found) {
found.setFullScreen(true)
found.restore();
found.show();
} else {
@ -207,6 +208,7 @@ module.exports = () => {
return window[MAIN_WINDOW_FLAG]
})
if (found) {
found.setFullScreen(false)
found.hide();
}
return true

66
app/main/windows/main.js

@ -43,41 +43,37 @@ const create = () => {
found.maximize();
return found;
} else {
let areaSize = require('electron').screen.getPrimaryDisplay().workAreaSize;
let width = areaSize.width;
let height = areaSize.height;
let resizable = true;
if (screen.width > 0 && screen.height > 0) {
const ratios = screen.width / screen.height;
height = areaSize.height;
width = Math.floor(areaSize.height * ratios);
resizable = false;
}
const win = createWindow(MAIN_WINDOW_URL, {
//alwaysOnTop: true, //窗口是否总是显示在其他窗口之前
fullscreen: true,
offScreen: false,
frame: false, //要创建无边框窗口
width: width, //悬浮窗口的宽度 比实际DIV的宽度要多2px 因为有1px的边框
height: height, //悬浮窗口的高度 比实际DIV的高度要多2px 因为有1px的边框
resizable: resizable, //禁止窗口大小缩放
show: false, //先不让窗口显示
// backgroundColor: "#0a0a0a"
})
win[MAIN_WINDOW_FLAG] = true
// start()
sinceTimeEnd('createWindow')
win.on('ready-to-show', () => {
sinceTimeEnd('ready-to-show')
win.show();
sinceTimeEnd('win.show')
});
win.on('hide', () => {
console.log('窗口hide');
createSuspensionWindow();
});
return create();
let areaSize = require('electron').screen.getPrimaryDisplay().workAreaSize
let width = areaSize.width
let height = areaSize.height
let resizable = true
if (screen.width > 0 && screen.height > 0) {
const ratios = screen.width / screen.height
height = areaSize.height
width = Math.floor(areaSize.height * ratios)
resizable = false
}
const win = createWindow(MAIN_WINDOW_URL, {
//alwaysOnTop: true, //窗口是否总是显示在其他窗口之前
fullscreen: true,
offScreen: false,
frame: false, //要创建无边框窗口
width: width, //悬浮窗口的宽度 比实际DIV的宽度要多2px 因为有1px的边框
height: height, //悬浮窗口的高度 比实际DIV的高度要多2px 因为有1px的边框
resizable: resizable, //禁止窗口大小缩放
show: false, //先不让窗口显示
// backgroundColor: "#0a0a0a"
})
win[MAIN_WINDOW_FLAG] = true
// start()
win.on('ready-to-show', () => {
win.show()
})
win.on('hide', () => {
console.log('窗口hide')
createSuspensionWindow()
})
return create()
}
}

Loading…
Cancel
Save