File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
src/components/dragelement Expand file tree Collapse file tree 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) {
7878 element . ontouchstart = onStart ;
7979
8080 function onStart ( e ) {
81+ if ( e . button && e . button === 2 ) { // right click
82+ return ;
83+ }
84+
8185 // make dragging and dragged into properties of gd
8286 // so that others can look at and modify them
8387 gd . _dragged = false ;
Original file line number Diff line number Diff line change @@ -122,6 +122,19 @@ describe('dragElement', function() {
122122 expect ( countCoverSlip ( ) ) . toEqual ( 0 ) ;
123123 } ) ;
124124
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+
125138 it ( 'should fire off click event when down/up without dragging' , function ( ) {
126139 var options = { element : this . element , gd : this . gd } ;
127140 dragElement . init ( options ) ;
You can’t perform that action at this time.
0 commit comments