Skip to content

Adds zoom as an optional third parameter to the reduce callback#257

Open
efreethy wants to merge 1 commit intomapbox:mainfrom
efreethy:zoom-reduce-parameter
Open

Adds zoom as an optional third parameter to the reduce callback#257
efreethy wants to merge 1 commit intomapbox:mainfrom
efreethy:zoom-reduce-parameter

Conversation

@efreethy
Copy link

@efreethy efreethy commented Feb 3, 2026

Adds zoom as an optional third parameter to the reduce callback function, enabling zoom-aware aggregation of cluster properties.

Use Case

This is useful when users need to track how properties aggregate differently at different zoom levels. For example:

  • Debugging cluster aggregation behavior across zoom levels
  • Creating custom visualizations that need zoom-level awareness
  • Implementing zoom-dependent weighting in cluster calculations

Changes

  • Modified reduce callback signature from (accumulated, props) to (accumulated, props, zoom)
  • Updated JSDoc comment to reflect the new parameter
  • Added test case to verify zoom is correctly passed to reduce function

Backward Compatibility

This change is fully backward compatible - existing reduce functions that don't use the zoom parameter will continue to work unchanged.

Testing

All existing tests pass, plus new test verifying zoom parameter is passed correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant