mirror of
https://github.com/konvajs/konva.git
synced 2025-04-05 20:48:28 +08:00
ts fixes
This commit is contained in:
parent
8698f020cc
commit
9529dc2071
@ -12,6 +12,7 @@ import { Shape } from './Shape';
|
||||
export interface LayerConfig extends ContainerConfig {
|
||||
clearBeforeDraw?: boolean;
|
||||
hitGraphEnabled?: boolean;
|
||||
imageSmoothingEnabled?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
|
22
src/Node.ts
22
src/Node.ts
@ -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';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user