From f2152da05d440f077050c8ed784631afe18a898a Mon Sep 17 00:00:00 2001 From: chenshenhai Date: Sat, 14 Oct 2023 18:20:48 +0800 Subject: [PATCH] feat: update idraw interface --- packages/idraw/src/index.ts | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/packages/idraw/src/index.ts b/packages/idraw/src/index.ts index c0edc8d..082e195 100644 --- a/packages/idraw/src/index.ts +++ b/packages/idraw/src/index.ts @@ -1,5 +1,5 @@ import { Core, MiddlewareSelector, MiddlewareScroller, MiddlewareScaler } from '@idraw/core'; -import type { PointSize, IDrawOptions, Data, ViewSizeInfo } from '@idraw/types'; +import type { PointSize, IDrawOptions, Data, ViewSizeInfo, IDrawEvent } from '@idraw/types'; export class iDraw { private _core: Core; @@ -82,23 +82,27 @@ export class iDraw { this._core.resize(opts); } - on() { - // TODO + on(name: T, callback: (e: IDrawEvent[T]) => void) { + this._core.on(name, callback); } - off() { - // TODO + off(name: T, callback: (e: IDrawEvent[T]) => void) { + this._core.off(name, callback); } - scrollLeft() { - // TODO + trigger(name: T, e: IDrawEvent[T]) { + this._core.trigger(name, e); } - scrollTop() { - // TODO - } + // scrollLeft() { + // // TODO + // } - exportDataURL() { - // TODO - } + // scrollTop() { + // // TODO + // } + + // exportDataURL() { + // // TODO + // } }