X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=plugins%2Fraphael.export.js;h=24e14cc4028132e1d1869a9ab97eec84d27a5538;hb=265ff3ab60fc67f052f7447edc3e56f0a72e5bad;hp=dfdeb3da5c03f4496221e5cc5ca78fcbc416d602;hpb=c08cabc928a81be9740fce0d62faa98133d2e59c;p=raphael diff --git a/plugins/raphael.export.js b/plugins/raphael.export.js index dfdeb3d..24e14cc 100644 --- a/plugins/raphael.export.js +++ b/plugins/raphael.export.js @@ -163,9 +163,10 @@ return initial; }, { - style: 'text-anchor: ' + (style.font.anchor ? style.font.anchor : 'middle;') + - styleToString(style) + ';' } - ), + style: 'text-anchor: ' + (style.font.anchor ? (style.font.anchor +';' ): 'middle;') + + styleToString(style) + ';' + } + ), node.matrix, tag('tspan', { @@ -187,9 +188,11 @@ reduce( node.attrs, function(initial, value, name) { - if ( name === 'path' ) name = 'd'; + if ( name === 'path' ) { + name = 'd'; + } - initial[name] = value.toString(); + initial[name] = (typeof(value) == 'undefined') ? '' : value.toString(); return initial; }, @@ -231,7 +234,7 @@ for ( i in node.attrs ) { var name = i; - + var val = node.attrs[i].toString(); switch ( i ) { case 'src': name = 'xlink:href'; @@ -239,12 +242,16 @@ break; case 'transform': name = ''; - break; + + case 'stroke': + case 'fill': + val = Raphael.getRGB(val).hex; + break; } if ( name ) { - attrs += ' ' + name + '="' + escapeXML(node.attrs[i].toString()) + '"'; + attrs += ' ' + name + '="' + escapeXML(val) + '"'; } }