Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let tooltip: any;
if (options.useHtml) {
tooltip = new Tooltip.Html(options);
const triggerEvent = this._getTriggerEvent();
if (!tooltip.get('enterable') && triggerEvent === 'panel:mousemove') {
const tooltipContainer = tooltip.get('container');
if (tooltipContainer) {
tooltipContainer.onmousemove = (e) => {
// 避免 tooltip 频繁闪烁
const eventObj = this._normalizeEvent(e);
view.emit(triggerEvent, eventObj);
};
}
}
} else {
tooltip = new Tooltip.Canvas(options);
}
this.tooltip = tooltip;
// 需要保存当前 tooltip 的配置项,否则当用户关闭 tooltip 再手动调用 view.showTooltip() 时会报错
this.options = options;
this._bindEvent();
}