Skip to content

Commit 7e08880

Browse files
committed
Add flag to disable dynamic centering
1 parent 0aa4a33 commit 7e08880

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/plots/map/layout_attributes.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,17 @@ var attrs = module.exports = overrideAll({
7777
'(in degrees, where *0* means perpendicular to the surface of the map) (map.pitch).'
7878
].join(' ')
7979
},
80+
disableDynamicCentering: {
81+
valType: 'boolean',
82+
dflt: false,
83+
description: [
84+
'By default the map camera will be dynamically centered on lon/lat points.',
85+
'This can be slow when the number of points are above 1e7.',
86+
'It is recommended to disable this feature for large datasets.',
87+
'Note: This feature is also disabled if center or zoom attributes are set',
88+
'regardless of disableDynamicCentering\'s setting.'
89+
].join(' ')
90+
},
8091

8192
bounds: {
8293
west: {

src/plots/map/layout_defaults.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ function handleDefaults(containerIn, containerOut, coerce, opts) {
2424
coerce('zoom');
2525
coerce('bearing');
2626
coerce('pitch');
27+
coerce('disableDynamicCentering');
2728

2829
// dynamically set center/zoom if neither param provided
29-
if (!containerIn?.center && !containerIn?.zoom) {
30+
if (!containerIn?.disableDynamicCentering && !containerIn?.center && !containerIn?.zoom) {
3031
var [{ lon, lat }] = opts.fullData;
3132
var { minLon, maxLon } = getLonBounds(lon);
3233
var { minLat, maxLat } = getLatBounds(lat);

0 commit comments

Comments
 (0)