Skip to content

Commit

Permalink
fix(Table): fix table resize drag prevent right click (#2961)
Browse files Browse the repository at this point in the history
* fix(table): fix table resize drag prevent right click

* chore(table): magic number set as variable
  • Loading branch information
HaixingOoO authored Jun 23, 2024
1 parent 642d4f1 commit 2242dde
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/table/hooks/useColumnResize.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const DEFAULT_MIN_WIDTH = 80;
const DEFAULT_MAX_WIDTH = 600;
// 当离右边框的距离不超过 8 时,显示拖拽图标
const distance = 8;
// 鼠标右键 event.button = 2
const CONTEXTMENU = 2;

let originalSelectStart: (this: GlobalEventHandlers, ev: Event) => any;
let originalDragStart: (this: GlobalEventHandlers, ev: Event) => any;
Expand Down Expand Up @@ -208,7 +210,7 @@ export default function useColumnResize(params: {
col: BaseTableCol<TableRowData>,
index: number,
) => {
if (!resizeLineParams.draggingCol) return;
if (e.button === CONTEXTMENU || !resizeLineParams.draggingCol) return;
const target = resizeLineParams.draggingCol;
const targetBoundRect = target.getBoundingClientRect();
const tableBoundRect = tableContentRef.current?.getBoundingClientRect();
Expand Down

0 comments on commit 2242dde

Please sign in to comment.