Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

fix resizer only work with left mouse click #10546

Merged
merged 4 commits into from
Apr 11, 2023
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: 4 additions & 0 deletions src/resizer/resizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ export default class Resizer<C extends IConfig = IConfig> {
}

private onMouseDown = (event: MouseEvent): void => {
const LEFT_MOUSE_BUTTON = 0;
if (event.button !== LEFT_MOUSE_BUTTON) {
Comment on lines +117 to +118
Copy link
Contributor

@jaller94 jaller94 May 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional bonus points: Rename to PRIMARY_MOUSE_BUTTON for the left-handed layout, touchpads and other input devices.

return;
}
// use closest in case the resize handle contains
// child dom nodes that can be the target
const resizeHandle = event.target && (<HTMLDivElement>event.target).closest(`.${this.classNames.handle}`);
Expand Down