fix(components/Titlebar): `还原/最大化`按钮在双击标题栏时不会更新的问题 (#1575)

* fix(components/Titlebar): `还原/最大化`按钮在双击标题栏时不会更新的问题

* update
master
memorydream 3 years ago committed by GitHub
parent c85af59b21
commit a9b05d66a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -332,6 +332,14 @@ class Background {
this.store.set('window', this.window.getBounds());
});
this.window.on('maximize', () => {
this.window.webContents.send('isMaximized', true);
});
this.window.on('unmaximize', () => {
this.window.webContents.send('isMaximized', false);
});
this.window.webContents.on('new-window', function (e, url) {
e.preventDefault();
log('open url');

@ -12,8 +12,8 @@
<div
class="button max-restore codicon"
:class="{
'codicon-chrome-restore': !isShowMaximized,
'codicon-chrome-maximize': isShowMaximized,
'codicon-chrome-restore': isMaximized,
'codicon-chrome-maximize': !isMaximized,
}"
@click="windowMaxRestore"
></div>
@ -40,7 +40,7 @@ export default {
name: 'LinuxTitlebar',
data() {
return {
isShowMaximized: true,
isMaximized: false,
};
},
computed: {
@ -49,9 +49,7 @@ export default {
created() {
if (process.env.IS_ELECTRON === true) {
ipcRenderer.on('isMaximized', (_, value) => {
// valuefalse
// valuetrue
this.isShowMaximized = value;
this.isMaximized = value;
});
}
},

@ -9,8 +9,8 @@
<div
class="button max-restore codicon"
:class="{
'codicon-chrome-restore': !isShowMaximized,
'codicon-chrome-maximize': isShowMaximized,
'codicon-chrome-restore': isMaximized,
'codicon-chrome-maximize': !isMaximized,
}"
@click="windowMaxRestore"
></div>
@ -37,7 +37,7 @@ export default {
name: 'Win32Titlebar',
data() {
return {
isShowMaximized: true,
isMaximized: false,
};
},
computed: {
@ -46,9 +46,7 @@ export default {
created() {
if (process.env.IS_ELECTRON === true) {
ipcRenderer.on('isMaximized', (_, value) => {
// valuefalse
// valuetrue
this.isShowMaximized = value;
this.isMaximized = value;
});
}
},

@ -222,9 +222,7 @@ export function initIpcMain(win, store, trayEventEmitter) {
});
ipcMain.on('maximizeOrUnmaximize', () => {
const isMaximized = win.isMaximized();
isMaximized ? win.unmaximize() : win.maximize();
win.webContents.send('isMaximized', isMaximized);
win.isMaximized() ? win.unmaximize() : win.maximize();
});
ipcMain.on('settings', (event, options) => {

Loading…
Cancel
Save