Resize tray on create to ensure proper size

This commit is contained in:
Nick O'Leary
2016-03-23 23:22:36 +00:00
parent 333acccff6
commit 9c766d76f3
3 changed files with 25 additions and 43 deletions

View File

@@ -562,10 +562,8 @@ RED.editor = (function() {
],
resize: function() {
if (editing_node && editing_node._def.oneditresize) {
setTimeout(function() {
var form = $("#dialog-form");
editing_node._def.oneditresize.call(editing_node,{width:form.width(),height:form.height()});
},0);
var form = $("#dialog-form");
editing_node._def.oneditresize.call(editing_node,{width:form.width(),height:form.height()});
}
},
open: function(tray) {
@@ -698,10 +696,8 @@ RED.editor = (function() {
title: (adding?RED._("editor.addNewConfig", {type:type}):RED._("editor.editConfig", {type:type})),
resize: function() {
if (editing_config_node && editing_config_node._def.oneditresize) {
setTimeout(function() {
var form = $("#node-config-dialog-edit-form");
editing_config_node._def.oneditresize.call(editing_config_node,{width:form.width(),height:form.height()});
},0);
var form = $("#node-config-dialog-edit-form");
editing_config_node._def.oneditresize.call(editing_config_node,{width:form.width(),height:form.height()});
}
},
open: function(tray) {
@@ -1071,17 +1067,15 @@ RED.editor = (function() {
}
],
resize: function() {
setTimeout(function() {
var rows = $("#dialog-form>div:not(.node-text-editor-row)");
var editorRow = $("#dialog-form>div.node-text-editor-row");
var height = $("#dialog-form").height();
for (var i=0;i<rows.size();i++) {
height -= $(rows[i]).outerHeight(true);
}
height -= (parseInt($("#dialog-form").css("marginTop"))+parseInt($("#dialog-form").css("marginBottom")));
$(".node-text-editor").css("height",height+"px");
subflowEditor.resize();
},0);
var rows = $("#dialog-form>div:not(.node-text-editor-row)");
var editorRow = $("#dialog-form>div.node-text-editor-row");
var height = $("#dialog-form").height();
for (var i=0;i<rows.size();i++) {
height -= $(rows[i]).outerHeight(true);
}
height -= (parseInt($("#dialog-form").css("marginTop"))+parseInt($("#dialog-form").css("marginBottom")));
$(".node-text-editor").css("height",height+"px");
subflowEditor.resize();
},
open: function(tray) {
if (editing_node) {

View File

@@ -66,16 +66,18 @@ RED.tray = (function() {
stack.push(tray);
setTimeout(function() {
var trayHeight = el.height()-header.outerHeight()-footer.outerHeight();
body.height(trayHeight-40);
var trayHeight = el.height()-header.outerHeight()-footer.outerHeight();
body.height(trayHeight-40);
if (options.resize) {
options.resize();
}
if (options.show) {
options.show();
}
setTimeout(function() {
setTimeout(function() {
if (options.resize) {
options.resize();
}
if (options.show) {
options.show();
}
},150);
el.css({right:0});
},0);
}