We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我有一个自定义覆盖物,通过registerOverlay注册了,其中有onDeselected回调,外部在创建时调用createOverlay也传入了onDeselected方法,传入的会覆盖注册时默认的onDeselected回调,但我希望他们都生效。我使用下面方法尝试在传入时调用默认的:
const overlayClass = kc.getOverlayClass(data.name) as any const ol = { ..., onDeselected: (event: OverlayEvent) => { console.log('onDeselected', overlayClass.onDeselected, event) if(overlayClass.onDeselected){ // 注册时此覆盖物默认的失去焦点回调 overlayClass.onDeselected(event) } // 创建时传入的失去焦点处理逻辑 return true; } } chart.createOverlay(ol);
但我发现实际获得的overlayClass是一个Custom自定义类,没有注册时的onDeselected方法(src\component\Overlay.ts)
static extend (template: OverlayTemplate): OverlayInnerConstructor { class Custom extends OverlayImp { constructor () { super(template) } } return Custom }
是否可以考虑给Custom添加注册时的回调来允许外部调用默认回调方法?
Custom
static extend (template: OverlayTemplate): OverlayInnerConstructor { class Custom extends OverlayImp { constructor () { super(template) } } // 将模板的回调方法添加到原型上 Object.keys(template).forEach(key => { if (typeof template[key] === 'function') { Custom.prototype[key] = template[key] } }) return Custom }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
需求描述
我有一个自定义覆盖物,通过registerOverlay注册了,其中有onDeselected回调,外部在创建时调用createOverlay也传入了onDeselected方法,传入的会覆盖注册时默认的onDeselected回调,但我希望他们都生效。我使用下面方法尝试在传入时调用默认的:
但我发现实际获得的overlayClass是一个Custom自定义类,没有注册时的onDeselected方法(src\component\Overlay.ts)
具体实现
是否可以考虑给
Custom
添加注册时的回调来允许外部调用默认回调方法?The text was updated successfully, but these errors were encountered: