Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"root": true,
"extends": [
"eslint:recommended",
"eslint:recommended"
],
"env": {
"commonjs": true
Expand All @@ -16,7 +16,7 @@
"brace-style": [0, "stroustrup", {"allowSingleLine": true}],
"curly": [0, "multi"],
"camelcase": [0, {"properties": "never"}],
"comma-spacing": [0, {"before": false, "after": true}],
"comma-spacing": [2, {"before": false, "after": true}],
"comma-style": [2, "last"],
"semi": [2],
"semi-spacing": [2, {"before": false, "after": true}],
Expand All @@ -36,7 +36,7 @@
"no-whitespace-before-property": [2],
"no-unexpected-multiline": [2],
"no-floating-decimal": [2],
"space-infix-ops": [0, {"int32Hint": false}],
"space-infix-ops": [2, {"int32Hint": true}],
"quotes": [2, "single"],
"dot-notation": [2],
"operator-linebreak": [2, "after"],
Expand All @@ -50,5 +50,5 @@
"no-loop-func": [2],
"no-console": [0],
"no-unused-labels": [2]
},
}
}
148 changes: 74 additions & 74 deletions src/components/annotations/index.js

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions src/components/color/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@ color.addOpacity = function(cstr, op) {
// color.background is assumed behind it
color.combine = function(front, back) {
var fc = tinycolor(front).toRgb();
if(fc.a===1) return tinycolor(front).toRgbString();
if(fc.a === 1) return tinycolor(front).toRgbString();

var bc = tinycolor(back||color.background).toRgb(),
bcflat = bc.a===1 ? bc : {
r: 255 * (1-bc.a) + bc.r*bc.a,
g: 255 * (1-bc.a) + bc.g*bc.a,
b: 255 * (1-bc.a) + bc.b*bc.a
var bc = tinycolor(back || color.background).toRgb(),
bcflat = bc.a === 1 ? bc : {
r: 255 * (1 - bc.a) + bc.r * bc.a,
g: 255 * (1 - bc.a) + bc.g * bc.a,
b: 255 * (1 - bc.a) + bc.b * bc.a
},
fcflat = {
r: bcflat.r*(1-fc.a) + fc.r*fc.a,
g: bcflat.g*(1-fc.a) + fc.g*fc.a,
b: bcflat.b*(1-fc.a) + fc.b*fc.a
r: bcflat.r * (1 - fc.a) + fc.r * fc.a,
g: bcflat.g * (1 - fc.a) + fc.g * fc.a,
b: bcflat.b * (1 - fc.a) + fc.b * fc.a
};
return tinycolor(fcflat).toRgbString();
};
Expand Down Expand Up @@ -110,7 +110,7 @@ function cleanOne(val) {
if(isNumeric(val) || typeof val !== 'string') return val;

var valTrim = val.trim();
if(valTrim.substr(0,3) !== 'rgb') return val;
if(valTrim.substr(0, 3) !== 'rgb') return val;

var match = valTrim.match(/^rgba?\s*\(([^()]*)\)$/);
if(!match) return val;
Expand Down
182 changes: 91 additions & 91 deletions src/components/colorbar/draw.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/components/colorscale/calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ module.exports = function calc(trace, vals, containerStr, cLetter) {
max = container[cLetter + 'max'],
scl = container.colorscale;

if(auto!==false || min===undefined) {
if(auto !== false || min === undefined) {
min = Lib.aggNums(Math.min, null, vals);
}

if(auto!==false || max===undefined) {
if(auto !== false || max === undefined) {
max = Lib.aggNums(Math.max, null, vals);
}

Expand Down
4 changes: 2 additions & 2 deletions src/components/colorscale/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var flipScale = require('./flip_scale');
module.exports = function colorScaleDefaults(traceIn, traceOut, layout, coerce, opts) {
var prefix = opts.prefix,
cLetter = opts.cLetter,
containerStr = prefix.slice(0, prefix.length-1),
containerStr = prefix.slice(0, prefix.length - 1),
containerIn = prefix ?
Lib.nestedProperty(traceIn, containerStr).get() || {} :
traceIn,
Expand All @@ -41,7 +41,7 @@ module.exports = function colorScaleDefaults(traceIn, traceOut, layout, coerce,
// handles both the trace case (autocolorscale is false by default) and
// the marker and marker.line case (autocolorscale is true by default)
var autoColorscaleDftl;
if(sclIn!==undefined) autoColorscaleDftl = !isValidScale(sclIn);
if(sclIn !== undefined) autoColorscaleDftl = !isValidScale(sclIn);
coerce(prefix + 'autocolorscale', autoColorscaleDftl);
var sclOut = coerce(prefix + 'colorscale');

Expand Down
2 changes: 1 addition & 1 deletion src/components/colorscale/flip_scale.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = function flipScale(scl) {
sclNew = new Array(N),
si;

for(var i = N-1, j = 0; i >= 0; i--, j++) {
for(var i = N - 1, j = 0; i >= 0; i--, j++) {
si = scl[i];
sclNew[j] = [1 - si[0], si[1]];
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/colorscale/has_colorscale.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ module.exports = function hasColorscale(trace, containerStr) {
}

return (
(typeof container==='object' && container!==null) && (
(typeof container === 'object' && container !== null) && (
isArrayWithOneNumber ||
container.showscale===true ||
container.showscale === true ||
(isNumeric(container.cmin) && isNumeric(container.cmax)) ||
isValidScale(container.colorscale) ||
(typeof container.colorbar==='object' && container.colorbar!==null)
(typeof container.colorbar === 'object' && container.colorbar !== null)
)
);
};
4 changes: 2 additions & 2 deletions src/components/colorscale/is_valid_scale_array.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ module.exports = function isValidScaleArray(scl) {

if(!Array.isArray(scl)) return false;
else {
if(+scl[0][0]!==0 || +scl[scl.length-1][0]!==1) return false;
if(+scl[0][0] !== 0 || +scl[scl.length - 1][0] !== 1) return false;
for(var i = 0; i < scl.length; i++) {
si = scl[i];
if(si.length!==2 || +si[0]<highestVal || !tinycolor(si[1]).isValid()) {
if(si.length !== 2 || +si[0] < highestVal || !tinycolor(si[1]).isValid()) {
isValid = false;
break;
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/dragelement/align.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = function align(v, dv, v0, v1, anchor) {
if(anchor === 'right' || anchor === 'top') return vmax;

// automatic based on position
if(vmin < (2/3) - vc) return vmin;
if(vmax > (4/3) - vc) return vmax;
if(vmin < (2 / 3) - vc) return vmin;
if(vmax > (4 / 3) - vc) return vmax;
return vc;
};
6 changes: 3 additions & 3 deletions src/components/dragelement/cursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ var cursorset = [
];

module.exports = function getCursor(x, y, xanchor, yanchor) {
if(xanchor === 'left') x=0;
else if(xanchor === 'center') x=1;
else if(xanchor === 'right') x=2;
if(xanchor === 'left') x = 0;
else if(xanchor === 'center') x = 1;
else if(xanchor === 'right') x = 2;
else x = Lib.constrain(Math.floor(x * 3), 0, 2);

if(yanchor === 'bottom') y = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/components/dragelement/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ dragElement.init = function init(options) {

if(Math.abs(dx) < minDrag) dx = 0;
if(Math.abs(dy) < minDrag) dy = 0;
if(dx||dy) {
if(dx || dy) {
gd._dragged = true;
dragElement.unhover(gd);
}
Expand Down
Loading