Skip to content

Commit dd1f988

Browse files
author
Dang Hai An
committed
fix: support disable right click in Opera, IE
1 parent 56d49d4 commit dd1f988

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/MouseBackend.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ function getNodeClientOffset (node) {
2020
return { x: left, y: top }
2121
}
2222

23+
function isRightClick (e) {
24+
if ('which' in e) {
25+
return e.which === 3
26+
} else if ('button' in e) {
27+
return e.button === 2
28+
}
29+
return false
30+
}
31+
2332
export default class MouseBackend {
2433
constructor(manager) {
2534
this.actions = manager.getActions()
@@ -138,7 +147,7 @@ export default class MouseBackend {
138147

139148
handleMoveStart (sourceId, e) {
140149
// Ignore right mouse button.
141-
if (e.which === 3) return
150+
if (isRightClick(e)) return
142151
this.moveStartSourceIds.unshift(sourceId)
143152
}
144153

0 commit comments

Comments
 (0)