mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-27 17:31:36 -06:00
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:
parent
52342dc4e1
commit
821bf16097
@ -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();
|
||||
|
@ -74,6 +74,7 @@ const DOWNLOAD_MANAGER_NAMESPACE = 'DownloadManager';
|
||||
const TITLE_BAR_EVENTS = [
|
||||
'maximize',
|
||||
'unmaximize',
|
||||
'move',
|
||||
'enter-full-screen',
|
||||
'leave-full-screen',
|
||||
];
|
||||
|
@ -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 });
|
||||
|
Loading…
Reference in New Issue
Block a user