From 3b1211c80c049c8722cade4dda5cdec5a63c2b01 Mon Sep 17 00:00:00 2001
From: lxfu1 <954055752@qq.com>
Date: Thu, 21 Mar 2024 16:12:12 +0800
Subject: [PATCH] fix: resolve conversation
---
packages/g6/src/plugins/tooltip.ts | 18 +++++++++---------
packages/g6/src/types/event.ts | 4 ++--
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/packages/g6/src/plugins/tooltip.ts b/packages/g6/src/plugins/tooltip.ts
index 75ce880781..5f8538b28d 100644
--- a/packages/g6/src/plugins/tooltip.ts
+++ b/packages/g6/src/plugins/tooltip.ts
@@ -1,7 +1,7 @@
import type { TooltipStyleProps } from '@antv/component';
import { Tooltip as TooltipComponent } from '@antv/component';
import type { RuntimeContext } from '../runtime/types';
-import type { ElementDatum, ElementType, IG6ElementEvent } from '../types';
+import type { ElementDatum, ElementType, G6ElementEvent } from '../types';
import type { BasePluginOptions } from './base-plugin';
import { BasePlugin } from './base-plugin';
@@ -11,7 +11,7 @@ export interface TooltipOptions
/** 触发方式 | Event type that triggers display of tooltip */
trigger?: 'hover' | 'click';
/** 自定义内容 | Function for getting tooltip content */
- getContent?: (evt: IG6ElementEvent, items: ElementDatum[]) => HTMLElement | string;
+ getContent?: (evt: G6ElementEvent, items: ElementDatum[]) => HTMLElement | string;
/** 触发类型 | Types of items for which tooltip is allowed to be displayed */
enableElements?: ElementType[];
}
@@ -99,7 +99,7 @@ export class Tooltip extends BasePlugin {
});
}
- public onClick = (e: IG6ElementEvent) => {
+ public onClick = (e: G6ElementEvent) => {
const {
targetType,
target: { id },
@@ -115,7 +115,7 @@ export class Tooltip extends BasePlugin {
}
};
- public onPointerMove = (e: IG6ElementEvent) => {
+ public onPointerMove = (e: G6ElementEvent) => {
const { targetType, target } = e;
if (this.options.enableElements.indexOf(targetType) === -1) return;
if (!this.currentTarget || target.id === this.currentTarget) {
@@ -124,23 +124,23 @@ export class Tooltip extends BasePlugin {
this.showTooltip(e);
};
- public onPointerLeave = (e: IG6ElementEvent) => {
+ public onPointerLeave = (e: G6ElementEvent) => {
this.hideTooltip(e);
this.currentTarget = null;
};
- public onCanvasMove = (e: IG6ElementEvent) => {
+ public onCanvasMove = (e: G6ElementEvent) => {
this.hideTooltip(e);
this.currentTarget = null;
};
- private onPointerEnter = (e: IG6ElementEvent) => {
+ private onPointerEnter = (e: G6ElementEvent) => {
const { targetType } = e;
if (this.options.enableElements.indexOf(targetType) === -1) return;
this.showTooltip(e);
};
- public showTooltip(e: IG6ElementEvent) {
+ public showTooltip(e: G6ElementEvent) {
const {
targetType,
client: { x, y },
@@ -192,7 +192,7 @@ export class Tooltip extends BasePlugin {
});
}
- public hideTooltip(e: IG6ElementEvent) {
+ public hideTooltip(e: G6ElementEvent) {
const {
client: { x, y },
} = e;
diff --git a/packages/g6/src/types/event.ts b/packages/g6/src/types/event.ts
index b5581f8977..6fdf0b4f05 100644
--- a/packages/g6/src/types/event.ts
+++ b/packages/g6/src/types/event.ts
@@ -1,11 +1,11 @@
import type { Document, FederatedMouseEvent } from '@antv/g';
-import { BehaviorEvent } from './behavior';
+import type { BehaviorEvent } from './behavior';
import { Edge, ElementType, Node } from './element';
export type Listener = (event: any) => void;
export type Target = Document | Node | Edge | null;
-export interface IG6ElementEvent extends BehaviorEvent {
+export interface G6ElementEvent extends BehaviorEvent {
targetType: ElementType;
}