66* LICENSE file in the root directory of this source tree.
77*/
88
9-
109'use strict' ;
1110
1211var mouseOffset = require ( 'mouse-event-offset' ) ;
1312var hasHover = require ( 'has-hover' ) ;
1413var supportsPassive = require ( 'has-passive-events' ) ;
1514
16- var Lib = require ( '../../lib' ) ;
17-
15+ var removeElement = require ( '../../lib' ) . removeElement ;
1816var constants = require ( '../../plots/cartesian/constants' ) ;
1917var interactConstants = require ( '../../constants/interactions' ) ;
2018
@@ -27,7 +25,6 @@ var unhover = require('./unhover');
2725dragElement . unhover = unhover . wrapped ;
2826dragElement . unhoverRaw = unhover . raw ;
2927
30-
3128/**
3229 * Abstracts click & drag interactions
3330 *
@@ -105,8 +102,7 @@ dragElement.init = function init(options) {
105102
106103 if ( ! supportsPassive ) {
107104 element . ontouchstart = onStart ;
108- }
109- else {
105+ } else {
110106 if ( element . _ontouchstart ) {
111107 element . removeEventListener ( 'touchstart' , element . _ontouchstart ) ;
112108 }
@@ -144,8 +140,7 @@ dragElement.init = function init(options) {
144140 if ( newMouseDownTime - gd . _mouseDownTime < DBLCLICKDELAY ) {
145141 // in a click train
146142 numClicks += 1 ;
147- }
148- else {
143+ } else {
149144 // new click train
150145 numClicks = 1 ;
151146 gd . _mouseDownTime = newMouseDownTime ;
@@ -156,8 +151,7 @@ dragElement.init = function init(options) {
156151 if ( hasHover && ! rightClick ) {
157152 dragCover = coverSlip ( ) ;
158153 dragCover . style . cursor = window . getComputedStyle ( element ) . cursor ;
159- }
160- else if ( ! hasHover ) {
154+ } else if ( ! hasHover ) {
161155 // document acts as a dragcover for mobile, bc we can't create dragcover dynamically
162156 dragCover = document ;
163157 cursor = window . getComputedStyle ( document . documentElement ) . cursor ;
@@ -215,9 +209,8 @@ dragElement.init = function init(options) {
215209 document . removeEventListener ( 'touchend' , onDone ) ;
216210
217211 if ( hasHover ) {
218- Lib . removeElement ( dragCover ) ;
219- }
220- else if ( cursor ) {
212+ removeElement ( dragCover ) ;
213+ } else if ( cursor ) {
221214 dragCover . documentElement . style . cursor = cursor ;
222215 cursor = null ;
223216 }
@@ -236,8 +229,7 @@ dragElement.init = function init(options) {
236229
237230 if ( gd . _dragged ) {
238231 if ( options . doneFn ) options . doneFn ( ) ;
239- }
240- else {
232+ } else {
241233 if ( options . clickFn ) options . clickFn ( numClicks , initialEvent ) ;
242234
243235 // If we haven't dragged, this should be a click. But because of the
0 commit comments