Conversation

camdecoster

Description

Add minscale and maxscale 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

  • Adds minscale and maxscale attributes to geo plots. Defaults are 0 and -1, respectively.
  • Enforces scale extents on zoom mouse events, mode bar button clicks
  • Manually creates zoom event to enforce scale extents on first render (treating the middle of the plot as the zoom point)

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

  • Start the dev dasard with npm start
  • Search for a geo mock and load it (I used geo_legendonly)
  • Zoom in and out and note how you can go as far as you want in either direction
  • Edit the mock file and add the following attributes under the "geo" key
    • "minscale": 2
    • "maxscale": 4
  • Reload the mock in the dasard
  • Note that the mock appears zoomed in upon first load
  • Zoom in and out and note how you're now limited in how far you can go

@camdecostercamdecoster force-pushed the cam/5192/add-min-max-scale-limits branch from c7b5ec3 to 29b4316 Compare February 18, 2025 14:15
@gvwilsongvwilson added P1needed for current cyclefixfixes something brokenlabels Feb 18, 2025
@camdecoster

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.

Sign up for free to join this conversation on . Already have an account? Sign in to comment
fixfixes something brokenP1needed for current cycle
None yet

Successfully merging this pull request may close these issues.

allow user to set zoom/scale limits for choropleth maps