Fix the dialog size when zoom level is changed of the browser.

The screen.width & screen.height does not reflect the values of the
height and width respectively when zoom level is changed for the
browser. It is better to review the calculated height and width based
on the window.innerHeight and window.innerWidth and re-evaluate them.
This commit is contained in:
Ashesh Vashi 2020-07-01 11:49:39 +05:30
parent 21d57b1f10
commit 3102a8d24b
2 changed files with 23 additions and 4 deletions

View File

@ -598,9 +598,12 @@ define('pgadmin.browser.node', [
let w, h, x, y;
if(screen.width < 800) {
w= pgAdmin.toPx(el, '95%', 'width', true);
w = pgAdmin.toPx(el, '95%', 'width', true);
} else {
w= pgAdmin.toPx(el, self.width || pgBrowser.stdW.default+'px', 'width', true);
w = pgAdmin.toPx(
el, (self.width || pgBrowser.stdW.default) + 'px',
'width', true
);
/* Fit to standard sizes */
if(w <= pgBrowser.stdW.sm) {
@ -617,7 +620,10 @@ define('pgadmin.browser.node', [
if(screen.height < 600) {
h = pgAdmin.toPx(el, '95%', 'height', true);
} else {
h = pgAdmin.toPx(el, self.height || pgBrowser.stdH.default+'px', 'height', true);
h = pgAdmin.toPx(
el, (self.height || pgBrowser.stdH.default) + 'px',
'height', true
);
/* Fit to standard sizes */
if(h <= pgBrowser.stdH.sm) {
@ -634,6 +640,18 @@ define('pgadmin.browser.node', [
x = (b.offsetWidth - w) / 2;
y = (b.offsetHeight - h) / 4;
// If the screen resolution is higher, but - it is zoomed, dialog
// may be go out of window, and will not be accessible through the
// keyboard.
if (w > window.innerWidth) {
x = 0;
w = window.innerWidth;
}
if (h > window.innerHeight) {
y = 0;
h = window.innerHeight;
}
var p = pgBrowser.docker.addPanel(
'node_props', wcDocker.DOCK.FLOAT, undefined, {
w: w + 'px',
@ -644,7 +662,6 @@ define('pgadmin.browser.node', [
);
b.removeChild(el);
// delete(el);
return p;
};

View File

@ -90,6 +90,8 @@
&.wcFrame, & .wcPanelBackground {
border-bottom-left-radius: $card-border-radius;
border-bottom-right-radius: $card-border-radius;
max-width: 100%;
max-height: 100%;
}
& .pg-panel-content {