1) Ensure that the zoom level should be set for the newly opened window.

2) Ensure that if the zoom level is changed on the main window then it should
   be applicable for all the opened windows.

refs #6271
This commit is contained in:
Akshay Joshi
2021-03-22 17:50:26 +05:30
parent 723d97971d
commit 2872b5c5d3
9 changed files with 59 additions and 18 deletions

View File

@@ -293,10 +293,20 @@ const setZoomEvents = () => {
});
};
// This function is used to iterate all open windows and set the zoom level.
const setZoomLevelForAllWindows = () => {
nw.Window.getAll(function(winArray) {
for (var i = 0; i < winArray.length; i++) {
winArray[i].zoomLevel = pgAdminWindowObject.zoomLevel;
}
})
};
// This function used to zoom in the pgAdmin window.
const zoomIn = () => {
if (pgAdminWindowObject != null) {
pgAdminWindowObject.zoomLevel += 0.5;
setZoomLevelForAllWindows();
ConfigureStore.set('zoomLevel', pgAdminWindowObject.zoomLevel);
ConfigureStore.saveConfig();
}
@@ -306,6 +316,7 @@ const zoomIn = () => {
const zoomOut = () => {
if (pgAdminWindowObject != null) {
pgAdminWindowObject.zoomLevel -= 0.5;
setZoomLevelForAllWindows();
ConfigureStore.set('zoomLevel', pgAdminWindowObject.zoomLevel);
ConfigureStore.saveConfig();
}
@@ -315,6 +326,7 @@ const zoomOut = () => {
const actualSize = () => {
if (pgAdminWindowObject != null) {
pgAdminWindowObject.zoomLevel = 0;
setZoomLevelForAllWindows();
ConfigureStore.set('zoomLevel', pgAdminWindowObject.zoomLevel);
ConfigureStore.saveConfig();
}
@@ -458,5 +470,6 @@ module.exports = {
setZoomEvents: setZoomEvents,
registerZoomEvents: registerZoomEvents,
unregisterZoomEvents: unregisterZoomEvents,
setZoomLevelForAllWindows: setZoomLevelForAllWindows,
ConfigureStore: ConfigureStore,
};

View File

@@ -118,14 +118,16 @@ function startDesktopMode() {
'focus': true,
'show': true,
});
} else if (chunk.indexOf('Runtime Zoom In') > -1) {
} else if (chunk.indexOf('Runtime Zoom In') >= 0) {
misc.zoomIn();
} else if (chunk.indexOf('Runtime Zoom Out') > -1) {
} else if (chunk.indexOf('Runtime Zoom Out') >= 0) {
misc.zoomOut();
} else if (chunk.indexOf('Runtime Actual Size') > -1) {
} else if (chunk.indexOf('Runtime Actual Size') >= 0) {
misc.actualSize();
} else if (chunk.indexOf('Runtime Toggle Full Screen') > -1) {
} else if (chunk.indexOf('Runtime Toggle Full Screen') >= 0) {
misc.toggleFullScreen();
} else if (chunk.indexOf('Runtime new window opened') >= 0) {
misc.setZoomLevelForAllWindows();
} else {
misc.writeServerLog(chunk);
}