Skip to content

Commit aa2ec8b

Browse files
committed
sub has??? -> has('???')
1 parent a78521c commit aa2ec8b

File tree

9 files changed

+24
-24
lines changed

9 files changed

+24
-24
lines changed

src/components/modebar/buttons.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ function handleCartesian(gd, ev) {
256256

257257
Plotly.relayout(gd, aobj).then(function() {
258258
if(astr === 'dragmode') {
259-
if(fullLayout._hasCartesian) {
259+
if(fullLayout._has('cartesian')) {
260260
setCursor(
261261
fullLayout._paper.select('.nsewdrag'),
262262
DRAGCURSORS[val]
@@ -500,7 +500,7 @@ function toggleHover(gd) {
500500
var fullLayout = gd._fullLayout;
501501

502502
var onHoverVal;
503-
if(fullLayout._hasCartesian) {
503+
if(fullLayout._has('cartesian')) {
504504
onHoverVal = fullLayout._isHoriz ? 'y' : 'x';
505505
}
506506
else onHoverVal = 'closest';

src/components/modebar/manage.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ function getButtonGroups(gd, buttonsToRemove, buttonsToAdd) {
7373
var fullLayout = gd._fullLayout,
7474
fullData = gd._fullData;
7575

76-
var hasCartesian = !!fullLayout._hasCartesian,
77-
hasGL3D = !!fullLayout._hasGL3D,
78-
hasGeo = !!fullLayout._hasGeo,
79-
hasPie = !!fullLayout._hasPie,
80-
hasGL2D = !!fullLayout._hasGL2D,
81-
hasTernary = !!fullLayout._hasTernary;
76+
var hasCartesian = !!fullLayout._has('cartesian'),
77+
hasGL3D = !!fullLayout._has('gl3d'),
78+
hasGeo = !!fullLayout._has('geo'),
79+
hasPie = !!fullLayout._has('pie'),
80+
hasGL2D = !!fullLayout._has('gl2d'),
81+
hasTernary = !!fullLayout._has('ternary');
8282

8383
var groups = [];
8484

src/components/rangeslider/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function draw(gd) {
4141
var height = (fullLayout.height - fullLayout.margin.b - fullLayout.margin.t) * options.thickness,
4242
offsetShift = Math.floor(options.borderwidth / 2);
4343

44-
if(sliderContainer[0].length === 0 && !fullLayout._hasGL2D) createSlider(gd);
44+
if(sliderContainer[0].length === 0 && !fullLayout._has('gl2d')) createSlider(gd);
4545

4646
// Need to default to 0 for when making gl plots
4747
var bb = fullLayout.xaxis._boundingBox ?

src/plot_api/plot_api.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2298,7 +2298,7 @@ Plotly.relayout = function relayout(gd, astr, val) {
22982298
if(p.parts[0].indexOf('scene') === 0) doplot = true;
22992299
else if(p.parts[0].indexOf('geo') === 0) doplot = true;
23002300
else if(p.parts[0].indexOf('ternary') === 0) doplot = true;
2301-
else if(fullLayout._hasGL2D &&
2301+
else if(fullLayout._has('gl2d') &&
23022302
(ai.indexOf('axis') !== -1 || p.parts[0] === 'plot_bgcolor')
23032303
) doplot = true;
23042304
else if(ai === 'hiddenlabels') docalc = true;
@@ -2643,7 +2643,7 @@ function makePlotFramework(gd) {
26432643
makeSubplots(gd, subplots);
26442644
}
26452645

2646-
if(fullLayout._hasCartesian) makeCartesianPlotFramwork(gd, subplots);
2646+
if(fullLayout._has('cartesian')) makeCartesianPlotFramwork(gd, subplots);
26472647

26482648
// single ternary layer for the whole plot
26492649
fullLayout._ternarylayer = fullLayout._paper.append('g').classed('ternarylayer', true);

src/plots/cartesian/axes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ axes.getFromTrace = axisIds.getFromTrace;
3939
// find the list of possible axes to reference with an xref or yref attribute
4040
// and coerce it to that list
4141
axes.coerceRef = function(containerIn, containerOut, gd, axLetter) {
42-
var axlist = gd._fullLayout._hasGL2D ? [] : axes.listIds(gd, axLetter),
42+
var axlist = gd._fullLayout._has('gl2d') ? [] : axes.listIds(gd, axLetter),
4343
refAttr = axLetter + 'ref',
4444
attrDef = {};
4545

@@ -1797,7 +1797,7 @@ axes.doTicks = function(gd, axid, skipTitle) {
17971797
var alldone = axes.getSubplots(gd, ax).map(function(subplot) {
17981798
var plotinfo = fullLayout._plots[subplot];
17991799

1800-
if(!fullLayout._hasCartesian) return;
1800+
if(!fullLayout._has('cartesian')) return;
18011801

18021802
var container = plotinfo[axletter + 'axislayer'],
18031803

src/plots/cartesian/graph_interact.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ fx.supplyLayoutDefaults = function(layoutIn, layoutOut, fullData) {
6060
coerce('dragmode');
6161

6262
var hovermodeDflt;
63-
if(layoutOut._hasCartesian) {
63+
if(layoutOut._has('cartesian')) {
6464
// flag for 'horizontal' plots:
6565
// determines the state of the mode bar 'compare' hovermode button
6666
var isHoriz = layoutOut._isHoriz = fx.isHoriz(fullData);
@@ -89,7 +89,7 @@ fx.isHoriz = function(fullData) {
8989
fx.init = function(gd) {
9090
var fullLayout = gd._fullLayout;
9191

92-
if(!fullLayout._hasCartesian || gd._context.staticPlot) return;
92+
if(!fullLayout._has('cartesian') || gd._context.staticPlot) return;
9393

9494
var subplots = Object.keys(fullLayout._plots || {}).sort(function(a,b) {
9595
// sort overlays last, then by x axis number, then y axis number
@@ -107,7 +107,7 @@ fx.init = function(gd) {
107107
subplots.forEach(function(subplot) {
108108
var plotinfo = fullLayout._plots[subplot];
109109

110-
if(!fullLayout._hasCartesian) return;
110+
if(!fullLayout._has('cartesian')) return;
111111

112112
var xa = plotinfo.x(),
113113
ya = plotinfo.y(),

src/plots/cartesian/layout_defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
7171
// if gl3d or geo is present on graph. This is retain backward compatible.
7272
//
7373
// TODO drop this in version 2.0
74-
var ignoreOrphan = (layoutOut._hasGL3D || layoutOut._hasGeo);
74+
var ignoreOrphan = (layoutOut._has('gl3d') || layoutOut._has('geo'));
7575

7676
if(!ignoreOrphan) {
7777
for(i = 0; i < layoutKeys.length; i++) {

src/plots/gl3d/layout/defaults.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ var supplyGl3dAxisLayoutDefaults = require('./axis_defaults');
1818

1919
module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
2020
var hasNon3D = (
21-
layoutOut._hasCartesian ||
22-
layoutOut._hasGeo ||
23-
layoutOut._hasGL2D ||
24-
layoutOut._hasPie ||
25-
layoutOut._hasTernary
21+
layoutOut._has('cartesian') ||
22+
layoutOut._has('geo') ||
23+
layoutOut._has('gl2d') ||
24+
layoutOut._has('pie') ||
25+
layoutOut._has('ternary')
2626
);
2727

2828
// some layout-wide attribute are used in all scenes

src/plots/plots.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ plots.getSubplotIds = function getSubplotIds(layout, type) {
190190
if(_module === undefined) return [];
191191

192192
// layout must be 'fullLayout' here
193-
if(type === 'cartesian' && !layout._hasCartesian) return [];
194-
if(type === 'gl2d' && !layout._hasGL2D) return [];
193+
if(type === 'cartesian' && (!layout._has || !layout._has('cartesian'))) return [];
194+
if(type === 'gl2d' && (!layout._has || !layout._has('gl2d'))) return [];
195195
if(type === 'cartesian' || type === 'gl2d') {
196196
return Object.keys(layout._plots || {});
197197
}

0 commit comments

Comments
 (0)