1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Fix panel/tray size calculation on resize

This commit is contained in:
Nick O'Leary 2019-05-15 16:29:06 +01:00
parent bbe41febf1
commit 2bf9a353a6
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 10 additions and 4 deletions

View File

@ -87,10 +87,10 @@ RED.panels = (function() {
resize: function(size) { resize: function(size) {
var panelSizes; var panelSizes;
if (vertical) { if (vertical) {
panelSizes = [$(children[0]).height(),$(children[1]).height()]; panelSizes = [$(children[0]).outerHeight(),$(children[1]).outerHeight()];
container.height(size); container.height(size);
} else { } else {
panelSizes = [$(children[0]).width(),$(children[1]).width()]; panelSizes = [$(children[0]).outerWidth(),$(children[1]).outerWidth()];
container.width(size); container.width(size);
} }
if (modifiedSizes) { if (modifiedSizes) {
@ -106,6 +106,11 @@ RED.panels = (function() {
} }
} }
if (options.resize) { if (options.resize) {
if (vertical) {
panelSizes = [$(children[0]).height(),$(children[1]).height()];
} else {
panelSizes = [$(children[0]).width(),$(children[1]).width()];
}
options.resize(panelSizes[0],panelSizes[1]); options.resize(panelSizes[0],panelSizes[1]);
} }
} }

View File

@ -184,8 +184,6 @@ RED.tray = (function() {
function handleWindowResize() { function handleWindowResize() {
if (stack.length > 0) { if (stack.length > 0) {
var tray = stack[stack.length-1]; var tray = stack[stack.length-1];
var trayHeight = tray.tray.height()-tray.header.outerHeight()-tray.footer.outerHeight();
tray.body.height(trayHeight);
if (tray.options.maximized || tray.width > $("#red-ui-editor-stack").position().left-8) { if (tray.options.maximized || tray.width > $("#red-ui-editor-stack").position().left-8) {
tray.width = $("#red-ui-editor-stack").position().left-8; tray.width = $("#red-ui-editor-stack").position().left-8;
tray.tray.width(tray.width); tray.tray.width(tray.width);
@ -195,9 +193,12 @@ RED.tray = (function() {
tray.tray.width(tray.width); tray.tray.width(tray.width);
// tray.body.parent().width(tray.width); // tray.body.parent().width(tray.width);
} }
var trayHeight = tray.tray.height()-tray.header.outerHeight()-tray.footer.outerHeight();
tray.body.height(trayHeight);
if (tray.options.resize) { if (tray.options.resize) {
tray.options.resize({width:tray.width, height:trayHeight}); tray.options.resize({width:tray.width, height:trayHeight});
} }
} }
} }