SDA-3679 Ability to maximize SDA by dragging (#1411)

* SDA-3679 Ability to maximize SDA by dragging

* SDA-3679 Adding move event registration to title bar
This commit is contained in:
Salah Benmoussati 2022-05-11 09:41:35 +02:00 committed by GitHub
parent 52342dc4e1
commit 821bf16097
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 17 deletions

View File

@ -85,31 +85,17 @@ const saveWindowSettings = async (): Promise<void> => {
} }
}; };
const windowMaximized = async (): Promise<void> => {
const browserWindow = BrowserWindow.getFocusedWindow() as ICustomBrowserWindow;
if (browserWindow && windowExists(browserWindow)) {
const isMaximized = browserWindow.isMaximized();
const isFullScreen = browserWindow.isFullScreen();
if (browserWindow.winName === apiName.mainWindowName) {
const { mainWinPos } = config.getUserConfigFields(['mainWinPos']);
await config.updateUserConfig({
mainWinPos: { ...mainWinPos, ...{ isMaximized, isFullScreen } },
});
}
}
};
const throttledWindowChanges = throttle(async (eventName, window) => { const throttledWindowChanges = throttle(async (eventName, window) => {
await saveWindowSettings(); await saveWindowSettings();
await windowMaximized();
notification.moveNotificationToTop(); notification.moveNotificationToTop();
if ( if (
window && window &&
(window as ICustomBrowserWindow).winName === apiName.mainWindowName (window as ICustomBrowserWindow).winName === apiName.mainWindowName
) { ) {
mainEvents.publish(eventName); const isMaximized = window.isMaximized();
mainEvents.publish(eventName, isMaximized);
} }
}, 1000); }, 300);
const throttledWindowRestore = throttle(async () => { const throttledWindowRestore = throttle(async () => {
notification.moveNotificationToTop(); notification.moveNotificationToTop();

View File

@ -74,6 +74,7 @@ const DOWNLOAD_MANAGER_NAMESPACE = 'DownloadManager';
const TITLE_BAR_EVENTS = [ const TITLE_BAR_EVENTS = [
'maximize', 'maximize',
'unmaximize', 'unmaximize',
'move',
'enter-full-screen', 'enter-full-screen',
'leave-full-screen', 'leave-full-screen',
]; ];

View File

@ -38,6 +38,9 @@ export default class WindowsTitleBar extends React.Component<{}, IState> {
ipcRenderer.on('unmaximize', () => ipcRenderer.on('unmaximize', () =>
this.updateState({ isMaximized: false }), this.updateState({ isMaximized: false }),
); );
ipcRenderer.on('move', (_event, isMaximized) => {
this.updateState({ isMaximized });
});
ipcRenderer.once('disable-action-button', () => { ipcRenderer.once('disable-action-button', () => {
this.updateState({ isDisabled: true }); this.updateState({ isDisabled: true });