From 9ed3a6748a25fb057840519a202ddf6e418239ad Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Tue, 21 May 2019 23:48:33 +0100 Subject: [PATCH] Fix node label size calculation --- .../@node-red/editor-client/src/js/ui/view.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js index 614ab532e..9683bf4a9 100755 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js @@ -1759,15 +1759,10 @@ RED.view = (function() { } function calculateTextDimensions(str,className,offsetW,offsetH) { - var sp = document.createElement("span"); - sp.className = className; - sp.style.position = "absolute"; - sp.style.top = "-1000px"; - sp.textContent = (str||""); - document.body.appendChild(sp); - var w = sp.offsetWidth; - var h = sp.offsetHeight; - document.body.removeChild(sp); + var sp = $('',{class: className,style: "position: absolute; top: -1000px"}).text(str||"").appendTo("#red-ui-editor"); + var w = sp.width(); + var h = sp.height(); + sp.remove(); return [offsetW+w,offsetH+h]; }