fixed a bug with globalAlpha
This commit is contained in:
parent
9dc92b79aa
commit
efcdc56ccd
@ -141,10 +141,16 @@
|
|||||||
apply : "stroke"
|
apply : "stroke"
|
||||||
},
|
},
|
||||||
"globalAlpha": {
|
"globalAlpha": {
|
||||||
svgAttr : "opacity",
|
svgAttr : "stroke-opacity",
|
||||||
canvas : 1,
|
canvas : 1,
|
||||||
svg : 1,
|
svg : 1,
|
||||||
apply : "fill stroke"
|
apply : "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
|
||||||
@ -368,10 +374,24 @@
|
|||||||
regex = /rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi;
|
regex = /rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?\.?\d*)\s*\)/gi;
|
||||||
matches = regex.exec(value);
|
matches = regex.exec(value);
|
||||||
this.__currentElement.setAttribute(style.svgAttr, format("rgb({r},{g},{b})", {r:matches[1], g:matches[2], b:matches[3]}));
|
this.__currentElement.setAttribute(style.svgAttr, format("rgb({r},{g},{b})", {r:matches[1], g:matches[2], b:matches[3]}));
|
||||||
this.__currentElement.setAttribute(style.svgAttr+"-opacity", matches[4]);
|
//should take globalAlpha here
|
||||||
|
var opacity = matches[4];
|
||||||
|
var globalAlpha = this.globalAlpha;
|
||||||
|
if (globalAlpha != null) {
|
||||||
|
opacity *= globalAlpha;
|
||||||
|
}
|
||||||
|
this.__currentElement.setAttribute(style.svgAttr+"-opacity", opacity);
|
||||||
} else {
|
} else {
|
||||||
|
if (keys[i] === 'globalAlpha') {
|
||||||
|
if (this.__currentElement.getAttribute(style.svgAttr)) {
|
||||||
|
//fill-opacity or stroke-opacity has already been set by stroke or fill.
|
||||||
|
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(style.svgAttr, value);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user