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) => {
await saveWindowSettings();
await windowMaximized();
notification.moveNotificationToTop();
if (
window &&
(window as ICustomBrowserWindow).winName === apiName.mainWindowName
) {
mainEvents.publish(eventName);
const isMaximized = window.isMaximized();
mainEvents.publish(eventName, isMaximized);
}
}, 1000);
}, 300);
const throttledWindowRestore = throttle(async () => {
notification.moveNotificationToTop();

View File

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

View File

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