Merge branch 'release/v3.0.2' into develop

This commit is contained in:
Paulo Veiga 2014-01-12 05:47:21 +00:00
commit 59a57e0b34

View File

@ -156,16 +156,20 @@ web2d.peer.svg.TextPeer = new Class({
var computedWidth; var computedWidth;
// Firefox hack for this issue:http://stackoverflow.com/questions/6390065/doing-ajax-updates-in-svg-breaks-getbbox-is-there-a-workaround // Firefox hack for this issue:http://stackoverflow.com/questions/6390065/doing-ajax-updates-in-svg-breaks-getbbox-is-there-a-workaround
try { try {
computedWidth = this._native.getBBox().width; 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 // 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){ if(computedWidth==0){
computedWidth = getBoundingClientRect().width - 35; var bbox = this._native.getBBox();
computedWidth = bbox.width;
} }
} catch(e) { } catch(e) {
computedWidth = 10; computedWidth = 10;
} }
console.log("Final result:"+computedWidth);
var width = parseInt(computedWidth); var width = parseInt(computedWidth);
width = width + this._font.getWidthMargin(); width = width + this._font.getWidthMargin();