This commit is contained in:
Anton Lavrenov 2019-05-29 16:26:22 -05:00
parent 8698f020cc
commit 9529dc2071
3 changed files with 68 additions and 1332 deletions

1377
konva.js

File diff suppressed because it is too large Load Diff

View File

@ -12,6 +12,7 @@ import { Shape } from './Shape';
export interface LayerConfig extends ContainerConfig {
clearBeforeDraw?: boolean;
hitGraphEnabled?: boolean;
imageSmoothingEnabled?: boolean;
}
/**

View File

@ -1858,7 +1858,16 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
* If you export to 500x500 size with pixelRatio = 2, then produced image will have size 1000x1000.
* @returns {String}
*/
toDataURL(config) {
toDataURL(config?: {
x?: number;
y?: number;
width?: number;
height?: number;
pixelRatio?: number;
mimeType?: string;
quality?: number;
callback?: (str: string) => void
}) {
config = config || {};
var mimeType = config.mimeType || null,
quality = config.quality || null;
@ -1896,7 +1905,16 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
* }
* });
*/
toImage(config) {
toImage(config?: {
x?: number;
y?: number;
width?: number;
height?: number;
pixelRatio?: number;
mimeType?: string;
quality?: number;
callback?: (img: HTMLImageElement) => void
}) {
if (!config || !config.callback) {
throw 'callback required for toImage method config argument';
}