mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-29 02:11:28 -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) => {
|
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();
|
||||||
|
@ -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',
|
||||||
];
|
];
|
||||||
|
@ -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 });
|
||||||
|
Loading…
Reference in New Issue
Block a user