import type { RuntimeContext } from '../runtime/types'; import type { EdgeDirection, Element, IPointerEvent, State } from '../types'; import type { BaseBehaviorOptions } from './base-behavior'; import { BaseBehavior } from './base-behavior'; /** * 悬浮元素交互配置项 * * Hover element behavior options */ export interface HoverActivateOptions extends BaseBehaviorOptions { /** * 是否启用动画 * * Whether to enable animation * @defaultValue true */ animation?: boolean; /** * 是否启用悬浮元素的功能 * * Whether to enable hover element function * @defaultValue true */ enable?: boolean | ((event: IPointerEvent) => boolean); /** * 激活元素的n度关系 * - 默认为 `0`,表示只激活当前节点 * - `1` 表示激活当前节点及其直接相邻的节点和边,以此类推 * * N-degree relationship of the hovered element * - default to `0`, which means only the current node is activated * - `1` means the current node and its directly adjacent nodes and edges are activated, etc * @defaultValue 0 */ degree?: number | ((event: IPointerEvent) => number); /** * 指定边的方向 * - `'both'`: 表示激活当前节点的所有关系 * - `'in'`: 表示激活当前节点的入边和入节点 * - `'out'`: 表示激活当前节点的出边和出节点 * * Specify the direction of the edge * - `'both'`: Activate all relationships of the current node * - `'in'`: Activate the incoming edges and nodes of the current node * - `'out'`: Activate the outgoing edges and nodes of the current node * @defaultValue 'both' */ direction?: EdgeDirection; /** * 激活元素的状态,默认为 `active` * * Active element state, default to`active` * @defaultValue 'active' */ state?: State; /** * 非激活元素的状态,默认为不改变 * * Inactive element state, default to no change */ inactiveState?: State; /** * 当元素被悬停时的回调 * * Callback when the element is hovered */ onHover?: (event: IPointerEvent) => void; /** * 当悬停结束时的回调 * * Callback when the hover ends */ onHoverEnd?: (event: IPointerEvent) => void; } /** * 悬浮元素交互 * * Hover element behavior * @remarks * 当鼠标悬停在元素上时,可以激活元素的状态,例如高亮节点或边。 * * When the mouse hovers over an element, you can activate the state of the element, such as highlighting nodes or edges. */ export declare class HoverActivate extends BaseBehavior { static defaultOptions: Partial; private isFrozen; constructor(context: RuntimeContext, options: HoverActivateOptions); private toggleFrozen; private bindEvents; private hoverElement; protected getActiveIds(event: IPointerEvent): string[]; private updateElementsState; private getElementsState; private validate; private unbindEvents; destroy(): void; }