Skip to content

Commit 7917640

Browse files
Alex Vinoberalexcjohnson
Alex Vinober
authored andcommitted
Refactored
1 parent 426ffa5 commit 7917640

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/components/dragelement/index.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,6 @@ dragElement.init = function init(options) {
7878
element.ontouchstart = onStart;
7979

8080
function onStart(e) {
81-
if(e.buttons && e.buttons === 2) { // right click
82-
return;
83-
}
84-
8581
// make dragging and dragged into properties of gd
8682
// so that others can look at and modify them
8783
gd._dragged = false;
@@ -90,6 +86,7 @@ dragElement.init = function init(options) {
9086
startX = offset[0];
9187
startY = offset[1];
9288
initialTarget = e.target;
89+
var rightClick = e.buttons && e.buttons === 2;
9390

9491
newMouseDownTime = (new Date()).getTime();
9592
if(newMouseDownTime - gd._mouseDownTime < DBLCLICKDELAY) {
@@ -104,11 +101,11 @@ dragElement.init = function init(options) {
104101

105102
if(options.prepFn) options.prepFn(e, startX, startY);
106103

107-
if(hasHover && (!e.buttons || (e.buttons && e.buttons !== 2))) {
104+
if(hasHover && !rightClick) {
108105
dragCover = coverSlip();
109106
dragCover.style.cursor = window.getComputedStyle(element).cursor;
110107
}
111-
else {
108+
else if(!hasHover) {
112109
// document acts as a dragcover for mobile, bc we can't create dragcover dynamically
113110
dragCover = document;
114111
cursor = window.getComputedStyle(document.documentElement).cursor;

0 commit comments

Comments
 (0)