How to use the @antv/component.Tooltip.Canvas function in @antv/component

To help you get started, we’ve selected a few @antv/component examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github antvis / G2 / packages / g2 / src / plot / controller / tooltip.ts View on Github external
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();
  }