Skip to content

Display feature count on cluster markers #778

Description

@dopenguin

Description

Currently, clustered features (core markers) are displayed as a multi-marker; a static SVG showing three stacked pin shapes. There is no indication of how many features are contained in a given cluster.

The cluster marker SVG should be replaced with a new design (see Figma) that displays the number of contained features as text within the SVG.

Current behavior

  • The multi-marker is a static SVG without any count indicator (src/core/utils/markers.ts, makeMultiMarker)
  • getMarkerStyle only receives a boolean (multi), not the actual feature count
  • Memoization is based on MarkerStyle + the multi flag only

Expected behavior

  • A new SVG design for cluster markers that includes a <text> element showing the feature count
  • The count is dynamically embedded into the SVG

Affected areas

File What needs to change
src/core/utils/markers.ts Replace makeMultiMarker with new SVG template including count; extend getMarkerStyle signature to accept count; adjust memoization to account for count
src/core/utils/map/setupMarkers.ts Pass the actual feature count (from feature.get('features')?.length) to getMarkerStyle at all call sites (layer styling, hover, selection, pointer move)

Out of scope

  • Configurability of count text styling (color, font size, etc.)
  • Changes to the single marker

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestrefactorRefactoring of previous code

Fields

No fields configured for Feature.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions