Skip to content

feat: expose SuperCluster properties on clusters - #1258

Open
hadt0786 wants to merge 1 commit into
googlemaps:mainfrom
hadt0786:fix-1068-supercluster-properties
Open

feat: expose SuperCluster properties on clusters#1258
hadt0786 wants to merge 1 commit into
googlemaps:mainfrom
hadt0786:fix-1068-supercluster-properties

Conversation

@hadt0786

Copy link
Copy Markdown

Summary

Expose SuperCluster aggregated properties on the resulting Cluster object so custom renderers can access values produced by SuperCluster map / reduce functions.

Changes

  • add an optional properties field to Cluster
  • preserve SuperCluster feature properties when converting a SuperCluster result into a Cluster
  • apply the same behavior to SuperClusterViewportAlgorithm
  • add regression coverage confirming aggregated properties are available through cluster.properties

This keeps the existing renderer API unchanged while allowing custom renderers to consume algorithm-specific aggregate data without recomputing it from every marker.

Example:

const renderer = {
  render: (cluster, stats, map) => {
    const properties = cluster.properties;

    // Properties produced by SuperCluster map/reduce are now available here.
    console.log(properties);

    return new google.maps.Marker({
      position: cluster.position,
      label: String(cluster.count),
    });
  },
};

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