-
Notifications
You must be signed in to change notification settings - Fork 50
stroke-dasharray #37
Description
Stroke dash array attribute is different in raphael.js from normal svg.
In raphael js it is one of the following array [“”, “-”, “.”, “-.”, “-..”, “. ”, “- ”, “--”, “- .”, “--.”, “--..”] . But in normal svg it is a list of comma and/or white space separated s and s that specify the lengths of alternating dashes and gaps.
Refer : http://raphaeljs.com/reference.html#Element.attr
and https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray
so if we export svg it will not be correct in stroke dash array.
I suggest add the following case in switch present in 'tag' function (after line 102)
case 'stroke-dasharray':
var sw = attrs['stroke-width'] !== undefined ? attrs['stroke-width'] : 1 ;
switch(element){
case "" :
element = "0";
break;
case "-" :
element = (3_sw)+","+sw;
break;
case "." :
element = sw+","+sw;
break;
case "-." :
element = (3_sw)+","+sw+","+sw+","+sw;
break;
case "-.." :
element = (3_sw)+","+sw+","+sw+","+sw+","+sw+","+sw;
break;
case ". " :
element = sw+","+(3_sw);
break;
case "- " :
element = (4_sw)+","+(3_sw);
break;
case "--" :
element = (8_sw)+","+(3_sw);
break;
case "- ." :
element = (4_sw)+","+(3_sw)+","+sw+","+(3_sw);
break;
case "--." :
element = (8_sw)+","+(3_sw)+","+sw+","+(3_sw);
break;
case "--.." :
element = (8_sw)+","+(3_sw)+","+sw+","+(3_sw)+","+sw+","+(3_sw);
break;
}