mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Fixed support for other Renderers other than Canvas
This commit is contained in:
parent
1ad7ed3e1c
commit
8d965029da
@ -23,6 +23,7 @@
|
||||
<file name="Renderer.js"/>
|
||||
<file name="Util.js"/>
|
||||
<file name="renderers/Canvas.js"/>
|
||||
<file name="renderers/SVG.js"/>
|
||||
<file name="html2canvas-post.txt"/>
|
||||
</filelist>
|
||||
</path>
|
||||
@ -76,6 +77,7 @@
|
||||
<file name="Renderer.js"/>
|
||||
<file name="Util.js"/>
|
||||
<file name="renderers/Canvas.js"/>
|
||||
<file name="renderers/SVG.js"/>
|
||||
</sources>
|
||||
</jscomp>
|
||||
<delete file="${build.dir}/${JS_NAME_MIN}.tmp"></delete>
|
||||
|
@ -58,9 +58,9 @@ _html2canvas.Renderer = function(parseQueue, options){
|
||||
|
||||
|
||||
sortZ(parseQueue.zIndex);
|
||||
if ( typeof options.renderer._create !== "function" ) {
|
||||
if ( typeof options._renderer._create !== "function" ) {
|
||||
throw new Error("Invalid renderer defined");
|
||||
}
|
||||
return options.renderer._create( parseQueue, options, document, queue, _html2canvas );
|
||||
return options._renderer._create( parseQueue, options, document, queue, _html2canvas );
|
||||
|
||||
};
|
||||
|
18
src/Util.js
18
src/Util.js
@ -34,14 +34,20 @@ html2canvas = function( elements, opts ) {
|
||||
flashcanvas: undefined, // path to flashcanvas
|
||||
width: null,
|
||||
height: null,
|
||||
taintTest: true // do a taint test with all images before applying to canvas
|
||||
|
||||
};
|
||||
taintTest: true, // do a taint test with all images before applying to canvas
|
||||
renderer: "Canvas"
|
||||
}, renderer;
|
||||
|
||||
options = _html2canvas.Util.Extend(opts, options);
|
||||
|
||||
options.renderer = options.renderer || _html2canvas.Renderer.Canvas( options );
|
||||
|
||||
|
||||
if (typeof options.renderer === "string" && _html2canvas.Renderer[options.renderer] !== undefined) {
|
||||
options._renderer = _html2canvas.Renderer[options.renderer]( options );
|
||||
} else if (typeof options.renderer === "function") {
|
||||
options._renderer = _html2canvas.Renderer.Canvas( options );
|
||||
} else {
|
||||
throw("Unknown renderer");
|
||||
}
|
||||
|
||||
_html2canvas.logging = options.logging;
|
||||
options.complete = function( images ) {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user