(xmlNode, el, defs, onlyInlineStyle)
| 26835 | }; |
| 26836 | |
| 26837 | function parseAttributes(xmlNode, el, defs, onlyInlineStyle) { |
| 26838 | var zrStyle = el.__inheritedStyle || {}; |
| 26839 | var isTextEl = el.type === 'text'; |
| 26840 | |
| 26841 | // TODO Shadow |
| 26842 | if (xmlNode.nodeType === 1) { |
| 26843 | parseTransformAttribute(xmlNode, el); |
| 26844 | |
| 26845 | extend(zrStyle, parseStyleAttribute(xmlNode)); |
| 26846 | |
| 26847 | if (!onlyInlineStyle) { |
| 26848 | for (var svgAttrName in attributesMap) { |
| 26849 | if (attributesMap.hasOwnProperty(svgAttrName)) { |
| 26850 | var attrValue = xmlNode.getAttribute(svgAttrName); |
| 26851 | if (attrValue != null) { |
| 26852 | zrStyle[attributesMap[svgAttrName]] = attrValue; |
| 26853 | } |
| 26854 | } |
| 26855 | } |
| 26856 | } |
| 26857 | } |
| 26858 | |
| 26859 | var elFillProp = isTextEl ? 'textFill' : 'fill'; |
| 26860 | var elStrokeProp = isTextEl ? 'textStroke' : 'stroke'; |
| 26861 | |
| 26862 | el.style = el.style || new Style(); |
| 26863 | var elStyle = el.style; |
| 26864 | |
| 26865 | zrStyle.fill != null && elStyle.set(elFillProp, getPaint(zrStyle.fill, defs)); |
| 26866 | zrStyle.stroke != null && elStyle.set(elStrokeProp, getPaint(zrStyle.stroke, defs)); |
| 26867 | |
| 26868 | each$1([ |
| 26869 | 'lineWidth', 'opacity', 'fillOpacity', 'strokeOpacity', 'miterLimit', 'fontSize' |
| 26870 | ], function (propName) { |
| 26871 | var elPropName = (propName === 'lineWidth' && isTextEl) ? 'textStrokeWidth' : propName; |
| 26872 | zrStyle[propName] != null && elStyle.set(elPropName, parseFloat(zrStyle[propName])); |
| 26873 | }); |
| 26874 | |
| 26875 | if (!zrStyle.textBaseline || zrStyle.textBaseline === 'auto') { |
| 26876 | zrStyle.textBaseline = 'alphabetic'; |
| 26877 | } |
| 26878 | if (zrStyle.textBaseline === 'alphabetic') { |
| 26879 | zrStyle.textBaseline = 'bottom'; |
| 26880 | } |
| 26881 | if (zrStyle.textAlign === 'start') { |
| 26882 | zrStyle.textAlign = 'left'; |
| 26883 | } |
| 26884 | if (zrStyle.textAlign === 'end') { |
| 26885 | zrStyle.textAlign = 'right'; |
| 26886 | } |
| 26887 | |
| 26888 | each$1(['lineDashOffset', 'lineCap', 'lineJoin', |
| 26889 | 'fontWeight', 'fontFamily', 'fontStyle', 'textAlign', 'textBaseline' |
| 26890 | ], function (propName) { |
| 26891 | zrStyle[propName] != null && elStyle.set(propName, zrStyle[propName]); |
| 26892 | }); |
| 26893 | |
| 26894 | if (zrStyle.lineDash) { |
no test coverage detected