Skip to content

Commit a046871

Browse files
committed
clear fallback to default view - no longer NaNs in d3-geo
1 parent 647b0dc commit a046871

File tree

2 files changed

+0
-83
lines changed

2 files changed

+0
-83
lines changed

src/plots/geo/geo.js

-23
Original file line numberDiff line numberDiff line change
@@ -249,29 +249,6 @@ proto.updateProjection = function(geoCalcData, fullLayout) {
249249
var s = this.fitScale = projection.scale();
250250
var t = projection.translate();
251251

252-
if(
253-
!isFinite(b[0][0]) || !isFinite(b[0][1]) ||
254-
!isFinite(b[1][0]) || !isFinite(b[1][1]) ||
255-
isNaN(t[0]) || isNaN(t[0])
256-
) {
257-
var attrToUnset = ['fitbounds', 'projection.rotation', 'center', 'lonaxis.range', 'lataxis.range'];
258-
var msg = 'Invalid geo settings, relayout\'ing to default view.';
259-
var updateObj = {};
260-
261-
// clear all attributes that could cause invalid bounds,
262-
// clear viewInitial to update reset-view behavior
263-
264-
for(var i = 0; i < attrToUnset.length; i++) {
265-
updateObj[this.id + '.' + attrToUnset[i]] = null;
266-
}
267-
268-
this.viewInitial = null;
269-
270-
Lib.warn(msg);
271-
gd._promises.push(Registry.call('relayout', gd, updateObj));
272-
return msg;
273-
}
274-
275252
if(geoLayout.fitbounds) {
276253
var b2 = projection.getBounds(makeRangeBox(axLon.range, axLat.range));
277254
var k2 = Math.min(

test/jasmine/tests/geo_test.js

-60
Original file line numberDiff line numberDiff line change
@@ -1421,66 +1421,6 @@ describe('Test geo interactions', function() {
14211421
.then(done, done.fail);
14221422
});
14231423

1424-
it('should plot to scope defaults when user setting lead to NaN map bounds', function(done) {
1425-
var gd = createGraphDiv();
1426-
1427-
spyOn(Lib, 'warn');
1428-
1429-
Plotly.newPlot(gd, [{
1430-
type: 'scattergeo',
1431-
lon: [0],
1432-
lat: [0]
1433-
}], {
1434-
geo: {
1435-
projection: {
1436-
type: 'kavrayskiy7',
1437-
rotation: {
1438-
lat: 38.794799,
1439-
lon: -81.622334,
1440-
}
1441-
},
1442-
center: {
1443-
lat: -81
1444-
},
1445-
lataxis: {
1446-
range: [38.794799, 45.122292]
1447-
},
1448-
lonaxis: {
1449-
range: [-82.904731, -81.622334]
1450-
}
1451-
},
1452-
width: 700,
1453-
heigth: 500
1454-
})
1455-
.then(function() {
1456-
var geoLayout = gd._fullLayout.geo;
1457-
var geo = geoLayout._subplot;
1458-
1459-
expect(geoLayout.projection.rotation).toEqual({
1460-
lon: 0, lat: 0, roll: 0,
1461-
});
1462-
expect(geoLayout.center).toEqual({
1463-
lon: 0, lat: 0
1464-
});
1465-
expect(geoLayout.lonaxis.range).toEqual([-180, 180]);
1466-
expect(geoLayout.lataxis.range).toEqual([-90, 90]);
1467-
1468-
expect(geo.viewInitial).toEqual({
1469-
'fitbounds': false,
1470-
'projection.rotation.lon': 0,
1471-
'center.lon': 0,
1472-
'center.lat': 0,
1473-
'projection.scale': 1
1474-
});
1475-
1476-
expect(Lib.warn).toHaveBeenCalledTimes(1);
1477-
expect(Lib.warn).toHaveBeenCalledWith(
1478-
'Invalid geo settings, relayout\'ing to default view.'
1479-
);
1480-
})
1481-
.then(done, done.fail);
1482-
});
1483-
14841424
it('should get hover right for choropleths involving landmasses that cross antimeridian', function(done) {
14851425
var gd = createGraphDiv();
14861426

0 commit comments

Comments
 (0)