Skip to content

Commit 8de500f

Browse files
committed
lint (td -> gd, some infix spacing)
1 parent 0071c24 commit 8de500f

File tree

3 files changed

+26
-21
lines changed

3 files changed

+26
-21
lines changed

src/plots/cartesian/axes.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,16 +202,18 @@ axes.saveRangeInitial = function(gd, overwrite) {
202202
var axList = axes.list(gd, '', true),
203203
hasOneAxisChanged = false;
204204

205-
var ax, isNew, hasChanged;
206-
207205
for(var i = 0; i < axList.length; i++) {
208-
ax = axList[i];
206+
var ax = axList[i];
209207

210-
isNew = ax._rangeInitial===undefined;
211-
hasChanged = isNew ||
212-
!(ax.range[0]===ax._rangeInitial[0] && ax.range[1]===ax._rangeInitial[1]);
208+
var isNew = (ax._rangeInitial === undefined);
209+
var hasChanged = (
210+
isNew || !(
211+
ax.range[0] === ax._rangeInitial[0] &&
212+
ax.range[1] === ax._rangeInitial[1]
213+
)
214+
);
213215

214-
if((isNew && ax.autorange===false) || (overwrite && hasChanged)) {
216+
if((isNew && ax.autorange === false) || (overwrite && hasChanged)) {
215217
ax._rangeInitial = ax.range.slice();
216218
hasOneAxisChanged = true;
217219
}

src/plots/cartesian/axis_ids.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var Lib = require('../../lib');
1414
var constants = require('./constants');
1515

1616

17-
// convert between axis names (xaxis, xaxis2, etc, elements of td.layout)
17+
// convert between axis names (xaxis, xaxis2, etc, elements of gd.layout)
1818
// and axis id's (x, x2, etc). Would probably have ditched 'xaxis'
1919
// completely in favor of just 'x' if it weren't ingrained in the API etc.
2020
exports.id2name = function id2name(id) {
@@ -43,8 +43,8 @@ exports.cleanId = function cleanId(id, axLetter) {
4343
// get all axis object names
4444
// optionally restricted to only x or y or z by string axLetter
4545
// and optionally 2D axes only, not those inside 3D scenes
46-
function listNames(td, axLetter, only2d) {
47-
var fullLayout = td._fullLayout;
46+
function listNames(gd, axLetter, only2d) {
47+
var fullLayout = gd._fullLayout;
4848
if(!fullLayout) return [];
4949

5050
function filterAxis(obj, extra) {
@@ -76,23 +76,23 @@ function listNames(td, axLetter, only2d) {
7676
}
7777

7878
// get all axis objects, as restricted in listNames
79-
exports.list = function(td, axletter, only2d) {
80-
return listNames(td, axletter, only2d)
79+
exports.list = function(gd, axletter, only2d) {
80+
return listNames(gd, axletter, only2d)
8181
.map(function(axName) {
82-
return Lib.nestedProperty(td._fullLayout, axName).get();
82+
return Lib.nestedProperty(gd._fullLayout, axName).get();
8383
});
8484
};
8585

8686
// get all axis ids, optionally restricted by letter
8787
// this only makes sense for 2d axes
88-
exports.listIds = function(td, axletter) {
89-
return listNames(td, axletter, true).map(exports.name2id);
88+
exports.listIds = function(gd, axletter) {
89+
return listNames(gd, axletter, true).map(exports.name2id);
9090
};
9191

9292
// get an axis object from its id 'x','x2' etc
9393
// optionally, id can be a subplot (ie 'x2y3') and type gets x or y from it
94-
exports.getFromId = function(td, id, type) {
95-
var fullLayout = td._fullLayout;
94+
exports.getFromId = function(gd, id, type) {
95+
var fullLayout = gd._fullLayout;
9696

9797
if(type === 'x') id = id.replace(/y[0-9]*/,'');
9898
else if(type === 'y') id = id.replace(/x[0-9]*/,'');
@@ -101,8 +101,8 @@ exports.getFromId = function(td, id, type) {
101101
};
102102

103103
// get an axis object of specified type from the containing trace
104-
exports.getFromTrace = function(td, fullTrace, type) {
105-
var fullLayout = td._fullLayout;
104+
exports.getFromTrace = function(gd, fullTrace, type) {
105+
var fullLayout = gd._fullLayout;
106106
var ax = null;
107107

108108
if(Plots.traceIs(fullTrace, 'gl3d')) {
@@ -112,7 +112,7 @@ exports.getFromTrace = function(td, fullTrace, type) {
112112
}
113113
}
114114
else {
115-
ax = exports.getFromId(td, fullTrace[type + 'axis'] || type);
115+
ax = exports.getFromId(gd, fullTrace[type + 'axis'] || type);
116116
}
117117

118118
return ax;

src/plots/cartesian/graph_interact.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1819,9 +1819,12 @@ function dragBox(gd, plotinfo, x, y, w, h, ns, ew) {
18191819
else if(doubleClickConfig === 'reset+autosize') {
18201820
for(i = 0; i < axList.length; i++) {
18211821
ax = axList[i];
1822+
18221823
if(ax.fixedrange) continue;
18231824
if(ax._rangeInitial === undefined ||
1824-
ax.range[0]===ax._rangeInitial[0] && ax.range[1]===ax._rangeInitial[1]) {
1825+
ax.range[0] === ax._rangeInitial[0] &&
1826+
ax.range[1] === ax._rangeInitial[1]
1827+
) {
18251828
attrs[ax._name + '.autorange'] = true;
18261829
}
18271830
else attrs[ax._name + '.range'] = ax._rangeInitial.slice();

0 commit comments

Comments
 (0)