File tree 2 files changed +17
-0
lines changed
src/components/dragelement
2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,10 @@ dragElement.init = function init(options) {
78
78
element . ontouchstart = onStart ;
79
79
80
80
function onStart ( e ) {
81
+ if ( e . button && e . button === 2 ) { // right click
82
+ return ;
83
+ }
84
+
81
85
// make dragging and dragged into properties of gd
82
86
// so that others can look at and modify them
83
87
gd . _dragged = false ;
Original file line number Diff line number Diff line change @@ -122,6 +122,19 @@ describe('dragElement', function() {
122
122
expect ( countCoverSlip ( ) ) . toEqual ( 0 ) ;
123
123
} ) ;
124
124
125
+ it ( 'should not add a cover slip div to the DOM when right click' , function ( ) {
126
+ function countCoverSlip ( ) {
127
+ return d3 . selectAll ( '.dragcover' ) . size ( ) ;
128
+ }
129
+
130
+ var options = { element : this . element , gd : this . gd } ;
131
+ dragElement . init ( options ) ;
132
+
133
+ options . element . onmousedown ( { button : 2 } )
134
+
135
+ expect ( countCoverSlip ( ) ) . toEqual ( 0 ) ;
136
+ } ) ;
137
+
125
138
it ( 'should fire off click event when down/up without dragging' , function ( ) {
126
139
var options = { element : this . element , gd : this . gd } ;
127
140
dragElement . init ( options ) ;
You can’t perform that action at this time.
0 commit comments