-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat: Add min/max scale limits for geo plots #7371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
c7b5ec3
to
29b4316
Compare
I believe that some tests are failing because there's now an extra zoom event on every call to updateFx
(for dragMode === 'pan'
). I think I need to restrict that call to only happen upon first load. I'll keep looking into it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's try setting dflt: 0
in the API and handle the case of zero instead of -1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We represent Infinity
with -1 since Infinity
isn't valid in JSON. If we made this change, how would we handle when a user wants to use Infinity
instead of 0 (which is also a valid value).
Opening geo_canadian-cities
mock in the dashboard gives me the following error:
plotly.js:9976 Uncaught (in promise) RangeError: Maximum call stack size exceeded
at String.replace (<anonymous>)
at stringInputToObject (plotly.js:9976:27)
at inputToRGB (plotly.js:9412:22)
at new tinycolor (plotly.js:9165:22)
at tinycolor (plotly.js:9163:20)
at color2.fill (plotly.js:11073:18)
at d3_selectionPrototype.call (plotly.js:1352:20)
at SVGGElement.<anonymous> (plotly.js:145654:18)
at plotly.js:1339:22
at d3_selection_each (plotly.js:1345:36)
@camdecoster do you get the same?
@archmoj that should be fixed by some recent commits. Are you on the latest version of the branch? I'm not seeing that error.
geo_canadian-cities
Thanks @camdecoster. My local test branch was not up-to-date. I confirm now it renders with no error.
If you add
"projection": { "minscale": 0.5, "maxscale": 2 },
to geo_canadian-cities
under "geo" object, the map renders smaller with gd._fullLayout.geo.projection.scale: 0.3013880580354019
.
@camdecoster Could you please investigate that?
If you add
"projection": { "minscale": 0.5, "maxscale": 2 },
to
geo_canadian-cities
under "geo" object, the map renders smaller withgd._fullLayout.geo.projection.scale: 0.3013880580354019
.@camdecoster Could you please investigate that?
Here is a codepen displaying the bug.
Uh oh!
There was an error while loading. Please reload this page.
Description
Add
minscale
andmaxscale
attributes to geo plots. These set the min and max scale extents for a plot (how far a user can zoom out/in). This PR supersedes #5192 which will be closed after this is merged.Changes
minscale
andmaxscale
attributes to geo plots. Defaults are 0 and -1, respectively.Demo Video or Screenshot(s):
Before:
Screencast.From.2025年02月22日.11-25-20.mp4
After:
Screencast.From.2025年02月22日.11-29-21.mp4
Testing
npm start
"geo"
key"minscale": 2
"maxscale": 4