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

Fix node label size calculation

This commit is contained in:
Nick O'Leary 2019-05-21 23:48:33 +01:00
parent 359c0354f6
commit 9ed3a6748a
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -1759,15 +1759,10 @@ RED.view = (function() {
} }
function calculateTextDimensions(str,className,offsetW,offsetH) { function calculateTextDimensions(str,className,offsetW,offsetH) {
var sp = document.createElement("span"); var sp = $('<span>',{class: className,style: "position: absolute; top: -1000px"}).text(str||"").appendTo("#red-ui-editor");
sp.className = className; var w = sp.width();
sp.style.position = "absolute"; var h = sp.height();
sp.style.top = "-1000px"; sp.remove();
sp.textContent = (str||"");
document.body.appendChild(sp);
var w = sp.offsetWidth;
var h = sp.offsetHeight;
document.body.removeChild(sp);
return [offsetW+w,offsetH+h]; return [offsetW+w,offsetH+h];
} }