fixed fatal error with multiple background images

This commit is contained in:
MoyuScript
2011-08-11 15:32:20 +03:00
parent 40418bd957
commit 1b395d0548
6 changed files with 43 additions and 39 deletions

View File

@ -2,9 +2,9 @@
html2canvas.prototype.drawBackground = function(el,bounds,ctx){
var background_image = this.getCSS(el,"background-image");
var background_repeat = this.getCSS(el,"background-repeat");
// TODO add support for multi background-images
var background_image = this.getCSS(el,"background-image").split(",")[0];
var background_repeat = this.getCSS(el,"background-repeat").split(",")[0];
if (typeof background_image != "undefined" && /^(1|none)$/.test(background_image)==false && /^(-webkit|-moz|linear-gradient|-o-)/.test(background_image)==false){
@ -166,7 +166,9 @@ html2canvas.prototype.backgroundImageUrl = function(src){
*/
html2canvas.prototype.getBackgroundPosition = function(el,bounds,image){
var bgpos = this.getCSS(el,"backgroundPosition") || "0 0";
// TODO add support for multi image backgrounds
var bgpos = this.getCSS(el,"backgroundPosition").split(",")[0] || "0 0";
// var bgpos = $(el).css("backgroundPosition") || "0 0";
var bgposition = bgpos.split(" "),
topPos,

View File

@ -19,8 +19,8 @@ html2canvas.prototype.getImages = function(el) {
var background_image = this.getCSS(el,'background-image');
if (background_image && background_image != "1" && background_image != "none" && background_image.substring(0,7)!="-webkit" && background_image.substring(0,3)!="-o-" && background_image.substring(0,4)!="-moz"){
var src = this.backgroundImageUrl(background_image);
// TODO add multi image background support
var src = this.backgroundImageUrl(background_image.split(",")[0]);
this.preloadImage(src);
}
}