From 80dfab3ef44d86a8d26b41919c63869868be62dd Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sun, 12 Jan 2014 02:17:42 -0300 Subject: [PATCH] Bug WISE-22 fixed. Resolve resize node issue. --- web2d/src/main/javascript/peer/svg/TextPeer.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/web2d/src/main/javascript/peer/svg/TextPeer.js b/web2d/src/main/javascript/peer/svg/TextPeer.js index 24fb8ba9..538a5bd5 100644 --- a/web2d/src/main/javascript/peer/svg/TextPeer.js +++ b/web2d/src/main/javascript/peer/svg/TextPeer.js @@ -156,16 +156,20 @@ web2d.peer.svg.TextPeer = new Class({ var computedWidth; // Firefox hack for this issue:http://stackoverflow.com/questions/6390065/doing-ajax-updates-in-svg-breaks-getbbox-is-there-a-workaround try { + computedWidth = this._native.getBBox().width; // Chrome bug is producing this error, oly during page loading. Remove the hack if it works. The issue seems to be - // caused when the element is hidden. + // caused when the element is hidden. I don't know why, but it works ... if(computedWidth==0){ - computedWidth = getBoundingClientRect().width - 35; + var bbox = this._native.getBBox(); + computedWidth = bbox.width; } } catch(e) { computedWidth = 10; + } + console.log("Final result:"+computedWidth); var width = parseInt(computedWidth); width = width + this._font.getWidthMargin();