Skip to content

Commit e470048

Browse files
committed
Add check for projections that don't play well with fitbounds
1 parent f04bc14 commit e470048

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/plots/geo/constants.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ exports.lataxisSpan = {
141141
'*': 180
142142
};
143143

144+
// Projections whose math doesn't play well with fitbounds
145+
exports.fitboundsIncompatible = new Set(['albers usa', 'craig', 'satellite']);
146+
144147
// defaults for each scope
145148
exports.scopeDefaults = {
146149
world: {

src/plots/geo/layout_defaults.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,9 @@ function handleGeoDefaults(geoLayoutIn, geoLayoutOut, coerce, opts) {
217217
lonaxisIn.range,
218218
lataxisIn.range
219219
].some((d) => d !== undefined);
220-
// The Albers projection doesn't need a fit, so skip here
221-
if (hasUserView || isAlbersUsa) geoLayoutOut.fitbounds = false;
220+
if (hasUserView || constants.fitboundsIncompatible.has(projType)) {
221+
geoLayoutOut.fitbounds = false;
222+
}
222223
}
223224

224225
// Set auto-filled view attributes to null so updateProjection can

0 commit comments

Comments
 (0)