mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Add foreignObjectRendering option
This commit is contained in:
@ -124,6 +124,7 @@ export class DocumentCloner {
|
||||
proxy: this.options.proxy,
|
||||
removeContainer: this.options.removeContainer,
|
||||
scale: this.options.scale,
|
||||
foreignObjectRendering: this.options.foreignObjectRendering,
|
||||
target: new CanvasRenderer(),
|
||||
width,
|
||||
height,
|
||||
|
@ -46,8 +46,10 @@ export const renderElement = (
|
||||
: documentBackgroundColor
|
||||
: options.backgroundColor ? new Color(options.backgroundColor) : null;
|
||||
|
||||
// $FlowFixMe
|
||||
return Feature.SUPPORT_FOREIGNOBJECT_DRAWING.then(
|
||||
return (options.foreignObjectRendering
|
||||
? // $FlowFixMe
|
||||
Feature.SUPPORT_FOREIGNOBJECT_DRAWING
|
||||
: Promise.resolve(false)).then(
|
||||
supportForeignObject =>
|
||||
supportForeignObject
|
||||
? (cloner => {
|
||||
|
@ -13,6 +13,7 @@ export type Options = {
|
||||
allowTaint: ?boolean,
|
||||
backgroundColor: string,
|
||||
canvas: ?HTMLCanvasElement,
|
||||
foreignObjectRendering: boolean,
|
||||
imageTimeout: number,
|
||||
proxy: ?string,
|
||||
removeContainer: ?boolean,
|
||||
@ -56,6 +57,7 @@ const html2canvas = (element: HTMLElement, conf: ?Options): Promise<*> => {
|
||||
imageTimeout: 15000,
|
||||
proxy: null,
|
||||
removeContainer: true,
|
||||
foreignObjectRendering: true,
|
||||
scale: defaultView.devicePixelRatio || 1,
|
||||
target: new CanvasRenderer(config.canvas),
|
||||
x: left,
|
||||
|
Reference in New Issue
Block a user