fixed duplicate def of globalAlpha in STYLES

This commit is contained in:
fuzhen 2016-01-06 23:58:17 +08:00
parent efcdc56ccd
commit f302a60389

View File

@ -141,16 +141,10 @@
apply : "stroke" apply : "stroke"
}, },
"globalAlpha": { "globalAlpha": {
svgAttr : "stroke-opacity", svgAttr : "opacity",
canvas : 1, canvas : 1,
svg : 1, svg : 1,
apply : "stroke" apply : "fill stroke"
},
"globalAlpha": {
svgAttr : "fill-opacity",
canvas : 1,
svg : 1,
apply : "fill"
}, },
"font":{ "font":{
//font converts to multiple svg attributes, there is custom logic for this //font converts to multiple svg attributes, there is custom logic for this
@ -382,14 +376,16 @@
} }
this.__currentElement.setAttribute(style.svgAttr+"-opacity", opacity); this.__currentElement.setAttribute(style.svgAttr+"-opacity", opacity);
} else { } else {
var attr = style.svgAttr;
if (keys[i] === 'globalAlpha') { if (keys[i] === 'globalAlpha') {
if (this.__currentElement.getAttribute(style.svgAttr)) { attr = type+'-'+style.svgAttr;
if (this.__currentElement.getAttribute(attr)) {
//fill-opacity or stroke-opacity has already been set by stroke or fill. //fill-opacity or stroke-opacity has already been set by stroke or fill.
continue; continue;
} }
} }
//otherwise only update attribute if right type, and not svg default //otherwise only update attribute if right type, and not svg default
this.__currentElement.setAttribute(style.svgAttr, value); this.__currentElement.setAttribute(attr, value);
} }