mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
refactor Preload
This commit is contained in:
parent
3774f3655c
commit
6ce619f0c0
@ -51,7 +51,7 @@ _html2canvas.Util.parseBackgroundImage = function (value) {
|
||||
}
|
||||
results.push({
|
||||
prefix: prefix,
|
||||
method: method,
|
||||
method: method.toLowerCase(),
|
||||
value: block,
|
||||
args: args
|
||||
});
|
||||
|
@ -126,10 +126,18 @@ _html2canvas.Preload = function( options ) {
|
||||
|
||||
background_images = _html2canvas.Util.parseBackgroundImage(background_image);
|
||||
while(!!(background_image = background_images.shift())) {
|
||||
if(!background_image ||
|
||||
!background_image.method ||
|
||||
!background_image.args ||
|
||||
background_image.args.length === 0 ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( background_image.value && background_image.value !== "1" && background_image.value !== "none" ) {
|
||||
if (/^(-webkit|-o|-moz|-ms|linear)-/.test( background_image.method )) {
|
||||
if (background_image.method === 'url') {
|
||||
src = background_image.args[0];
|
||||
methods.loadImage(src);
|
||||
|
||||
} else if( background_image.method.match( /\-gradient$/ ) ) {
|
||||
img = _html2canvas.Generate.Gradient( background_image.value, _html2canvas.Util.Bounds( el ) );
|
||||
|
||||
if ( img !== undefined ){
|
||||
@ -142,12 +150,6 @@ _html2canvas.Preload = function( options ) {
|
||||
start();
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
src = _html2canvas.Util.backgroundImage(background_image.value);
|
||||
methods.loadImage(src);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user