Skip to content

Commit

Permalink
fix: add bindSparklineHoverEvent rebind #1894
Browse files Browse the repository at this point in the history
  • Loading branch information
Rui-Sun committed Jun 12, 2024
1 parent e049c3c commit 8c5024b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/vtable/src/event/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ export class EventManager {
//报错已绑定过的事件 后续清除绑定
globalEventListeners: { name: string; env: 'document' | 'body' | 'window'; callback: (e?: any) => void }[] = [];
inertiaScroll: InertiaScroll;

bindSparklineHoverEvent: boolean;
constructor(table: BaseTableAPI) {
this.table = table;
this.handleTextStickBindId = [];
Expand Down Expand Up @@ -102,6 +104,9 @@ export class EventManager {
});
this.handleTextStickBindId = [];
}

// chart hover
bindSparklineHoverEvent(this.table);
}, 0);
}
bindSelfEvent() {
Expand Down
6 changes: 6 additions & 0 deletions packages/vtable/src/event/sparkline-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import type { MousePointerCellEvent } from '../ts-types';
import type { BaseTableAPI } from '../ts-types/base-table';

export function bindSparklineHoverEvent(table: BaseTableAPI) {
if (table.eventManager.bindSparklineHoverEvent) {
return;
}

// 判断是否有sparkline 类型
let hasSparkLine = false;
if (table.isPivotTable()) {
Expand All @@ -23,6 +27,8 @@ export function bindSparklineHoverEvent(table: BaseTableAPI) {
return;
}

table.eventManager.bindSparklineHoverEvent = true;

table.on(TABLE_EVENT_TYPE.MOUSEMOVE_CELL, (e: MousePointerCellEvent) => {
const { col, row, x, y } = e;
const type = table.getBodyColumnType(col, row);
Expand Down

0 comments on commit 8c5024b

Please sign in to comment.