Skip to content

Commit 51b74b5

Browse files
committed
lint for mojtaba
1 parent 8fea156 commit 51b74b5

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

src/components/dragelement/index.js

+7-15
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
109
'use strict';
1110

1211
var mouseOffset = require('mouse-event-offset');
1312
var hasHover = require('has-hover');
1413
var supportsPassive = require('has-passive-events');
1514

16-
var Lib = require('../../lib');
17-
15+
var removeElement = require('../../lib').removeElement;
1816
var constants = require('../../plots/cartesian/constants');
1917
var interactConstants = require('../../constants/interactions');
2018

@@ -27,7 +25,6 @@ var unhover = require('./unhover');
2725
dragElement.unhover = unhover.wrapped;
2826
dragElement.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

src/plots/ternary/ternary.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ proto.initInteractions = function() {
493493
var _this = this;
494494
var dragger = _this.layers.plotbg.select('path').node();
495495
var gd = _this.graphDiv;
496-
var zoomContainer = gd._fullLayout._zoomlayer;
496+
var zoomLayer = gd._fullLayout._zoomlayer;
497497

498498
// use plotbg for the main interactions
499499
var dragOptions = {
@@ -578,7 +578,7 @@ proto.initInteractions = function() {
578578
path0 = 'M0,' + _this.h + 'L' + (_this.w / 2) + ', 0L' + _this.w + ',' + _this.h + 'Z';
579579
dimmed = false;
580580

581-
zb = zoomContainer.append('path')
581+
zb = zoomLayer.append('path')
582582
.attr('class', 'zoombox')
583583
.attr('transform', 'translate(' + _this.x0 + ', ' + _this.y0 + ')')
584584
.style({
@@ -587,7 +587,7 @@ proto.initInteractions = function() {
587587
})
588588
.attr('d', path0);
589589

590-
corners = zoomContainer.append('path')
590+
corners = zoomLayer.append('path')
591591
.attr('class', 'zoombox-corners')
592592
.attr('transform', 'translate(' + _this.x0 + ', ' + _this.y0 + ')')
593593
.style({

0 commit comments

Comments
 (0)