diff options
| author | Alon Levy <alon@pobox.com> | 2014-12-04 16:10:54 +0200 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2014-12-04 16:10:54 +0200 |
| commit | 11c41cdb9aa79dc08a0067a1834caf6016bce766 (patch) | |
| tree | da0f34a62c21f05b0f02661eab3c5974b36932aa /src | |
| parent | b6b97601277aef7657b57e84fa3147be92cc7021 (diff) | |
measure should be hidden - reparented it to fo (and now it's out of the fo width so invisible)
Diffstat (limited to 'src')
| -rw-r--r-- | src/rz_core.js | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/rz_core.js b/src/rz_core.js index 5b393ea7..176f2855 100644 --- a/src/rz_core.js +++ b/src/rz_core.js @@ -30,6 +30,16 @@ var node_text_dx = 15, * edit_link(@sibling, @link) */ var svgInput = (function() { + var measure_span; + + function createMeasureSpan(parent) { + measure_span = document.createElement('span'); + measure_span.setAttribute('id', 'measure'); + measure_span.style.display = 'inline'; + measure_span.style.visibility = 'hidden'; + parent.appendChild(measure_span); + } + function appendForeignElementInputWithID(base, elemid, width, height) { var input = document.createElement('input'), @@ -45,18 +55,14 @@ var svgInput = (function() { fo.appendChild(body); base.appendChild(fo); input.setAttribute('id', elemid); + createMeasureSpan(body); return input; } - var measure_span = document.createElement('span'); - measure_span.setAttribute('id', 'measure'); - measure_span.style.display = 'inline'; - measure_span.style.visibility = 'none'; - document.body.appendChild(measure_span); - function measure(e, text) { measure_span.style.cssText = window.getComputedStyle(e).cssText; + measure_span.style.visibility = 'none'; measure_span.innerHTML = text; return measure_span.getBoundingClientRect().width; // $().width() works too } |
