Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: rename min/max scale limits
  • Loading branch information
mojoaxel authored and camdecoster committed Feb 18, 2025
commit d870252e3e2d2838f39b6ca996f704fba106fefe
12 changes: 6 additions & 6 deletions src/components/modebar/buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -543,16 +543,16 @@ function handleGeo(gd, ev) {

if(attr === 'zoom') {
var scale = geoLayout.projection.scale;
var minScale = geoLayout.projection.minScale;
var maxScale = geoLayout.projection.maxScale;
var minscale = geoLayout.projection.minscale;
var maxscale = geoLayout.projection.maxscale;

var newScale = (val === 'in') ? 2 * scale : 0.5 * scale;

// make sure the scale is within the min/max bounds
if(newScale > maxScale) {
newScale = maxScale;
} else if(newScale < minScale) {
newScale = minScale;
if(newScale > maxscale) {
newScale = maxscale;
} else if(newScale < minscale) {
newScale = minscale;
}

Registry.call('_guiRelayout', gd, id + '.projection.scale', newScale);
Expand Down
6 changes: 3 additions & 3 deletions src/plots/geo/layout_attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ var attrs = module.exports = overrideAll({
'that fits the map\'s lon and lat ranges. '
].join(' ')
},
minScale: {
minscale: {
valType: 'number',
min: 0,
dflt: 0,
Expand All @@ -187,10 +187,10 @@ var attrs = module.exports = overrideAll({
'where the map has half the size of base zoom level.'
].join(' ')
},
maxScale: {
maxscale: {
valType: 'number',
min: 0,
dflt: Infinity,
dflt: null,
description: [
'Maximal zoom level of the map view.',
'A maxScale of *2* (200%) corresponds to a zoom level',
Expand Down
8 changes: 4 additions & 4 deletions src/plots/geo/layout_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ function handleGeoDefaults(geoLayoutIn, geoLayoutOut, coerce, opts) {
}

coerce('projection.scale');
coerce('projection.minScale');
coerce('projection.maxScale');
coerce('projection.minscale');
coerce('projection.maxscale');

show = coerce('showland', !visible ? false : undefined);
if(show) coerce('landcolor');
Expand Down Expand Up @@ -207,8 +207,8 @@ function handleGeoDefaults(geoLayoutIn, geoLayoutOut, coerce, opts) {
// clear attributes that will get auto-filled later
if(fitBounds) {
delete geoLayoutOut.projection.scale;
delete geoLayoutOut.projection.minScale;
delete geoLayoutOut.projection.maxScale;
delete geoLayoutOut.projection.minscale;
delete geoLayoutOut.projection.maxscale;

if(isScoped) {
delete geoLayoutOut.center.lon;
Expand Down