mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
fix shadow parsing for IE9
This commit is contained in:
parent
ebd7828dc8
commit
2d39cd0719
@ -21,12 +21,11 @@ _html2canvas.Util.trimText = (function(isNative){
|
|||||||
})( String.prototype.trim );
|
})( String.prototype.trim );
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
// TODO: support all possible length values
|
// TODO: support all possible length values
|
||||||
var TEXT_SHADOW_PROPERTY = /((rgba|rgb)\([^\)]+\)(\s-?\d+px){0,})/g;
|
var TEXT_SHADOW_PROPERTY = /((rgba|rgb)\([^\)]+\)(\s-?\d+px){0,})/g;
|
||||||
var TEXT_SHADOW_VALUES = /(-?\d+px)|(#.+)|(rgb\(.+\))|(rgba\(.+\))/g;
|
var TEXT_SHADOW_VALUES = /(-?\d+px)|(#.+)|(rgb\(.+\))|(rgba\(.+\))/g;
|
||||||
_html2canvas.Util.parseTextShadows = function (value) {
|
_html2canvas.Util.parseTextShadows = function (value) {
|
||||||
if (value === 'none') {
|
if (!value || value === 'none') {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ _html2canvas.Parse = function (images, options) {
|
|||||||
bold = getCSS(el, "fontWeight"),
|
bold = getCSS(el, "fontWeight"),
|
||||||
family = getCSS(el, "fontFamily"),
|
family = getCSS(el, "fontFamily"),
|
||||||
size = getCSS(el, "fontSize"),
|
size = getCSS(el, "fontSize"),
|
||||||
shadow = getCSS(el, "textShadow");
|
shadows = _html2canvas.Util.parseTextShadows(getCSS(el, "textShadow"));
|
||||||
|
|
||||||
switch(parseInt(bold, 10)){
|
switch(parseInt(bold, 10)){
|
||||||
case 401:
|
case 401:
|
||||||
@ -95,9 +95,7 @@ _html2canvas.Parse = function (images, options) {
|
|||||||
ctx.setVariable("font", [getCSS(el, "fontStyle"), getCSS(el, "fontVariant"), bold, size, family].join(" "));
|
ctx.setVariable("font", [getCSS(el, "fontStyle"), getCSS(el, "fontVariant"), bold, size, family].join(" "));
|
||||||
ctx.setVariable("textAlign", (align) ? "right" : "left");
|
ctx.setVariable("textAlign", (align) ? "right" : "left");
|
||||||
|
|
||||||
if (shadow !== "none") {
|
if (shadows.length) {
|
||||||
var shadows = _html2canvas.Util.parseTextShadows(shadow);
|
|
||||||
|
|
||||||
// TODO: support multiple text shadows
|
// TODO: support multiple text shadows
|
||||||
// apply the first text shadow
|
// apply the first text shadow
|
||||||
ctx.setVariable("shadowColor", shadows[0].color);
|
ctx.setVariable("shadowColor", shadows[0].color);
|
||||||
|
Loading…
Reference in New Issue
Block a user