Skip to content

Commit 4b95bbd

Browse files
committed
revise defaults
1 parent 1ac6e9f commit 4b95bbd

File tree

4 files changed

+37
-20
lines changed

4 files changed

+37
-20
lines changed

src/plots/mapbox/layout_attributes.js

+16-8
Original file line numberDiff line numberDiff line change
@@ -97,23 +97,31 @@ var attrs = module.exports = overrideAll({
9797

9898
westbound: {
9999
valType: 'number',
100-
dflt: null,
101-
description: 'Sets the minimum longitude of the map (in degrees East).'
100+
description: [
101+
'Sets the minimum longitude of the map (in degrees East)',
102+
'if `eastbound`, `southbound` and `northbound` are declared.'
103+
].join(' ')
102104
},
103105
eastbound: {
104106
valType: 'number',
105-
dflt: null,
106-
description: 'Sets the maximum longitude of the map (in degrees East).'
107+
description: [
108+
'Sets the maximum longitude of the map (in degrees East)',
109+
'if `westbound`, `southbound` and `northbound` are declared.'
110+
].join(' ')
107111
},
108112
southbound: {
109113
valType: 'number',
110-
dflt: null,
111-
description: 'Sets the minimum latitude of the map (in degrees North).'
114+
description: [
115+
'Sets the minimum latitude of the map (in degrees North)',
116+
'if `eastbound`, `westbound` and `northbound` are declared.'
117+
].join(' ')
112118
},
113119
northbound: {
114120
valType: 'number',
115-
dflt: null,
116-
description: 'Sets the maximum latitude of the map (in degrees North).'
121+
description: [
122+
'Sets the maximum latitude of the map (in degrees North)',
123+
'if `eastbound`, `westbound` and `southbound` are declared.'
124+
].join(' ')
117125
},
118126

119127
layers: templatedArray('layer', {

src/plots/mapbox/layout_defaults.js

+15-4
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,21 @@ function handleDefaults(containerIn, containerOut, coerce, opts) {
2626
coerce('bearing');
2727
coerce('pitch');
2828

29-
coerce('westbound');
30-
coerce('eastbound');
31-
coerce('southbound');
32-
coerce('northbound');
29+
var westbound = coerce('westbound');
30+
var eastbound = coerce('eastbound');
31+
var southbound = coerce('southbound');
32+
var northbound = coerce('northbound');
33+
if(
34+
westbound === undefined ||
35+
eastbound === undefined ||
36+
southbound === undefined ||
37+
northbound === undefined
38+
) {
39+
delete containerOut.westbound;
40+
delete containerOut.eastbound;
41+
delete containerOut.southbound;
42+
delete containerOut.northbound;
43+
}
3344

3445
handleArrayContainerDefaults(containerIn, containerOut, {
3546
name: 'layers',

src/plots/mapbox/mapbox.js

+2
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,11 @@ proto.createMap = function(calcData, fullLayout, resolve, reject) {
9696
var southbound = opts.southbound;
9797
var northbound = opts.northbound;
9898
var maxBounds = (
99+
/*
99100
westbound !== undefined &&
100101
eastbound !== undefined &&
101102
southbound !== undefined &&
103+
*/
102104
northbound !== undefined
103105
) ? [[westbound, southbound], [eastbound, northbound]] : null;
104106

test/plot-schema.json

+4-8
Original file line numberDiff line numberDiff line change
@@ -3087,8 +3087,7 @@
30873087
}
30883088
},
30893089
"eastbound": {
3090-
"description": "Sets the maximum longitude of the map (in degrees East).",
3091-
"dflt": null,
3090+
"description": "Sets the maximum longitude of the map (in degrees East) if `westbound`, `southbound` and `northbound` are declared.",
30923091
"editType": "plot",
30933092
"valType": "number"
30943093
},
@@ -3313,8 +3312,7 @@
33133312
"role": "object"
33143313
},
33153314
"northbound": {
3316-
"description": "Sets the maximum latitude of the map (in degrees North).",
3317-
"dflt": null,
3315+
"description": "Sets the maximum latitude of the map (in degrees North) if `eastbound`, `westbound` and `southbound` are declared.",
33183316
"editType": "plot",
33193317
"valType": "number"
33203318
},
@@ -3326,8 +3324,7 @@
33263324
},
33273325
"role": "object",
33283326
"southbound": {
3329-
"description": "Sets the minimum latitude of the map (in degrees North).",
3330-
"dflt": null,
3327+
"description": "Sets the minimum latitude of the map (in degrees North) if `eastbound`, `westbound` and `northbound` are declared.",
33313328
"editType": "plot",
33323329
"valType": "number"
33333330
},
@@ -3359,8 +3356,7 @@
33593356
"valType": "any"
33603357
},
33613358
"westbound": {
3362-
"description": "Sets the minimum longitude of the map (in degrees East).",
3363-
"dflt": null,
3359+
"description": "Sets the minimum longitude of the map (in degrees East) if `eastbound`, `southbound` and `northbound` are declared.",
33643360
"editType": "plot",
33653361
"valType": "number"
33663362
},

0 commit comments

Comments
 (0)