/ui/layers/legends/distributed
The distributed theme legend module exports the distributedTheme to the ui.layers.legend{} library object.
Requires
Members
(inner, constant) drawnValues
The drawnValues WeakMap holds the number of category values for which the legend of a distributed theme was last drawn.
(inner, constant) pendingRedraw
The pendingRedraw WeakSet holds the distributed themes for which a postrender listener to redraw the legend is registered. Only a single listener must be registered for a theme, no matter how often the legend is drawn.
Methods
(inner) distributedTheme(layer) → {HTMLElement}
The distributedTheme method creates and returns a distributed theme legend for the current layer.style.theme.
The category values are assigned by the distributed theme method as features are rendered. Only categories with values assigned from the layer data are drawn in the legend, and only the icons of these categories are created.
The legend is redrawn after a render only if values have been assigned to categories since the legend was last drawn.
| Name | Type | Description |
|---|---|---|
layer | layer | The decorated mapp layer. |
The distributed theme legend element.
- Type:
- HTMLElement
(inner) redrawOnRender(layer, theme)
The redrawOnRender method registers a single postrender listener for the theme. The legend is redrawn once the render is complete if values have been assigned to the theme categories since the legend was last drawn.
The listener is registered again after each render for as long as the distributed theme is the current layer theme.
| Name | Type | Description |
|---|---|---|
layer | layer | The decorated mapp layer. |
theme | Object | The distributed theme for which the legend was drawn. |
(inner) valuesCount(theme) → {number}
The valuesCount method returns the number of values assigned to the categories of a distributed theme.
| Name | Type | Description |
|---|---|---|
theme | Object | The distributed theme. |
The number of assigned category values.
- Type:
- number