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

Fix gridSize for node width calculation to avoid odd resizing

This commit is contained in:
Nick O'Leary 2017-06-05 16:10:47 +01:00
parent 48a8dc0989
commit f527841c29
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -1880,7 +1880,7 @@ RED.view = (function() {
if (isLink) {
d.w = node_height;
} else {
d.w = Math.max(node_width,gridSize*(Math.ceil((calculateTextWidth(l, "node_label", 50)+(d._def.inputs>0?7:0))/gridSize)) );
d.w = Math.max(node_width,20*(Math.ceil((calculateTextWidth(l, "node_label", 50)+(d._def.inputs>0?7:0))/20)) );
}
d.h = Math.max(node_height,(d.outputs||0) * 15);
@ -2068,7 +2068,7 @@ RED.view = (function() {
if (!isLink && d.resize) {
var l = RED.utils.getNodeLabel(d);
var ow = d.w;
d.w = Math.max(node_width,gridSize*(Math.ceil((calculateTextWidth(l, "node_label", 50)+(d._def.inputs>0?7:0))/gridSize)) );
d.w = Math.max(node_width,20*(Math.ceil((calculateTextWidth(l, "node_label", 50)+(d._def.inputs>0?7:0))/20)) );
d.h = Math.max(node_height,(d.outputs||0) * 15);
d.x += (d.w-ow)/2;
d.resize = false;