I had the same issue in Rapahel 2.2.0 and 2.2.1, and using ._getBBox() did not fix this for me.
What can I fix this for, returns to .auxGetBBox() , if defined, and regular .getBBox() does not work, for example:
var bbox = path.getBBox( ); // Workaround for apparent bug in Raphael VML module getBBox() override if( isNaN( bbox.x ) && path.auxGetBBox ){ bbox = path.auxGetBBox(); }
I do not have a fix for the main error, but I found its source.
In VML mode, Raphael takes the initial getBBox() function, saves it as auxGetBBox() in the element prototype, and then replaces it with a function that seems to be broken.
It has calculations based on a variable defined as var z = 1/this.paper._viewBoxShift.scale; , which explicitly expects _viewBoxShift.scale to be some scale factor for the current viewport compared to the original viewport, but in fact _viewBoxShift.scale is the kind of object that comes from paperproto.getSize() :
{ height: someNumber, width: someNumber }
All NaN happens here. Cannes are divided by object.
Thus, this workaround works fine if scaling is not used when using scaling, but can lead to incorrect results when scaling is applied (something that I cannot use at all in recent raphael versions in VML mode, but this is a separate issue) . A commit that includes a deep recess in Raphael's VML module to pass the correct scaling factor to this variable z .
source share