Skip to content

Commit e0c29f1

Browse files
committed
lint (mostly infix spacing)
1 parent b37439e commit e0c29f1

File tree

4 files changed

+35
-25
lines changed

4 files changed

+35
-25
lines changed

src/components/dragelement/cursor.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,22 @@ var Lib = require('../../lib');
1515
// set cursors pointing toward the closest corner/side,
1616
// to indicate alignment
1717
// x and y are 0-1, fractions of the plot area
18-
var cursorset = [['sw-resize','s-resize','se-resize'],
19-
['w-resize','move','e-resize'],
20-
['nw-resize','n-resize','ne-resize']];
21-
module.exports = function getCursor(x,y,xanchor,yanchor) {
22-
if(xanchor==='left') x=0;
23-
else if(xanchor==='center') x=1;
24-
else if(xanchor==='right') x=2;
25-
else x = Lib.constrain(Math.floor(x*3),0,2);
26-
27-
if(yanchor==='bottom') y=0;
28-
else if(yanchor==='middle') y=1;
29-
else if(yanchor==='top') y=2;
30-
else y = Lib.constrain(Math.floor(y*3),0,2);
18+
var cursorset = [
19+
['sw-resize', 's-resize', 'se-resize'],
20+
['w-resize', 'move', 'e-resize'],
21+
['nw-resize', 'n-resize', 'ne-resize']
22+
];
23+
24+
module.exports = function getCursor(x, y, xanchor, yanchor) {
25+
if(xanchor === 'left') x=0;
26+
else if(xanchor === 'center') x=1;
27+
else if(xanchor === 'right') x=2;
28+
else x = Lib.constrain(Math.floor(x * 3), 0, 2);
29+
30+
if(yanchor === 'bottom') y = 0;
31+
else if(yanchor === 'middle') y = 1;
32+
else if(yanchor === 'top') y = 2;
33+
else y = Lib.constrain(Math.floor(y * 3), 0, 2);
3134

3235
return cursorset[y][x];
3336
};

src/components/dragelement/index.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ var Lib = require('../../lib');
1515
var constants = require('../../plots/cartesian/constants');
1616

1717

18+
var dragElement = module.exports = {};
19+
20+
dragElement.align = require('./align');
21+
dragElement.getCursor = require('./cursor');
22+
23+
var unhover = require('./unhover');
24+
dragElement.unhover = unhover.wrapped;
25+
dragElement.unhoverRaw = unhover.raw;
26+
1827
/**
1928
* Abstracts click & drag interactions
2029
* @param {object} options with keys:
@@ -35,15 +44,6 @@ var constants = require('../../plots/cartesian/constants');
3544
* numClicks is how many clicks we've registered within
3645
* a doubleclick time
3746
*/
38-
var dragElement = module.exports = {};
39-
40-
dragElement.align = require('./align');
41-
dragElement.getCursor = require('./cursor');
42-
43-
var unhover = require('./unhover');
44-
dragElement.unhover = unhover.wrapped;
45-
dragElement.unhoverRaw = unhover.raw;
46-
4747
dragElement.init = function init(options) {
4848
var gd = Lib.getPlotDiv(options.element) || {},
4949
numClicks = 1,

src/components/dragelement/unhover.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,32 @@ var unhover = module.exports = {};
1818

1919
unhover.wrapped = function(gd, evt, subplot) {
2020
if(typeof gd === 'string') gd = document.getElementById(gd);
21+
2122
// Important, clear any queued hovers
2223
if(gd._hoverTimer) {
2324
clearTimeout(gd._hoverTimer);
2425
gd._hoverTimer = undefined;
2526
}
26-
unhover.raw(gd,evt,subplot);
27+
28+
unhover.raw(gd, evt, subplot);
2729
};
2830

2931

3032
// remove hover effects on mouse out, and emit unhover event
3133
unhover.raw = function unhoverRaw(gd, evt) {
3234
var fullLayout = gd._fullLayout;
35+
3336
if(!evt) evt = {};
3437
if(evt.target &&
3538
Events.triggerHandler(gd, 'plotly_beforehover', evt) === false) {
3639
return;
3740
}
41+
3842
fullLayout._hoverlayer.selectAll('g').remove();
43+
3944
if(evt.target && gd._hoverdata) {
4045
gd.emit('plotly_unhover', {points: gd._hoverdata});
4146
}
47+
4248
gd._hoverdata = undefined;
4349
};

src/lib/setcursor.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
// omit cursor to revert to the default.
1515
module.exports = function setCursor(el3, csr) {
1616
(el3.attr('class') || '').split(' ').forEach(function(cls) {
17-
if(cls.indexOf('cursor-')===0) el3.classed(cls,false);
17+
if(cls.indexOf('cursor-') === 0) el3.classed(cls, false);
1818
});
19-
if(csr) el3.classed('cursor-'+csr, true);
19+
20+
if(csr) el3.classed('cursor-' + csr, true);
2021
};

0 commit comments

Comments
 (0)