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:
parent
359c0354f6
commit
9ed3a6748a
@ -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];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user