Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Table): fix table resize drag prevent right click #2961

Merged
merged 2 commits into from
Jun 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading